refactor: 横幅及导航新增用于回显的链接数据字段

This commit is contained in:
2025-03-18 10:22:17 +08:00
parent 36f9c8431b
commit 4d43c26a5e
3 changed files with 32 additions and 0 deletions

View File

@@ -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
];
}
}