|
|
@@ -5,6 +5,7 @@ namespace SixShop\WechatPay\Trait;
|
|
|
use SixShop\Wechat\Facade\WechatUser;
|
|
|
use SixShop\WechatPay\Facade\WechatPayBuilder;
|
|
|
use think\facade\Log;
|
|
|
+use function SixShop\Core\throw_logic_exception;
|
|
|
|
|
|
trait MiniAppTrait
|
|
|
{
|
|
|
@@ -53,7 +54,7 @@ trait MiniAppTrait
|
|
|
string $trackingNo = '',
|
|
|
string $expressCompany = '',
|
|
|
string $receiverContact = '',
|
|
|
- int $logisticsType = 1,
|
|
|
+ int $logisticsType = 1,
|
|
|
bool $failException = true,
|
|
|
): array
|
|
|
{
|
|
|
@@ -104,11 +105,11 @@ trait MiniAppTrait
|
|
|
* @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_search.html
|
|
|
*/
|
|
|
private function waybillToken(
|
|
|
- int $userID,
|
|
|
+ int $userID,
|
|
|
string $receiverPhone,
|
|
|
string $waybillID,
|
|
|
string $deliveryID,
|
|
|
- array $detailList,
|
|
|
+ array $detailList,
|
|
|
bool $failException = true
|
|
|
): array
|
|
|
{
|
|
|
@@ -126,7 +127,9 @@ trait MiniAppTrait
|
|
|
$response = WechatPayBuilder::getMiniApp()->getClient()->postJson('cgi-bin/express/delivery/open_msg/trace_waybill', $data);
|
|
|
$result = $response->getContent();
|
|
|
$result = json_decode($result, true);
|
|
|
- if ($result['errcode'] !== 0) {
|
|
|
+ if ($result['errcode'] == 931023) {
|
|
|
+ throw_logic_exception("运单不存在:".$waybillID);
|
|
|
+ } else if ($result['errcode'] !== 0) {
|
|
|
Log::error('获取运单token失败{errcode}:{errmsg}:' . json_encode($data), $result);
|
|
|
$failException && throw new \RuntimeException($result['errmsg'], $result['errcode']);
|
|
|
}
|