DeviceTaskDelay.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. class DeviceTaskDelay extends Base
  8. {
  9. public function list(){
  10. $page = input('page',1);
  11. $size = input('size',20);
  12. $map[] = ['org_id','=',$this->orgId];
  13. $lists = Db::name('device_task_delay')
  14. ->where($map)
  15. ->page($page,$size)
  16. ->order('id desc')
  17. ->select();
  18. foreach ($lists as $k=>$v){
  19. $taskTitle = Db::name('device_task')->where('id',$v['task_id'])->value('title');
  20. $lists[$k]['task_title'] = $taskTitle?$taskTitle:'';
  21. $lists[$k]['end_time'] = date('Y-m-d H:i',strtotime($v['end_time']));
  22. $lists[$k]['uname'] = Db::name('user')->where('id',$v['user_id'])->value('real_name');
  23. $lists[$k]['deal_user'] = '';
  24. if($v['deal_user_id'] > 0){
  25. $lists[$k]['deal_user'] = Db::name('user')->where('id',$v['deal_user_id'])->value('real_name');
  26. }
  27. }
  28. HelpHander::success($lists);
  29. }
  30. public function deal(){
  31. $res = model('DeviceTask')->dealDelay($this->userId,$this->orgId);
  32. if(!$res){
  33. HelpHander::error(model('DeviceTask')->getError());
  34. }
  35. HelpHander::success('操作成功');
  36. }
  37. }