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
aae20f62
Commit
aae20f62
authored
Jan 08, 2019
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车缓存
parent
2a943e8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
Goods.php
application/models/DAO/Goods.php
+2
-1
PBundling.php
application/models/DAO/PBundling.php
+28
-1
No files found.
application/models/DAO/Goods.php
View file @
aae20f62
...
@@ -316,7 +316,8 @@ class GoodsModel extends \DAO\AbstractModel {
...
@@ -316,7 +316,8 @@ class GoodsModel extends \DAO\AbstractModel {
}
}
}
}
}
}
\DAO\PBundlingModel
::
getInstance
()
->
deletePBundlingByGoodsCommonId
(
$goodsCommonId
);
//\DAO\PBundlingModel::getInstance()->deletePBundlingByGoodsCommonId($goodsCommonId);
\DAO\PBundlingModel
::
getInstance
()
->
updatePBundlingByGoodsCommonId
(
$goodsCommonId
);
\Lock\RedisLock
::
getInstance
()
->
releaseLock
(
\Our\NameConst
::
goodsStorageRedisPrefix
.
$goodsCommonId
);
\Lock\RedisLock
::
getInstance
()
->
releaseLock
(
\Our\NameConst
::
goodsStorageRedisPrefix
.
$goodsCommonId
);
}
}
return
true
;
return
true
;
...
...
application/models/DAO/PBundling.php
View file @
aae20f62
...
@@ -259,7 +259,7 @@ class PBundlingModel extends \DAO\AbstractModel {
...
@@ -259,7 +259,7 @@ class PBundlingModel extends \DAO\AbstractModel {
public
function
deletePBundlingByGoodsCommonId
(
$goodsCommonId
){
public
function
deletePBundlingByGoodsCommonId
(
$goodsCommonId
){
$pBundlingDao
=
\Redis\Db4\PBundlingRedisModel
::
getInstance
();
$pBundlingDao
=
\Redis\Db4\PBundlingRedisModel
::
getInstance
();
$pBundlingDao
->
tableDelAll
(
$pBundlingDao
->
tableKeys
(
'*'
.
\Our\NameConst
::
blGoods
.
$goodsCommonId
));
return
$pBundlingDao
->
tableDelAll
(
$pBundlingDao
->
tableKeys
(
'*'
.
\Our\NameConst
::
blGoods
.
$goodsCommonId
));
}
}
/**
/**
...
@@ -267,7 +267,34 @@ class PBundlingModel extends \DAO\AbstractModel {
...
@@ -267,7 +267,34 @@ class PBundlingModel extends \DAO\AbstractModel {
* @param $goodsCommonId
* @param $goodsCommonId
*/
*/
public
function
updatePBundlingByGoodsCommonId
(
$goodsCommonId
){
public
function
updatePBundlingByGoodsCommonId
(
$goodsCommonId
){
$goodsRedis
=
\Redis\Db4\GoodsRedisModel
::
getInstance
();
$onlineStorageGoodsKey
=
\Our\NameConst
::
onlineStorageGoodsPrefix
.
$goodsCommonId
;
$onlineStorageGoods
=
$goodsRedis
->
tableHGAll
(
$onlineStorageGoodsKey
);
$pBundlingRedisDao
=
\Redis\Db4\PBundlingRedisModel
::
getInstance
();
$keys
=
$pBundlingRedisDao
->
tableKeys
(
'*'
.
\Our\NameConst
::
blGoods
.
$goodsCommonId
);
foreach
(
$keys
as
$blIdKey
){
$pBundling
=
$pBundlingRedisDao
->
getNoPrefix
(
$blIdKey
);
if
(
\Our\Common
::
isSerialized
(
$pBundling
)){
$pBundling
=
unserialize
(
$pBundling
);
}
$goodsList
=
$pBundling
[
'goodsList'
];
if
(
$goodsList
){
$newGoods
=
array
();
foreach
(
$goodsList
as
$goods
){
if
(
$goods
[
'goodsCommonId'
]
==
$goodsCommonId
){
$goods
[
'goodsStorage'
]
=
unserialize
(
$onlineStorageGoods
[
$goods
[
'goods_id'
]])[
'goodsStorage'
];
if
(
intval
(
$goods
[
'goodsStorage'
]
/
$goods
[
'num'
])
<
$pBundling
[
'bl_storage'
]){
$pBundling
[
'bl_storage'
]
=
intval
(
$goods
[
'goodsStorage'
]
/
$goods
[
'num'
]);
}
}
$newGoods
[]
=
$goods
;
}
$pBundling
[
'goodsList'
]
=
$newGoods
;
}
$pBundlingRedisDao
->
setNoPrefix
(
$blIdKey
,
serialize
(
$pBundling
),
\Our\ApiConst
::
oneDaySecond
);
}
return
true
;
}
}
public
function
delPBundlingListByStoreIdAndBlIds
(
$storeId
=
false
,
$blId
=
false
){
public
function
delPBundlingListByStoreIdAndBlIds
(
$storeId
=
false
,
$blId
=
false
){
...
...
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