|
|
@@ -400,10 +400,13 @@ class IntraCityController extends BaseController
|
|
|
if (empty($miniOpenId)) {
|
|
|
util::fail('没有找到用户的微信数据');
|
|
|
}
|
|
|
-
|
|
|
+ $weight = $post['weight'] ?? 0;
|
|
|
+ if ($weight <= 0) {
|
|
|
+ util::fail('请填写重量');
|
|
|
+ }
|
|
|
$cargo = [
|
|
|
'cargo_name' => $cargoName,
|
|
|
- 'cargo_weight' => intval($post['weight'] * 1000),
|
|
|
+ 'cargo_weight' => intval($weight * 1000),
|
|
|
'cargo_type' => IntraCityExpress::GOODS_TYPE_FLOWER,
|
|
|
'cargo_num' => intval($packageNum),
|
|
|
'cargo_price' => intval($order['actPrice'] * 100), // $order 中有各个价格,请注意
|
|
|
@@ -414,7 +417,10 @@ class IntraCityController extends BaseController
|
|
|
$mainId = $this->mainId;
|
|
|
$snData = ['shopId' => $shopId, 'mainId' => $mainId];
|
|
|
$storeOrderId = orderSn::getExpressSn($snData);
|
|
|
-
|
|
|
+ $userAddress = $post['user_address'] ?? '';
|
|
|
+ if (empty($userAddress)) {
|
|
|
+ util::fail('地址不能为空');
|
|
|
+ }
|
|
|
$callbackUrl = Yii::$app->params['hdHost'] . '/intra-city/callback';
|
|
|
$orderData = [
|
|
|
'wx_store_id' => $wxStoreId,
|
|
|
@@ -422,7 +428,7 @@ class IntraCityController extends BaseController
|
|
|
'user_openid' => $miniOpenId,
|
|
|
'user_lng' => $post['user_lng'],
|
|
|
'user_lat' => $post['user_lat'],
|
|
|
- 'user_address' => $post['user_address'],
|
|
|
+ 'user_address' => $userAddress,
|
|
|
'user_name' => $post['user_name'],
|
|
|
'user_phone' => $post['user_phone'],
|
|
|
'order_seq' => $order['sendNum'], // 用于配送员快速寻找到匹配的商品(非必传) -- 对应 xhOrder 表的 sendNum
|
|
|
@@ -442,6 +448,7 @@ class IntraCityController extends BaseController
|
|
|
OrderClass::updateById($orderId, ['sendStatus' => -1, 'deliveryId' => $deliveryId, 'sendDistance' => $sendDistance, 'sendType' => 2, 'status' => 3]);
|
|
|
|
|
|
// 保存进 xhExpressOrder 表
|
|
|
+ $fee = $result['fee'] ?? 0;
|
|
|
$orderData = [
|
|
|
'mainId' => $this->mainId,
|
|
|
'shopId' => $this->shopId,
|
|
|
@@ -452,7 +459,7 @@ class IntraCityController extends BaseController
|
|
|
'orderId' => $orderId,
|
|
|
'transOrderId' => $result['trans_order_id'] ?? '',
|
|
|
'distance' => $result['distance'] ?? 0,
|
|
|
- 'fee' => $result['fee'] ?? 0,
|
|
|
+ 'fee' => $fee,
|
|
|
'fetchCode' => $result['fetch_code'] ?? '',
|
|
|
'orderSeq' => $result['order_seq'] ?? '',
|
|
|
'status' => 1,//有订单可以取消
|
|
|
@@ -460,6 +467,10 @@ class IntraCityController extends BaseController
|
|
|
];
|
|
|
ExpressOrderClass::add($orderData);
|
|
|
|
|
|
+ $hdName = $order['hdName'] ?? '';
|
|
|
+ $customName = $order['customName'] ?? '';
|
|
|
+ noticeUtil::push("零售订单,发跑跑腿,获取运费:{$fee} 重量:{$weight} 距离:{$sendDistance} 订单号:{$orderId} 花店:{$hdName} 客户:{$customName} 收货地址:{$userAddress}", '15280215347');
|
|
|
+
|
|
|
util::success(['fee' => $result['fee']], '订单创建成功');
|
|
|
} else {
|
|
|
noticeUtil::push("门店 -- " . $this->mainId . ",订单创建失败:" . json_encode($result));
|