|
@@ -6,9 +6,11 @@ import com.zanxiang.game.module.mybatis.entity.User;
|
|
|
import com.zanxiang.game.module.mybatis.entity.UserAgentLog;
|
|
|
import com.zanxiang.game.module.mybatis.mapper.UserAgentLogMapper;
|
|
|
import com.zanxiang.game.module.sdk.service.IUserAgentLogService;
|
|
|
+import com.zanxiang.module.util.JsonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.logging.log4j.util.Strings;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import reactor.util.function.Tuple3;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
@@ -35,15 +37,15 @@ public class UserAgentLogServiceImpl extends ServiceImpl<UserAgentLogMapper, Use
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean agentUpdateLog(User user, Long newAgentId, String newChannel) {
|
|
|
+ public boolean agentUpdateLog(Tuple3<Long, Long, String> oldAgentChannel, Long newAgentId, String newChannel) {
|
|
|
if (newAgentId == null || Strings.isBlank(newChannel)) {
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
try {
|
|
|
- return super.save(this.transform(user, newAgentId, newChannel));
|
|
|
+ return super.save(this.transform(oldAgentChannel, newAgentId, newChannel));
|
|
|
} catch (Exception e) {
|
|
|
- log.error("用户渠道更新记录保存异常, userId : {}, newAgentId : {}, newChannel : {}, e : {}",
|
|
|
- user.getId(), newAgentId, newChannel, e.getMessage());
|
|
|
+ log.error("用户渠道更新记录保存异常, oldAgentChannel : {}, newAgentId : {}, newChannel : {}, e : {}",
|
|
|
+ JsonUtil.toString(oldAgentChannel), newAgentId, newChannel, e.getMessage());
|
|
|
}
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
@@ -58,11 +60,11 @@ public class UserAgentLogServiceImpl extends ServiceImpl<UserAgentLogMapper, Use
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
- private UserAgentLog transform(User user, Long newAgentId, String newChannel) {
|
|
|
+ private UserAgentLog transform(Tuple3<Long, Long, String> oldAgentChannel, Long newAgentId, String newChannel) {
|
|
|
return UserAgentLog.builder()
|
|
|
- .userId(user.getId())
|
|
|
- .oldAgentId(Agent.DEFAULT_AGENT.equals(user.getAgentId()) ? null : user.getAgentId())
|
|
|
- .oldChannel(Agent.DEFAULT_AGENT.equals(user.getAgentId()) ? null : user.getChannel())
|
|
|
+ .userId(oldAgentChannel.getT1())
|
|
|
+ .oldAgentId(Agent.DEFAULT_AGENT.equals(oldAgentChannel.getT2()) ? null : oldAgentChannel.getT2())
|
|
|
+ .oldChannel(Agent.DEFAULT_AGENT.equals(oldAgentChannel.getT2()) ? null : oldAgentChannel.getT3())
|
|
|
.newAgentId(newAgentId)
|
|
|
.newChannel(newChannel)
|
|
|
.createTime(LocalDateTime.now())
|