Help.php
2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
namespace Index;
use LibModels\Web\Home\HelpData;
/**
* 帮助中心
*/
class HelpModel
{
/**
* 获取帮助列表
*/
public static function getHelpList($cateId)
{
$list = array();
$res = HelpData::getHelpCategory();
if (isset($res['data']) && $res['data']) {
foreach ($res['data'] as $key => $value) {
$list[$key]['id'] = $value['id'];
$list[$key]['name'] = $value['caption'];
if ($value['id'] == $cateId) {
$list[$key]['active'] = true;
}
}
}
return $list;
}
/**
* 获取具体的帮助信息(非常见问题)
* @param type $cateId
*/
public static function getHelpDetail($cateId)
{
$detail = '';
$res = HelpData::getHelpDetail($cateId);
if (isset($res['data']['helpdetail_list']) && $res['data']['helpdetail_list']) {
$detail = $res['data']['helpdetail_list'][0]['content'];
}
return $detail;
}
/**
* 常见问题相关数据
* @param type $cateId
* @param type $page
* @param type $limit
* @param type $key
* @return type
*/
public static function getSearchDetail($cateId = 37, $page = 1, $limit = 10, $key = '')
{
$question = array();
$qRes = HelpData::getCommonFaqLimit($cateId, $key);
if (isset($qRes['data']) && $qRes['data']) {
foreach ($qRes['data'] as $qk => $qv) {
$question['common'][$qk]['ask'] = $qv['problem'];
$question['common'][$qk]['answer'] = $qv['answer'];
}
}
$res = HelpData::getHelpDetail($cateId, $page, $limit, $key);
if (isset($res['data']['helpdetail_list']) && $res['data']['helpdetail_list']) {
foreach ($res['data']['helpdetail_list'] as $fqk => $fqv) {
$question['all'][$fqk]['ask'] = $fqv['problem'];
$question['all'][$fqk]['answer'] = $fqv['answer'];
if ($fqk % 2) {
$question['all'][$fqk]['class'] = 'even';
}
}
$question['pager']['page'] = $res['data']['page'];
$question['pager']['total'] = $res['data']['total'];
$question['pager']['pageTotal'] = $res['data']['page_total'];
}
else {
$question['common'] = array();
$question['all'] = array('empty' => '对不起,没有找到和“<span>' . $key . '</span>”相关的问题!');
}
return $question;
}
}