BudgetItems.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. class BudgetItems extends Base
  6. {
  7. // 新增
  8. public function save(){
  9. model('BudgetItems')->add();
  10. HelpHander::success([],'操作成功');
  11. }
  12. // 编辑
  13. public function update(){
  14. model('BudgetItems')->add();
  15. HelpHander::success([],'操作成功');
  16. }
  17. // 详情
  18. public function detail(){
  19. $id = input('id/d',0);
  20. $ret = model('BudgetItems')->info($id);
  21. HelpHander::success($ret);
  22. }
  23. // 列表
  24. public function list(){
  25. $page = input('page/d',1);
  26. $size = input('size/d',10);
  27. $companyId = input('companyId/d',0);
  28. $title = input('title','','trim');
  29. $ret = model('BudgetItems')->lists($page,$size,$companyId,$title,$this->orgId);
  30. HelpHander::success($ret);
  31. }
  32. // 获取最近活动的预算项目
  33. public function newlist(){
  34. $companyId = input('companyId/d',0);
  35. $ret = model('BudgetItems')->newlists($companyId,$this->orgId);
  36. HelpHander::success($ret);
  37. }
  38. public function newBudget(){
  39. $ret = model('BudgetItems')->newbudget($this->orgId,$this->userId);
  40. HelpHander::success($ret);
  41. }
  42. // 删除
  43. public function del(){
  44. $id = input('id/d',0);
  45. model('BudgetItems')->del($id);
  46. HelpHander::success([],'操作成功');
  47. }
  48. // 当前可用列表
  49. public function curList(){
  50. $ret = model('BudgetItems')->curLists($this->orgId);
  51. HelpHander::success($ret);
  52. }
  53. // 获取所有预算项目
  54. public function all(){
  55. $ret = model('BudgetItems')->all($this->orgId);
  56. HelpHander::success($ret);
  57. }
  58. }