|
@@ -1,20 +1,13 @@
|
|
|
package com.zanxiang.game.module.sdk.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.github.sd4324530.jtuple.Tuple2;
|
|
|
-import com.zanxiang.game.module.mybatis.entity.Agent;
|
|
|
import com.zanxiang.game.module.mybatis.entity.Game;
|
|
|
-import com.zanxiang.game.module.mybatis.entity.User;
|
|
|
import com.zanxiang.game.module.mybatis.mapper.GameMapper;
|
|
|
import com.zanxiang.game.module.sdk.pojo.param.UserData;
|
|
|
-import com.zanxiang.game.module.sdk.service.IAgentService;
|
|
|
import com.zanxiang.game.module.sdk.service.IGameService;
|
|
|
-import com.zanxiang.game.module.sdk.service.IUserEventService;
|
|
|
-import com.zanxiang.game.module.sdk.service.IUserService;
|
|
|
import com.zanxiang.module.util.JsonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.logging.log4j.util.Strings;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Collections;
|
|
@@ -29,15 +22,6 @@ import java.util.Map;
|
|
|
@Service
|
|
|
public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IGameService {
|
|
|
|
|
|
- @Autowired
|
|
|
- private IUserService userService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IAgentService agentService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IUserEventService userEventService;
|
|
|
-
|
|
|
@Override
|
|
|
public Map<String, Object> getAdSdkConfig(UserData userData) {
|
|
|
Game game = super.getById(userData.getGameId());
|
|
@@ -45,48 +29,5 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
return Collections.singletonMap("adSdk", 0);
|
|
|
}
|
|
|
return JsonUtil.toMap(game.getAdSdkConfig(), Map.class, Object.class);
|
|
|
-// //判断是否为APP, APP直接返回配置
|
|
|
-// if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
|
-// return JsonUtil.toMap(game.getAdSdkConfig(), Map.class, Object.class);
|
|
|
-// }
|
|
|
-// //查询用户信息以及投放渠道
|
|
|
-// Tuple2<User, Agent> userAndAgent = this.getUserAndAgent(userData.getUserId());
|
|
|
-// User user = userAndAgent.first;
|
|
|
-// Agent agent = userAndAgent.second;
|
|
|
-// //渠道判断, 目前只有投腾讯才返回
|
|
|
-// if (agent != null) {
|
|
|
-// //腾讯广告
|
|
|
-// if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_MINI_GAME.getValue())) {
|
|
|
-// return JsonUtil.toMap(game.getAdSdkConfig(), Map.class, Object.class);
|
|
|
-// }
|
|
|
-// //头条广告
|
|
|
-// if (Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
-// return Collections.singletonMap("adSdk", 0);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// //用户判断, 是否调试阶段和测试用户
|
|
|
-// if (user != null) {
|
|
|
-// if (Objects.equals(game.getStatus(), 2) || userEventService.count(new LambdaQueryWrapper<UserEvent>()
|
|
|
-// .eq(UserEvent::getGameId, user.getGameId())
|
|
|
-// .and(qw -> qw.eq(UserEvent::getUsername, user.getUsername())
|
|
|
-// .or().eq(UserEvent::getUsername, user.getOpenId())
|
|
|
-// .or().eq(UserEvent::getMobile, user.getMobile()))
|
|
|
-// ) > 0) {
|
|
|
-// return JsonUtil.toMap(game.getAdSdkConfig(), Map.class, Object.class);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// //默认返回不初始化
|
|
|
-// return Collections.singletonMap("adSdk", 0);
|
|
|
- }
|
|
|
-
|
|
|
- private Tuple2<User, Agent> getUserAndAgent(Long userId) {
|
|
|
- if (userId == null) {
|
|
|
- return Tuple2.with(null, null);
|
|
|
- }
|
|
|
- User user = userService.getById(userId);
|
|
|
- if (user == null) {
|
|
|
- return Tuple2.with(null, null);
|
|
|
- }
|
|
|
- return Tuple2.with(user, agentService.getById(user.getAgentId()));
|
|
|
}
|
|
|
}
|