1.提交缺失的东西

This commit is contained in:
2025-05-17 16:26:26 +08:00
parent 5be5385d5f
commit 49beb4ee65
2 changed files with 24 additions and 1 deletions

View File

@ -27,7 +27,12 @@ class MenuController extends BaseApiController
public function lists()
{
$type = $this->request->get('type', 1);
$list = MenuLogic::getMenu($type,$this->userInfo);
if ($type == 2) {
$list = MenuLogic::getUserCenterMenu($this->userInfo);
} else {
$list = MenuLogic::getMenu($type,$this->userInfo);
}
return $this->success('获取成功', $list);
}
}

View File

@ -26,6 +26,24 @@ use think\facade\Db;
class MenuLogic
{
public static function getUserCenterMenu($user_info) {
$list = Db::name('decorate_page')
->where(['type' => 2])
->field('data')
->find();
$domain = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://";
$domain .= $_SERVER['HTTP_HOST'];
$arr = json_decode($list['data'], true);
foreach($arr as &$v) {
if (!empty($v['content'] && !empty($v['content']['data']))) {
foreach ($v['content']['data'] as &$v1) {
$v1['image'] = $domain . '/' . $v1['image'];
}
}
}
return $arr;
}
public static function getMenu($type,$user_info)
{
$list = Db::name('menu_decorate')