1.提交缺失的东西
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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')
|
||||
|
||||
Reference in New Issue
Block a user