医生微信登录接口

master
heminjian502 2 years ago
parent 0363bcabef
commit b794c777bb

@ -100,7 +100,7 @@ public class WechatServiceImpl implements IWechatService {
} else { } else {
// 已绑定信息 直接登录 // 已绑定信息 直接登录
resp.setBindFlag(true); resp.setBindFlag(true);
TDoctor tDoctor = tDoctorMapper.selectTDoctorById(wechatUser.getId()); TDoctor tDoctor = tDoctorMapper.selectTDoctorById(wechatUser.getUserId());
String token = buildTokenByDoctor(tDoctor); String token = buildTokenByDoctor(tDoctor);
resp.setToken(token); resp.setToken(token);
} }
@ -148,14 +148,14 @@ public class WechatServiceImpl implements IWechatService {
TDoctor currentDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone()); TDoctor currentDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone());
TWechatUser wechatUser = new TWechatUser(); TWechatUser wechatUser = new TWechatUser();
if (Objects.nonNull(currentDoctor)) { if (Objects.nonNull(currentDoctor)) {
// 存在 需要把患者信息更新 并绑定openid
BeanUtils.copyProperties(req, currentDoctor);
currentDoctor.setDelFlag("0");
tDoctorMapper.updateTDoctor(currentDoctor);
TWechatUser queryUser = tWechatUserMapper.selectWechatUserByUserId(currentDoctor.getId()); TWechatUser queryUser = tWechatUserMapper.selectWechatUserByUserId(currentDoctor.getId());
if (Objects.nonNull(queryUser)) { if (Objects.nonNull(queryUser)) {
throw new ServiceException("该手机号已绑定其他微信账号!"); throw new ServiceException("该手机号已绑定其他微信账号!");
} }
// 存在 需要把患者信息更新 并绑定openid
BeanUtils.copyProperties(req, currentDoctor);
currentDoctor.setDelFlag("0");
tDoctorMapper.updateTDoctor(currentDoctor);
wechatUser.setUserId(currentDoctor.getId()); wechatUser.setUserId(currentDoctor.getId());
tDoctor.setId(currentDoctor.getId()); tDoctor.setId(currentDoctor.getId());
} else { } else {

Loading…
Cancel
Save