| | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.mapper.TAppUserMapper; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TInviteUserService; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | public class TAppUserServiceImpl extends ServiceImpl<TAppUserMapper, TAppUser> implements TAppUserService { |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TInviteUserService inviteUserService; |
| | | @Override |
| | | public Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData) { |
| | | public Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData,Long inviteUserId) { |
| | | // 通过手机号查询用户,是否已存在手动导入用户,包含支付宝用户 |
| | | TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone, appletUserDecodeData.getPhoneNumber()) |
| | |
| | | if(Objects.nonNull(appUser.getStatus())){ |
| | | throwInfo(appUser.getStatus()); |
| | | } |
| | | appUser.setInviteUserId(inviteUserId); |
| | | appUser.setAvatar(appletUserDecodeData.getAvatarUrl()); |
| | | appUser.setCity(appletUserDecodeData.getCity()); |
| | | appUser.setName(appletUserDecodeData.getNickName()); |
| | | appUser.setProvince(appletUserDecodeData.getProvince()); |
| | | appUser.setWxOpenid(appletUserDecodeData.getOpenId()); |
| | | this.saveOrUpdate(appUser); |
| | | inviteUserService.saveInviteUser(appUser.getId(), inviteUserId); |
| | | return this.getUserInfo(appUser); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,String phone) { |
| | | public Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,String phone,Long inviteUserId) { |
| | | // 通过手机号查询用户,是否已存在手动导入用户,包含微信用户 |
| | | TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone, phone) |
| | |
| | | if(Objects.nonNull(appUser.getStatus())){ |
| | | throwInfo(appUser.getStatus()); |
| | | } |
| | | appUser.setInviteUserId(inviteUserId); |
| | | appUser.setAliOpenid(response.getOpenId()); |
| | | this.saveOrUpdate(appUser); |
| | | inviteUserService.saveInviteUser(appUser.getId(), inviteUserId); |
| | | return this.getUserInfo(appUser); |
| | | } |
| | | // @Override |
| | |
| | | case 2: |
| | | throw new ServiceException("账号被冻结,请联系管理员"); |
| | | case 3: |
| | | throw new ServiceException("账号已注销,请重新注册使用"); |
| | | // throw new ServiceException("账号已注销,请重新注册使用"); |
| | | default: |
| | | break; |
| | | } |