GiftCardController.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. return $this->success('新增礼品卡成功',$result);
  49. if($result == 'true'){
  50. return $this->success('新增礼品卡成功');
  51. }else{
  52. return $this->fail(GiftCardLogic::getError());
  53. }
  54. }else{
  55. return $this->fail('请求方式错误');
  56. }
  57. }
  58. /**
  59. * @notes 礼品卡批次卡号详情
  60. * @return \think\response\Json
  61. * @author ljj
  62. * @date 2022/3/31 11:23 上午
  63. */
  64. public function cardDetail()
  65. {
  66. $params = (new GiftCardValidate())->goCheck('detail');
  67. return $this->dataLists(new GiftCardInfoLists());
  68. }
  69. /**
  70. * @notes 删除批次
  71. * @return \think\response\Json
  72. * @author ljj
  73. * @date 2022/3/31 2:29 下午
  74. */
  75. public function delGiftCard()
  76. {
  77. $params = (new GiftCardValidate())->post()->goCheck('delGiftCard');
  78. $result = (new GiftCardLogic())->deleteGiftCard($params);
  79. if (true !== $result) {
  80. return $this->fail(GiftCardLogic::getError());
  81. }
  82. return $this->success('删除成功',[],1,1);
  83. }
  84. /**
  85. * @notes 删除礼品卡
  86. * @return \think\response\Json
  87. * @author ljj
  88. * @date 2022/3/31 2:29 下午
  89. */
  90. public function delGiftCardInfo()
  91. {
  92. $params = (new GiftCardValidate())->post()->goCheck('delGiftCardInfo');
  93. $result = (new GiftCardLogic())->deleteGiftCardInfo($params);
  94. if (true !== $result) {
  95. return $this->fail(GiftCardLogic::getError());
  96. }
  97. return $this->success('删除成功',[],1,1);
  98. }
  99. }