<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Express\Provider; use Illuminate\Support\Facades\Cache; use ModStart\Core\Input\Response; use Module\Vendor\Provider\ProviderTrait; class ExpressTransportProvider { use ProviderTrait; public static function all() { return self::listAll(); } public static function get($zO6V5) { return self::getByName($zO6V5); } public static function first() { foreach (self::all() as $tDnAb) { return $tDnAb; } return null; } public static function query($EkpRH, $Lxm1k, $I2nM5 = null, $w6bW5 = array()) { goto zgOOx; jqEwQ: $avcnU = array(); goto sz0Oj; oV0UQ: $avcnU['content'] = array('list' => $rhLXE['data']['list']); goto OtKWa; sz0Oj: $avcnU['status'] = intval($rhLXE['data']['status']); goto oV0UQ; zgOOx: $tDnAb = self::first(); goto NrIPH; EhTVJ: $rhLXE = $tDnAb->queryTransportDetail($EkpRH, $Lxm1k, $I2nM5, $w6bW5); goto QA5Yp; OtKWa: return Response::generateSuccessData($avcnU); goto adYIo; NrIPH: if (!$tDnAb) { return Response::generateError('快递查询服务暂不可用'); } goto EhTVJ; QA5Yp: if (Response::isError($rhLXE)) { return Response::generateError('快递查询服务出错：' . $rhLXE['msg']); } goto jqEwQ; adYIo: } public static function queryTransportDetailCached($HWA34, $tmz5M, $I2nM5 = null, $w6bW5 = array(), $n_e_3 = 60) { return Cache::remember('ExpressTransport:' . $HWA34 . ':' . $tmz5M, $n_e_3, function () use($HWA34, $tmz5M, $I2nM5, $w6bW5) { $AzbSd = array('status' => '', 'list' => array()); $tDnAb = self::first(); if ($tDnAb) { $rhLXE = $tDnAb->queryTransportDetail($HWA34, $tmz5M, $I2nM5, $w6bW5); if (Response::isSuccess($rhLXE)) { $AzbSd['status'] = $rhLXE['data']['status']; $AzbSd['list'] = $rhLXE['data']['list']; } } return $AzbSd; }); } }