MasterWorkerCustomerController.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\master_worker_customer;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\master_worker_customer\MasterWorkerCustomerLists;
  17. use app\adminapi\logic\master_worker_customer\MasterWorkerCustomerLogic;
  18. use app\adminapi\validate\master_worker_customer\MasterWorkerCustomerValidate;
  19. /**
  20. * MasterWorkerCustomer控制器
  21. * Class MasterWorkerCustomerController
  22. * @package app\adminapi\controller\master_worker_customer
  23. */
  24. class MasterWorkerCustomerController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 获取列表
  28. * @return \think\response\Json
  29. * @author likeadmin
  30. * @date 2024/07/10 17:34
  31. */
  32. public function lists()
  33. {
  34. return $this->dataLists(new MasterWorkerCustomerLists());
  35. }
  36. /**
  37. * @notes 添加
  38. * @return \think\response\Json
  39. * @author likeadmin
  40. * @date 2024/07/10 17:34
  41. */
  42. public function add()
  43. {
  44. $params = (new MasterWorkerCustomerValidate())->post()->goCheck('add');
  45. $result = MasterWorkerCustomerLogic::add($params);
  46. if (true === $result) {
  47. return $this->success('添加成功', [], 1, 1);
  48. }
  49. return $this->fail(MasterWorkerCustomerLogic::getError());
  50. }
  51. /**
  52. * @notes 编辑
  53. * @return \think\response\Json
  54. * @author likeadmin
  55. * @date 2024/07/10 17:34
  56. */
  57. public function edit()
  58. {
  59. $params = (new MasterWorkerCustomerValidate())->post()->goCheck('edit');
  60. $params['admin_id'] = $this->adminId;
  61. $result = MasterWorkerCustomerLogic::edit($params);
  62. if (true === $result) {
  63. return $this->success('编辑成功', [], 1, 1);
  64. }
  65. return $this->fail(MasterWorkerCustomerLogic::getError());
  66. }
  67. /**
  68. * @notes 删除
  69. * @return \think\response\Json
  70. * @author likeadmin
  71. * @date 2024/07/10 17:34
  72. */
  73. public function delete()
  74. {
  75. $params = (new MasterWorkerCustomerValidate())->post()->goCheck('delete');
  76. MasterWorkerCustomerLogic::delete($params);
  77. return $this->success('删除成功', [], 1, 1);
  78. }
  79. /**
  80. * @notes 获取详情
  81. * @return \think\response\Json
  82. * @author likeadmin
  83. * @date 2024/07/10 17:34
  84. */
  85. public function detail()
  86. {
  87. $params = (new MasterWorkerCustomerValidate())->goCheck('detail');
  88. $result = MasterWorkerCustomerLogic::detail($params);
  89. return $this->data($result);
  90. }
  91. }