...
|
...
|
@@ -2,6 +2,8 @@ |
|
|
|
|
|
namespace Home;
|
|
|
|
|
|
use Configs\CacheConfig;
|
|
|
use LibModels\Wap\Home\IndexData;
|
|
|
use LibModels\Wap\Home\OrderData;
|
|
|
use Plugin\Helpers;
|
|
|
|
...
|
...
|
@@ -14,6 +16,7 @@ class OrderModel |
|
|
|
|
|
const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码
|
|
|
const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码
|
|
|
const CODE_LOGISTIC_BANNER = '1fc9b2484fcd559049f2f7e0db313f20'; // 物流详情banner资源码
|
|
|
|
|
|
/**
|
|
|
* 订单相关数据处理
|
...
|
...
|
@@ -99,23 +102,80 @@ class OrderModel |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if (isset($orderCode) && is_numeric($uid)) {
|
|
|
do {
|
|
|
if (!isset($orderCode) || !is_numeric($uid)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$logistics = OrderData::LogisticsData($orderCode, $uid);
|
|
|
if (!empty($logistics['data'])) {
|
|
|
$result['logisticUrl'] = $logistics['data']['url'];
|
|
|
$result['logisticImg'] = $logistics['data']['logo'];
|
|
|
$result['logisticCompany'] = $logistics['data']['caption'];
|
|
|
$result['logisticNumber'] = $logistics['data']['express_number'];
|
|
|
|
|
|
$build = array();
|
|
|
foreach ($logistics['data']['express_detail'] as $value) {
|
|
|
$build['status'] = $value['accept_address'];
|
|
|
$build['date'] = $value['acceptTime'];
|
|
|
$result['logisticDetail'][] = $build;
|
|
|
if (empty($logistics['data'])) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$result['logisticUrl'] = $logistics['data']['url'];
|
|
|
$result['logisticImg'] = $logistics['data']['logo'];
|
|
|
$result['logisticCompany'] = $logistics['data']['caption'];
|
|
|
$result['logisticNumber'] = $logistics['data']['express_number'];
|
|
|
|
|
|
$build = array();
|
|
|
foreach ($logistics['data']['express_detail'] as $value) {
|
|
|
$build['status'] = $value['accept_address'];
|
|
|
$build['date'] = $value['acceptTime'];
|
|
|
$result['logisticDetail'][] = $build;
|
|
|
}
|
|
|
|
|
|
// 获取物流详情页banner
|
|
|
$banner = self::getLogisterBanner();
|
|
|
if ($banner) {
|
|
|
$result['banner'] = $banner;
|
|
|
}
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取物流详情页banner
|
|
|
*
|
|
|
* @return array|bool
|
|
|
*/
|
|
|
private static function getLogisterBanner()
|
|
|
{
|
|
|
$result = false;
|
|
|
|
|
|
if (USE_CACHE) {
|
|
|
// 先尝试获取一级缓存(master), 有数据则直接返回.
|
|
|
$result = Cache::get(CacheConfig::KEY_CODE_LOGISTIC_BANNER, 'master');
|
|
|
if (!empty($result)) {
|
|
|
return $result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 调用接口获取数据
|
|
|
$banner = IndexData::getBannerStart(self::CODE_LOGISTIC_BANNER);
|
|
|
if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) {
|
|
|
$result = array();
|
|
|
// 处理数据
|
|
|
foreach ($banner['data'] as $val) {
|
|
|
foreach ($val['data'] as $single) {
|
|
|
$result['url'] = Helpers::getFilterUrl($single['url']);
|
|
|
$result['img'] = Helpers::getImageUrl($single['src'], 640, 200);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (USE_CACHE) {
|
|
|
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
|
|
|
if (empty($result)) {
|
|
|
$result = Cache::get(CacheConfig::KEY_CODE_LOGISTIC_BANNER, 'slave');
|
|
|
}
|
|
|
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
|
|
|
else {
|
|
|
Cache::set(CacheConfig::KEY_CODE_LOGISTIC_BANNER, $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
...
|
...
|
|