登录更新手机号

main
cheney 11 months ago
parent 9a41de6178
commit b4492a199a
  1. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamAccountMapper.java
  2. 5
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml
  3. 15
      nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java

@ -41,4 +41,6 @@ public interface PlatformTeamAccountMapper extends BaseMapper<PlatformTeamAccoun
void updateUserInfo(@Param("userId")Integer userId); void updateUserInfo(@Param("userId")Integer userId);
void updateAccountOpenId(@Param("openid")String openid,@Param("accountId")Integer accountId); void updateAccountOpenId(@Param("openid")String openid,@Param("accountId")Integer accountId);
void updateAccountPhone(@Param("phone")String phone, @Param("accountId")Integer accountId);
} }

@ -11,6 +11,11 @@
SET app_open_id = #{openid} SET app_open_id = #{openid}
WHERE id = #{accountId} WHERE id = #{accountId}
</update> </update>
<update id="updateAccountPhone">
UPDATE hr_user_account
SET phone = #{phone}
WHERE id = #{accountId}
</update>
<select id="platformTeamAccountMergeList" <select id="platformTeamAccountMergeList"
resultType="com.huoran.nakadai.entity.res.PlatformTeamAccountResp"> resultType="com.huoran.nakadai.entity.res.PlatformTeamAccountResp">

@ -108,6 +108,10 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco
if (!userAccount.getIsEnable()){ if (!userAccount.getIsEnable()){
throw new CustomException(ExceptionEnum.ACCOUNT_DISABLED); throw new CustomException(ExceptionEnum.ACCOUNT_DISABLED);
} }
if (userAccount.getPhone()== null){
//登录更新手机号
baseMapper.updateAccountPhone(appletCallbackReq.getPhone(),userAccount.getId());
}
//更新登录时间 //更新登录时间
baseMapper.updateUserInfo(userAccount.getUserId()); baseMapper.updateUserInfo(userAccount.getUserId());
data.put("state", "login"); data.put("state", "login");
@ -151,11 +155,16 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco
@Override @Override
public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) { public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) {
UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId()); UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId());
//根据手机号查询用户 if (userAccount != null){
UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(),appletCallbackReq.getPlatformId().toString());
if (userAccount != null || userAccountByPhone!= null){
return R.error("该用户已存在"); return R.error("该用户已存在");
} }
if (appletCallbackReq.getPhone()!= null){
UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(),appletCallbackReq.getPlatformId().toString());
//根据手机号查询用户
if (userAccountByPhone != null){
return R.error("该用户已存在");
}
}
Map<String, Object> data = new HashedMap<String, Object>(); Map<String, Object> data = new HashedMap<String, Object>();
String randomNumbers = cn.hutool.core.util.RandomUtil.randomNumbers(6); String randomNumbers = cn.hutool.core.util.RandomUtil.randomNumbers(6);

Loading…
Cancel
Save