|
|
@@ -12,26 +12,8 @@ use think\facade\Cache;
|
|
|
use think\Model;
|
|
|
use function SixShop\Core\throw_logic_exception;
|
|
|
|
|
|
-class ExtensionWuLiuEntity extends BaseEntity implements LogisticsInterface
|
|
|
+class ExtensionWuLiuEntity extends BaseEntity
|
|
|
{
|
|
|
- public function logisticsInformation(string $number, string $type = ''): LogisticsInformationResponse
|
|
|
- {
|
|
|
- $entity = $this->where('number', $number)->when($type, function (Model $query, $type) {
|
|
|
- $query->where('type', $type);
|
|
|
- })->findOrEmpty();
|
|
|
- if (!$entity->isEmpty() && ($entity->is_sign == 1 || $entity->update_time > time() - 600)) {
|
|
|
- // 已签收或10分钟内更新过,直接返回
|
|
|
- } else {
|
|
|
- $entity = $this->queryLogistics($number, $type, $entity);
|
|
|
- }
|
|
|
- return new LogisticsInformationResponse(
|
|
|
- Extension::EXTENSION_ID,
|
|
|
- $entity->number,
|
|
|
- $entity->type,
|
|
|
- $entity->toArray()
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
public function getWuliuInfo(int $userID, string $no, string $type = ''): array
|
|
|
{
|
|
|
$entity = $this->where('number', $no)->when($type, function (Model $query, $type) {
|
|
|
@@ -52,7 +34,7 @@ class ExtensionWuLiuEntity extends BaseEntity implements LogisticsInterface
|
|
|
return $this->queryLogistics($no, $type, $entity)->toArray();
|
|
|
}
|
|
|
|
|
|
- private function queryLogistics(string $number, string $type, self $entity): self
|
|
|
+ public function queryLogistics(string $number, string $type, self $entity): self
|
|
|
{
|
|
|
$result = WuLiuClient::kdi($number, $type);
|
|
|
$entity->number = $result->number;
|