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.
|
|
|
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();
|
|
|
|
return authAdmin.getCustomerId() + "";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|