登录代码,验证token,(app与管理端)

	/**
	 * 微信授权登录
	 */
	@PostMapping("/login")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "移动端登录", notes = "移动端登录")
	public R login(@RequestBody AppUser appUser) {
		R<UserInfo> r = userClient.userInfo(BladeConstant.ADMIN_TENANT_ID ,appUser.getAccount() ,UserEnum.APP.getName());
		if(!r.isSuccess()){
			return R.fail("获取用户信息失败");
		}
		UserInfo userInfo = r.getData();
		if(userInfo == null || userInfo.getUser() == null){
			return R.fail("用户不存在");
		}
		User user = userInfo.getUser();
		Long id = user.getId();
		String currentPwswd = user.getPassword();
		if(currentPwswd == null || !currentPwswd.equals(DigestUtil.encrypt(appUser.getPassword()))){
			return R.fail("密码错误");
		}

		Integer userType = user.getUserType();
		if (userType!=2){
			return R.fail("该用户不是app用户!");
		}

		CacheUtil.put(CacheN

猜你喜欢

转载自blog.csdn.net/weixin_42759398/article/details/131572346