AddressController.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\workerapi\controller\shops;
  3. use app\workerapi\controller\BaseApiController;
  4. use app\workerapi\logic\shops\ShopAddressLogic;
  5. use app\workerapi\validate\shops\ShopAddressValidate;
  6. class AddressController extends BaseApiController
  7. {
  8. public function lists()
  9. {
  10. $result = ShopAddressLogic::getAddressList($this->userId);
  11. return $this->data($result);
  12. }
  13. public function add()
  14. {
  15. $params = (new ShopAddressValidate())->post()->goCheck('add',[
  16. 'worker_id'=>$this->userId
  17. ]);
  18. $result = ShopAddressLogic::add($params);
  19. if (true === $result) {
  20. return $this->success('添加成功', [], 1, 1);
  21. }
  22. return $this->fail(ShopAddressLogic::getError());
  23. }
  24. /**
  25. * @notes 编辑
  26. * @return \think\response\Json
  27. */
  28. public function edit()
  29. {
  30. $params = (new ShopAddressValidate())->post()->goCheck('edit',[
  31. 'worker_id'=>$this->userId
  32. ]);
  33. $result = ShopAddressLogic::edit($params);
  34. if (true === $result) {
  35. return $this->success('编辑成功', [], 1, 1);
  36. }
  37. return $this->fail(ShopAddressLogic::getError());
  38. }
  39. /**
  40. * @notes 删除
  41. * @return \think\response\Json
  42. */
  43. public function delete()
  44. {
  45. $params = (new ShopAddressValidate())->goCheck('delete',[
  46. 'worker_id'=>$this->userId
  47. ]);
  48. ShopAddressLogic::delete($params);
  49. return $this->success('删除成功', [], 1, 1);
  50. }
  51. /**
  52. * @notes 获取详情
  53. * @return \think\response\Json
  54. * @author likeadmin
  55. * @date 2024/07/18 13:51
  56. */
  57. public function detail()
  58. {
  59. $params = (new ShopAddressValidate())->goCheck('detail',[
  60. 'worker_id'=>$this->userId
  61. ]);
  62. $result = ShopAddressLogic::detail($params);
  63. return $this->data($result);
  64. }
  65. }