12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\App;
- use think\Db;
- use think\exception\Handle;
- class CleanTask extends Base
- {
- public function __construct(App $app = null) {
- parent::__construct($app);
- $this->model = new \app\common\model\CleanTask();
- }
- public function detail(){
- $id=input('id');
- $ret=$this->model->detail($id);
- if($ret){
- HelpHander::success($ret);
- }else{
- HelpHander::error('暂无信息');
- }
- }
- public function list(){
- $page=input('page',1);
- $size=input('size',10);
- $status=input('status');
- $type=input('type',1);
- $userId=$this->userId;
- $ret=$this->model->lists($page,$size,$status,$userId,$this->orgId,$type);
- HelpHander::success($ret);
- }
- public function commit(){
- $content = input('content');
- $formId = input('formId');
- $taskId =input('taskId');
- $consItems = input('consItems');
- $orgId = $this->orgId;
- $formJson = input('formJson');
- if(!$formJson){
- HelpHander::error('检查结果不能为空');
- }
- $ret=$this->model->addSave($content,$formId,$taskId,$orgId,$formJson,$this->userId,$consItems);
- if(!$ret){
- HelpHander::error($this->model->getError());
- }
- HelpHander::success([],'操作成功');
- }
- public function updateStatus(){
- $id = input('id');
- $checkContent =input('checkContent');
- if(!$checkContent){
- HelpHander::error('验收报告不能为空');
- }
- $task = Db::name('clean_task')->where('id',$id)
- ->find();
- if(!$task){
- HelpHander::error('验收报告不能为空');
- }
- $ret = Db::name('clean_task')->where('id',$id)->update([
- 'status' => 3,
- 'check_user' => $this->userId,
- 'check_content' => $checkContent,
- 'chek_time' => date('Y-m-d H:i:s')
- ]);
- if(!$ret){
- HelpHander::error('操作失败');
- }
- HelpHander::success([],'操作成功');
- }
- }
|