From 1ad034cc2c785017349547215decec25a2770981 Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Wed, 12 Aug 2020 11:33:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E8=BF=94?= =?UTF-8?q?=E5=88=B8=E6=B4=BB=E5=8A=A8--=E8=AF=B7=E6=B1=82=E5=8F=82?= =?UTF-8?q?=E6=95=B0ids=E4=B8=BA=E7=A9=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Request/CouponRebateReceiveRequest.php | 3 --- app/Service/CommonService.php | 25 ++++++++++++++++++++++ app/Service/CouponRebateService.php | 19 +++++++++++++--- 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 app/Service/CommonService.php diff --git a/app/Request/CouponRebateReceiveRequest.php b/app/Request/CouponRebateReceiveRequest.php index 4c4beed..7abce7d 100644 --- a/app/Request/CouponRebateReceiveRequest.php +++ b/app/Request/CouponRebateReceiveRequest.php @@ -24,7 +24,6 @@ class CouponRebateReceiveRequest extends FormRequest return [ 'user_id' => 'required|nonempty|integer|exists_enable:ims_cjdc_user,id', 'receive_type' => 'required|nonempty|integer', - 'ids' => 'required|nonempty', ]; } @@ -33,7 +32,6 @@ class CouponRebateReceiveRequest extends FormRequest return [ 'user_id.*' => ':attribute信息不正确', 'receive_type.*' => ':attribute必须', - 'ids.*' => ':attribute必须', ]; } @@ -42,7 +40,6 @@ class CouponRebateReceiveRequest extends FormRequest return [ 'user_id' => '领取用户ID', 'receive_type' => '领取方式', - 'ids' => '优惠券', ]; } } diff --git a/app/Service/CommonService.php b/app/Service/CommonService.php new file mode 100644 index 0000000..9ffb169 --- /dev/null +++ b/app/Service/CommonService.php @@ -0,0 +1,25 @@ +0领取失败 $result = [ 'status' => 1, 'coupon_text' => '活动已过期~' ]; + /* 如果请求的优惠券ids为空,则返回过期提示 */ + if($this->commonService->empty($params["ids"])){ + return $result; + } + + $ids = $params["ids"]; + $idsData = is_array($ids) ? $ids : explode(',',$ids); // 错误日志记录 $errorData = [ @@ -150,7 +163,7 @@ class CouponRebateService implements CouponRebateServiceInterface } if(count($receiveSsdb) > 0){ -; + $saveSsdb = [ $ssdbKey, implode(',',$receiveSsdb) From d13bd3253888e62feae0f2bd73e96d2fd4480b88 Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Wed, 12 Aug 2020 12:04:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E8=BF=94?= =?UTF-8?q?=E5=88=B8=E6=B4=BB=E5=8A=A8--=E5=8F=AA=E6=9C=89=E5=8A=A0?= =?UTF-8?q?=E8=BF=9B=E6=B4=BB=E5=8A=A8=E7=9A=84=E5=88=B8=E6=89=8D=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/CouponService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Service/CouponService.php b/app/Service/CouponService.php index b0aa716..994b899 100644 --- a/app/Service/CouponService.php +++ b/app/Service/CouponService.php @@ -70,8 +70,8 @@ class CouponService implements CouponServiceInterface // 当前用户可领的优惠券ID $couponIds = array_diff($c_ids, $cr_ids); - // 获取领取型优惠券 - $couponIds = $couponActivity['forward'] === false ? $couponIds : array_merge($couponIds,explode(',',$couponActivity['forward'])); + // 转发型优惠券 + $couponReceiveIds = $couponActivity === false ? [] : explode(',',$couponActivity['forward']); $whereC = [ ['u.end_time','>',$nowTime], @@ -97,7 +97,7 @@ class CouponService implements CouponServiceInterface if($v->active_type == 1){ $result['not_receive'][] = $v; - }else if($v->active_type == 2){ + }else if($v->active_type == 2 && in_array($v->id,$couponReceiveIds)){ $result['jump_data']['coupons'][] = $v->id; } From 0a6fdc159f583c7df7aa219ae8b4ac8a7db98671 Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Wed, 12 Aug 2020 14:35:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E8=BF=94?= =?UTF-8?q?=E5=88=B8=E6=B4=BB=E5=8A=A8--=E4=BF=AE=E6=94=B9=E6=B8=85?= =?UTF-8?q?=E9=99=A4=E9=A2=86=E5=8F=96=E7=BC=93=E5=AD=98=EF=BC=88ssdb?= =?UTF-8?q?=EF=BC=89=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/CouponRebateService.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/Service/CouponRebateService.php b/app/Service/CouponRebateService.php index 539a404..56e9da7 100644 --- a/app/Service/CouponRebateService.php +++ b/app/Service/CouponRebateService.php @@ -397,8 +397,6 @@ class CouponRebateService implements CouponRebateServiceInterface return ( $ssdb->exec('hclear', SsdbKeysPrefix::COUPON_REBATE_RECEIVE) === false) ? false : true ; } }else { - $ssdb->exec('hclear', SsdbKeysPrefix::COUPON_REBATE_RECEIVE . $activity . $userId ); - if($get > 0){ return $ssdb->exec('hget', SsdbKeysPrefix::COUPON_REBATE_RECEIVE, $key); }else{