作者 lyh

变更数据

... ... @@ -167,6 +167,12 @@ class TicketUploadDataController extends BaseController
'type.required' => '上传类型不能为空',
'text' => '数据详情不为空'
]);
if(empty($this->param['text']['image'])){
$this->response('参数错误',Code::SYSTEM_ERROR);
}
if(empty($this->param['text']['title'])){
$this->response('参数错误,标题不能为空',Code::SYSTEM_ERROR);
}
//验证当前数据是否已提交
$this->param['text'] = json_encode($this->param['text'], true);
if(isset($this->param['id']) && !empty($this->param['id'])){
... ... @@ -202,20 +208,26 @@ class TicketUploadDataController extends BaseController
$this->request->validate([
'project_id' => 'required',
'type' => 'required',
'search' => 'required'
], [
'project_id.required' => 'project_id不能为空',
'type.required' => 'type不能为空',
'search.required' => '搜索参数不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
if ($this->param['type'] == 1) {
//todo::搜索获取分类
$productCateModel = new Category();
$data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
if(!isset($this->param['search']) || empty($this->param['search'])){
$data = $productCateModel->lists(['status'=>1], 1, 20,'id',['id','title as name']);
}else{
$data = $productCateModel->lists(['status'=>1,'title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
}
} else {
$keywordModel = new Keyword();
$data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
if(!isset($this->param['search']) || empty($this->param['search'])){
$data = $keywordModel->lists([], 1, 20,'id',['id','title as name']);
}else{
$data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
}
}
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
... ... @@ -239,7 +251,11 @@ class TicketUploadDataController extends BaseController
]);
ProjectServer::useProject($this->param['project_id']);
$blogCateModel = new BlogCategory();
$data = $blogCateModel->lists(['name' => ['like' ,'%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
if(!isset($this->param['search']) || empty($this->param['search'])){
$data = $blogCateModel->lists([], 1, 20,'id',['id','name']);
}else{
$data = $blogCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
}
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
}
... ... @@ -262,7 +278,11 @@ class TicketUploadDataController extends BaseController
]);
ProjectServer::useProject($this->param['project_id']);
$newsCateModel = new NewsCategory();
$data = $newsCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
if(!isset($this->param['search']) || empty($this->param['search'])){
$data = $newsCateModel->lists([], 1, 20,'id',['id','name']);
}else{
$data = $newsCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
}
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
}
... ...