正在显示
1 个修改的文件
包含
9 行增加
和
6 行删除
| @@ -89,16 +89,18 @@ class TicketUploadDataController extends BaseController | @@ -89,16 +89,18 @@ class TicketUploadDataController extends BaseController | ||
| 89 | 'type.required' => '上传类型不能为空', | 89 | 'type.required' => '上传类型不能为空', |
| 90 | 'text' => '数据详情不为空' | 90 | 'text' => '数据详情不为空' |
| 91 | ]); | 91 | ]); |
| 92 | + //验证当前数据是否已提交 | ||
| 93 | + $this->param['text'] = json_encode($this->param['text'], true); | ||
| 92 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 94 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 93 | //执行编辑 | 95 | //执行编辑 |
| 94 | $info = $this->model->read(['id'=>$this->param['id']]); | 96 | $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); | 97 | + if($info['status'] == 0){ |
| 98 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 99 | + }else{ | ||
| 100 | + $this->response('当前状态不允许编辑', Code::SYSTEM_ERROR); | ||
| 99 | } | 101 | } |
| 100 | - //验证当前数据是否已提交 | ||
| 101 | - $this->param['text'] = json_encode($this->param['text'], true); | 102 | + $this->response('success'); |
| 103 | + }else{ | ||
| 102 | $info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]); | 104 | $info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]); |
| 103 | if ($info === false) { | 105 | if ($info === false) { |
| 104 | $id = $this->model->addReturnId($this->param); | 106 | $id = $this->model->addReturnId($this->param); |
| @@ -108,6 +110,7 @@ class TicketUploadDataController extends BaseController | @@ -108,6 +110,7 @@ class TicketUploadDataController extends BaseController | ||
| 108 | $data = ['id' => $id]; | 110 | $data = ['id' => $id]; |
| 109 | $this->response('success', Code::SUCCESS, $data); | 111 | $this->response('success', Code::SUCCESS, $data); |
| 110 | } | 112 | } |
| 113 | + } | ||
| 111 | 114 | ||
| 112 | /** | 115 | /** |
| 113 | * @remark :根据项目获取分类 | 116 | * @remark :根据项目获取分类 |
-
请 注册 或 登录 后发表评论