Authored by cailing

帮助

@@ -36,7 +36,7 @@ class HelpData @@ -36,7 +36,7 @@ class HelpData
36 $param['code'] = $code; 36 $param['code'] = $code;
37 $param['return_type'] = 'html'; 37 $param['return_type'] = 'html';
38 $param['client_secret'] = Sign::getSign($param); 38 $param['client_secret'] = Sign::getSign($param);
39 - return Yohobuy::post(Yohobuy::API_URL, $param,$param ); 39 + return Yohobuy::post(Yohobuy::API_URL, $param, true);
40 } 40 }
41 41
42 42
1 {{> layout/header}} 1 {{> layout/header}}
2 - 2 +{{{iHelp}}}
3 {{> layout/footer}} 3 {{> layout/footer}}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="iHelp"> 2 <div class="iHelp">
3 <ul> 3 <ul>
4 {{# iHelp}} 4 {{# iHelp}}
5 - <li><a href="/home/helpDetail?code={{ code}}"><span>{{ caption}}</span><i class="iconfont num">&#xe604;</i></a></li> 5 + <li><a href="{{url}}"><span>{{caption}}</span><i class="iconfont num">&#xe604;</i></a></li>
6 {{/ iHelp}} 6 {{/ iHelp}}
7 </ul> 7 </ul>
8 </div> 8 </div>
@@ -871,31 +871,23 @@ class HomeController extends AbstractAction @@ -871,31 +871,23 @@ class HomeController extends AbstractAction
871 $this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true)); 871 $this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true));
872 } 872 }
873 873
874 - /**  
875 - * 帮助中心列表页  
876 - */  
877 - public function helpAction()  
878 - {  
879 - $service = Home\HelpModel::serviceInfo();  
880 - $this->setTitle('帮助中心');  
881 - $this->setNavHeader('帮助中心');  
882 - $data = array(  
883 - 'iHelp' =>$service,  
884 - );  
885 - $this->_view->display('i-help', $data);  
886 - }  
887 874
888 /** 875 /**
889 * 帮助中心列表详细信息 876 * 帮助中心列表详细信息
890 */ 877 */
891 - public function helpDetailAction()  
892 - { 878 + public function helpDetailAction() {
  879 + $caption = $this->get('caption', '帮助中心');
893 $code = $this->get('code', 0); 880 $code = $this->get('code', 0);
  881 + if (empty($code)) {
  882 + $this->error();
  883 + }
  884 +
  885 + $this->setTitle($caption);
  886 + $this->setNavHeader($caption);
  887 +
894 $service = Home\HelpModel::serviceDetail($code); 888 $service = Home\HelpModel::serviceDetail($code);
895 - $data = array( 889 + $this->_view->display('helpDetail', array(
896 'iHelp' => $service, 890 'iHelp' => $service,
897 - );  
898 - print_r($service);  
899 - $this->_view->display('helpDetail', $data); 891 + ));
900 } 892 }
901 } 893 }
@@ -8,14 +8,13 @@ use Plugin\Helpers; @@ -8,14 +8,13 @@ use Plugin\Helpers;
8 /* 8 /*
9 * 帮助中心相关数据处理 9 * 帮助中心相关数据处理
10 */ 10 */
11 -class HelpModel  
12 -{ 11 +
  12 +class HelpModel {
13 /* 13 /*
14 * 获取帮助列表 14 * 获取帮助列表
15 */ 15 */
16 16
17 - public static function serviceInfo()  
18 - { 17 + public static function serviceInfo() {
19 //调用接口获取数据 18 //调用接口获取数据
20 $res = json_decode(HelpData::serviceInfo(), TRUE); 19 $res = json_decode(HelpData::serviceInfo(), TRUE);
21 $cateInfo = $res['data']; 20 $cateInfo = $res['data'];
@@ -24,8 +23,8 @@ class HelpModel @@ -24,8 +23,8 @@ class HelpModel
24 foreach ($cateInfo as $key => $value) { 23 foreach ($cateInfo as $key => $value) {
25 $iHelp[$key]['caption'] = $value['caption']; 24 $iHelp[$key]['caption'] = $value['caption'];
26 $iHelp[$key]['code'] = $value['code']; 25 $iHelp[$key]['code'] = $value['code'];
  26 + $iHelp[$key]['url'] = Helpers::url('/home/helpDetail', array('code' => $value['code'], 'caption' => $value['caption']) );
27 } 27 }
28 -  
29 } 28 }
30 return $iHelp; 29 return $iHelp;
31 } 30 }
@@ -34,13 +33,14 @@ class HelpModel @@ -34,13 +33,14 @@ class HelpModel
34 * 获取帮助中心详细内容 33 * 获取帮助中心详细内容
35 */ 34 */
36 35
37 - public static function serviceDetail($code)  
38 - {  
39 - 36 + public static function serviceDetail($code) {
40 $res = HelpData::serviceDetail($code); 37 $res = HelpData::serviceDetail($code);
  38 + if (!empty($res)) {
  39 + if (false !== ($part = strstr($res,'<div class="deal_main">'))) {
  40 + $res = strstr($part,'</body>',TRUE);
  41 + }
  42 + }
41 return $res; 43 return $res;
42 } 44 }
43 45
44 -  
45 } 46 }
46 -