You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.9 KiB

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://doc.hyperf.io
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace App\Controller\v3;
  12. use Hyperf\Di\Annotation\Inject;
  13. use App\Controller\BaseController;
  14. use App\Service\v3\Interfaces\CouponRecServiceInterface;
  15. class CouponController extends BaseController
  16. {
  17. /**
  18. * @Inject
  19. * @var CouponRecServiceInterface
  20. */
  21. protected $couponRecService;
  22. /**
  23. * 获取用户可领取优惠卷接口
  24. */
  25. public function getSystemCouponUserList()
  26. {
  27. }
  28. //统计用户
  29. public function userCouponAccount()
  30. {
  31. }
  32. /**
  33. * 用户领取优惠卷
  34. */
  35. public function userReceiveCoupon()
  36. {
  37. }
  38. /**
  39. * 获取用户已经领取的优惠卷列表
  40. */
  41. public function getUserReceiveCouponList()
  42. {
  43. }
  44. /**
  45. * 获取用户当前订单可用的优惠券列表
  46. * 按分类(1订单 等优惠)分组返回
  47. */
  48. public function getListByUser()
  49. {
  50. $userId = $this->request->input('user_id');
  51. $page = $this->request->input('page');
  52. $pagesize = $this->request->input('pagesize');
  53. $type = $this->request->input('type','1');
  54. /**
  55. * $type unused 未使用 used 已使用 expired已失效
  56. */
  57. switch ($type){
  58. case 'unused':
  59. $res = $this->couponRecService->getUnusedListByUser($userId,$page,$pagesize);
  60. break;
  61. case 'used':
  62. $res = $this->couponRecService->getUsedListByUser($userId,$page,$pagesize);
  63. break;
  64. case 'expired':
  65. $res = $this->couponRecService->getExpiredListByUser($userId,$page,$pagesize);
  66. break;
  67. }
  68. return $this->success($res);
  69. }
  70. }