|
@@ -8,6 +8,7 @@ import com.github.sd4324530.jtuple.Tuple3;
|
|
|
import com.zanxiang.game.back.base.ServerInfo;
|
|
|
import com.zanxiang.game.back.base.pojo.dto.TencentMiniGameOrderBackQueryRpcDTO;
|
|
|
import com.zanxiang.game.back.base.pojo.dto.TtAppOrderBackQueryRpcDTO;
|
|
|
+import com.zanxiang.game.back.base.pojo.enums.OrderStatusEnum;
|
|
|
import com.zanxiang.game.back.base.pojo.vo.GameBackPolicyRpcVO;
|
|
|
import com.zanxiang.game.back.base.pojo.vo.OrderBackQueryRpcVO;
|
|
|
import com.zanxiang.game.back.base.rpc.IGameBackPolicyRpc;
|
|
@@ -240,17 +241,20 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
|
//判断是否订单付费回传, 添加回传金额
|
|
|
if (Objects.equals(callBackTypeEnum, CallBackTypeEnum.CALL_BACK_PAY_ORDER) && Strings.isNotBlank(param.getOrderId())) {
|
|
|
PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
|
- if (platformOrderDTO == null || platformOrderDTO.getAmount() == null) {
|
|
|
- return false;
|
|
|
- }
|
|
|
//头条APP媒体回传, 返回的单位是元
|
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
|
resultMap.put("amount", Collections.singletonList(platformOrderDTO.getAmount().intValue()));
|
|
|
}
|
|
|
//腾讯小游戏媒体SDK回传, 返回的单位是分, 乘以100
|
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_WX_APPLET.getId())) {
|
|
|
- int amount = platformOrderDTO.getAmount().multiply(new BigDecimal(100)).intValue();
|
|
|
- resultMap.put("amount", Collections.singletonList(amount));
|
|
|
+ //订单未支付或者已回传
|
|
|
+ if (this.orderPayAndBackCheck(platformOrderDTO)) {
|
|
|
+ resultMap.put("callBack", Boolean.FALSE);
|
|
|
+ resultMap.put("backMsg", "微信小游戏投放腾讯广告或巨量广告, 测试账号, 订单未支付或已回传");
|
|
|
+ } else {
|
|
|
+ int amount = platformOrderDTO.getAmount().multiply(new BigDecimal(100)).intValue();
|
|
|
+ resultMap.put("amount", Collections.singletonList(amount));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//返回结果
|
|
@@ -266,28 +270,31 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
|
}
|
|
|
//查询游戏
|
|
|
Game game = gameService.getById(user.getGameId());
|
|
|
- //非买量, 安卓APP, 不回传
|
|
|
+ //自然量安卓APP, 不回传
|
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
|
- resultMap.put("backMsg", "玩家属于自然量或者被分享用户, 不回传");
|
|
|
+ resultMap.put("backMsg", "自然量安卓APP, 不执行回传");
|
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
|
}
|
|
|
- //非买量, 新手引导无法回传
|
|
|
+ //自然量微信小游戏, 新手引导无法回传, 无法定义新手引导回传等级
|
|
|
if (Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_TUTORIAL_FINISH)) {
|
|
|
- resultMap.put("backMsg", "非买量, 新手引导回传无法判定, 不回传");
|
|
|
- return Tuple2.with(Boolean.FALSE, null);
|
|
|
- }
|
|
|
- //非买量, 订单回传, 不继续判断, 直接回传
|
|
|
- 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", Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100));
|
|
|
+ resultMap.put("backMsg", "自然量微信小游戏, 新手引导回传无法判定, 不回传");
|
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
|
}
|
|
|
//其他回传, 还是走判断
|
|
|
return Tuple2.with(Boolean.TRUE, null);
|
|
|
}
|
|
|
|
|
|
+ private boolean orderPayAndBackCheck(PlatformOrderDTO platformOrderDTO) {
|
|
|
+ //订单未支付或者已回传
|
|
|
+ return !Objects.equals(platformOrderDTO.getStatus(), OrderStatusEnum.SUCCESS_PAY.getValue())
|
|
|
+ || super.count(new LambdaQueryWrapper<GameBackLogMediaSdk>()
|
|
|
+ .eq(GameBackLogMediaSdk::getGameId, platformOrderDTO.getGameId())
|
|
|
+ .eq(GameBackLogMediaSdk::getUserId, platformOrderDTO.getUserId())
|
|
|
+ .eq(GameBackLogMediaSdk::getOrderId, platformOrderDTO.getOrderId())
|
|
|
+ .eq(GameBackLogMediaSdk::getCallBackTypeEnum, CallBackTypeEnum.CALL_BACK_PAY_ORDER.getValue())
|
|
|
+ ) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
private void checkCallBack(User user, Agent agent, Map<String, Object> resultMap, CallBackControlParam param) {
|
|
|
//玩家id
|
|
|
Long userId = user.getId();
|
|
@@ -498,19 +505,19 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
|
doBack = orderBackQueryRpcVO.getDoBack();
|
|
|
backMsg = orderBackQueryRpcVO.getBackMsg();
|
|
|
}
|
|
|
- //订单信息
|
|
|
- PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(orderId);
|
|
|
- //腾讯小游戏投腾讯广告
|
|
|
- if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_MINI_GAME.getValue())) {
|
|
|
- doBack = Boolean.TRUE;
|
|
|
- amount = Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100);
|
|
|
- backMsg = "腾讯小游戏投腾讯广告, 订单全量满金额回传腾讯媒体SDK";
|
|
|
- }
|
|
|
- //微信小游戏投巨量广告 (坑逼腾讯要其他渠道的订单数据)
|
|
|
- if (Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
- doBack = Boolean.TRUE;
|
|
|
- amount = Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100);
|
|
|
- backMsg = "微信小游戏投巨量广告, 订单全量满金额回传腾讯媒体SDK";
|
|
|
+ //微信小游戏投放腾讯广告或巨量广告 (坑逼腾讯要其他渠道的订单数据)
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_MINI_GAME.getValue())
|
|
|
+ || Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
+ PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(orderId);
|
|
|
+ //订单未支付成功或者已经回传, 不执行回传
|
|
|
+ if (this.orderPayAndBackCheck(platformOrderDTO)) {
|
|
|
+ doBack = Boolean.FALSE;
|
|
|
+ backMsg = "微信小游戏投放腾讯广告或巨量广告, 订单未支付或已回传";
|
|
|
+ } else {
|
|
|
+ doBack = Boolean.TRUE;
|
|
|
+ amount = Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100);
|
|
|
+ backMsg = "微信小游戏投放腾讯广告或巨量广告, 订单全量满金额回传";
|
|
|
+ }
|
|
|
}
|
|
|
return Tuple3.with(doBack, amount, Strings.isBlank(backMsg) ? "未知的渠道投放类型" : backMsg);
|
|
|
}
|