Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
16dc8515
authored
Nov 21, 2022
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
订单
parent
ecfb1977
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
1 deletions
app/Admin/Controllers/Api/OrderApiController.php
app/Admin/Service/OrderService.php
app/Models/Order.php
app/Models/OrderPrice.php
resources/lang/en/order.php
app/Admin/Controllers/Api/OrderApiController.php
View file @
16dc8515
...
...
@@ -190,6 +190,7 @@ class OrderApiController extends BaseController
public
function
editOrderSettlement
(
Request
$request
){
$reqParams
=
$request
->
all
();
OrderService
::
editOrderSettlement
(
$reqParams
);
return
$this
->
setSuccess
();
}
...
...
app/Admin/Service/OrderService.php
View file @
16dc8515
...
...
@@ -257,13 +257,31 @@ class OrderService extends BaseService
}
//修改订单结算信息
public
static
function
editOrderSettlement
(
$reqParams
){
$orderId
=
arrayGet
(
$reqParams
,
"order_id"
,
0
,
"intval"
);
$freightCharge
=
arrayGet
(
$reqParams
,
"freight_charge"
,
0
,
"floatval"
);
//运费
$payCommission
=
arrayGet
(
$reqParams
,
"pay_commission"
,
0
,
"floatval"
);
//支付手续费
$orderUserPayType
=
arrayGet
(
$reqParams
,
"order_user_pay_type"
,
0
,
"intval"
);
//支付方式
(
new
self
)
->
startTransaction
();
try
{
$orderInfo
=
Order
::
getOne
(
$orderId
);
if
(
empty
(
$orderInfo
)){
throw
new
InvalidRequestException
(
admin_trans
(
"order.return_msg.50005"
));
}
OrderPrice
::
editOrderSettlement
(
$orderId
,
$orderInfo
[
"order_sn"
],
$freightCharge
,
$payCommission
);
Order
::
updateOrder
([
"order_id"
=>
$orderId
],[
"order_user_pay_type"
=>
$orderUserPayType
,
"update_time"
=>
time
(),
]);
}
catch
(
\Throwable
$e
){
(
new
self
)
->
rollBackTransaction
();
throw
new
InvalidRequestException
(
sprintf
(
"%s:%s"
,
admin_trans
(
"order.return_msg.50004"
),
$e
->
getMessage
()));
}
(
new
self
)
->
commitTransaction
();
}
}
app/Models/Order.php
View file @
16dc8515
...
...
@@ -127,4 +127,6 @@ class Order extends Model
}
}
app/Models/OrderPrice.php
View file @
16dc8515
...
...
@@ -35,4 +35,33 @@ class OrderPrice extends Model
"支付手续费"
=>
5
,
];
//新增或者修改订单的 运费 支付手续费
public
static
function
editOrderSettlement
(
$orderId
,
$orderSn
,
$freightCharge
,
$payCommission
){
if
(
$freightCharge
){
self
::
updateOrCreate
([
"order_id"
=>
$orderId
,
"price_type"
=>
self
::
$PRICE_TYPE_LIST
[
"运费"
],
],[
"order_sn"
=>
$orderSn
,
"price"
=>
decimal_number_format
(
$freightCharge
),
"currency"
=>
2
,
"create_time"
=>
time
(),
]);
}
if
(
$payCommission
){
self
::
updateOrCreate
([
"order_id"
=>
$orderId
,
"price_type"
=>
self
::
$PRICE_TYPE_LIST
[
"支付手续费"
],
],[
"order_sn"
=>
$orderSn
,
"price"
=>
decimal_number_format
(
$payCommission
),
"currency"
=>
2
,
"create_time"
=>
time
(),
]);
}
}
}
resources/lang/en/order.php
View file @
16dc8515
...
...
@@ -28,6 +28,8 @@ return [
"50001"
=>
"只能修改不是待审核的订单状态"
,
"50002"
=>
"取消订单失败"
,
"50003"
=>
"修改订单失败"
,
"50004"
=>
"修改结算信息失败"
,
"50005"
=>
"没找到订单相关数据"
,
],
"validator"
=>
[
'order_id_required'
=>
'订单id必填'
,
...
...
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