作者 lyh

变更数据

... ... @@ -89,6 +89,14 @@ class TicketUploadDataController extends BaseController
'type.required' => '上传类型不能为空',
'text' => '数据详情不为空'
]);
if(isset($this->param['id']) && !empty($this->param['id'])){
//执行编辑
$info = $this->model->read(['id'=>$this->param['id']]);
if($this->param['status'] == 0){
$this->model->edit($this->param,['id'=>$id]);
}
$this->response('success', Code::SUCCESS, $data);
}
//验证当前数据是否已提交
$this->param['text'] = json_encode($this->param['text'], true);
$info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]);
... ... @@ -96,9 +104,6 @@ class TicketUploadDataController extends BaseController
$id = $this->model->addReturnId($this->param);
} else {
$id = $info['id'];
if($this->param['status'] == 0){
$this->model->edit($this->param,['id'=>$id]);
}
}
$data = ['id' => $id];
$this->response('success', Code::SUCCESS, $data);
... ... @@ -126,10 +131,10 @@ class TicketUploadDataController extends BaseController
if ($this->param['type'] == 1) {
//todo::搜索获取分类
$productCateModel = new Category();
$data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title']);
$data = $productCateModel->lists(['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']);
$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);
... ...