Authored by Rock Zhang

添加帮助中心有关接口

@@ -431,4 +431,35 @@ class UserData @@ -431,4 +431,35 @@ class UserData
431 return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v1/help/getCategory', $param); 431 return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v1/help/getCategory', $param);
432 } 432 }
433 433
  434 + /**
  435 + * 帮助中心列表接口
  436 + *
  437 + * @return array 接口返回的数据
  438 + */
  439 + public static function helpListData()
  440 + {
  441 + $param = Yohobuy::param();
  442 + $param['method'] = 'app.help.li';
  443 + $param['client_secret'] = Sign::getSign($param);
  444 +
  445 + return Yohobuy::get(Yohobuy::API_URL, $param);
  446 + }
  447 +
  448 + /**
  449 + * 帮助详情接口
  450 + *
  451 + * @param string $code 具体一条帮助的code
  452 + * @return array 接口返回的数据
  453 + */
  454 + public static function helpDetailData($code)
  455 + {
  456 + $param = Yohobuy::param();
  457 + $param['method'] = 'app.help.detail';
  458 + $param['return_type'] = 'html';
  459 + $param['code'] = $code;
  460 + $param['client_secret'] = Sign::getSign($param);
  461 +
  462 + return Yohobuy::get(Yohobuy::API_URL, $param, true, true);
  463 + }
  464 +
434 } 465 }
@@ -36,9 +36,12 @@ class HomeController extends AbstractAction @@ -36,9 +36,12 @@ class HomeController extends AbstractAction
36 $excludeActions = array( 36 $excludeActions = array(
37 'index', 37 'index',
38 'onlineservice', 38 'onlineservice',
  39 + 'onlineservicedetail',
39 'suggest', 40 'suggest',
40 'suggestsub', 41 'suggestsub',
41 'suggestimgupload', 42 'suggestimgupload',
  43 + 'help',
  44 + 'helpdetail',
42 ); 45 );
43 if (!$this->_uid && !in_array($action, $excludeActions) && !$this->isAjax()) { 46 if (!$this->_uid && !in_array($action, $excludeActions) && !$this->isAjax()) {
44 $this->go(Helpers::url('/signin.html')); 47 $this->go(Helpers::url('/signin.html'));
@@ -789,25 +792,31 @@ class HomeController extends AbstractAction @@ -789,25 +792,31 @@ class HomeController extends AbstractAction
789 /** 792 /**
790 * 帮助列表页 793 * 帮助列表页
791 */ 794 */
792 - private function IHelpAction() 795 + public function IhelpAction()
793 { 796 {
794 $this->setTitle('帮助中心'); 797 $this->setTitle('帮助中心');
795 $this->setNavHeader('帮助中心'); 798 $this->setNavHeader('帮助中心');
796 - $data = array(  
797 - 'iHelp' => array(  
798 - array('name' => '新用户注册','url' => 'http://m.dev.yohobuy.com/' ),  
799 - array('name' => '交款须知' ,'url' => 'http://m.dev.yohobuy.com/'),  
800 - array('name' => '服务条款' ,'url' => 'http://m.dev.yohobuy.com/'),  
801 - array('name' => '网站订购流程' ,'url' => 'http://m.dev.yohobuy.com/'),  
802 - array('name' => '会员登录' ,'url' => 'http://m.dev.yohobuy.com/'),  
803 - array('name' => '网站订单修改' ,'url' => 'http://m.dev.yohobuy.com/'),  
804 - array('name' => 'YOHO币' ,'url' => 'http://m.dev.yohobuy.com/'),  
805 - array('name' => '常见问题' ,'url' => 'http://m.dev.yohobuy.com/'),  
806 - array('name' => '支付方式' ,'url' => 'http://m.dev.yohobuy.com/'),  
807 - array('name' => '发票制度说明' ,'url' => 'http://m.dev.yohobuy.com/'),  
808 - array('name' => '配送时间' ,'url' => 'http://m.dev.yohobuy.com/')  
809 - )  
810 - ); 799 +
  800 + $data = UserModel::getHelpListData();
  801 +
  802 + $this->_view->display('i-help', $data);
  803 + }
  804 +
  805 + /**
  806 + * 帮助详情页
  807 + */
  808 + public function helpdetailAction()
  809 + {
  810 + $code = $this->get('code', null);
  811 + if (empty($code)) {
  812 + $this->error();
  813 + }
  814 +
  815 + $this->setTitle('帮助中心');
  816 + $this->setNavHeader('帮助中心');
  817 +
  818 + $data = array('content'=>UserModel::getHelpDetailData($code));
  819 +
811 $this->_view->display('i-help', $data); 820 $this->_view->display('i-help', $data);
812 } 821 }
813 } 822 }
@@ -725,4 +725,42 @@ class UserModel @@ -725,4 +725,42 @@ class UserModel
725 return $result; 725 return $result;
726 } 726 }
727 727
  728 + /**
  729 + * 处理帮助中心列表数据
  730 + *
  731 + * @return array|mixed 处理之后的返回
  732 + */
  733 + public static function getHelpListData()
  734 + {
  735 + $result = array();
  736 +
  737 + $helpListData = UserData::helpListData();
  738 +
  739 + if (isset($helpListData['data']) && !empty($helpListData['data'])) {
  740 + $help = $helpListData['data'];
  741 +
  742 + $one = array();
  743 + foreach ($help as $val) {
  744 + $one = array();
  745 + $one['name'] = $val['caption'];
  746 + $one['url'] = Helpers::url('/home/helpdetail/', array('code' => $val['code']));
  747 +
  748 + $result['iHelp'][] = $one;
  749 + }
  750 + }
  751 +
  752 + return $result;
  753 + }
  754 +
  755 + /**
  756 + * 处理帮助详情数据
  757 + *
  758 + * @param string $code 具体一条帮助的code
  759 + * @return array|mixed 处理之后的返回
  760 + */
  761 + public static function getHelpDetailData($code)
  762 + {
  763 + return UserData::helpDetailData($code);
  764 + }
  765 +
728 } 766 }