作者 lyh

变更数据

@@ -167,6 +167,12 @@ class TicketUploadDataController extends BaseController @@ -167,6 +167,12 @@ class TicketUploadDataController extends BaseController
167 'type.required' => '上传类型不能为空', 167 'type.required' => '上传类型不能为空',
168 'text' => '数据详情不为空' 168 'text' => '数据详情不为空'
169 ]); 169 ]);
  170 + if(empty($this->param['text']['image'])){
  171 + $this->response('参数错误',Code::SYSTEM_ERROR);
  172 + }
  173 + if(empty($this->param['text']['title'])){
  174 + $this->response('参数错误,标题不能为空',Code::SYSTEM_ERROR);
  175 + }
170 //验证当前数据是否已提交 176 //验证当前数据是否已提交
171 $this->param['text'] = json_encode($this->param['text'], true); 177 $this->param['text'] = json_encode($this->param['text'], true);
172 if(isset($this->param['id']) && !empty($this->param['id'])){ 178 if(isset($this->param['id']) && !empty($this->param['id'])){
@@ -202,20 +208,26 @@ class TicketUploadDataController extends BaseController @@ -202,20 +208,26 @@ class TicketUploadDataController extends BaseController
202 $this->request->validate([ 208 $this->request->validate([
203 'project_id' => 'required', 209 'project_id' => 'required',
204 'type' => 'required', 210 'type' => 'required',
205 - 'search' => 'required'  
206 ], [ 211 ], [
207 'project_id.required' => 'project_id不能为空', 212 'project_id.required' => 'project_id不能为空',
208 'type.required' => 'type不能为空', 213 'type.required' => 'type不能为空',
209 - 'search.required' => '搜索参数不能为空',  
210 ]); 214 ]);
211 ProjectServer::useProject($this->param['project_id']); 215 ProjectServer::useProject($this->param['project_id']);
212 if ($this->param['type'] == 1) { 216 if ($this->param['type'] == 1) {
213 //todo::搜索获取分类 217 //todo::搜索获取分类
214 $productCateModel = new Category(); 218 $productCateModel = new Category();
215 - $data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']); 219 + if(!isset($this->param['search']) || empty($this->param['search'])){
  220 + $data = $productCateModel->lists(['status'=>1], 1, 20,'id',['id','title as name']);
  221 + }else{
  222 + $data = $productCateModel->lists(['status'=>1,'title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
  223 + }
216 } else { 224 } else {
217 $keywordModel = new Keyword(); 225 $keywordModel = new Keyword();
218 - $data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']); 226 + if(!isset($this->param['search']) || empty($this->param['search'])){
  227 + $data = $keywordModel->lists([], 1, 20,'id',['id','title as name']);
  228 + }else{
  229 + $data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
  230 + }
219 } 231 }
220 DB::disconnect('custom_mysql'); 232 DB::disconnect('custom_mysql');
221 $this->response('success', Code::SUCCESS, $data); 233 $this->response('success', Code::SUCCESS, $data);
@@ -239,7 +251,11 @@ class TicketUploadDataController extends BaseController @@ -239,7 +251,11 @@ class TicketUploadDataController extends BaseController
239 ]); 251 ]);
240 ProjectServer::useProject($this->param['project_id']); 252 ProjectServer::useProject($this->param['project_id']);
241 $blogCateModel = new BlogCategory(); 253 $blogCateModel = new BlogCategory();
242 - $data = $blogCateModel->lists(['name' => ['like' ,'%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']); 254 + if(!isset($this->param['search']) || empty($this->param['search'])){
  255 + $data = $blogCateModel->lists([], 1, 20,'id',['id','name']);
  256 + }else{
  257 + $data = $blogCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
  258 + }
243 DB::disconnect('custom_mysql'); 259 DB::disconnect('custom_mysql');
244 $this->response('success', Code::SUCCESS, $data); 260 $this->response('success', Code::SUCCESS, $data);
245 } 261 }
@@ -262,7 +278,11 @@ class TicketUploadDataController extends BaseController @@ -262,7 +278,11 @@ class TicketUploadDataController extends BaseController
262 ]); 278 ]);
263 ProjectServer::useProject($this->param['project_id']); 279 ProjectServer::useProject($this->param['project_id']);
264 $newsCateModel = new NewsCategory(); 280 $newsCateModel = new NewsCategory();
265 - $data = $newsCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']); 281 + if(!isset($this->param['search']) || empty($this->param['search'])){
  282 + $data = $newsCateModel->lists([], 1, 20,'id',['id','name']);
  283 + }else{
  284 + $data = $newsCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
  285 + }
266 DB::disconnect('custom_mysql'); 286 DB::disconnect('custom_mysql');
267 $this->response('success', Code::SUCCESS, $data); 287 $this->response('success', Code::SUCCESS, $data);
268 } 288 }