ShopNoticeController.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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\shop_notice;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\shop_notice\ShopNoticeLists;
  22. use app\adminapi\logic\shop_notice\ShopNoticeLogic;
  23. use app\adminapi\validate\shop_notice\ShopNoticeValidate;
  24. use app\common\model\ShopNotice;
  25. class ShopNoticeController extends BaseAdminController
  26. {
  27. /**
  28. * @notes 添加商城公告
  29. * @return \think\response\Json
  30. * @author ljj
  31. * @date 2021/8/23 2:01 下午
  32. */
  33. public function add()
  34. {
  35. $params = (new ShopNoticeValidate())->post()->goCheck('add');
  36. (new ShopNoticeLogic())->add($params);
  37. return $this->success('添加成功',[],1,1);
  38. }
  39. /**
  40. * @notes 查看商城公告列表
  41. * @return \think\response\Json
  42. * @author ljj
  43. * @date 2021/8/23 2:16 下午
  44. */
  45. public function lists()
  46. {
  47. return $this->dataLists(new ShopNoticeLists());
  48. }
  49. /**
  50. * @notes 编辑商城公告
  51. * @return \think\response\Json
  52. * @throws \think\db\exception\DataNotFoundException
  53. * @throws \think\db\exception\DbException
  54. * @throws \think\db\exception\ModelNotFoundException
  55. * @author ljj
  56. * @date 2021/8/23 2:42 下午
  57. */
  58. public function edit()
  59. {
  60. $params = (new ShopNoticeValidate())->post()->goCheck('edit');
  61. (new ShopNoticeLogic())->edit($params);
  62. return $this->success('修改成功',[],1,1);
  63. }
  64. /**
  65. * @notes 查看商城公告详情
  66. * @return \think\response\Json
  67. * @throws \think\db\exception\DataNotFoundException
  68. * @throws \think\db\exception\DbException
  69. * @throws \think\db\exception\ModelNotFoundException
  70. * @author ljj
  71. * @date 2021/8/23 2:49 下午
  72. */
  73. public function detail()
  74. {
  75. $params = (new ShopNoticeValidate())->goCheck('detail');
  76. $result = (new ShopNoticeLogic())->detail($params);
  77. return $this->success('',$result);
  78. }
  79. /**
  80. * @notes 修改商城公告状态
  81. * @return \think\response\Json
  82. * @throws \think\db\exception\DataNotFoundException
  83. * @throws \think\db\exception\DbException
  84. * @throws \think\db\exception\ModelNotFoundException
  85. * @author ljj
  86. * @date 2021/8/23 2:58 下午
  87. */
  88. public function status()
  89. {
  90. $params = (new ShopNoticeValidate())->post()->goCheck('status');
  91. (new ShopNoticeLogic())->status($params);
  92. return $this->success('修改成功',[],1,1);
  93. }
  94. /**
  95. * @notes 删除商城公告
  96. * @return \think\response\Json
  97. * @author ljj
  98. * @date 2021/8/23 3:04 下午
  99. */
  100. public function del()
  101. {
  102. $params = (new ShopNoticeValidate())->post()->goCheck('del');
  103. (new ShopNoticeLogic())->del($params);
  104. return $this->success('删除成功',[],1,1);
  105. }
  106. }