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.

62 lines
1.5 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  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;
  12. use Hyperf\DbConnection\Db;
  13. use Hyperf\Redis\Redis;
  14. use Hyperf\Utils\ApplicationContext;
  15. use App\Service\CouponRebateServiceInterface;
  16. use http\Client\Curl\User;
  17. use Hyperf\Di\Annotation\Inject;
  18. use App\Model\Coupon;
  19. use App\Model\CouponUserRecType;
  20. use App\Model\CouponRec;
  21. use App\Request\CouponRebateReceiveRequest;
  22. use App\Service\CouponRebateService;
  23. class CouponRebateController extends BaseController
  24. {
  25. /**
  26. * @Inject
  27. * @var CouponRebateService
  28. */
  29. protected $CouponRebateService;
  30. /**
  31. * 用户是否领取过领取优惠券
  32. */
  33. public function isCouponRebate()
  34. {
  35. $user_id = $this->request->input('user_id', 0);
  36. $res = $this->CouponRebateService->isCouponRebate($user_id);
  37. return $this->success($res);
  38. }
  39. /**
  40. * 返回活动信息
  41. */
  42. public function getActiveInfo()
  43. {
  44. $res = $this->CouponRebateService->getActiveInfo();
  45. return $this->success($res);
  46. }
  47. /**
  48. * 用户领取优惠券
  49. * 2020.08.04 只领一张优惠券
  50. */
  51. public function userReceiveCoupon(CouponRebateReceiveRequest $validator)
  52. {
  53. return $this->success($this->CouponRebateService->userReceiveCoupon($this->request->all()));
  54. }
  55. }