|
@@ -41,17 +41,19 @@ trait MiniAppTrait
|
|
|
* @param string $expressCompany 物流公司编码
|
|
* @param string $expressCompany 物流公司编码
|
|
|
* @param string $receiverContact 收件人联系方式
|
|
* @param string $receiverContact 收件人联系方式
|
|
|
* @param bool $failException 是否抛出异常
|
|
* @param bool $failException 是否抛出异常
|
|
|
|
|
+ * @param int $logisticsType 1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提
|
|
|
*
|
|
*
|
|
|
* @see 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
|
|
* @see 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
|
|
|
*/
|
|
*/
|
|
|
private function uploadShippingInfo(
|
|
private function uploadShippingInfo(
|
|
|
string $outTradeNo,
|
|
string $outTradeNo,
|
|
|
int $userID,
|
|
int $userID,
|
|
|
- string $itemDesc,
|
|
|
|
|
- string $trackingNo,
|
|
|
|
|
- string $expressCompany,
|
|
|
|
|
- string $receiverContact,
|
|
|
|
|
- bool $failException = true
|
|
|
|
|
|
|
+ string $itemDesc = '',
|
|
|
|
|
+ string $trackingNo = '',
|
|
|
|
|
+ string $expressCompany = '',
|
|
|
|
|
+ string $receiverContact = '',
|
|
|
|
|
+ int $logisticsType = 1,
|
|
|
|
|
+ bool $failException = true,
|
|
|
): array
|
|
): array
|
|
|
{
|
|
{
|
|
|
$data = [
|
|
$data = [
|
|
@@ -60,9 +62,15 @@ trait MiniAppTrait
|
|
|
'mchid' => WechatPayBuilder::getConfig()->mchid,
|
|
'mchid' => WechatPayBuilder::getConfig()->mchid,
|
|
|
'out_trade_no' => $outTradeNo,
|
|
'out_trade_no' => $outTradeNo,
|
|
|
],
|
|
],
|
|
|
- 'logistics_type' => 1, // 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提
|
|
|
|
|
|
|
+ 'logistics_type' => $logisticsType, // 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提
|
|
|
'delivery_mode' => 1, // 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY
|
|
'delivery_mode' => 1, // 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY
|
|
|
- 'shipping_list' => [
|
|
|
|
|
|
|
+ 'upload_time' => date('c'), // 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00`
|
|
|
|
|
+ 'payer' => [
|
|
|
|
|
+ 'openid' => WechatUser::openid($userID), // 用户标识,用户在小程序appid下的唯一标识
|
|
|
|
|
+ ]
|
|
|
|
|
+ ];
|
|
|
|
|
+ if ($logisticsType == 1) {
|
|
|
|
|
+ $data['shipping_list'] = [
|
|
|
[
|
|
[
|
|
|
'tracking_no' => $trackingNo, // 物流单号
|
|
'tracking_no' => $trackingNo, // 物流单号
|
|
|
'express_company' => $expressCompany, // 物流公司编码,快递公司ID
|
|
'express_company' => $expressCompany, // 物流公司编码,快递公司ID
|
|
@@ -71,12 +79,8 @@ trait MiniAppTrait
|
|
|
'receiver_contact' => substr_replace($receiverContact, '****', -8, 4), // 收件人联系方式
|
|
'receiver_contact' => substr_replace($receiverContact, '****', -8, 4), // 收件人联系方式
|
|
|
],
|
|
],
|
|
|
],
|
|
],
|
|
|
- ],
|
|
|
|
|
- 'upload_time' => date('c'), // 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00`
|
|
|
|
|
- 'payer' => [
|
|
|
|
|
- 'openid' => WechatUser::openid($userID), // 用户标识,用户在小程序appid下的唯一标识
|
|
|
|
|
- ]
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
$response = WechatPayBuilder::getMiniApp()->getClient()->postJson('wxa/sec/order/upload_shipping_info', $data);
|
|
$response = WechatPayBuilder::getMiniApp()->getClient()->postJson('wxa/sec/order/upload_shipping_info', $data);
|
|
|
$result = $response->getContent();
|
|
$result = $response->getContent();
|
|
|
$result = json_decode($result, true);
|
|
$result = json_decode($result, true);
|