|
@@ -502,9 +502,9 @@ public class CpPushDataServiceImpl implements ICpPushDataService {
|
|
|
.last("limit 1"));
|
|
|
user = this.transform(gameId, shareUser, param);
|
|
|
} else {
|
|
|
- Tuple2<Long, Map<String, String>> tuple2 = this.getUserAgentChannel(game, userData);
|
|
|
- user = this.transform(gameId, tuple2, param);
|
|
|
- channelMap = tuple2.getT2();
|
|
|
+ Tuple3<Long, Map<String, String>, String> tuple3 = this.getUserAgentChannel(game, userData);
|
|
|
+ user = this.transform(gameId, tuple3, param);
|
|
|
+ channelMap = tuple3.getT2();
|
|
|
}
|
|
|
userService.save(user);
|
|
|
gameUserService.createGameUser(user);
|
|
@@ -542,9 +542,9 @@ public class CpPushDataServiceImpl implements ICpPushDataService {
|
|
|
return Collections.emptyMap();
|
|
|
}
|
|
|
//渠道id, 链接参数
|
|
|
- Tuple2<Long, Map<String, String>> tuple2 = this.getUserAgentChannel(game, userData);
|
|
|
+ Tuple3<Long, Map<String, String>, String> tuple3 = this.getUserAgentChannel(game, userData);
|
|
|
//查询渠道
|
|
|
- Agent agent = agentService.getById(tuple2.getT1());
|
|
|
+ Agent agent = agentService.getById(tuple3.getT1());
|
|
|
if (agent == null) {
|
|
|
return Collections.emptyMap();
|
|
|
}
|
|
@@ -556,30 +556,30 @@ public class CpPushDataServiceImpl implements ICpPushDataService {
|
|
|
//添加渠道变更记录
|
|
|
userAgentLogService.agentUpdateLog(user, agent.getId(), userData.getChannel());
|
|
|
//回传用户信息
|
|
|
- callBackService.userCallBack(user, tuple2.getT2());
|
|
|
+ callBackService.userCallBack(user, tuple3.getT2());
|
|
|
//渠道变更信息埋点数据发送到卡夫卡
|
|
|
kafkaService.eventTrack(KafkaEventTrackEnum.KAFKA_EVENT_TRACK_AGENT_UPDATE, JsonUtil.toString(user));
|
|
|
//返回更新的渠道信息
|
|
|
- return tuple2.getT2();
|
|
|
+ return tuple3.getT2();
|
|
|
}
|
|
|
|
|
|
- private Tuple2<Long, Map<String, String>> getUserAgentChannel(Game game, UserData userData) {
|
|
|
+ private Tuple3<Long, Map<String, String>, String> getUserAgentChannel(Game game, UserData userData) {
|
|
|
//解析渠道信息
|
|
|
String channel = new String(Base64.getDecoder().decode(userData.getChannel()));
|
|
|
//没有携带渠道标识, 无法解析渠道信息, 判定为自然量
|
|
|
if (!channel.contains("agentKey") || !channel.contains("state")) {
|
|
|
- return Tuples.of(0L, Collections.emptyMap());
|
|
|
+ return Tuples.of(0L, Collections.emptyMap(), channel);
|
|
|
}
|
|
|
Tuple2<Boolean, Boolean> jsonAndEmpty = this.isJsonAndEmpty(channel);
|
|
|
//channel渠道信息非json格式, 或者是空json
|
|
|
if (!jsonAndEmpty.getT1() || jsonAndEmpty.getT2()) {
|
|
|
//返回自然量渠道
|
|
|
- return Tuples.of(0L, Collections.emptyMap());
|
|
|
+ return Tuples.of(0L, Collections.emptyMap(), channel);
|
|
|
}
|
|
|
//渠道id, 链接参数, 分享人id
|
|
|
Tuple3<Long, Map<String, String>, String> tuple3 = agentService.getUserAgentId(game, userData);
|
|
|
//返回渠道id, 渠道参数
|
|
|
- return Tuples.of(tuple3.getT1(), tuple3.getT2());
|
|
|
+ return Tuples.of(tuple3.getT1(), tuple3.getT2(), channel);
|
|
|
}
|
|
|
|
|
|
private User transform(Long gameId, User shareUser, CpPushUserParam param) {
|
|
@@ -602,12 +602,12 @@ public class CpPushDataServiceImpl implements ICpPushDataService {
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
- private User transform(Long gameId, Tuple2<Long, Map<String, String>> tuple2, CpPushUserParam param) {
|
|
|
+ private User transform(Long gameId, Tuple3<Long, Map<String, String>, String> tuple3, CpPushUserParam param) {
|
|
|
return User.builder()
|
|
|
.openId(param.getOpenId())
|
|
|
- .regAgentId(tuple2.getT1())
|
|
|
- .agentId(tuple2.getT1())
|
|
|
- .channel(JsonUtil.toString(tuple2.getT2()))
|
|
|
+ .regAgentId(tuple3.getT1())
|
|
|
+ .agentId(tuple3.getT1())
|
|
|
+ .channel(tuple3.getT2().isEmpty() ? tuple3.getT3() : JsonUtil.toString(tuple3.getT2()))
|
|
|
.gameId(gameId)
|
|
|
.username(param.getOpenId())
|
|
|
.nickname(RegisterUtil.randomNickName(param.getOpenId()))
|