這個還是不行,還是自己拼湊了一個方法來解決。
/**
* 獲取指定級別的欄目列表
* @param string type son表示下一級欄目,self表示同級欄目,top頂級欄目
* @param boolean $self 包括自己本身
* @author wengxianhu by 2018-4-26
*/
public function getSwitchType($typeid = '', $type = 'son')
{
$result = array();
switch ($type) {
case 'son': // 下級欄目
$result = $this->getSon($typeid, false);
break;
case 'self': // 同級欄目
$result = $this->getSelf($typeid);
break;
case 'top': // 頂級欄目
$result = $this->getTop();
break;
case 'sonself': // 下級、同級欄目
$result = $this->getSon($typeid, true);
break;
case 'selftop': // 下級、同級欄目
$result = $this->getSelftop($typeid, true);
break;
}
/*處理自定義表字段的值*/
if (!empty($result)) {
/*獲取自定義表字段信息*/
$map = array(
'channel_id' => config('global.arctype_channel_id'),
);
$fieldInfo = model('Channelfield')->getListByWhere($map, '*', 'name');
/*--end*/
$fieldLogic = new apphomelogicFieldLogic;
foreach ($result as $key => $val) {
if (!empty($val)) {
$val = $fieldLogic->handleAddonFieldList($val, $fieldInfo);
$result[$key] = $val;
}
}
}
/*--end*/
return $result;
}
/**
* 獲取頂級父欄目
* @author killer707 2020-3-16
*/
public function getSelftop($typeid, $self = false)
{
$result = array();
if (empty($typeid)) {
return $result;
}
/*if ($self) {
$map['id|parent_id'] = array('IN', $typeid);
} else {
$map['parent_id'] = 0;
}*/
$result = model('Arctype')->getAllPid($typeid); // 當前欄目往上一級級父欄目
reset($result); // 重置數(shù)組
/*獲取最頂級父欄目ID*/
$firstVal = current($result);
$topTypeId = $firstVal['id'];
$map['id'] =$topTypeId;
$map['is_hidden'] = 0;
$map['status'] = 1;
$result = M('arctype')->field('*, id as typeid')
->where($map)
->where('lang', $this->home_lang)
->order('sort_order asc')
->select();
if ($result) {
$ctl_name_list = model('Channeltype')->getAll('id,ctl_name', array(), 'id');
foreach ($result as $key => $val) {
// 獲取指定路由模式下的URL
if ($val['is_part'] == 1) {
$typeurl = $val['typelink'];
} else {
$ctl_name = $ctl_name_list[$val['current_channel']]['ctl_name'];
$typeurl = typeurl(MODULE_NAME.'/'.$ctl_name."/lists", $val);
}
$val['typeurl'] = $typeurl;
// 封面圖
$val['litpic'] = handle_subdir_pic($val['litpic']);
$result[$key] = $val;
}
}
return $result;
}
把tagChannelartlist的對應方法換一下就好了