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
ce3fcef7
Commit
ce3fcef7
authored
Aug 29, 2018
by
zhz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into master_dev
parents
a055929f
8aa3900c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
CouponService.php
application/models/Business/Coupon/CouponService.php
+17
-5
Coupon.php
application/models/DAO/Coupon/Coupon.php
+3
-3
No files found.
application/models/Business/Coupon/CouponService.php
View file @
ce3fcef7
...
@@ -164,11 +164,21 @@ class CouponServiceModel extends \Business\AbstractModel{
...
@@ -164,11 +164,21 @@ class CouponServiceModel extends \Business\AbstractModel{
}
}
$couponDao
->
db
->
doCommit
();
$couponDao
->
db
->
doCommit
();
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db13\MemberCouponRedisModel
::
getInstance
(),
array
(
&
$memberCouponDao
,
'getList'
),
array
(),
array
(
$memberId
));
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db13\MemberCouponRedisModel
::
getInstance
(),
array
(
&
$memberCouponDao
,
'getList'
),
array
(),
array
(
$memberId
));
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(),
array
(
$coupon
[
'store_id'
]
.
"_"
.
$memberId
));
return
true
;
return
true
;
}
}
/**
* 购物车多店下单涉及到赠券时使用
* @param $coupons
* @param $memberId
* @param int $orderId
* @return bool
* @throws \Error\OurExceptionModel
* @throws \Exception
* @throws \Our\Exception
*/
public
function
receiveCouponBatch
(
$coupons
,
$memberId
,
$orderId
=
\Our\ApiConst
::
zero
){
public
function
receiveCouponBatch
(
$coupons
,
$memberId
,
$orderId
=
\Our\ApiConst
::
zero
){
$dbName
=
\Our\DbNameConst
::
masterDBConnectName
;
$dbName
=
\Our\DbNameConst
::
masterDBConnectName
;
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
(
$dbName
);
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
(
$dbName
);
...
@@ -268,7 +278,7 @@ class CouponServiceModel extends \Business\AbstractModel{
...
@@ -268,7 +278,7 @@ class CouponServiceModel extends \Business\AbstractModel{
public
function
getStoreCoupons
(
$where
,
$memberId
=
null
){
public
function
getStoreCoupons
(
$where
,
$memberId
=
null
){
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponDao
->
validStoreCouponParam
(
$where
);
$couponDao
->
validStoreCouponParam
(
$where
);
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'storeId'
]));
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'storeId'
]
.
"_"
.
$memberId
));
if
(
$couponList
){
if
(
$couponList
){
$couponList
=
array_values
(
$couponList
);
$couponList
=
array_values
(
$couponList
);
}
}
...
@@ -279,7 +289,7 @@ class CouponServiceModel extends \Business\AbstractModel{
...
@@ -279,7 +289,7 @@ class CouponServiceModel extends \Business\AbstractModel{
$this
->
validCouponStore
(
$where
);
$this
->
validCouponStore
(
$where
);
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponDao
->
validStoreCouponParam
(
$where
);
$couponDao
->
validStoreCouponParam
(
$where
);
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
,
true
),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'storeId'
]
));
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
,
\Our\ApiConst
::
one
),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'storeId'
]
.
"_"
.
$memberId
));
if
(
$couponList
){
if
(
$couponList
){
$couponList
=
array_values
(
$couponList
);
$couponList
=
array_values
(
$couponList
);
if
(
count
(
$couponList
)
>=
\Our\ApiConst
::
defaultCouponTitleLength
){
if
(
count
(
$couponList
)
>=
\Our\ApiConst
::
defaultCouponTitleLength
){
...
@@ -315,7 +325,7 @@ class CouponServiceModel extends \Business\AbstractModel{
...
@@ -315,7 +325,7 @@ class CouponServiceModel extends \Business\AbstractModel{
* @param $memberId 会员ID
* @param $memberId 会员ID
* @return array|bool
* @return array|bool
*/
*/
public
function
getStoreCouponsById
(
$storeId
,
$memberId
,
$timeFlag
=
false
){
public
function
getStoreCouponsById
(
$storeId
,
$memberId
,
$timeFlag
=
\Our\ApiConst
::
zero
){
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponList
=
$couponDao
->
getStoreIndexCouponList
(
$storeId
,
$timeFlag
);
$couponList
=
$couponDao
->
getStoreIndexCouponList
(
$storeId
,
$timeFlag
);
if
(
!
$couponList
){
if
(
!
$couponList
){
...
@@ -348,10 +358,12 @@ class CouponServiceModel extends \Business\AbstractModel{
...
@@ -348,10 +358,12 @@ class CouponServiceModel extends \Business\AbstractModel{
if
(
in_array
(
\Our\ApiConst
::
availCouponState
,
$couponStates
)){
if
(
in_array
(
\Our\ApiConst
::
availCouponState
,
$couponStates
)){
$coupon
[
'isGet'
]
=
\Our\ApiConst
::
one
;
$coupon
[
'isGet'
]
=
\Our\ApiConst
::
one
;
}
else
{
}
else
{
$coupon
[
'isGet'
]
=
\Our\ApiConst
::
zero
;
$coupon
[
'isGet'
]
=
\Our\ApiConst
::
zero
;
}
}
}
}
}
}
}
else
{
$coupon
[
'isGet'
]
=
\Our\ApiConst
::
zero
;
}
}
unset
(
$coupon
[
'is_overlay'
]);
unset
(
$coupon
[
'is_overlay'
]);
}
}
...
...
application/models/DAO/Coupon/Coupon.php
View file @
ce3fcef7
...
@@ -150,7 +150,7 @@ class CouponModel extends \DAO\AbstractModel {
...
@@ -150,7 +150,7 @@ class CouponModel extends \DAO\AbstractModel {
*/
*/
public
function
getStorePromotionCouponList
(
$storeId
){
public
function
getStorePromotionCouponList
(
$storeId
){
$field
=
$this
->
availStoreIndexField
;
$field
=
$this
->
availStoreIndexField
;
$where
=
' and store_id
in( '
.
$storeId
.
',0)
and type<>1'
;
$where
=
' and store_id
='
.
$storeId
.
'
and type<>1'
;
$this
->
setDb
(
$this
->
dbName
);
$this
->
setDb
(
$this
->
dbName
);
$coupons
=
$this
->
getOnlineCouponList
(
$where
,
$field
);
$coupons
=
$this
->
getOnlineCouponList
(
$where
,
$field
);
...
@@ -215,7 +215,7 @@ class CouponModel extends \DAO\AbstractModel {
...
@@ -215,7 +215,7 @@ class CouponModel extends \DAO\AbstractModel {
*/
*/
public
function
getStoreCouponList
(
$storeId
){
public
function
getStoreCouponList
(
$storeId
){
$field
=
$this
->
availStoreIndexField
;
$field
=
$this
->
availStoreIndexField
;
$where
=
' and store_id
in( '
.
$storeId
.
',0)'
;
$where
=
' and store_id
= '
.
$storeId
;
$coupons
=
$this
->
getOnlineCouponList
(
$where
,
$field
);
$coupons
=
$this
->
getOnlineCouponList
(
$where
,
$field
);
//$coupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array($where,$field),\Our\ApiConst::oneHour);
//$coupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array($where,$field),\Our\ApiConst::oneHour);
return
$coupons
;
return
$coupons
;
...
@@ -261,7 +261,7 @@ class CouponModel extends \DAO\AbstractModel {
...
@@ -261,7 +261,7 @@ class CouponModel extends \DAO\AbstractModel {
* @param $storeId 店铺Id
* @param $storeId 店铺Id
* @return array
* @return array
*/
*/
public
function
getStoreIndexCouponList
(
$storeId
,
$timeFlag
=
false
){
public
function
getStoreIndexCouponList
(
$storeId
,
$timeFlag
=
\Our\ApiConst
::
zero
){
$coupons
=
$this
->
getStoreCouponList
(
$storeId
);
$coupons
=
$this
->
getStoreCouponList
(
$storeId
);
if
(
$coupons
){
if
(
$coupons
){
$result
=
array
();
$result
=
array
();
...
...
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