提交 b584f8b4 编写于 作者: dong.an's avatar dong.an

微信登录修改

上级 12c41943
流水线 #16696 已失败 于阶段
in 0 second
......@@ -22,6 +22,8 @@ public class LoginResult {
private String unionId;
@ApiModelProperty("是否完善过信息,1.信息未补全, 2信息已补全,3已补全密码")
private int entireFlag;
@ApiModelProperty("加密手机号")
private String mobile;
public String getToken() {
return token;
......@@ -62,4 +64,12 @@ public class LoginResult {
public void setEntireFlag(int entireFlag) {
this.entireFlag = entireFlag;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
}
......@@ -25,7 +25,8 @@ public enum AccountExceptionEnum {
PICA_PARAMS_ERROR("216517", "传递参数有误"),
PICA_SYSCODE_RETRY("216518", "请X秒后重试"),
PICA_NOT_EXIST("216519", "该用户不存在"),
PICA_REGISTER_FAIL("216520", "注册失败");
PICA_REGISTER_FAIL("216520", "注册失败"),
PICA_WECHAT_CODE_ERROR("216521", "微信登录授权code不正确");
private String code;
......
......@@ -187,6 +187,9 @@ public class LoginServiceImpl implements LoginService {
@Override
public LoginResult loginByWeChat(BaseRequest request) {
WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode());
if (weChatEntity == null || StringUtils.isEmpty(weChatEntity.getOpenid()) || StringUtils.isEmpty(weChatEntity.getAccess_token())) {
throw new PicaException(AccountExceptionEnum.PICA_WECHAT_CODE_ERROR.getCode(), AccountExceptionEnum.PICA_WECHAT_CODE_ERROR.getMessage());
}
//todo:微信登录获取个人信息
Map map = new HashMap();
map.put("access_token", weChatEntity.getAccess_token());
......@@ -211,6 +214,11 @@ public class LoginServiceImpl implements LoginService {
result.setToken(newToken);
result.setUserId(userId);
result.setBindFlag(AccountTypeEnum.BIND_STATUS_SUCCESS.getCode()+"");
if (request.getProductType() == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
PICAPDoctor doctor = doctorInfoMapper.queryDoctor(userId);
result.setEntireFlag(doctor.getEntire_flag());
result.setMobile(doctor.getMobile_phone());
}
return result;
} else {
AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册