StoreCouponJob.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\jobs\activity;
  12. use app\services\activity\coupon\StoreCouponIssueServices;
  13. use crmeb\basic\BaseJobs;
  14. use crmeb\traits\QueueTrait;
  15. use think\facade\Log;
  16. /**
  17. * 营销:优惠券
  18. * Class StoreCouponJob
  19. * @package app\jobs\user
  20. */
  21. class StoreCouponJob extends BaseJobs
  22. {
  23. use QueueTrait;
  24. /**
  25. * 新人礼赠送优惠券
  26. * @param $uid
  27. * @return bool
  28. */
  29. public function newcomerGiveCoupon($uid)
  30. {
  31. try {
  32. /**@var StoreCouponIssueServices $storeCoupon */
  33. $storeCoupon = app()->make(StoreCouponIssueServices::class);
  34. $storeCoupon->newcomerGiveCoupon((int)$uid);
  35. } catch (\Throwable $e) {
  36. Log::error('赠送新人礼优惠券失败,失败原因:' . $e->getMessage());
  37. }
  38. return true;
  39. }
  40. /**
  41. * 会员卡激活赠送优惠券
  42. * @param $uid
  43. * @return bool
  44. */
  45. public function levelGiveCoupon($uid)
  46. {
  47. try {
  48. /**@var StoreCouponIssueServices $storeCoupon */
  49. $storeCoupon = app()->make(StoreCouponIssueServices::class);
  50. $storeCoupon->levelGiveCoupon((int)$uid);
  51. } catch (\Throwable $e) {
  52. Log::error('赠送新人礼优惠券失败,失败原因:' . $e->getMessage());
  53. }
  54. return true;
  55. }
  56. /**
  57. * 增加新人券
  58. * @param $uid
  59. * @return bool
  60. */
  61. public function newUserGiveCoupon($uid)
  62. {
  63. try {
  64. /**@var StoreCouponIssueServices $storeCoupon */
  65. $storeCoupon = app()->make(StoreCouponIssueServices::class);
  66. $storeCoupon->userFirstSubGiveCoupon((int)$uid);
  67. } catch (\Throwable $e) {
  68. Log::error('赠送新人券失败,失败原因:' . $e->getMessage());
  69. }
  70. return true;
  71. }
  72. }