|
|
@@ -55,10 +55,40 @@ class ExpressService
|
|
|
*
|
|
|
* 使用微信支付单号
|
|
|
*
|
|
|
+ * @param string $transactionID 微信支付单号
|
|
|
+ * @param string $openid 用户openid
|
|
|
+ * @param array $shippingList 订单发货信息
|
|
|
+ * @param int $logisticsType 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提
|
|
|
+ * @param int $deliveryMode 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY
|
|
|
+ *
|
|
|
* @link https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%B8%80%E3%80%81%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E5%BD%95%E5%85%A5%E6%8E%A5%E5%8F%A3
|
|
|
*/
|
|
|
- public function uploadShippingInfo(string $transactionID): array
|
|
|
+ public function uploadShippingInfo(
|
|
|
+ string $transactionID,
|
|
|
+ string $openid,
|
|
|
+ array $shippingList,
|
|
|
+ int $logisticsType = 1,
|
|
|
+ int $deliveryMode = 1,
|
|
|
+ bool $isAllDelivered = false,
|
|
|
+ ): void
|
|
|
{
|
|
|
-
|
|
|
+ $response = $this->miniApp->getClient()->postJson('/wxa/sec/order/upload_shipping_info', [
|
|
|
+ 'order_key' => [
|
|
|
+ 'order_number_type' => 2, // 使用微信支付单号
|
|
|
+ 'transaction_id' => $transactionID,
|
|
|
+ ],
|
|
|
+ 'logistics_type' => $logisticsType,
|
|
|
+ 'delivery_mode' => $deliveryMode,
|
|
|
+ 'payer' => [
|
|
|
+ 'openid' => $openid,
|
|
|
+ ],
|
|
|
+ 'upload_time' => date('c'),
|
|
|
+ 'shipping_list' => $shippingList,
|
|
|
+ ]);
|
|
|
+ if ($response->isFailed()) {
|
|
|
+ $responseData = $response->toArray();
|
|
|
+ Log::error('发货信息录入失败{transaction_id}{response}', ['transaction_id' => $transactionID, 'response' => json_encode($responseData)]);
|
|
|
+ throw_logic_exception(msg: '发货信息录入失败', code: $responseData['errcode']);
|
|
|
+ }
|
|
|
}
|
|
|
}
|