Browse Source

优惠券返券活动--修改获取活动标志acrtivity_type为通过ssdb获取

master
liangyuyan 5 years ago
parent
commit
1a177615b9
  1. 16
      app/Service/CouponRebateService.php
  2. 12
      app/Service/CouponService.php

16
app/Service/CouponRebateService.php

@ -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,

12
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) ;

Loading…
Cancel
Save