DeviceRecord.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. ];
  22. $ret = $this->model->add($json);
  23. if($ret){
  24. HelpHander::success($ret,'添加成功');
  25. }else{
  26. HelpHander::error($this->model->getError());
  27. }
  28. }
  29. public function queryRecordList(){
  30. $page = input('page',1);
  31. $size = input('size',10);
  32. $deviceId = input('deviceId/d',0);
  33. $type = input('type/d',0);
  34. $model = $this->model;
  35. $ret = $model->lists($page,$size,$deviceId,$this->userId,$this->orgId,$type);
  36. HelpHander::success($ret);
  37. }
  38. public function queryRecordDetails(){
  39. $id = input('deviceRecordId/d',0);
  40. $model = $this->model;
  41. $ret = $model->details($id);
  42. if($ret){
  43. HelpHander::success($ret);
  44. }else{
  45. HelpHander::error('参数错误');
  46. }
  47. }
  48. }