Help.php 1.1 KB
<?php

namespace Home;

use LibModels\Wap\Home\HelpData;
use Plugin\Helpers;

/**
 * 帮助中心相关数据处理
 */
class HelpModel
{
    /*
     * 获取帮助中心列表
     */
    public static function serviceInfo()
    {
        $iHelp = array();
        
        $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']));
            }
        }
        
        return $iHelp;
    }

    /*
     * 获取帮助中心详细内容
     */

    public static function serviceDetail($code)
    {
        $res = HelpData::serviceDetail($code);
        if (!empty($res)) {
            if (false !== ($part = strstr($res, '<body>'))) {
                $res = strstr($part, '</body>', true);
            }
        }
        return $res;
    }

}