Program.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 Program extends Base
  7. {
  8. // 新增
  9. public function save(){
  10. model('Program')->add();
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 编辑
  14. public function update(){
  15. model('Program')->add();
  16. HelpHander::success([],'操作成功');
  17. }
  18. // 详情
  19. public function detail(){
  20. $id = input('id/d',0);
  21. $ret = model('Program')->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. $cpompanyId = input('companyId/d',0);
  30. $ret = model('Program')->lists($page,$size,$title,$cpompanyId,$this->orgId);
  31. HelpHander::success($ret);
  32. }
  33. // 全部数据
  34. public function all(){
  35. $ret = model('Program')->allLists($this->orgId);
  36. HelpHander::success($ret);
  37. }
  38. // 删除
  39. public function del(){
  40. $id = input('id/d',0);
  41. model('Program')->del($id);
  42. HelpHander::success([],'操作成功');
  43. }
  44. }