| xqd
@@ -135,21 +135,25 @@ class ByteDance extends BaseUniPlatform
|
|
|
'access_token' => $this->accessToken,
|
|
|
'open_id' => $openid,
|
|
|
'order_type' => 0, // 0:普通小程序订单(非 POI 订单),
|
|
|
- 'order_detail' => [
|
|
|
+ 'order_status' => 1,
|
|
|
+ 'app_name' => 'douyin',
|
|
|
+ 'update_time' => (int)Carbon::now()->getPreciseTimestamp(3),
|
|
|
+ 'order_detail' => json_encode([
|
|
|
'order_id' => $orderId,
|
|
|
'create_time' => (int)Carbon::now()->getPreciseTimestamp(3),
|
|
|
'status' => $status, // 已支付 待支付
|
|
|
'amount' => 1,
|
|
|
- 'total_price' => '',
|
|
|
+ 'total_price' => $goods['price'] * 100,
|
|
|
'detail_url' => 'pages/my/consume',
|
|
|
'item_list' => [
|
|
|
- 'item_code' => $goods['id'], // 商品ID,
|
|
|
- 'img' => $goods['img'],
|
|
|
- 'title' => $goods['title'],
|
|
|
- 'price' => $goods['price'],
|
|
|
+ [
|
|
|
+ 'item_code' => (string)$goods['id'], // 商品ID,
|
|
|
+ 'img' => 'https://zhengda.oss-cn-chengdu.aliyuncs.com/zhangsiye/images/26474488be1b83e2fcb0b9475508a9bb.png',
|
|
|
+ 'title' => $goods['title'],
|
|
|
+ 'price' => $goods['price'] * 100,
|
|
|
+ ]
|
|
|
]
|
|
|
- ],
|
|
|
- 'update_time' => (int)Carbon::now()->getPreciseTimestamp(3)
|
|
|
+ ],JSON_UNESCAPED_UNICODE),
|
|
|
];
|
|
|
return $this->post($this->API::ORDER_PUSH, $data);
|
|
|
}
|
| xqd
@@ -186,13 +190,18 @@ class ByteDance extends BaseUniPlatform
|
|
|
'headers' => ['Content-Type' => 'application/json'],
|
|
|
'body' => json_encode($data)
|
|
|
]);
|
|
|
+
|
|
|
$stringBody = (string)$res->getBody();
|
|
|
$res = json_decode($stringBody, true);
|
|
|
|
|
|
- if(!empty($res['err_no'])){
|
|
|
+ if(isset($res['err_no']) && !empty($res['err_no'])){
|
|
|
throw new \Exception("请求字节跳动API接口错误,错误码:{$res['err_no']},错误信息:{$res['err_tips']}");
|
|
|
}
|
|
|
- return $res['data'];
|
|
|
+
|
|
|
+ if(isset($res['err_code']) && !empty($res['err_code'])){
|
|
|
+ throw new \Exception("请求字节跳动API接口错误,错误码:{$res['err_msg']},错误信息:{$res['err_msg']}");
|
|
|
+ }
|
|
|
+ return $res['data']?? [];
|
|
|
} catch (GuzzleException $e) {
|
|
|
\Log::error($e->getMessage());
|
|
|
throw new \Exception($e->getMessage());
|