|
|
|
@@ -8,10 +8,12 @@ import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.MallRolePermission; |
|
|
|
import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.MallUserRole; |
|
|
|
import com.iformall.domain.po.WxAppinfo; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.service.MallRolePermissionService; |
|
|
|
import com.iformall.service.MallUserInfoService; |
|
|
|
import com.iformall.service.MallUserRoleService; |
|
|
|
import com.iformall.service.WxAppinfoService; |
|
|
|
import com.iformall.shiro.UserSession; |
|
|
|
import com.iformall.shiro.UseriFormallToken; |
|
|
|
import com.iformall.utils.ShiroUtils; |
|
|
|
@@ -56,6 +58,9 @@ public class HomeController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private MallRolePermissionService mallRolePermissionService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxAppinfoService appinfoService; |
|
|
|
|
|
|
|
@GetMapping("/captcha.jpg") |
|
|
|
public void captcha(HttpServletResponse response)throws ServletException, IOException { |
|
|
|
logger.debug("[" + getIpAddr() + "] HomeController::captcha"); |
|
|
|
@@ -167,15 +172,25 @@ public class HomeController extends BaseController { |
|
|
|
public ResultData bLogin(@RequestBody MallUserInfo user) { |
|
|
|
logger.debug("[" + getIpAddr() + "] HomeController::bHidLogin"); |
|
|
|
ResultData data = new ResultData(); |
|
|
|
// tenantId is appId |
|
|
|
if(StringUtils.isBlank(user.getTenantId())) { |
|
|
|
logger.error("appid信息未提供"); |
|
|
|
return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); |
|
|
|
} |
|
|
|
WxAppinfo appinfo = appinfoService.getByAppId(user.getTenantId()); |
|
|
|
if(appinfo == null) { |
|
|
|
logger.error("appid未找到"); |
|
|
|
return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(user.getPhone())) { |
|
|
|
// 领导登录 |
|
|
|
user = mallUserInfoService.getByPhone(user.getPhone()); |
|
|
|
user = mallUserInfoService.getByPhone(user.getPhone(), appinfo.getTenantId()); |
|
|
|
if(user == null || !isInMobileAdmin(user)) { |
|
|
|
return new ResultData(ErrorCode.USER_NOT_ADMIN); |
|
|
|
} |
|
|
|
} else if(StringUtils.isNotBlank(user.getOpenId())) { |
|
|
|
// 领导登录 |
|
|
|
user = mallUserInfoService.getByOpenId(user.getOpenId()); |
|
|
|
user = mallUserInfoService.getByOpenId(user.getOpenId(), appinfo.getTenantId()); |
|
|
|
if(user == null || !isInMobileAdmin(user)) { |
|
|
|
return new ResultData(ErrorCode.USER_NOT_ADMIN); |
|
|
|
} |
|
|
|
|