Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
b7d7577c21390cd612ffa37a0a96d72acb585d43
1 parent
9c49c357
物流详情页添加banner以及你可能喜欢
Code Review By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
13 deletions
library/Configs/CacheConfig.php
yohobuy/m.yohobuy.com/application/models/Guang/Index.php
yohobuy/m.yohobuy.com/application/models/Home/Order.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
library/Configs/CacheConfig.php
View file @
b7d7577
...
...
@@ -59,7 +59,9 @@ class CacheConfig
const
KEY_INDEX_BRANDS_LIST_DATA
=
'key_index_brands_list_data'
;
//频道brands数据
const
KEY_CODE_YOHOCOIN_BANNER
=
'key_code_yohocoin_banner'
;
// 有货币banner数据
const
KEY_CODE_LOGISTIC_BANNER
=
'key_code_logistic_banner'
;
// 物流详情banner数据
const
KEY_WEB_HOME_NAVBAR_DATA
=
'key_web_home_navbar_data'
;
//web的导航数据
const
KEY_WEB_HOME_CHANNEL_DATA
=
'key_web_home_channel_data'
;
//web首页频道数据[boys, girls, kids, lifestyle]
const
KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA
=
'key_web_home_newarrival_data'
;
//web频道最新上架数据[boys, girls, kids, lifestyle]
...
...
yohobuy/m.yohobuy.com/application/models/Guang/Index.php
View file @
b7d7577
...
...
@@ -315,6 +315,8 @@ class IndexModel
}
/**
* 获取切换逛类别或者分页时的文章数据
*
* @param string $gender "1,3"表示男, "2,3"表示女
* @param int $sortId 分类ID
* @param int $uid 用户ID
...
...
yohobuy/m.yohobuy.com/application/models/Home/Order.php
View file @
b7d7577
...
...
@@ -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
;
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
b7d7577
...
...
@@ -378,6 +378,11 @@ class UserModel
return
$result
;
}
/**
* 获取有货币页面的banner数据
*
* @return array|bool|mixed
*/
public
static
function
getYohoCoinBanner
()
{
$result
=
false
;
...
...
Please
register
or
login
to post a comment