UserSubsidies.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class UserSubsidies extends Base
  7. {
  8. // 新增
  9. public function save(){
  10. model('UserSubsidies')->add();
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 编辑
  14. public function update(){
  15. model('UserSubsidies')->add();
  16. HelpHander::success([],'操作成功');
  17. }
  18. // 详情
  19. public function detail(){
  20. $id = input('id/d',0);
  21. $ret = model('UserSubsidies')->info($id);
  22. HelpHander::success($ret);
  23. }
  24. // 列表
  25. public function list(){
  26. $page = input('page/d',1);
  27. $size = input('size/d',10);
  28. $title = input('title','','trim');
  29. $payType = input('payType/d',1);
  30. if(!in_array($payType,[1,2,3,4,5])){
  31. HelpHander::error('参数错误');
  32. }
  33. $ret = model('UserSubsidies')->lists($page,$size,$title,$payType);
  34. HelpHander::success($ret);
  35. }
  36. // 所有
  37. public function all(){
  38. $ret = model('UserSubsidies')->all();
  39. HelpHander::success($ret);
  40. }
  41. // 删除
  42. public function del(){
  43. $id = input('id/d',0);
  44. model('UserSubsidies')->del($id);
  45. HelpHander::success([],'操作成功');
  46. }
  47. }