小程序手机号与openid解绑代码修改

This commit is contained in:
youxilong 2024-07-10 09:47:51 +08:00
parent 25bec878d1
commit f49f838ba0
3 changed files with 15 additions and 2 deletions

View File

@ -78,4 +78,11 @@ public interface ResidentInfoMapper {
* @return 居民基本信息
*/
List<ResidentInfo> getResidentInfoByPhoneAndName(@Param("phone") String phone, @Param("patientName") String patientName);
/**
* 更新用户openid
* @param residentInfo 用户信息
* @return 结果
*/
int updateResidentInfoOpenid(ResidentInfo residentInfo);
}

View File

@ -173,6 +173,10 @@
where id = #{id}
</update>
<update id="updateResidentInfoOpenid" parameterType="com.xinelu.manage.domain.residentinfo.ResidentInfo">
UPDATE resident_info SET open_id = #{openId} WHERE id = #{id}
</update>
<delete id="deleteResidentInfoById" parameterType="Long">
delete from resident_info where id = #{id}
</delete>

View File

@ -279,6 +279,7 @@ public class AppletPersonCenterServiceImpl implements AppletPersonCenterService
// 更新用户的openid
ResidentInfo residentInfo = residentInfos.get(0);
residentInfo.setOpenId(openId);
residentInfo.setUpdateTime(LocalDateTime.now());
residentInfoMapper.updateResidentInfo(residentInfo);
log.info("用户注册成功,姓名:{},手机号:{}openid{}", verifySmsCodeDTO.getPatientName(), verifySmsCodeDTO.getPhoneNum(), openId);
return AjaxResult.success("注册成功!", residentInfo);
@ -310,7 +311,8 @@ public class AppletPersonCenterServiceImpl implements AppletPersonCenterService
// 清空openid字段更新用户信息
residentInfo.setOpenId(null);
residentInfoMapper.updateResidentInfo(residentInfo);
residentInfo.setUpdateTime(LocalDateTime.now());
residentInfoMapper.updateResidentInfoOpenid(residentInfo);
log.info("解绑成功,手机号:{}openId{}", phoneNum, openId);
return AjaxResult.success("解绑成功!");
} catch (Exception e) {