PickUp.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace app\controller\admin\system\pickUp;
  3. use app\common\repositories\store\order\PickUpRepository;
  4. class PickUp
  5. {
  6. protected $repository;
  7. /**
  8. * @param PickUpRepository $repository
  9. */
  10. public function __construct(PickUpRepository $repository)
  11. {
  12. $this->repository = $repository;
  13. }
  14. /**
  15. * @return mixed
  16. * @throws \think\db\exception\DataNotFoundException
  17. * @throws \think\db\exception\DbException
  18. * @throws \think\db\exception\ModelNotFoundException
  19. * @author 史晨
  20. * @date 2026/3/20 10:13
  21. * 自提点地址列表
  22. */
  23. public function getList()
  24. {
  25. $params = request()->get();
  26. $list = $this->repository->adminList($params);
  27. return app('json')->success($list);
  28. }
  29. /**
  30. * @return mixed
  31. * @author 史晨
  32. * @date 2026/3/20 10:32
  33. * 添加自提点
  34. */
  35. public function add()
  36. {
  37. $params = request()->post();
  38. $res = $this->repository->add($params);
  39. if (!$res) {
  40. return app('json')->fail('添加失败');
  41. }
  42. return app('json')->success('添加成功');
  43. }
  44. /**
  45. * @param $id
  46. * @return mixed
  47. * @author 史晨
  48. * @date 2026/3/20 10:32
  49. * 获取自提点信息
  50. */
  51. public function get($id)
  52. {
  53. $data = $this->repository->get($id);
  54. if (!$data) {
  55. return app('json')->fail('获取失败');
  56. }
  57. return app('json')->success($data);
  58. }
  59. /**
  60. * @param $id
  61. * @return mixed
  62. * @author 史晨
  63. * @date 2026/3/20 10:33
  64. * 更新自提点信息
  65. */
  66. public function update($id)
  67. {
  68. $params = request()->post();
  69. $res = $this->repository->update($id, $params);
  70. if (!$res) {
  71. return app('json')->fail('添加失败');
  72. }
  73. return app('json')->success('添加成功');
  74. }
  75. }