Commit 6adc42e4 authored by 于桐's avatar 于桐

微信小程序关联用户(新用户自动注册),增加vcc推广注册渠道ID

parent de088d39
......@@ -47,10 +47,12 @@ public class AppletController {
}
/**
* 微信小程序关联用户(新用户自动注册)
* @return
*/
@PostMapping("/relevance")
public JsonResult relevance(@Validated @RequestBody AppletParamEntry appletParamEntry) {
log.info("[applet][relevance] 微信小程序关联用户: [{}]", appletParamEntry);
if (!containsAppName(appletParamEntry.getAppName())) {
throw new DataException("appName不合法");
}
......
......@@ -28,6 +28,10 @@ public class AppletParamEntry {
*/
@NotNull(message = "02:channelId 不能为空")
private Long channelId;
/**
* vcc注册推广渠道号
*/
private Long vccRegisterChannelId;
/**
* 小程序openid
*/
......
......@@ -70,7 +70,7 @@ public class AppletServiceImpl implements IAppletService {
User user = userService.findByPhoneInDb(appletParamEntry.getMobile());
//如果不存在就去注册一下
if (null == user) {
user = iUserRegisterService.register(appletParamEntry.getChannelId(), appletParamEntry.getMobile());
user = iUserRegisterService.registerVcc(appletParamEntry.getChannelId(), appletParamEntry.getMobile(), appletParamEntry.getVccRegisterChannelId());
}
wechatUserInfo.setUserId(user.getId());
}
......
......@@ -13,6 +13,8 @@ import java.util.List;
public interface IUserRegisterService {
User register(Long registerFrom, String phoneNo);
User registerVcc(Long registerFrom, String phoneNo, Long vccRegisterChannelId);
/**
* 替换AppController.register
* /app/login,/app/login_super
......
......@@ -50,6 +50,23 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
return user;
}
@Transactional(rollbackFor = Exception.class)
@Override
public User registerVcc(Long registerFrom, String phoneNo, Long vccRegisterChannelId) {
UserRegisterParam userRegisterParam = UserRegisterParam.builder()
.registerFrom(registerFrom)
.phoneNo(phoneNo)
.channelId(registerFrom)
.vccRegisterChannelId(vccRegisterChannelId)
.sendSuccessSms(true)
.sendAppSms(true)
.sendSuccessMq(true)
.build();
User user = saveUser(userRegisterParam);
applicationEventPublisher.publishEvent(new RegisterEvent(this, userRegisterParam));
return user;
}
@Transactional(rollbackFor = Exception.class)
@Override
public User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment