From 1a177615b96428daee09e84c1ef7b2fb58581fae Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Fri, 7 Aug 2020 10:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E8=BF=94=E5=88=B8?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8--=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=A0=87=E5=BF=97acrtivity=5Ftype=E4=B8=BA?= =?UTF-8?q?=E9=80=9A=E8=BF=87ssdb=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/CouponRebateService.php | 18 +++++++++--------- app/Service/CouponService.php | 12 +++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/Service/CouponRebateService.php b/app/Service/CouponRebateService.php index a3bff6e..c31cf19 100644 --- a/app/Service/CouponRebateService.php +++ b/app/Service/CouponRebateService.php @@ -36,7 +36,7 @@ class CouponRebateService implements CouponRebateServiceInterface $sendUserId = $params["send_user_id"]; $phone = $params["phone"]; $now = time(); - $idsData = is_array($ids) ? $ids : explode(',',$ids); + $idsData = is_array($ids) ? $ids : explode(',',$ids); // status: 0领取成功 >0领取失败 $result = [ @@ -57,8 +57,8 @@ class CouponRebateService implements CouponRebateServiceInterface $receiveSsdb = []; // 判断是否已全部领取 - $couponActivity = $ssdb->exec('get', SsdbKeysPrefix::COUPON_REBATE_ACTIVITY); - $userReceiveCouponIds = $ssdb->exec('hgetall', SsdbKeysPrefix::COUPON_REBATE_FORWARD . $couponActivity); + $couponActivity = $ssdb->exec('hget', SsdbKeysPrefix::COUPON_REBATE_ACTIVITY,0); + $userReceiveCouponIds = $ssdb->exec('hgetall', SsdbKeysPrefix::COUPON_REBATE_RECEIVE . $couponActivity . $userId); if($userReceiveCouponIds !== false){ $ids = array_diff($idsData, $userReceiveCouponIds); }else{ @@ -187,7 +187,7 @@ class CouponRebateService implements CouponRebateServiceInterface $saveSsdb[] = $vssdb; } // 记录到ssdb - if(false === $ssdb->exec('multi_hset',SsdbKeysPrefix::COUPON_REBATE_RECEIVE.$userId,$saveSsdb)){ + if(false === $ssdb->exec('multi_hset',SsdbKeysPrefix::COUPON_REBATE_RECEIVE . $couponActivity . $userId, $saveSsdb)){ $errorData['msg'] = '记录领取优惠券到ssdb失败'; $this->log->event( LogLabel::COUPON_LOG, @@ -254,12 +254,12 @@ class CouponRebateService implements CouponRebateServiceInterface $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); // $rrss1 = $ssdb->exec('hgetall', SsdbKeysPrefix::COUPON_REBATE_FORWARD . $couponActivity); - // $rrss2 = $ssdb->exec('get', SsdbKeysPrefix::COUPON_REBATE_REPAY . $couponActivity); - // $rrss3 = $ssdb->exec('get', SsdbKeysPrefix::COUPON_REBATE_ACTIVITY); - // return [$rrss3]; + // $rrss2 = $ssdb->exec('hget', SsdbKeysPrefix::COUPON_REBATE_REPAY . $couponActivity,0); + // $rrss3 = $ssdb->exec('hget', SsdbKeysPrefix::COUPON_REBATE_ACTIVITY,0); + // return [$rrss1,$rrss2,$rrss3]; // 记录活动本次 activity_type 活动标志值 - if (false === $ssdb->exec('set', SsdbKeysPrefix::COUPON_REBATE_ACTIVITY, $couponActivity)) { + if (false === $ssdb->exec('hset', SsdbKeysPrefix::COUPON_REBATE_ACTIVITY, [0,$couponActivity])) { $this->log->event( LogLabel::COUPON_LOG, @@ -292,7 +292,7 @@ class CouponRebateService implements CouponRebateServiceInterface }; // 记录返还类型优惠券 - if (false === $ssdb->exec('set', SsdbKeysPrefix::COUPON_REBATE_REPAY . $couponActivity, $couponRepay)) { + if (false === $ssdb->exec('hset', SsdbKeysPrefix::COUPON_REBATE_REPAY . $couponActivity, [0,$couponRepay])) { $this->log->event( LogLabel::COUPON_LOG, diff --git a/app/Service/CouponService.php b/app/Service/CouponService.php index 67f9e56..c0ff451 100644 --- a/app/Service/CouponService.php +++ b/app/Service/CouponService.php @@ -27,13 +27,16 @@ class CouponService implements CouponServiceInterface */ public function getSystemCouponUserList($userId,$receiveType) { - $activityType = 2;/* 优惠券活动标志 2 */ + /* 优惠券活动标志 2 */ + $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); + $couponActivity = $ssdb->exec('hget', SsdbKeysPrefix::COUPON_REBATE_ACTIVITY,0); + $result = [ 'active_type' => 1, 'not_receive' => [], 'jump_data' => [ - 'src' => "/zh_cjdianc/pages/couponrebate/index?activity_type=".$activityType, - 'src2' => "/zh_cjdianc/pages/couponrebate/index?activity_type=".$activityType, + 'src' => "/zh_cjdianc/pages/couponrebate/index?activity_type=".$couponActivity, + 'src2' => "/zh_cjdianc/pages/couponrebate/index?activity_type=".$couponActivity, 'coupons' => [] ] ]; @@ -65,8 +68,7 @@ class CouponService implements CouponServiceInterface $couponIds = array_diff($c_ids, $cr_ids); // 获取领取型优惠券 - $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); - $couponRebateIds = $ssdb->exec('hgetall',SsdbKeysPrefix::COUPON_REBATE_FORWARD.$activityType); + $couponRebateIds = $ssdb->exec('hgetall',SsdbKeysPrefix::COUPON_REBATE_FORWARD.$couponActivity); $couponIds = ($couponRebateIds === false || empty($couponRebateIds)) ? $couponIds : array_merge($couponIds,$couponRebateIds) ;