作者 lyh

变更数据

@@ -89,6 +89,14 @@ class TicketUploadDataController extends BaseController @@ -89,6 +89,14 @@ class TicketUploadDataController extends BaseController
89 'type.required' => '上传类型不能为空', 89 'type.required' => '上传类型不能为空',
90 'text' => '数据详情不为空' 90 'text' => '数据详情不为空'
91 ]); 91 ]);
  92 + if(isset($this->param['id']) && !empty($this->param['id'])){
  93 + //执行编辑
  94 + $info = $this->model->read(['id'=>$this->param['id']]);
  95 + if($this->param['status'] == 0){
  96 + $this->model->edit($this->param,['id'=>$id]);
  97 + }
  98 + $this->response('success', Code::SUCCESS, $data);
  99 + }
92 //验证当前数据是否已提交 100 //验证当前数据是否已提交
93 $this->param['text'] = json_encode($this->param['text'], true); 101 $this->param['text'] = json_encode($this->param['text'], true);
94 $info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]); 102 $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 @@ -96,9 +104,6 @@ class TicketUploadDataController extends BaseController
96 $id = $this->model->addReturnId($this->param); 104 $id = $this->model->addReturnId($this->param);
97 } else { 105 } else {
98 $id = $info['id']; 106 $id = $info['id'];
99 - if($this->param['status'] == 0){  
100 - $this->model->edit($this->param,['id'=>$id]);  
101 - }  
102 } 107 }
103 $data = ['id' => $id]; 108 $data = ['id' => $id];
104 $this->response('success', Code::SUCCESS, $data); 109 $this->response('success', Code::SUCCESS, $data);
@@ -126,10 +131,10 @@ class TicketUploadDataController extends BaseController @@ -126,10 +131,10 @@ class TicketUploadDataController extends BaseController
126 if ($this->param['type'] == 1) { 131 if ($this->param['type'] == 1) {
127 //todo::搜索获取分类 132 //todo::搜索获取分类
128 $productCateModel = new Category(); 133 $productCateModel = new Category();
129 - $data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title']); 134 + $data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
130 } else { 135 } else {
131 $keywordModel = new Keyword(); 136 $keywordModel = new Keyword();
132 - $data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title']); 137 + $data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
133 } 138 }
134 DB::disconnect('custom_mysql'); 139 DB::disconnect('custom_mysql');
135 $this->response('success', Code::SUCCESS, $data); 140 $this->response('success', Code::SUCCESS, $data);