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
6cb49176
Commit
6cb49176
authored
Jan 08, 2019
by
chenchuanwen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lyz_goods_storage' of git.shenbd.com:qm-develop/shenbd into lyz_goods_storage
parents
d828c06a
aae20f62
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
+43
-4
OrderConfirmUtil.php
application/library/Order/OrderConfirmUtil.php
+1
-1
Goods.php
application/models/DAO/Goods.php
+2
-1
PBundling.php
application/models/DAO/PBundling.php
+40
-2
No files found.
application/library/Order/OrderConfirmUtil.php
View file @
6cb49176
...
...
@@ -974,7 +974,7 @@ class OrderConfirmUtil {
$goodsDao
=
\DAO\GoodsModel
::
getInstance
();
if
(
$blGoodsList
){
foreach
(
$blGoodsList
as
$key
=>
$blGoods
){
$pBundlingCacheResult
=
$pBundlingDao
->
opBlGoodsStorage
(
$key
,
$blGoods
[
'blStorage'
],
$op
);
//组合销售库存删减
$pBundlingCacheResult
=
$pBundlingDao
->
updatePBundlingStorageCacheByBlId
(
$key
,
$blGoods
[
'blStorage'
],
$op
);
//组合销售库存删减
if
(
$pBundlingCacheResult
===
false
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
blGoodsStorageToCacheFailedForOrder
);
}
...
...
application/models/DAO/Goods.php
View file @
6cb49176
...
...
@@ -319,7 +319,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
);
}
return
true
;
...
...
application/models/DAO/PBundling.php
View file @
6cb49176
...
...
@@ -192,6 +192,7 @@ class PBundlingModel extends \DAO\AbstractModel {
return
false
;
}
$pBundling
=
$result
[
'result'
];
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$pBundling
),
'/data/log/apptest'
);
$key
=
$result
[
'key'
];
if
(
$op
==
\Our\ApiConst
::
minus
){
$pBundling
[
'bl_storage'
]
=
$pBundling
[
'bl_storage'
]
-
$blStorage
;
...
...
@@ -204,8 +205,10 @@ class PBundlingModel extends \DAO\AbstractModel {
$pBundling
[
'bl_storage'
]
=
$pBundling
[
'bl_storage'
]
+
$blStorage
;
$pBundling
[
'bl_origin_storage'
]
=
$pBundling
[
'bl_origin_storage'
]
+
$blStorage
;
}
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$pBundling
),
'/data/log/apptest'
);
\Lock\RedisLock
::
getInstance
()
->
releaseLock
(
\Our\NameConst
::
pBundlingStorageRedisPrefix
.
$blId
);
return
$pBundlingRedisDao
->
setNoPrefix
(
$key
,
$pBundling
,
\Our\ApiConst
::
oneDaySecond
);
\Our\Log
::
getInstance
()
->
write
(
$key
,
'/data/log/apptest'
);
return
$pBundlingRedisDao
->
setNoPrefix
(
$key
,
serialize
(
$pBundling
),
\Our\ApiConst
::
oneDaySecond
);
}
...
...
@@ -256,7 +259,42 @@ class PBundlingModel extends \DAO\AbstractModel {
public
function
deletePBundlingByGoodsCommonId
(
$goodsCommonId
){
$pBundlingDao
=
\Redis\Db4\PBundlingRedisModel
::
getInstance
();
$pBundlingDao
->
tableDelAll
(
$pBundlingDao
->
tableKeys
(
'*'
.
\Our\NameConst
::
blGoods
.
$goodsCommonId
));
return
$pBundlingDao
->
tableDelAll
(
$pBundlingDao
->
tableKeys
(
'*'
.
\Our\NameConst
::
blGoods
.
$goodsCommonId
));
}
/**
* 根据GoodsCommonIds反向更新组合销售数据
* @param $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
){
...
...
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