ImportantRecord.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. class ImportantRecord extends Base
  6. {
  7. // 新增/编辑
  8. public function save(){
  9. model('ImportantRecord')->add();
  10. HelpHander::success([],'操作成功');
  11. }
  12. // 详情
  13. public function detail(){
  14. $id = input('id/d',0);
  15. $ret = model('ImportantRecord')->info($id);
  16. HelpHander::success($ret);
  17. }
  18. // 列表
  19. public function list(){
  20. $ret = model('ImportantRecord')->lists($this->orgId,$this->userId);
  21. HelpHander::success($ret);
  22. }
  23. // 获取下级节点
  24. public function getNextList(){
  25. $pid = input('pid/d',0);
  26. $importantId = input('importantId/d',0);
  27. $ret = model('ImportantRecord')->getNextList($importantId,$pid);
  28. HelpHander::success($ret);
  29. }
  30. // 获取所有下级
  31. public function getNextAll(){
  32. $pid = input('pid/d',0);
  33. $importantId = input('importantId/d',0);
  34. $ret = model('ImportantRecord')->getNextAll($importantId,$pid);
  35. HelpHander::success($ret);
  36. }
  37. // 办结
  38. public function finish(){
  39. model('ImportantRecord')->finish();
  40. HelpHander::success([],'操作成功');
  41. }
  42. // 撤销
  43. public function backout(){
  44. $id = input('id/d',0);
  45. model('ImportantRecord')->backout($id);
  46. HelpHander::success([],'操作成功');
  47. }
  48. // 同意/拒绝办结
  49. public function deal(){
  50. $id = input('id/d',0);
  51. $type = input('type/d',1);
  52. model('ImportantRecord')->deal($id,$type,$this->userId);
  53. HelpHander::success([],'操作成功');
  54. }
  55. // 接受/退回
  56. public function confirm(){
  57. $id = input('id/d',0);
  58. $status = input('status/d',1);
  59. if(!in_array($status,[1,3])){
  60. HelpHander::error('参数错误');
  61. }
  62. model('ImportantRecord')->confirm($id,$status);
  63. HelpHander::success([],'操作成功');
  64. }
  65. // 操作成功
  66. public function tranfer(){
  67. $id = input('id/d',0);
  68. $toUserId = input('toUserId/d',0);
  69. if($toUserId <= 0){
  70. HelpHander::error('未选择转交人员');
  71. }
  72. if($toUserId == $this->userId){
  73. HelpHander::error('不能转交给自己');
  74. }
  75. model('ImportantRecord')->tranfer($id,$this->userId,$toUserId);
  76. HelpHander::success([],'操作成功');
  77. }
  78. // 修改进度
  79. public function progress(){
  80. $id = input('id/d',0);
  81. $progress = input('progress/d',0);
  82. model('ImportantRecord')->progress($id,$progress);
  83. HelpHander::success([],'操作成功');
  84. }
  85. public function unapply(){
  86. $ret = model('ImportantRecord')->unapply($this->userId);
  87. HelpHander::success($ret);
  88. }
  89. }