FreightController.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller\settings\delivery;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\settings\delivery\FreightLists;
  22. use app\adminapi\logic\settings\delivery\FreightLogic;
  23. use app\adminapi\validate\settings\delivery\FreightValidate;
  24. class FreightController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 添加运费模版
  28. * @return \think\response\Json
  29. * @author ljj
  30. * @date 2021/7/30 2:48 下午
  31. */
  32. public function add()
  33. {
  34. $params = (new FreightValidate())->post()->goCheck('add');
  35. $result = (new FreightLogic())->add($params);
  36. if (true !== $result) {
  37. return $this->fail($result);
  38. }
  39. return $this->success('添加成功',[],1,1);
  40. }
  41. /**
  42. * @notes 查看运费模版列表
  43. * @return \think\response\Json
  44. * @author ljj
  45. * @date 2021/7/30 4:56 下午
  46. */
  47. public function lists()
  48. {
  49. return $this->dataLists(new FreightLists());
  50. }
  51. /**
  52. * @notes 编辑运费模版
  53. * @return \think\response\Json
  54. * @author ljj
  55. * @date 2021/7/30 6:06 下午
  56. */
  57. public function edit()
  58. {
  59. $params = (new FreightValidate())->post()->goCheck('edit');
  60. $result = (new FreightLogic())->edit($params);
  61. if (true !== $result) {
  62. return $this->fail($result);
  63. }
  64. return $this->success('修改成功',[],1,1);
  65. }
  66. /**
  67. * @notes 查看运费模版详情
  68. * @return \think\response\Json
  69. * @throws \think\db\exception\DataNotFoundException
  70. * @throws \think\db\exception\DbException
  71. * @throws \think\db\exception\ModelNotFoundException
  72. * @author ljj
  73. * @date 2021/7/30 6:52 下午
  74. */
  75. public function detail()
  76. {
  77. $params = (new FreightValidate())->goCheck('detail');
  78. $result = (new FreightLogic())->detail($params);
  79. return $this->success('获取成功',$result);
  80. }
  81. /**
  82. * @notes 删除运费模版
  83. * @return \think\response\Json
  84. * @author ljj
  85. * @date 2021/7/30 7:00 下午
  86. */
  87. public function del()
  88. {
  89. $params = (new FreightValidate())->post()->goCheck('del');
  90. (new FreightLogic())->del($params);
  91. return $this->success('删除成功',[],1,1);
  92. }
  93. }