|
|
@@ -6,6 +6,7 @@ use bizGhs\base\classes\BaseClass;
|
|
|
use bizGhs\order\classes\OrderClass;
|
|
|
use common\components\delivery\services\DispatchService;
|
|
|
use common\components\dict;
|
|
|
+use common\components\push;
|
|
|
use mikemadisonweb\rabbitmq\components\ConsumerInterface;
|
|
|
use common\components\noticeUtil;
|
|
|
use Yii;
|
|
|
@@ -18,6 +19,7 @@ class GhsDeliveryOrderClass extends BaseClass
|
|
|
public static function payAfter($order)
|
|
|
{
|
|
|
$orderId = $order->id;
|
|
|
+ $shopId = $order->shopId;
|
|
|
try {
|
|
|
noticeUtil::push('批发,付款成功之后要发跑腿的订单:' . $orderId, '15280215347');
|
|
|
$cacheKey = 'ghs_pt_cacheData:' . $orderId;
|
|
|
@@ -27,7 +29,7 @@ class GhsDeliveryOrderClass extends BaseClass
|
|
|
|
|
|
$data = [
|
|
|
'orderId' => $orderId,
|
|
|
- 'shopId' => $order->shopId,
|
|
|
+ 'shopId' => $shopId,
|
|
|
'mainId' => $order->mainId,
|
|
|
'platform' => $cachedData['deliveryPlatform'],
|
|
|
'ip' => '127.0.0.1',
|
|
|
@@ -36,15 +38,22 @@ class GhsDeliveryOrderClass extends BaseClass
|
|
|
'deliveryBracketContent' => $cachedData['deliveryBracketContent'],
|
|
|
'pickupTime' => $cachedData['pickupTime'],
|
|
|
'allParams' => $cachedData['deliveryAllParams'],
|
|
|
+ // ----------
|
|
|
'weight' => $cachedData['weight'] ?? 1,
|
|
|
'remark' => $cachedData['deliveryRemark'] ?? '',
|
|
|
'price' => $order->actPrice,
|
|
|
+ 'consumerType' => '扫码付款'
|
|
|
];
|
|
|
self::askCreateOrder($data);
|
|
|
} else {
|
|
|
noticeUtil::push("批发-缓存数据不存在或已过期,cacheKey:{$cacheKey}");
|
|
|
// 发送 app 通知
|
|
|
-
|
|
|
+ $title = '发跑腿失败';
|
|
|
+ $msg = "批发-缓存数据不存在或已过期,cacheKey:{$cacheKey}";
|
|
|
+ $allDevices = \bizGhs\device\classes\GhsDeviceClass::getAllByCondition(['shopId' => $shopId]);
|
|
|
+ $cids = array_column($allDevices, 'clientId');
|
|
|
+ $push = new push('ghs', push::MSG_TYPE_WORK);
|
|
|
+ $push->pushByCloud($cids, $title, $msg, []);
|
|
|
return;
|
|
|
}
|
|
|
} catch (\Exception $e) {
|
|
|
@@ -104,6 +113,7 @@ class GhsDeliveryOrderClass extends BaseClass
|
|
|
'weight' => $post['weight'] ?? 1,
|
|
|
'remark' => $post['deliveryRemark'] ?? '',
|
|
|
'price' => $order->actPrice,
|
|
|
+ 'consumerType' => '已付款'
|
|
|
];
|
|
|
self::askCreateOrder($data);
|
|
|
}
|
|
|
@@ -253,6 +263,15 @@ class GhsDeliveryOrderClass extends BaseClass
|
|
|
} catch (\Exception $e) {
|
|
|
Yii::error("ghs-orderId={$orderId}, 创建跑腿失败:" . $e->getMessage());
|
|
|
noticeUtil::push("ghs-orderId={$orderId}, 创建跑腿失败:" . $e->getMessage());
|
|
|
+
|
|
|
+ // 发 App 通知
|
|
|
+ $title = '发跑腿失败';
|
|
|
+ $msg = "批发订单:{$orderId}, 创建跑腿失败:" . $e->getMessage();
|
|
|
+ $allDevices = \bizGhs\device\classes\GhsDeviceClass::getAllByCondition(['shopId' => $shopId]);
|
|
|
+ $cids = array_column($allDevices, 'clientId');
|
|
|
+ $push = new push('ghs', push::MSG_TYPE_WORK);
|
|
|
+ $push->pushByCloud($cids, $title, $msg, []);
|
|
|
+
|
|
|
return ConsumerInterface::MSG_REJECT;
|
|
|
}
|
|
|
}
|