CleanTask.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\App;
  6. use think\Db;
  7. use think\exception\Handle;
  8. class CleanTask extends Base
  9. {
  10. public function __construct(App $app = null) {
  11. parent::__construct($app);
  12. $this->model = new \app\common\model\CleanTask();
  13. }
  14. public function detail(){
  15. $id=input('id');
  16. $ret=$this->model->detail($id);
  17. if($ret){
  18. HelpHander::success($ret);
  19. }else{
  20. HelpHander::error('暂无信息');
  21. }
  22. }
  23. public function list(){
  24. $page=input('page',1);
  25. $size=input('size',10);
  26. $status=input('status');
  27. $type=input('type',1);
  28. $userId=$this->userId;
  29. $ret=$this->model->lists($page,$size,$status,$userId,$this->orgId,$type);
  30. HelpHander::success($ret);
  31. }
  32. public function commit(){
  33. $content = input('content');
  34. $formId = input('formId');
  35. $taskId =input('taskId');
  36. $consItems = input('consItems');
  37. $orgId = $this->orgId;
  38. $formJson = input('formJson');
  39. if(!$formJson){
  40. HelpHander::error('检查结果不能为空');
  41. }
  42. $ret=$this->model->addSave($content,$formId,$taskId,$orgId,$formJson,$this->userId,$consItems);
  43. if(!$ret){
  44. HelpHander::error($this->model->getError());
  45. }
  46. HelpHander::success([],'操作成功');
  47. }
  48. public function updateStatus(){
  49. $id = input('id');
  50. $checkContent =input('checkContent');
  51. if(!$checkContent){
  52. HelpHander::error('验收报告不能为空');
  53. }
  54. $task = Db::name('clean_task')->where('id',$id)
  55. ->find();
  56. if(!$task){
  57. HelpHander::error('验收报告不能为空');
  58. }
  59. $ret = Db::name('clean_task')->where('id',$id)->update([
  60. 'status' => 3,
  61. 'check_user' => $this->userId,
  62. 'check_content' => $checkContent,
  63. 'chek_time' => date('Y-m-d H:i:s')
  64. ]);
  65. if(!$ret){
  66. HelpHander::error('操作失败');
  67. }
  68. HelpHander::success([],'操作成功');
  69. }
  70. }