GiftCardController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop开源商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | gitee下载:https://gitee.com/likeshop_gitee
  7. // | github下载:https://github.com/likeshop-github
  8. // | 访问官网:https://www.likeshop.cn
  9. // | 访问社区:https://home.likeshop.cn
  10. // | 访问手册:http://doc.likeshop.cn
  11. // | 微信公众号:likeshop技术社区
  12. // | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
  13. // | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
  14. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  15. // | likeshop团队版权所有并拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshop.cn.team
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller\gift_card;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\gift_card\GiftCardLists;
  22. use app\adminapi\lists\gift_card\GiftCardInfoLists;
  23. use app\adminapi\validate\gift_card\GiftCardValidate;
  24. use app\adminapi\logic\gift_card\GiftCardLogic;
  25. class GiftCardController extends BaseAdminController
  26. {
  27. /**
  28. * @notes 礼品卡批次列表
  29. * @return \think\response\Json
  30. * @author ljj
  31. * @date 2022/3/30 5:40 下午
  32. */
  33. public function lists()
  34. {
  35. return $this->dataLists(new GiftCardLists());
  36. }
  37. /**
  38. * @notes 新增礼品卡
  39. * @return \think\response\Json
  40. * @author ljj
  41. * @date 2022/3/31 11:23 上午
  42. */
  43. public function add()
  44. {
  45. if($this->request->isPost()) {
  46. $params = (new GiftCardValidate())->post()->goCheck('add');
  47. $result = (new GiftCardLogic())->add($params);
  48. if($result == 'true'){
  49. return $this->success('新增礼品卡成功');
  50. }else{
  51. return $this->fail(GiftCardLogic::getError());
  52. }
  53. }else{
  54. return $this->fail('请求方式错误');
  55. }
  56. }
  57. /**
  58. * @notes 礼品卡批次卡号详情
  59. * @return \think\response\Json
  60. * @author ljj
  61. * @date 2022/3/31 11:23 上午
  62. */
  63. public function cardDetail()
  64. {
  65. $params = (new GiftCardValidate())->goCheck('detail');
  66. return $this->dataLists(new GiftCardInfoLists());
  67. }
  68. /**
  69. * @notes 删除批次
  70. * @return \think\response\Json
  71. * @author ljj
  72. * @date 2022/3/31 2:29 下午
  73. */
  74. public function delGiftCard()
  75. {
  76. $params = (new GiftCardValidate())->post()->goCheck('delGiftCard');
  77. $result = (new GiftCardLogic())->deleteGiftCard($params);
  78. if (true !== $result) {
  79. return $this->fail(GiftCardLogic::getError());
  80. }
  81. return $this->success('删除成功',[],1,1);
  82. }
  83. /**
  84. * @notes 删除礼品卡
  85. * @return \think\response\Json
  86. * @author ljj
  87. * @date 2022/3/31 2:29 下午
  88. */
  89. public function delGiftCardInfo()
  90. {
  91. $params = (new GiftCardValidate())->post()->goCheck('delGiftCardInfo');
  92. $result = (new GiftCardLogic())->deleteGiftCardInfo($params);
  93. if (true !== $result) {
  94. return $this->fail(GiftCardLogic::getError());
  95. }
  96. return $this->success('删除成功',[],1,1);
  97. }
  98. }