package com.goafanti.common.controller; import javax.annotation.Resource; import com.goafanti.common.bo.Result; import com.goafanti.common.constant.ErrorConstants; import com.goafanti.common.enums.UserLevel; import com.goafanti.common.model.User; import com.goafanti.core.shiro.token.TokenManager; import com.goafanti.user.service.OrganizationIdentityService; import com.goafanti.user.service.UserIdentityService; public class CertifyApiController extends BaseApiController { @Resource private OrganizationIdentityService organizationIdentityService; @Resource private UserIdentityService userIdentityService; public boolean checkCertify(Result res, User user) { if (user == null) { res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户未指定", "用户")); return false; } if (UserLevel.getStatus(user.getLvl()).equals(UserLevel.GENERAL)) { res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!")); return false; } return true; } public boolean checkAdminLogin(Result res) { if (TokenManager.getAdminToken() == null) { res.getError().add(buildError(ErrorConstants.NON_LOGIN, "找不到登录信息")); return false; } return true; } public boolean checkUserLogin(Result res) { if (TokenManager.getUserToken() == null) { res.getError().add(buildError(ErrorConstants.NON_LOGIN, "找不到登录信息")); return false; } return true; } }