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
a4afcd05
Commit
a4afcd05
authored
Oct 08, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券有效数据
parent
b7cbd8c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
Coupon.php
application/models/DAO/Coupon/Coupon.php
+17
-0
GoodsCommon.php
application/models/DAO/GoodsCommon.php
+5
-0
No files found.
application/models/DAO/Coupon/Coupon.php
View file @
a4afcd05
...
@@ -168,6 +168,7 @@ class CouponModel extends \DAO\AbstractModel {
...
@@ -168,6 +168,7 @@ class CouponModel extends \DAO\AbstractModel {
$storeClassIds
=
array_column
(
$storeClasses
,
'gc_id'
);
$storeClassIds
=
array_column
(
$storeClasses
,
'gc_id'
);
}
}
$result
=
array
();
$result
=
array
();
$goodsCommonDao
=
\DAO\GoodsCommonModel
::
getInstance
();
foreach
(
$coupons
as
$coupon
){
foreach
(
$coupons
as
$coupon
){
if
(
!
(
$coupon
[
'start_time'
]
<=
TIMESTAMP
&&
$coupon
[
'end_time'
]
>
TIMESTAMP
)){
if
(
!
(
$coupon
[
'start_time'
]
<=
TIMESTAMP
&&
$coupon
[
'end_time'
]
>
TIMESTAMP
)){
continue
;
continue
;
...
@@ -183,6 +184,22 @@ class CouponModel extends \DAO\AbstractModel {
...
@@ -183,6 +184,22 @@ class CouponModel extends \DAO\AbstractModel {
continue
;
continue
;
}
}
}
}
if
(
$coupon
[
'type'
]
==
\Our\ApiConst
::
goodsCoupon
){
//指定商品优惠券,判断商品是否在线,在线才能展示
$goodsCommmonIds
=
array_filter
(
explode
(
','
,
$coupon
[
'gift_goods_commonids'
]));
if
(
!
$goodsCommmonIds
){
continue
;
}
$goodsCon
=
array
();
$goodsCon
[
'goods_commonid'
]
=
array
(
'in'
,
$goodsCommmonIds
);
$goodsCon
[
'goods_state'
]
=
\Our\ApiConst
::
onlineGoodsState
;
$goodsCon
[
'goods_verify'
]
=
\Our\ApiConst
::
onlineGoodsVerify
;
$goodsCon
[
'is_del'
]
=
\Our\ApiConst
::
onlineGoodsDel
;
//$goodsCommonFlag = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(), array(&$goodsCommonDao, 'getOne'),array($goodsCon,'goods_commonid'),\Our\ApiConst::oneHour);
$goodsCommonFlag
=
$goodsCommonDao
->
getOne
(
$goodsCon
,
'goods_commonid'
);
if
(
!
$goodsCommonFlag
){
continue
;
}
}
$temp
=
array
();
$temp
=
array
();
$temp
[
'couponId'
]
=
$coupon
[
'id'
];
$temp
[
'couponId'
]
=
$coupon
[
'id'
];
$orderAmount
=
intval
(
$coupon
[
'order_amount'
]);
$orderAmount
=
intval
(
$coupon
[
'order_amount'
]);
...
...
application/models/DAO/GoodsCommon.php
100755 → 100644
View file @
a4afcd05
...
@@ -32,8 +32,13 @@ class GoodsCommonModel extends \DAO\AbstractModel {
...
@@ -32,8 +32,13 @@ class GoodsCommonModel extends \DAO\AbstractModel {
public
function
getOne
(
$where
,
$field
=
\Our\NameConst
::
allField
){
public
function
getOne
(
$where
,
$field
=
\Our\NameConst
::
allField
){
$this
->
setDb
(
$this
->
dbName
);
$this
->
setDb
(
$this
->
dbName
);
if
(
is_array
(
$where
)){
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchOne
();
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchOne
();
}
}
public
function
getGoodsSaleNumFromCache
(
$goodsCommonId
){
public
function
getGoodsSaleNumFromCache
(
$goodsCommonId
){
$goodsCommonRedis
=
\Redis\Db4\GoodsCommonRedisModel
::
getInstance
();
$goodsCommonRedis
=
\Redis\Db4\GoodsCommonRedisModel
::
getInstance
();
$onlineGoodsCommonSaleNumKey
=
\Our\NameConst
::
onlineGoodsCommonSaleNumPrefix
;
$onlineGoodsCommonSaleNumKey
=
\Our\NameConst
::
onlineGoodsCommonSaleNumPrefix
;
...
...
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