提交 405a5c13 编写于 作者: xinxu.wang's avatar xinxu.wang

小程序退出登录

上级 b7d4332a
流水线 #48515 已失败 于阶段
......@@ -18,6 +18,8 @@ import com.pica.cloud.account.account.server.req.OneClickLoginReq;
import com.pica.cloud.account.account.server.service.*;
import com.pica.cloud.account.account.server.util.*;
import com.pica.cloud.foundation.completeness.client.utils.IntactUtils;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
......@@ -591,7 +593,43 @@ public class LoginController extends AccountBaseController {
cacheClient.set("token-doctor-unionid-"+appletModel.getUnionId(),login.getToken(),expiredSeconds);
cacheClient.set("token-unionid-"+login.getToken(),appletModel.getUnionId(),expiredSeconds);
cacheClient.set("token-openid-"+login.getToken(),appletModel.getOpenId(),expiredSeconds);
/** 绑定医生和unionid关系 */
appletServiceClient.insertAppletDoctor(appletModel.getUnionId(), EncryptUtils.encryptContent(login.getUserId().toString(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_ID));
}
return PicaResponse.toResponse(login);
}
/**
* 退出登录接口,返回一个随机token
*
* @return
*/
@ApiOperation(value = "云鹊医助手小程序退出登录接口")
@GetMapping("/logout/applet")
public PicaResponse loginOutApplet() {
String token = super.getToken();
if (StringUtils.isNotEmpty(token)) {
Long doctorId = super.getDoctorIdByToken();
Doctor doctorInfo = doctorService.getDoctorInfo(doctorId.intValue());
if (StringUtil.isNotNull(doctorInfo)) {
Integer acctId = doctorInfo.getAcctId();
String unionid = redisClient.get("token-unionid-" +token);
redisClient.del("token-unionid-" +token);
redisClient.del("token-openid-" +token);
redisClient.del("token-doctor-unionid-" +unionid);
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, 1, 4,
AccountTypeEnum.LOGIN_OUT.getCode(), super.getIpAddr(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode(),
"",0,super.getUserTokenTourist());
picaLogUtils.info(entity);
return PicaResponse.toResponse();
} else {
return PicaResponse.toResponse();
}
} else {
throw new AccountException(AccountExceptionEnum.PICA_LOGIN_AGAIN);
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册