|
@@ -15,6 +15,7 @@ import com.zanxiang.game.back.base.rpc.ITencentMiniGameBackRpc;
|
|
|
import com.zanxiang.game.back.base.rpc.ITtAppBackRpc;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.AccountTypeEnum;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
|
|
|
+import com.zanxiang.game.module.base.pojo.enums.PayDeviceEnum;
|
|
|
import com.zanxiang.game.module.mybatis.entity.*;
|
|
|
import com.zanxiang.game.module.mybatis.mapper.GameBackLogMediaSdkMapper;
|
|
|
import com.zanxiang.game.module.sdk.constant.RedisKeyConstant;
|
|
@@ -107,7 +108,7 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
|
return resultMap;
|
|
|
}
|
|
|
//玩家渠道信息回传检测
|
|
|
- Tuple2<Boolean, Agent> userAgentCheckTuple2 = this.userAgentCheck(user, resultMap);
|
|
|
+ Tuple2<Boolean, Agent> userAgentCheckTuple2 = this.userAgentCheck(user, resultMap, param);
|
|
|
if (!userAgentCheckTuple2.first) {
|
|
|
return resultMap;
|
|
|
}
|
|
@@ -257,27 +258,42 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private Tuple2<Boolean, Agent> userAgentCheck(User user, Map<String, Object> resultMap) {
|
|
|
- //判断玩家是否为自然量或者被分享用户, 是则不执行回传
|
|
|
- if (Objects.equals(user.getAgentId(), Agent.DEFAULT_AGENT) || user.getShareUserId() != null) {
|
|
|
+ private Tuple2<Boolean, Agent> userAgentCheck(User user, Map<String, Object> resultMap, CallBackControlParam param) {
|
|
|
+ //玩家渠道
|
|
|
+ Agent agent = agentService.getById(user.getAgentId());
|
|
|
+ //买量用户, 返回执行回传, 且返回渠道信息
|
|
|
+ if (agent != null && user.getShareUserId() == null) {
|
|
|
+ return Tuple2.with(Boolean.TRUE, agent);
|
|
|
+ }
|
|
|
+ //查询游戏
|
|
|
+ Game game = gameService.getById(user.getGameId());
|
|
|
+ //非买量, 安卓APP, 不回传
|
|
|
+ if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
|
resultMap.put("backMsg", "玩家属于自然量或者被分享用户, 不回传");
|
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
|
}
|
|
|
- //判断玩家是否存在渠道, 不存在渠道则不回传
|
|
|
- Agent agent = agentService.getById(user.getAgentId());
|
|
|
- if (agent == null) {
|
|
|
- resultMap.put("backMsg", "根据玩家渠道id查询渠道信息为空, 无法执行回传");
|
|
|
+ //非买量, 新手引导无法回传
|
|
|
+ if (Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_TUTORIAL_FINISH)) {
|
|
|
+ resultMap.put("backMsg", "非买量, 新手引导回传无法判定, 不回传");
|
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
|
}
|
|
|
- //返回执行回传, 且返回渠道信息
|
|
|
- return Tuple2.with(Boolean.TRUE, agent);
|
|
|
+ //非买量, 订单回传, 不继续判断, 直接回传
|
|
|
+ if (Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_PAY_ORDER)) {
|
|
|
+ resultMap.put("callBack", Boolean.TRUE);
|
|
|
+ resultMap.put("backMsg", "微信小游戏自然量订单全量回传");
|
|
|
+ PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
|
+ resultMap.put("amount", platformOrderDTO.getAmount().longValue() * 100);
|
|
|
+ return Tuple2.with(Boolean.FALSE, null);
|
|
|
+ }
|
|
|
+ //其他回传, 还是走判断
|
|
|
+ return Tuple2.with(Boolean.TRUE, null);
|
|
|
}
|
|
|
|
|
|
private void checkCallBack(User user, Agent agent, Map<String, Object> resultMap, CallBackControlParam param) {
|
|
|
//玩家id
|
|
|
Long userId = user.getId();
|
|
|
//游戏id
|
|
|
- Long gameId = agent.getGameId();
|
|
|
+ Long gameId = user.getGameId();
|
|
|
//角色id
|
|
|
String roleId = param.getRoleId();
|
|
|
//角色等级
|
|
@@ -484,7 +500,7 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
|
doBack = orderBackQueryRpcVO.getDoBack();
|
|
|
backMsg = orderBackQueryRpcVO.getBackMsg();
|
|
|
}
|
|
|
- //腾讯小游戏媒体SDK回传
|
|
|
+ //腾讯小游戏投腾讯广告
|
|
|
if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_MINI_GAME.getValue())) {
|
|
|
TencentMiniGameOrderBackQueryRpcDTO orderQuery = this.transform(user.getOpenId(), orderId, agent);
|
|
|
OrderBackQueryRpcVO orderBackQueryRpcVO = tencentMiniGameBackRpc.orderBackQuery(orderQuery).getData();
|
|
@@ -493,6 +509,22 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
|
}
|
|
|
doBack = orderBackQueryRpcVO.getDoBack();
|
|
|
backMsg = orderBackQueryRpcVO.getBackMsg();
|
|
|
+ //米大师支付会被监听, 漏单修正, 直接更改结果为回传1分钱
|
|
|
+ if (Objects.equals(orderBackQueryRpcVO.getDoBack(), Boolean.FALSE)) {
|
|
|
+ PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(orderId);
|
|
|
+ if (Objects.equals(platformOrderDTO.getPayDeviceId(), PayDeviceEnum.MI_PAY.getPayDeviceId())) {
|
|
|
+ doBack = Boolean.TRUE;
|
|
|
+ amount = Collections.singletonList(1L);
|
|
|
+ backMsg = "米大师漏单, 修改回传金额为1分钱回传";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //微信小游戏投巨量广告 (坑逼腾讯要其他渠道的订单数据)
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
+ PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(orderId);
|
|
|
+ doBack = Boolean.TRUE;
|
|
|
+ amount = Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100);
|
|
|
+ backMsg = "微信小游戏投巨量广告, 订单回传给腾讯媒体SDK";
|
|
|
}
|
|
|
return Tuple3.with(doBack, amount, Strings.isBlank(backMsg) ? "未知的渠道投放类型" : backMsg);
|
|
|
}
|