1、文件:app/controller/kefu/Order.php
按照下图(修改后截图)增加参数:

2、文件:app/services/order/StoreOrderServices.php
增加参数: string $type = 'admin'增加一行代码:$f[] = Form::hidden('type', $type);
3、文件:app/common/controller/Order.php
找到方法:update,替换成下面代码
public function update($id)
{
if (!$id) return app('json')->fail('Missing order ID');
$type = $this->request->param('type', 'admin');
if ($type == 'admin') {
$data = $this->request->postMore([
['gain_integral', 0],//赠送积分
['is_postage', 0],//是否包邮
['cart_info', []],//商品改价数组[['id' => 1, 'true_price' => 11.00],['id' => 2, 'true_price' => 11.00]]
]);
if ($data['cart_info']) {
foreach ($data['cart_info'] as $cart) {
if (!isset($cart['id']) || !$cart['id'] || !isset($cart['true_price'])) {
return app('json')->fail('请选择需要改价的商品进行操作');
}
}
}
$this->services->setItem('change_manager_type', 'admin')->setItem('change_manager_id', $this->request->adminId());
} else {//客服
$data = $this->request->postMore([
['order_id', ''],
['total_price', 0],
['total_postage', 0],
['pay_price', 0],
['pay_postage', 0],
['gain_integral', 0],
]);
validate(StoreOrderValidate::class)->check($data);
if ($data['total_price'] < 0) {
return $this->fail('Please enter the total price');
}
if ($data['pay_price'] < 0) {
return $this->fail('Please enter the actual payment amount');
}
$this->services->setItem('change_manager_type', 'kefu')->setItem('change_manager_id', $this->request->kefuInfo()['uid'] ?? 0);
}
$this->services->updateOrder((int)$id, $data);
$this->services->reset();
return app('json')->success('Modified success');
}4、重启swoole,重新改价操作试试

