|
|
@@ -373,8 +373,10 @@ class IntraCityController extends BaseController
|
|
|
if ($result['errcode'] === 0) {
|
|
|
util::success($result, "查询成功");
|
|
|
} else {
|
|
|
- Yii::error("运费查询失败:" . json_encode($result));
|
|
|
- util::fail('查询失败');
|
|
|
+ $errMsg = $result['errmsg'] ?? '';
|
|
|
+ $errCode = $result['errcode'] ?? '';
|
|
|
+ noticeUtil::push("运费查询失败了:" . $errMsg . ",编号:" . $errCode, '15280215347');
|
|
|
+ util::fail('查询失败,编号8911');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -390,11 +392,11 @@ class IntraCityController extends BaseController
|
|
|
util::checkRepeatCommit($adminId, 4);
|
|
|
|
|
|
$orderId = intval($post['orderId']);
|
|
|
- $order = OrderClass::getById($orderId);
|
|
|
+ $order = OrderClass::getById($orderId, true);
|
|
|
if (empty($order)) {
|
|
|
util::fail('没有找到订单');
|
|
|
}
|
|
|
- if ($order['mainId'] != $this->mainId) {
|
|
|
+ if ($order->mainId != $this->mainId) {
|
|
|
util::fail('不是你的订单');
|
|
|
}
|
|
|
$packageNum = $post['packageNum'] ?? 0;
|
|
|
@@ -405,22 +407,26 @@ class IntraCityController extends BaseController
|
|
|
if ($weight <= 0) {
|
|
|
util::fail('请填写重量');
|
|
|
}
|
|
|
- $actPrice = $order['actPrice'] ?? 0;
|
|
|
+ $actPrice = $order->actPrice ?? 0;
|
|
|
if ($actPrice <= 0) {
|
|
|
util::fail('订单没有价格,不能发跑腿');
|
|
|
}
|
|
|
- if ($order['status'] != 2) {
|
|
|
+ if ($order->status != 2) {
|
|
|
util::fail('待发货订单才能发跑腿,请刷新页面');
|
|
|
}
|
|
|
// 不能创建配送的几种配送状态
|
|
|
$notCanCreateSendStatus = [-1, 3];
|
|
|
- if (!in_array($order['sendStatus'], $notCanCreateSendStatus)) {
|
|
|
+ if (!in_array($order->sendStatus, $notCanCreateSendStatus)) {
|
|
|
util::fail('不能叫跑腿,请刷新页面');
|
|
|
}
|
|
|
-
|
|
|
- $sn = $order['orderSn'];
|
|
|
+ $cgId = $order->purchaseId ?? 0;
|
|
|
+ $cgInfo = PurchaseClass::getById($cgId, true);
|
|
|
+ if (empty($cgInfo)) {
|
|
|
+ util::fail('没有采购信息');
|
|
|
+ }
|
|
|
+ $sn = $order->orderSn;
|
|
|
$itemInfo = OrderItemClass::getByCondition(['orderSn' => $sn], null, 'id, name, cover, num');
|
|
|
- $num = intval($order['itemNum']);
|
|
|
+ $num = intval($order->itemNum);
|
|
|
$itemList[] = [
|
|
|
'item_name' => '花材',
|
|
|
'item_pic_url' => imgUtil::groupImg($itemInfo['cover']) . "?x-oss-process=image/resize,m_fill,h_130,w_130",
|
|
|
@@ -433,13 +439,13 @@ class IntraCityController extends BaseController
|
|
|
util::fail('你还没有开通跑腿功能');
|
|
|
}
|
|
|
|
|
|
- $cgId = $order['purchaseId'] ?? 0;
|
|
|
+ $cgId = $order->purchaseId ?? 0;
|
|
|
if (empty($cgId)) {
|
|
|
util::fail('没有找到采购信息');
|
|
|
}
|
|
|
|
|
|
$miniOpenId = '';
|
|
|
- $customShopAdminId = $order['customShopAdminId'] ?? 0;
|
|
|
+ $customShopAdminId = $order->customShopAdminId ?? 0;
|
|
|
if (!empty($customShopAdminId)) {
|
|
|
$customStaff = StaffClass::getById($customShopAdminId, true);
|
|
|
$customStaffAdminId = $customStaff->adminId ?? '';
|
|
|
@@ -471,17 +477,17 @@ class IntraCityController extends BaseController
|
|
|
$snData = ['shopId' => $shopId, 'mainId' => $mainId];
|
|
|
$storeOrderId = orderSn::getGhsExpressSn($snData);
|
|
|
|
|
|
- $sendNum = $order['sendNum'] ?? '';
|
|
|
- $customName = $order['customName'] ?? '';
|
|
|
+ $sendNum = $order->sendNum ?? '';
|
|
|
+ $customName = $order->customName ?? '';
|
|
|
if (empty($customName)) {
|
|
|
util::fail('客户名称无效');
|
|
|
}
|
|
|
- $customMobile = $order['customMobile'] ?? '';
|
|
|
+ $customMobile = $order->customMobile ?? '';
|
|
|
if (empty($customMobile)) {
|
|
|
util::fail('客户手机号无效');
|
|
|
}
|
|
|
- $long = $order['long'] ?? '';
|
|
|
- $lat = $order['lat'] ?? '';
|
|
|
+ $long = $order->long ?? '';
|
|
|
+ $lat = $order->lat ?? '';
|
|
|
if (empty($long) || empty($lat)) {
|
|
|
util::fail('客户地址无效');
|
|
|
}
|
|
|
@@ -527,13 +533,17 @@ class IntraCityController extends BaseController
|
|
|
'orderSeq' => $result['order_seq'] ?? ''
|
|
|
];
|
|
|
GhsExpressOrderClass::add($data);
|
|
|
- $updateData = [
|
|
|
- 'sendDistance' => $data['distance'],
|
|
|
- 'sendStatus' => 0,
|
|
|
- 'deliveryId' => $data['deliveryId'],
|
|
|
- ];
|
|
|
- //更新订单状态为配送中
|
|
|
- OrderClass::updateById($orderId, $updateData);
|
|
|
+ $sendDistance = $data['distance'] ?? 0;
|
|
|
+ $deliveryId = $data['deliveryId'] ?? '';
|
|
|
+ //更新订单配送状态
|
|
|
+ $order->sendDistance = $sendDistance;
|
|
|
+ $order->sendStatus = 0;
|
|
|
+ $order->deliveryId = $deliveryId;
|
|
|
+ $order->save();
|
|
|
+ $cgInfo->sendDistance = $sendDistance;
|
|
|
+ $cgInfo->sendStatus = 0;
|
|
|
+ $cgInfo->deliveryId = $deliveryId;
|
|
|
+ $cgInfo->save();
|
|
|
util::success(['fee' => $data['fee']], '订单创建成功');
|
|
|
} else {
|
|
|
noticeUtil::push("批发 -- " . $this->mainId . ",订单创建失败:" . json_encode($result));
|