Authored by Rock Zhang

添加帮助中心有关接口

... ... @@ -431,4 +431,35 @@ class UserData
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v1/help/getCategory', $param);
}
/**
* 帮助中心列表接口
*
* @return array 接口返回的数据
*/
public static function helpListData()
{
$param = Yohobuy::param();
$param['method'] = 'app.help.li';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 帮助详情接口
*
* @param string $code 具体一条帮助的code
* @return array 接口返回的数据
*/
public static function helpDetailData($code)
{
$param = Yohobuy::param();
$param['method'] = 'app.help.detail';
$param['return_type'] = 'html';
$param['code'] = $code;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, true, true);
}
}
... ...
... ... @@ -36,9 +36,12 @@ class HomeController extends AbstractAction
$excludeActions = array(
'index',
'onlineservice',
'onlineservicedetail',
'suggest',
'suggestsub',
'suggestimgupload',
'help',
'helpdetail',
);
if (!$this->_uid && !in_array($action, $excludeActions) && !$this->isAjax()) {
$this->go(Helpers::url('/signin.html'));
... ... @@ -789,25 +792,31 @@ class HomeController extends AbstractAction
/**
* 帮助列表页
*/
private function IHelpAction()
public function IhelpAction()
{
$this->setTitle('帮助中心');
$this->setNavHeader('帮助中心');
$data = array(
'iHelp' => array(
array('name' => '新用户注册','url' => 'http://m.dev.yohobuy.com/' ),
array('name' => '交款须知' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '服务条款' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '网站订购流程' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '会员登录' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '网站订单修改' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => 'YOHO币' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '常见问题' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '支付方式' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '发票制度说明' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '配送时间' ,'url' => 'http://m.dev.yohobuy.com/')
)
);
$data = UserModel::getHelpListData();
$this->_view->display('i-help', $data);
}
/**
* 帮助详情页
*/
public function helpdetailAction()
{
$code = $this->get('code', null);
if (empty($code)) {
$this->error();
}
$this->setTitle('帮助中心');
$this->setNavHeader('帮助中心');
$data = array('content'=>UserModel::getHelpDetailData($code));
$this->_view->display('i-help', $data);
}
}
... ...
... ... @@ -725,4 +725,42 @@ class UserModel
return $result;
}
/**
* 处理帮助中心列表数据
*
* @return array|mixed 处理之后的返回
*/
public static function getHelpListData()
{
$result = array();
$helpListData = UserData::helpListData();
if (isset($helpListData['data']) && !empty($helpListData['data'])) {
$help = $helpListData['data'];
$one = array();
foreach ($help as $val) {
$one = array();
$one['name'] = $val['caption'];
$one['url'] = Helpers::url('/home/helpdetail/', array('code' => $val['code']));
$result['iHelp'][] = $one;
}
}
return $result;
}
/**
* 处理帮助详情数据
*
* @param string $code 具体一条帮助的code
* @return array|mixed 处理之后的返回
*/
public static function getHelpDetailData($code)
{
return UserData::helpDetailData($code);
}
}
... ...