|  | @@ -1,6 +1,7 @@
 | 
	
		
			
				|  |  |  package com.zanxiang.game.back.serve.rpc.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
	
		
			
				|  |  | +import com.github.sd4324530.jtuple.Tuple2;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.base.pojo.dto.*;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.base.pojo.enums.OrderStatusEnum;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.back.base.rpc.ITencentAppApiBackRpc;
 | 
	
	
		
			
				|  | @@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.apache.dubbo.config.annotation.DubboService;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import reactor.util.function.Tuples;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.time.LocalDateTime;
 | 
	
		
			
				|  |  |  import java.util.Objects;
 | 
	
	
		
			
				|  | @@ -77,8 +79,12 @@ public class TencentAppApiBackRpcImpl implements ITencentAppApiBackRpc {
 | 
	
		
			
				|  |  |                  .createTime(LocalDateTime.now())
 | 
	
		
			
				|  |  |                  .build();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        GameTencentAppCallback callback = gameTencentAppCallbackService.getUserCallback(userLog.getGameId(), userLog.getImei(), userLog.getOaid(), userLog.getAndroidId(), userLog.getIdfa(), userLog.getCaid(), userLog.getIp(), userLog.getRegisterTime());
 | 
	
		
			
				|  |  | -        userLog.setCallbackId(callback == null ? -1L : callback.getId());
 | 
	
		
			
				|  |  | +        if(dto.getCallbackId() != null) {
 | 
	
		
			
				|  |  | +            userLog.setCallbackId(dto.getCallbackId());
 | 
	
		
			
				|  |  | +        } else  {
 | 
	
		
			
				|  |  | +            GameTencentAppCallback callback = gameTencentAppCallbackService.getUserCallback(userLog.getGameId(), userLog.getImei(), userLog.getOaid(), userLog.getAndroidId(), userLog.getIdfa(), userLog.getCaid(), userLog.getIp(), userLog.getRegisterTime());
 | 
	
		
			
				|  |  | +            userLog.setCallbackId(callback == null ? -1L : callback.getId());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          gameTencentAppApiUserService.save(userLog);
 | 
	
		
			
				|  |  |          return ResultVO.ok(true);
 | 
	
		
			
				|  |  |          // 激活现在默认不回传了,等创角的时候一起回传
 | 
	
	
		
			
				|  | @@ -207,17 +213,11 @@ public class TencentAppApiBackRpcImpl implements ITencentAppApiBackRpc {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public ResultVO<String> queryUserAgentFromCallback(TencentAppApiUserAgentQueryRpcDTO dto) {
 | 
	
		
			
				|  |  | -        GameTencentAppApiUser user = gameTencentAppApiUserService.getOne(new LambdaQueryWrapper<GameTencentAppApiUser>()
 | 
	
		
			
				|  |  | -                .eq(GameTencentAppApiUser::getGameId, dto.getGameId())
 | 
	
		
			
				|  |  | -                .eq(GameTencentAppApiUser::getUserId, dto.getUserId())
 | 
	
		
			
				|  |  | -                .orderByDesc(GameTencentAppApiUser::getCreateTime)
 | 
	
		
			
				|  |  | -                .last("limit 1")
 | 
	
		
			
				|  |  | -        );
 | 
	
		
			
				|  |  | -        if(user == null || user.getCallbackId() == null || user.getCallbackId() < 1) {
 | 
	
		
			
				|  |  | +    public ResultVO<Tuple2<String, Long>> queryUserAgentFromCallback(TencentAppApiUserAgentQueryRpcDTO dto) {
 | 
	
		
			
				|  |  | +        GameTencentAppCallback callback = gameTencentAppCallbackService.getUserCallback(dto.getGameId(), dto.getImei(), dto.getOaid(), dto.getAndroidId(), dto.getIdfa(), dto.getCaid(), dto.getRegIp(), dto.getRegisterTime());
 | 
	
		
			
				|  |  | +        if(callback == null) {
 | 
	
		
			
				|  |  |              return ResultVO.ok(null);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        GameTencentAppCallback callback = gameTencentAppCallbackService.getById(user.getCallbackId());
 | 
	
		
			
				|  |  | -        return ResultVO.ok(callback.getAgentKey());
 | 
	
		
			
				|  |  | +        return ResultVO.ok(Tuple2.with(callback.getAgentKey(), callback.getId()));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |