|  | @@ -7,6 +7,7 @@ import com.zanxiang.game.module.mybatis.entity.UserVisitLog;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.module.mybatis.mapper.UserVisitLogMapper;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.module.sdk.service.IAgentService;
 | 
	
		
			
				|  |  |  import com.zanxiang.game.module.sdk.service.IUserVisitLogService;
 | 
	
		
			
				|  |  | +import com.zanxiang.module.util.JsonUtil;
 | 
	
		
			
				|  |  |  import com.zanxiang.module.web.util.IpUtil;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  |  import org.apache.logging.log4j.util.Strings;
 | 
	
	
		
			
				|  | @@ -36,19 +37,25 @@ public class UserVisitLogServiceImpl extends ServiceImpl<UserVisitLogMapper, Use
 | 
	
		
			
				|  |  |      public boolean visitLogCreate(String url, String userAgent, HttpServletRequest httpServletRequest) {
 | 
	
		
			
				|  |  |          //解析url
 | 
	
		
			
				|  |  |          Map<String, String> urlParamMap = this.getUrlParameter(url);
 | 
	
		
			
				|  |  | +        log.error("下载地址访问上报参数 urlParamMap : {}", JsonUtil.toString(urlParamMap));
 | 
	
		
			
				|  |  |          //获取渠道标识
 | 
	
		
			
				|  |  | -        String state = urlParamMap.get("agentId");
 | 
	
		
			
				|  |  | -        if (Strings.isBlank(state)) {
 | 
	
		
			
				|  |  | -            state = urlParamMap.get("agentKey");
 | 
	
		
			
				|  |  | +        Agent agent = null;
 | 
	
		
			
				|  |  | +        String agentId = urlParamMap.get("agentId");
 | 
	
		
			
				|  |  | +        String agentKey = urlParamMap.get("agentKey");
 | 
	
		
			
				|  |  | +        if (Strings.isNotBlank(agentId)) {
 | 
	
		
			
				|  |  | +            agent = agentService.getById(agentId);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (agent == null && Strings.isNotBlank(agentKey)) {
 | 
	
		
			
				|  |  | +            agent = agentService.getOne(new LambdaQueryWrapper<Agent>().eq(Agent::getAgentKey, agentKey));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //判断是否存在渠道
 | 
	
		
			
				|  |  | +        if (agent == null) {
 | 
	
		
			
				|  |  | +            return Boolean.FALSE;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        final String agentSign = state;
 | 
	
		
			
				|  |  | -        //查询渠道信息
 | 
	
		
			
				|  |  | -        Agent agent = agentService.getOne(new LambdaQueryWrapper<Agent>()
 | 
	
		
			
				|  |  | -                .and(qw -> qw.eq(Agent::getAgentKey, agentSign).or().eq(Agent::getId, agentSign)));
 | 
	
		
			
				|  |  |          //保存访问记录
 | 
	
		
			
				|  |  |          return super.save(UserVisitLog.builder()
 | 
	
		
			
				|  |  | -                .gameId(agent == null ? null : agent.getGameId())
 | 
	
		
			
				|  |  | -                .agentId(agent == null ? null : agent.getId())
 | 
	
		
			
				|  |  | +                .gameId(agent.getGameId())
 | 
	
		
			
				|  |  | +                .agentId(agent.getId())
 | 
	
		
			
				|  |  |                  .ip(IpUtil.getRealIp(httpServletRequest))
 | 
	
		
			
				|  |  |                  .ua(userAgent)
 | 
	
		
			
				|  |  |                  .url(urlParamMap.get("url"))
 |