Authored by hf

code review by hf: format help center code

... ... @@ -22,7 +22,7 @@ class HelpData
$param['method'] = 'app.help.li';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param, $param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
... ...
... ... @@ -867,7 +867,8 @@ class HomeController extends AbstractAction
/**
* 帮助中心列表详细信息
*/
public function helpDetailAction() {
public function helpDetailAction()
{
$caption = $this->get('caption', '帮助中心');
$code = $this->get('code', 0);
if (empty($code)) {
... ... @@ -877,9 +878,8 @@ class HomeController extends AbstractAction
$this->setTitle($caption);
$this->setNavHeader($caption);
$service = Home\HelpModel::serviceDetail($code);
$this->_view->display('helpDetail', array(
'iHelp' => $service,
'iHelp' => Home\HelpModel::serviceDetail($code),
));
}
... ...
... ... @@ -8,36 +8,37 @@ use Plugin\Helpers;
/**
* 帮助中心相关数据处理
*/
class HelpModel {
class HelpModel
{
/*
* 获取帮助中心列表
*/
public static function serviceInfo() {
//调用接口获取数据
$res = json_decode(HelpData::serviceInfo(), TRUE);
$cateInfo = $res['data'];
public static function serviceInfo()
{
$iHelp = array();
$list = array();
if ($cateInfo) {
foreach ($cateInfo as $key => $value) {
$cateInfo = HelpData::serviceInfo();
if (!empty($cateInfo['data'])) {
foreach ($cateInfo['data'] as $key => $value) {
$iHelp[$key]['name'] = $value['caption'];
$iHelp[$key]['code'] = $value['code'];
$iHelp[$key]['url'] = Helpers::url('/home/helpDetail', array('code' => $value['code'], 'caption' => $value['caption']) );
$iHelp[$key]['url'] = Helpers::url('/home/helpDetail', array('code' => $value['code'], 'caption' => $value['caption']));
}
}
return $iHelp;
}
/*
* 获取帮助中心详细内容
*/
public static function serviceDetail($code) {
public static function serviceDetail($code)
{
$res = HelpData::serviceDetail($code);
if (!empty($res)) {
if (false !== ($part = strstr($res,'<div class="deal_main">'))) {
$res = strstr($part,'</body>',TRUE);
if (false !== ($part = strstr($res, '<body>'))) {
$res = strstr($part, '</body>', true);
}
}
return $res;
... ...
... ... @@ -212,7 +212,7 @@ class DetailModel
// 统计每个尺码对应的各个颜色的库存量
foreach ($sizeList as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['sizeName'] ]) );
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
}
// 商品库存总数
... ...