PatrolTask.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\App;
  6. class PatrolTask extends Base
  7. {
  8. public function __construct(App $app = null) {
  9. parent::__construct($app);
  10. $this->model = new \app\common\model\PatrolTask();
  11. }
  12. public function lists(){
  13. $page = input('page/d',1);
  14. $size = input('size/d',10);
  15. $type = input('type/d');
  16. $patrol_mode = input('patrolMode/d');
  17. $status= input('status','');
  18. if($status == 0){
  19. $status = 2;
  20. }elseif ($status == 1){
  21. $status = 3;
  22. }elseif ($status == 2){
  23. $status = 5;
  24. }
  25. $model = $this->model;
  26. $ret = $model->lists($page,$size,$type,$this->userId,$this->orgId,$patrol_mode,$status);
  27. HelpHander::success($ret);
  28. }
  29. public function queryAddrList(){
  30. $taskId = input('taskId');
  31. $model = $this->model;
  32. $ret = $model->addrList($taskId,$this->orgId);
  33. if($ret){
  34. HelpHander::success($ret);
  35. }else{
  36. HelpHander::error('暂无信息');
  37. }
  38. }
  39. public function queryTaskDeatil(){
  40. $taskId = input('taskId');
  41. $formId = input('patrolAddrFormId');
  42. $model = $this->model;
  43. $ret = $model->taskDeatils($taskId,$formId,$this->orgId);
  44. if($ret){
  45. HelpHander::success($ret);
  46. }else{
  47. HelpHander::error('暂无信息');
  48. }
  49. }
  50. public function queryForms(){
  51. $patrolAddrFormId = input('patrolAddrFormId');
  52. $model = $this->model;
  53. $ret = $model->forms($patrolAddrFormId);
  54. if($ret){
  55. HelpHander::success($ret);
  56. }else{
  57. HelpHander::error('暂无信息');
  58. }
  59. }
  60. public function updateStatus(){
  61. $patrolTaskId = input('patrolTaskId');
  62. $interruptReson = input('interruptReson');
  63. $interruptImg = input('interruptImg');
  64. $model = $this->model;
  65. $ret = $model->updateStatus($patrolTaskId,$interruptReson,$interruptImg);
  66. if($ret){
  67. HelpHander::success([],'修改成功');
  68. }else{
  69. HelpHander::error($model->getError());
  70. }
  71. }
  72. }