DeviceRecord.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 DeviceRecord extends Base
  7. {
  8. public function __construct(App $app = null) {
  9. parent::__construct($app);
  10. $this->model = new \app\common\model\DeviceRecord();
  11. }
  12. public function add(){
  13. $json = [
  14. 'images'=>input('images'),
  15. 'content'=>input('content'),
  16. 'deviceId'=>input('deviceId'),
  17. 'userId'=>$this->userId,
  18. 'orgId'=>$this->orgId,
  19. 'checkJson'=>input('checkJson'),
  20. 'taskId'=>input('taskId'),
  21. 'video'=>input('video')
  22. ];
  23. $ret = $this->model->add($json);
  24. if($ret){
  25. HelpHander::success($ret,'添加成功');
  26. }else{
  27. HelpHander::error($this->model->getError());
  28. }
  29. }
  30. public function queryRecordList(){
  31. $page = input('page',1);
  32. $size = input('size',10);
  33. $deviceId = input('deviceId/d',0);
  34. $type = input('type/d',0);
  35. $model = $this->model;
  36. $ret = $model->lists($page,$size,$deviceId,$this->userId,$this->orgId,$type);
  37. HelpHander::success($ret);
  38. }
  39. public function queryRecordDetails(){
  40. $id = input('deviceRecordId/d',0);
  41. $model = $this->model;
  42. $ret = $model->details($id);
  43. if($ret){
  44. HelpHander::success($ret);
  45. }else{
  46. HelpHander::error('参数错误');
  47. }
  48. }
  49. }