升级创客

This commit is contained in:
韩鹏辉
2023-07-11 14:59:07 +08:00
parent 056bd8169d
commit f40c48fab9
3 changed files with 46 additions and 6 deletions

View File

@@ -400,7 +400,7 @@ public interface UserAppService extends IService<UserApp> {
UserApp getUserAppByPhone(String phone, UserApp userApp);
void applyMarker(UserApp userApp);
void applyMarker(UserApp userApp,String code) throws Exception;
}

View File

@@ -1923,8 +1923,43 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
@Autowired
@Lazy
UserPromotionMapper userPromotionMapper;
@Autowired
@Lazy
MerchantBaseInfoService merchantBaseInfoService;
@Transactional(rollbackFor = Exception.class)
@Override
public void applyMarker(UserApp userApp) {
public void applyMarker(UserApp userApp,String code) throws Exception{
UserInfo userInfo=new UserInfo();
userInfo.setId(userApp.getUserId());
UserInfo userInfos= userInfoService.queryUserInfo(userInfo);
if(ObjectUtil.isEmpty(userInfos)){
MsgException.checkNull(null,"用户信息不存在");
}
PhoneValidateCode phoneValidateCode = new PhoneValidateCode();
phoneValidateCode.setPhone(userInfos.getPhone());
phoneValidateCode = phoneValidateCodeService.queryPhoneValidateCode(phoneValidateCode);
if (phoneValidateCode == null) {
throw new MsgException("无效的验证码!");
}
if (!phoneValidateCode.getCode().equalsIgnoreCase(code)) {
throw new MsgException("无效的验证码!");
}
MerchantBaseInfo baseInfo= merchantBaseInfoService.getMerchantBaseInfoByUserId(userInfos.getId().toString());
if(ObjectUtil.isEmpty(baseInfo)){
MsgException.checkNull(null,"商户信息不存在");
}
if(!"1".equals(baseInfo.getMerchantType())){
MsgException.checkNull(null,"非小微不允许升级创客");
}
UserMarker marker= userMarkerMapper.selectById(userApp.getUserId());
if(ObjectUtil.isNotEmpty(marker)){