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
f34b307f
Commit
f34b307f
authored
Dec 29, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
立即购买
parent
00dbaab4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
18 deletions
+29
-18
GroupSaleService.php
application/models/Business/Goods/GroupSaleService.php
+15
-14
Goods.php
application/models/DAO/Goods.php
+10
-2
GoodsCommon.php
application/models/DAO/GoodsCommon.php
+2
-0
GoodsStorage.php
application/models/DAO/Storage/GoodsStorage.php
+2
-2
No files found.
application/models/Business/Goods/GroupSaleService.php
View file @
f34b307f
...
...
@@ -923,7 +923,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
wrongGoodsForBuyNow
);
}
$storeId
=
$goods
[
'store_id'
];
$goodsCommonStorages
=
$goodsDao
->
getOnlineStorageGoodsByGoodsCommonIds
(
array
(
$goods
[
'goods_commonid'
]),
true
);
$goodsCommonStorages
=
$goodsDao
->
getOnlineStorageGoodsByGoodsCommonIds
(
array
(
$goods
[
'goods_commonid'
]));
/*$goodsCommonStorages = $goodsDao->getOnlineStorageGoodsByGoodsCommonIds(array($goods['goods_commonid']),true);*/
$tempObj
[
'goodsId'
]
=
$goods
[
'goods_id'
];
$tempObj
[
'goodsCommonId'
]
=
$goods
[
'goods_commonid'
];
$tempObj
[
'goodsName'
]
=
$goods
[
'goods_name'
];
...
...
@@ -946,34 +947,34 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$goodsCommonIds
[]
=
$goods
[
'goods_commonid'
];
$storeTotalPrice
+=
$tempObj
[
'goodsPrice'
]
*
$tempObj
[
'goodsNum'
];
$storeCouponPrice
=
$storeTotalPrice
;
$oneGoodsCommon
=
$goodsCommonStorages
[
$goods
[
'goods_commonid'
]];
$goodsStorage
=
isset
(
$
oneGoodsCommon
[
$goods
[
'goods_id'
]])
?
$oneGoodsCommon
[
$goods
[
'goods_id'
]]
:
array
();
//
$oneGoodsCommon = $goodsCommonStorages[$goods['goods_commonid']];
$goodsStorage
=
isset
(
$
goodsCommonStorages
[
$goods
[
'goods_commonid'
]][
$goods
[
'goods_id'
]])
?
$goodsCommonStorages
[
$goods
[
'goods_commonid'
]]
[
$goods
[
'goods_id'
]]
:
array
();
$goodsFreight
=
$goodsCommonStorages
[
$goods
[
'goods_commonid'
]]
[
'goods_freight'
];
$goodsFreight
=
$goods
[
'goods_freight'
];
if
(
!
$goodsFreight
){
if
(
$isTransport
){
$isTransport
=
$
oneGoodsCommon
[
'is_transport'
];
$isTransport
=
$
goods
[
'is_transport'
];
}
if
(
$transportId
==
\Our\ApiConst
::
zero
){
$transportId
=
$
oneGoodsCommon
[
'transport_id'
];
$transportId
=
$
goods
[
'transport_id'
];
}
$storeExpressNum
+=
$tempObj
[
'goodsNum'
];
}
if
(
isset
(
$storeGcCouponPriceArray
[
$
oneGoodsCommon
[
'gcId
'
]][
'totalPrice'
])){
$storeGcCouponPriceArray
[
$
oneGoodsCommon
[
'gcId
'
]][
'totalPrice'
]
+=
$tempObj
[
'goodsPrice'
]
*
$tempObj
[
'goodsNum'
];
if
(
isset
(
$storeGcCouponPriceArray
[
$
goods
[
'gc_id_1
'
]][
'totalPrice'
])){
$storeGcCouponPriceArray
[
$
goods
[
'gc_id_1
'
]][
'totalPrice'
]
+=
$tempObj
[
'goodsPrice'
]
*
$tempObj
[
'goodsNum'
];
}
else
{
$storeGcCouponPriceArray
[
$
oneGoodsCommon
[
'gcId
'
]][
'totalPrice'
]
=
$tempObj
[
'goodsPrice'
]
*
$tempObj
[
'goodsNum'
];
$storeGcCouponPriceArray
[
$
goods
[
'gc_id_1
'
]][
'totalPrice'
]
=
$tempObj
[
'goodsPrice'
]
*
$tempObj
[
'goodsNum'
];
}
if
(
isset
(
$storeGoodsCommonCouponPriceArray
[
$tempObj
[
'goodsCommonId'
]][
'totalPrice'
])){
$storeGoodsCommonCouponPriceArray
[
$tempObj
[
'goodsCommonId'
]][
'totalPrice'
]
+=
$tempObj
[
'goodsPrice'
]
*
$tempObj
[
'goodsNum'
];
}
else
{
$storeGoodsCommonCouponPriceArray
[
$tempObj
[
'goodsCommonId'
]][
'totalPrice'
]
=
$tempObj
[
'goodsPrice'
]
*
$tempObj
[
'goodsNum'
];
}
$tempObj
[
'gcId'
]
=
$goods
CommonStorages
[
$goods
[
'goods_commonid'
]][
'gcId
'
];
$tempObj
[
'gc_id'
]
=
$goods
CommonStorages
[
$goods
[
'goods_commonid'
]]
[
'gc_id'
];
$tempObj
[
'gc_id_2'
]
=
$goods
CommonStorages
[
$goods
[
'goods_commonid'
]]
[
'gc_id_2'
];
$tempObj
[
'gc_id_3'
]
=
$goods
CommonStorages
[
$goods
[
'goods_commonid'
]]
[
'gc_id_3'
];
$tempObj
[
'delivery_template_id'
]
=
$goods
CommonStorages
[
$goods
[
'goods_commonid'
]][
'delivery_template_id'
]
?
$goodsCommonStorages
[
$goods
[
'goods_commonid'
]]
[
'delivery_template_id'
]
:
\Our\ApiConst
::
zero
;
$tempObj
[
'gcId'
]
=
$goods
[
'gc_id_1
'
];
$tempObj
[
'gc_id'
]
=
$goods
[
'gc_id'
];
$tempObj
[
'gc_id_2'
]
=
$goods
[
'gc_id_2'
];
$tempObj
[
'gc_id_3'
]
=
$goods
[
'gc_id_3'
];
$tempObj
[
'delivery_template_id'
]
=
$goods
[
'delivery_template_id'
]
?
$goods
[
'delivery_template_id'
]
:
\Our\ApiConst
::
zero
;
$allGcIds
[]
=
$tempObj
[
'gcId'
];
$storeGcIds
[]
=
$tempObj
[
'gcId'
];
if
(
$goodsStorage
[
'onlineFlag'
]
==
\Our\ApiConst
::
one
)
{
...
...
application/models/DAO/Goods.php
View file @
f34b307f
...
...
@@ -119,6 +119,14 @@ class GoodsModel extends \DAO\AbstractModel {
return
$goods
;
}
public
function
getOnelineOneWithStorage
(
$goodsId
,
$field
=
\Our\NameConst
::
allField
){
$goodsInfo
=
$this
->
getOnlineOne
(
$goodsId
,
$field
);
if
(
$goodsInfo
){
}
return
array
();
}
public
function
validAddCartGoods
(
$where
,
$storageFlag
=
false
){
$goods
=
$this
->
getOnlineOne
(
$where
[
'goodsId'
],
$this
->
cartGoodsField
);
if
(
!
$goods
){
...
...
@@ -171,7 +179,7 @@ class GoodsModel extends \DAO\AbstractModel {
* 获取商品是否在售,如果在售还返回对应库存信息
* @param $goodsId
*/
public
function
getOnlineStorageGoods
(
$goodsId
){
/*
public function getOnlineStorageGoods($goodsId){
$goodsRedis = \Redis\Db4\GoodsRedisModel::getInstance();
$onlineStorageGoodsKey = \Our\NameConst::onlineStorageGoodsPrefix.$goodsId;
$onlineStorageGoods = $goodsRedis->tableHGAll($onlineStorageGoodsKey);
...
...
@@ -191,7 +199,7 @@ class GoodsModel extends \DAO\AbstractModel {
$goodsRedis->tableHMGet($onlineStorageGoodsKey,$data,\Our\ApiConst::tenDaySecond);
return $data;
}
}
}
*/
/**
* 更新商品库存缓存以及更新销量
...
...
application/models/DAO/GoodsCommon.php
View file @
f34b307f
...
...
@@ -80,6 +80,8 @@ class GoodsCommonModel extends \DAO\AbstractModel {
return
$saleNum
;
}
/**
* 删除销量缓存
* @param $goodsCommonId
...
...
application/models/DAO/Storage/GoodsStorage.php
100755 → 100644
View file @
f34b307f
...
...
@@ -151,7 +151,7 @@ class GoodsStorageModel extends \DAO\AbstractModel {
* 获取商品是否在售,如果在售还返回对应库存信息
* @param $goodsId
*/
public
function
getOnlineStorageGoods
(
$goodsId
){
/*
public function getOnlineStorageGoods($goodsId){
$goodsRedis = \Redis\Db4\GoodsRedisModel::getInstance();
$onlineStorageGoodsKey = \Our\NameConst::onlineStorageGoodsPrefix.$goodsId;
$onlineStorageGoods = $goodsRedis->tableHGAll($onlineStorageGoodsKey);
...
...
@@ -170,7 +170,7 @@ class GoodsStorageModel extends \DAO\AbstractModel {
$goodsRedis->tableHMGet($onlineStorageGoodsKey,$data,\Our\ApiConst::tenDaySecond);
return $data;
}
}
}
*/
/**
* 更新商品缓存
...
...
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