You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.1 KiB
Java
56 lines
1.1 KiB
Java
package com.glxp.api.controller;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.glxp.api.constant.Constant;
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class BaseController {
|
|
|
|
@Resource
|
|
CustomerService customerService;
|
|
|
|
/**
|
|
* 页面跳转
|
|
*/
|
|
public String redirect(String url) {
|
|
return StrUtil.format("redirect:{}", url);
|
|
}
|
|
|
|
|
|
public boolean isAdmin(Long userId) {
|
|
return Constant.ADMIN_ID.equals(userId);
|
|
}
|
|
|
|
|
|
public AuthAdmin getUser() {
|
|
return customerService.getUserBean();
|
|
}
|
|
|
|
public Long getUserId() {
|
|
return customerService.getUserId();
|
|
}
|
|
|
|
public String getCustomerId() {
|
|
AuthAdmin authAdmin = getUser();
|
|
if (authAdmin != null)
|
|
return authAdmin.getCustomerId() + "";
|
|
return "110";
|
|
}
|
|
|
|
public boolean isHosUser() {
|
|
String customerId = getCustomerId();
|
|
if (customerId.equals("110")) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|