Car.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. class Car extends Base
  6. {
  7. // 新增
  8. public function save(){
  9. model('Car')->add();
  10. HelpHander::success([],'操作成功');
  11. }
  12. // 编辑
  13. public function update(){
  14. model('Car')->add();
  15. HelpHander::success([],'操作成功');
  16. }
  17. // 编辑里程
  18. public function recordUpdate(){
  19. model('CarRecord')->add();
  20. HelpHander::success([],'操作成功');
  21. }
  22. // 详情
  23. public function detail(){
  24. $id = input('id/d',0);
  25. $ret = model('Car')->info($id);
  26. HelpHander::success($ret);
  27. }
  28. // 列表
  29. public function list(){
  30. $page = input('page/d',1);
  31. $size = input('size/d',10);
  32. $title = input('title','','trim');
  33. $enable = input('enable/d',-1);
  34. $ret = model('Car')->lists($page,$size,$title,$enable,$this->orgId);
  35. HelpHander::success($ret);
  36. }
  37. public function all(){
  38. $ret = model('Car')->all($this->orgId);
  39. HelpHander::success($ret);
  40. }
  41. // 删除
  42. public function del(){
  43. $id = input('id/d',0);
  44. model('Car')->del($id);
  45. HelpHander::success([],'操作成功');
  46. }
  47. public function record(){
  48. $page = input('page/d',1);
  49. $size = input('size/d',10);
  50. $carId = input('carId/d',0);
  51. $ret = model('Car')->record($page,$size,$carId,$this->orgId);
  52. HelpHander::success($ret);
  53. }
  54. public function export(){
  55. $carId = input('carId/d',0);
  56. $ret = model('Car')->export($carId,$this->orgId);
  57. HelpHander::success($ret);
  58. }
  59. }