Transfer.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\giftcard\api\controller;
  11. use addon\giftcard\model\transfer\Blessing;
  12. use addon\giftcard\model\transfer\Transfer as TransferModel;
  13. use app\api\controller\BaseApi;
  14. /**
  15. * 礼品卡
  16. */
  17. class Transfer extends BaseApi
  18. {
  19. /**
  20. * 转赠
  21. */
  22. public function transfer()
  23. {
  24. $token = $this->checkToken();
  25. if ($token[ 'code' ] < 0) return $this->response($token);
  26. $no = $this->params[ 'no' ] ?? '';
  27. $blessing_model = new Blessing();
  28. $info = $blessing_model->getMemberCardBlessingInfo([ [ 'no', '=', $no ] ])[ 'data' ] ?? [];
  29. $transfer_model = new TransferModel();
  30. $params = array (
  31. 'site_id' => $this->site_id,
  32. 'member_id' => $this->member_id,
  33. 'blessing_id' => $info[ 'blessing_id' ] ?? 0
  34. );
  35. $result = $transfer_model->transfer($params);
  36. return $this->response($result);
  37. }
  38. public function blessingDetail()
  39. {
  40. $token = $this->checkToken();
  41. // if ($token['code'] < 0) return $this->response($token);
  42. $no = $this->params[ 'no' ] ?? '';
  43. $blessing_model = new Blessing();
  44. $params = array (
  45. 'site_id' => $this->site_id,
  46. 'no' => $no,
  47. 'member_id' => $this->member_id
  48. );
  49. $result = $blessing_model->getBlessingDetail($params);
  50. return $this->response($result);
  51. }
  52. }