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
ecc49bdf
Commit
ecc49bdf
authored
Dec 03, 2018
by
christ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dilivery
parent
59d96dd3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
23 deletions
+29
-23
OrderService.php
application/models/Business/Order/OrderService.php
+27
-23
RefundService.php
application/models/Business/Order/RefundService.php
+2
-0
No files found.
application/models/Business/Order/OrderService.php
View file @
ecc49bdf
...
...
@@ -713,8 +713,6 @@ class OrderServiceModel extends \Business\AbstractModel
public
function
changeOrderStatus
()
{
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderConfirmUtilDao
=
OrderConfirmUtil
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$beginTime
=
file_get_contents
(
$this
->
baseDir
.
\Our\PathConst
::
orderCloseWaitRecieveOrder
,
TIMESTAMP
);
$beginTime
=
$beginTime
?
$beginTime
:
ApiConst
::
zero
;
$endTime
=
TIMESTAMP
-
ApiConst
::
orderStateWaitConfirmBeyond
;
...
...
@@ -769,27 +767,7 @@ class OrderServiceModel extends \Business\AbstractModel
}
$orderIds
=
array_column
(
$orders
,
'orderId'
);
//更新商品库存
$orderGoods
=
$orderGoodsDao
->
getOrderGoodsByOrderIds
(
$orderIds
,
$this
->
getGoodsDetailField
());
$storeCartsList
=
array
();
$storeCarts
=
array
();
$storeCarts
[
'storeCarts'
]
=
array
();
foreach
(
$orderGoods
as
$orderGood
){
$orderGood
[
'type'
]
=!
empty
(
$orderGood
[
'goodsGroup'
])
?
\Our\ApiConst
::
addBundingToCart
:
\Our\ApiConst
::
addGoodsToCart
;
$orderGood
[
'goodsNum'
]
=
$orderGood
[
'goodsNum'
];
$orderGood
[
'goodsList'
]
=
\Our\Common
::
isSerialized
(
$orderGood
[
'goodsGroup'
])
?
unserialize
(
$orderGood
[
'goodsGroup'
])
:
array
();
array_push
(
$storeCarts
[
'storeCarts'
],
$orderGood
);
}
if
(
!
empty
(
$storeCarts
[
'storeCarts'
])){
array_push
(
$storeCartsList
,
$storeCarts
);
}
// $orderDao->updateNotRecieveOrders(ApiConst::orderStateWaitConfirm, ApiConst::orderStateClose, 'add_time', ApiConst::orderStateWaitConfirmBeyond, $this->orderMessageField);
try
{
$orderConfirmUtilDao
->
updateGoodsStorage
(
$storeCartsList
,
\Our\ApiConst
::
plus
);
}
catch
(
\Exception
$ex
){
$orderidsStr
=
implode
(
','
,
array_column
(
$orders
,
'orderId'
));
echo
'商品库存更新失败:'
.
$ex
->
getMessage
()
.
$ex
->
getCode
()
.
":"
.
$orderidsStr
;
}
$this
->
updateOrderGoodsStoregeByOrderIds
(
$orderIds
);
//发送消息
$push
=
Push
::
getInstance
();
$push
->
pushOrderCloseMessage
(
$orders
);
...
...
@@ -798,6 +776,32 @@ class OrderServiceModel extends \Business\AbstractModel
file_put_contents
(
$this
->
baseDir
.
\Our\PathConst
::
orderCloseWaitRecieveOrder
,
$endTime
);
}
public
function
updateOrderGoodsStoregeByOrderIds
(
$orderIds
){
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderConfirmUtilDao
=
OrderConfirmUtil
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
//更新商品库存
$orderGoods
=
$orderGoodsDao
->
getOrderGoodsByOrderIds
(
$orderIds
,
$this
->
getGoodsDetailField
());
$storeCartsList
=
array
();
$storeCarts
=
array
();
$storeCarts
[
'storeCarts'
]
=
array
();
foreach
(
$orderGoods
as
$orderGood
){
$orderGood
[
'type'
]
=!
empty
(
$orderGood
[
'goodsGroup'
])
?
\Our\ApiConst
::
addBundingToCart
:
\Our\ApiConst
::
addGoodsToCart
;
$orderGood
[
'goodsNum'
]
=
$orderGood
[
'goodsNum'
];
$orderGood
[
'goodsList'
]
=
\Our\Common
::
isSerialized
(
$orderGood
[
'goodsGroup'
])
?
unserialize
(
$orderGood
[
'goodsGroup'
])
:
array
();
array_push
(
$storeCarts
[
'storeCarts'
],
$orderGood
);
}
if
(
!
empty
(
$storeCarts
[
'storeCarts'
])){
array_push
(
$storeCartsList
,
$storeCarts
);
}
// $orderDao->updateNotRecieveOrders(ApiConst::orderStateWaitConfirm, ApiConst::orderStateClose, 'add_time', ApiConst::orderStateWaitConfirmBeyond, $this->orderMessageField);
try
{
$orderConfirmUtilDao
->
updateGoodsStorage
(
$storeCartsList
,
\Our\ApiConst
::
plus
);
}
catch
(
\Exception
$ex
){
$orderidsStr
=
implode
(
','
,
$orderIds
);
echo
'商品库存更新失败:'
.
$ex
->
getMessage
()
.
$ex
->
getCode
()
.
":"
.
$orderidsStr
;
}
}
//订单任务脚本自动确认收货
public
function
canformRecieveOrder
()
{
...
...
application/models/Business/Order/RefundService.php
View file @
ecc49bdf
...
...
@@ -286,6 +286,8 @@ class RefundServiceModel extends \Business\AbstractModel
if
(
$refund_array
[
'seller_state'
]
==
'2'
&&
!
$isGiveUp
)
{
$refund_array
[
'return_type'
]
=
'2'
;
//退货类型:1为不用退货,2为需要退货
$refund_array
[
'goods_state'
]
=
2
;
$orderService
=
\Business\Order\OrderServiceModel
::
getInstance
();
$orderService
->
updateOrderGoodsStoregeByOrderIds
(
$return
[
'order_id'
]);
}
elseif
(
$refund_array
[
'seller_state'
]
==
'3'
)
{
$refund_array
[
'refund_state'
]
=
'3'
;
//状态:1为处理中,2为待管理员处理,3为已完成
...
...
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