医生微信登录接口

master
heminjian502 2 years ago
parent 1f992472c8
commit bbf87b0106

@ -73,6 +73,7 @@ public class SysLoginController
@ApiOperation("app医生登录") @ApiOperation("app医生登录")
@PostMapping("/login/app") @PostMapping("/login/app")
public AjaxResult loginForApp(@RequestBody LoginBody loginBody) { public AjaxResult loginForApp(@RequestBody LoginBody loginBody) {
logger.info("login for app :{}", loginBody.getUsername());
if (!"123456".equals(loginBody.getPassword())) { if (!"123456".equals(loginBody.getPassword())) {
return AjaxResult.error("密码错误"); return AjaxResult.error("密码错误");
} }

@ -12,6 +12,8 @@ import eu.bitwalker.useragentutils.UserAgent;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -29,6 +31,7 @@ import java.util.concurrent.TimeUnit;
@Component @Component
public class UserTokenService public class UserTokenService
{ {
private static final Logger logger = LoggerFactory.getLogger(UserTokenService.class);
// 令牌自定义标识 // 令牌自定义标识
@Value("${token.header}") @Value("${token.header}")
private String header; private String header;
@ -169,6 +172,7 @@ public class UserTokenService
loginUser.setExpireTime(loginUser.getLoginTime() + appExpireTime * MILLIS_MINUTE); loginUser.setExpireTime(loginUser.getLoginTime() + appExpireTime * MILLIS_MINUTE);
// 根据uuid将loginUser缓存 // 根据uuid将loginUser缓存
String userKey = getTokenKey(loginUser.getToken()); String userKey = getTokenKey(loginUser.getToken());
logger.info("login user :{} , login user key :{}", loginUser.getUsername(), userKey);
redisCache.setCacheObject(userKey, loginUser, appExpireTime, TimeUnit.MINUTES); redisCache.setCacheObject(userKey, loginUser, appExpireTime, TimeUnit.MINUTES);
} }

Loading…
Cancel
Save