refactor: 横幅及导航新增用于回显的链接数据字段
This commit is contained in:
@@ -219,4 +219,29 @@ class System
|
||||
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
// 根据系统页面url获取回显数据项
|
||||
static public function getEchoDataBySystemPageUrl($link_to, $link)
|
||||
{
|
||||
if ('custom' == $link_to) return [];
|
||||
|
||||
$data = [];
|
||||
parse_str(parse_url($link, PHP_URL_QUERY), $params);
|
||||
switch ($link_to) {
|
||||
case 'article':
|
||||
$data = ArticleModel::field(['id', 'title' => 'name'])->bypk($params['id'])->find();
|
||||
break;
|
||||
case 'product':
|
||||
$data = ProductModel::field(['id', 'name'])->bypk($params['id'])->find();
|
||||
break;
|
||||
default:
|
||||
return [];
|
||||
break;
|
||||
}
|
||||
return [
|
||||
'id' => $data['id'],
|
||||
'name' => $data['name'],
|
||||
'link' => $link
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user