|
@@ -4,6 +4,8 @@ namespace SixShop\Wechat\Service;
|
|
|
|
|
|
|
|
use SixShop\Wechat\Entity\WechatDeliveryEntity;
|
|
use SixShop\Wechat\Entity\WechatDeliveryEntity;
|
|
|
use think\Collection;
|
|
use think\Collection;
|
|
|
|
|
+use think\facade\Log;
|
|
|
|
|
+use function SixShop\Core\throw_logic_exception;
|
|
|
|
|
|
|
|
class ExpressService
|
|
class ExpressService
|
|
|
{
|
|
{
|
|
@@ -19,9 +21,38 @@ class ExpressService
|
|
|
$result = $this->wechatDeliveryEntity->select();
|
|
$result = $this->wechatDeliveryEntity->select();
|
|
|
if ($result->isEmpty()) {
|
|
if ($result->isEmpty()) {
|
|
|
$response = $this->miniApp->getClient()->get('/cgi-bin/express/business/delivery/getall');
|
|
$response = $this->miniApp->getClient()->get('/cgi-bin/express/business/delivery/getall');
|
|
|
|
|
+ if ($response->isFailed()) {
|
|
|
|
|
+ Log::error('获取所有快递公司失败'.json_encode($response->toArray()));
|
|
|
|
|
+ throw_logic_exception('获取所有快递公司失败');
|
|
|
|
|
+ }
|
|
|
$result = $response->toArray();
|
|
$result = $response->toArray();
|
|
|
$result = $this->wechatDeliveryEntity->saveAll($result['data']);
|
|
$result = $this->wechatDeliveryEntity->saveAll($result['data']);
|
|
|
}
|
|
}
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询订单发货状态
|
|
|
|
|
+ */
|
|
|
|
|
+ public function queryOrder(string $transactionID): array
|
|
|
|
|
+ {
|
|
|
|
|
+ $response = $this->miniApp->getClient()->postJson('/wxa/sec/order/get_order', [
|
|
|
|
|
+ 'transaction_id' => $transactionID,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ if ($response->isFailed()) {
|
|
|
|
|
+ Log::error('查询订单发货状态失败'.json_encode($response->toArray()));
|
|
|
|
|
+ throw_logic_exception('查询订单发货状态失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ return $response->toArray()['order'];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 发货信息录入
|
|
|
|
|
+ *
|
|
|
|
|
+ * 使用微信支付单号
|
|
|
|
|
+ */
|
|
|
|
|
+ public function uploadShippingInfo(string $transactionID): array
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|