合并分支 'lyh-server' 到 'master'
Lyh server 查看合并请求 !2861
正在显示
1 个修改的文件
包含
19 行增加
和
11 行删除
| @@ -91,17 +91,25 @@ class TicketUploadDataController extends BaseController | @@ -91,17 +91,25 @@ class TicketUploadDataController extends BaseController | ||
| 91 | ]); | 91 | ]); |
| 92 | //验证当前数据是否已提交 | 92 | //验证当前数据是否已提交 |
| 93 | $this->param['text'] = json_encode($this->param['text'], true); | 93 | $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]); | ||
| 95 | - if ($info === false) { | ||
| 96 | - $id = $this->model->addReturnId($this->param); | ||
| 97 | - } else { | ||
| 98 | - $id = $info['id']; | ||
| 99 | - if($this->param['status'] == 0){ | ||
| 100 | - $this->model->edit($this->param,['id'=>$id]); | 94 | + if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 95 | + //执行编辑 | ||
| 96 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 97 | + if($info['status'] == 0){ | ||
| 98 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 99 | + }else{ | ||
| 100 | + $this->response('当前状态不允许编辑', Code::SYSTEM_ERROR); | ||
| 101 | + } | ||
| 102 | + $this->response('success'); | ||
| 103 | + }else{ | ||
| 104 | + $info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]); | ||
| 105 | + if ($info === false) { | ||
| 106 | + $id = $this->model->addReturnId($this->param); | ||
| 107 | + } else { | ||
| 108 | + $id = $info['id']; | ||
| 101 | } | 109 | } |
| 110 | + $data = ['id' => $id]; | ||
| 111 | + $this->response('success', Code::SUCCESS, $data); | ||
| 102 | } | 112 | } |
| 103 | - $data = ['id' => $id]; | ||
| 104 | - $this->response('success', Code::SUCCESS, $data); | ||
| 105 | } | 113 | } |
| 106 | 114 | ||
| 107 | /** | 115 | /** |
| @@ -126,10 +134,10 @@ class TicketUploadDataController extends BaseController | @@ -126,10 +134,10 @@ class TicketUploadDataController extends BaseController | ||
| 126 | if ($this->param['type'] == 1) { | 134 | if ($this->param['type'] == 1) { |
| 127 | //todo::搜索获取分类 | 135 | //todo::搜索获取分类 |
| 128 | $productCateModel = new Category(); | 136 | $productCateModel = new Category(); |
| 129 | - $data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title']); | 137 | + $data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']); |
| 130 | } else { | 138 | } else { |
| 131 | $keywordModel = new Keyword(); | 139 | $keywordModel = new Keyword(); |
| 132 | - $data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title']); | 140 | + $data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']); |
| 133 | } | 141 | } |
| 134 | DB::disconnect('custom_mysql'); | 142 | DB::disconnect('custom_mysql'); |
| 135 | $this->response('success', Code::SUCCESS, $data); | 143 | $this->response('success', Code::SUCCESS, $data); |
-
请 注册 或 登录 后发表评论