处理订单自动发货的错误

This commit is contained in:
luofei 2024-03-04 17:28:48 +08:00
parent 8b6f0d7c04
commit 6999d00e07
2 changed files with 14 additions and 3 deletions

View File

@ -1344,6 +1344,7 @@ class StoreOrderRepository extends BaseRepository
if ($order['is_virtual'] && $data['delivery_type'] != 3)
throw new ValidateException('虚拟商品只能虚拟发货');
//订单记录
/** @var StoreOrderStatusRepository $statusRepository */
$statusRepository = app()->make(StoreOrderStatusRepository::class);
switch ($data['delivery_type']) {
case 1:
@ -1385,6 +1386,8 @@ class StoreOrderRepository extends BaseRepository
'change_message' => $change_message,
'change_type' => $change_type,
];
$statusRepository->adminId = $order['mer_id'];
$statusRepository->adminNickname = $order->merchant['nickname'];
if ($service_id) {
$statusRepository->createServiceLog($service_id, $orderStatus);
} else {

View File

@ -100,6 +100,8 @@ class StoreOrderStatusRepository extends BaseRepository
const ORDER_DELIVERY_CITY_REFUND = 'delivery_5_10';
const ORDER_DELIVERY_CITY_REFUNDING = 'delivery_5_9';
public $adminId;
public $adminNickname;
/**
* StoreOrderStatusRepository constructor.
@ -134,9 +136,15 @@ class StoreOrderStatusRepository extends BaseRepository
public function createAdminLog(array $data)
{
$request = request();
$data['user_type'] = $request->userType();
$data['uid'] = $data['user_type'] == 1 ? $request->uid() : $request->adminId();
$data['nickname'] = $data['user_type'] == 1 ? $request->userInfo()->real_name : $request->adminInfo()->real_name;
if ($request->hasMacro('userType')) {
$data['user_type'] = $request->userType();
$data['uid'] = $data['user_type'] == 1 ? $request->uid() : $request->adminId();
$data['nickname'] = $data['user_type'] == 1 ? $request->userInfo()->real_name : $request->adminInfo()->real_name;
} else {
$data['user_type'] = 3;
$data['uid'] = $this->adminId;
$data['nickname'] = $this->adminNickname;
}
return $this->dao->create($data);
}