Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
2f24d27b
Commit
2f24d27b
authored
Sep 30, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
领取优惠券
parent
509e3d6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
CouponService.php
application/models/Business/Coupon/CouponService.php
+9
-5
No files found.
application/models/Business/Coupon/CouponService.php
View file @
2f24d27b
...
...
@@ -247,14 +247,18 @@ class CouponServiceModel extends \Business\AbstractModel{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
couponNoUsedTicketNum
);
}
$memberCouponDao
=
\DAO\Coupon\MemberCouponModel
::
getInstance
(
$dbName
);
if
(
$coupon
[
'is_overlay'
]){
//允许领用多张的优惠券是否存在已经领取的未使用有效优惠券
$whereSql
=
'
coupon_state ='
.
\Our\ApiConst
::
couponUnused
.
' and
member_id ='
.
$memberId
.
' and coupon_id='
.
$coupon
[
'id'
]
.
' and out_time > '
.
time
();
/*
if($coupon['is_overlay']){//允许领用多张的优惠券是否存在已经领取的未使用有效优惠券
$whereSql = ' member_id ='.$memberId.' and coupon_id='.$coupon['id'].' and out_time > '.time();
//$memberCoupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array($whereSql),\Our\ApiConst::oneHour,array($where['couponId']));
$memberCoupons = $memberCouponDao->getList($whereSql);
if($memberCoupons&&count($memberCoupons)>=$coupon['get_ticket_num']){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::alreadyGetTheCoupon);
}
}else{//不允许领用多张的优惠券
$memberCoupons
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\MemberCouponRedisModel
::
getInstance
(),
array
(
&
$memberCouponDao
,
'getList'
),
array
(
array
(
'coupon_id'
=>
$where
[
'couponId'
],
'member_id'
=>
$memberId
)),
\Our\ApiConst
::
oneHour
,
array
(
$memberId
));
}
if
(
$memberCoupons
&&
count
(
$memberCoupons
)
>
0
){
}*/
$memberCoupons
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\MemberCouponRedisModel
::
getInstance
(),
array
(
&
$memberCouponDao
,
'getList'
),
array
(
array
(
'coupon_id'
=>
$where
[
'couponId'
],
'member_id'
=>
$memberId
)),
\Our\ApiConst
::
oneHour
,
array
(
$memberId
));
if
(
$memberCoupons
&&
count
(
$memberCoupons
)
>=
$coupon
[
'get_ticket_num'
]){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
alreadyGetTheCoupon
);
}
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment