|
@@ -8,6 +8,7 @@ import com.github.sd4324530.jtuple.Tuple3;
|
|
import com.zanxiang.game.back.base.ServerInfo;
|
|
import com.zanxiang.game.back.base.ServerInfo;
|
|
import com.zanxiang.game.back.base.pojo.dto.TencentMiniGameOrderBackQueryRpcDTO;
|
|
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.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.GameBackPolicyRpcVO;
|
|
import com.zanxiang.game.back.base.pojo.vo.OrderBackQueryRpcVO;
|
|
import com.zanxiang.game.back.base.pojo.vo.OrderBackQueryRpcVO;
|
|
import com.zanxiang.game.back.base.rpc.IGameBackPolicyRpc;
|
|
import com.zanxiang.game.back.base.rpc.IGameBackPolicyRpc;
|
|
@@ -240,17 +241,19 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
//判断是否订单付费回传, 添加回传金额
|
|
//判断是否订单付费回传, 添加回传金额
|
|
if (Objects.equals(callBackTypeEnum, CallBackTypeEnum.CALL_BACK_PAY_ORDER) && Strings.isNotBlank(param.getOrderId())) {
|
|
if (Objects.equals(callBackTypeEnum, CallBackTypeEnum.CALL_BACK_PAY_ORDER) && Strings.isNotBlank(param.getOrderId())) {
|
|
PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
- if (platformOrderDTO == null || platformOrderDTO.getAmount() == null) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
//头条APP媒体回传, 返回的单位是元
|
|
//头条APP媒体回传, 返回的单位是元
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
resultMap.put("amount", Collections.singletonList(platformOrderDTO.getAmount().intValue()));
|
|
resultMap.put("amount", Collections.singletonList(platformOrderDTO.getAmount().intValue()));
|
|
}
|
|
}
|
|
//腾讯小游戏媒体SDK回传, 返回的单位是分, 乘以100
|
|
//腾讯小游戏媒体SDK回传, 返回的单位是分, 乘以100
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_WX_APPLET.getId())) {
|
|
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, param.getMipeiSuces())) {
|
|
|
|
+ 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 +269,48 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
}
|
|
}
|
|
//查询游戏
|
|
//查询游戏
|
|
Game game = gameService.getById(user.getGameId());
|
|
Game game = gameService.getById(user.getGameId());
|
|
- //非买量, 安卓APP, 不回传
|
|
|
|
|
|
+ //自然量安卓APP, 不回传
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_APP.getId())) {
|
|
- resultMap.put("backMsg", "玩家属于自然量或者被分享用户, 不回传");
|
|
|
|
|
|
+ resultMap.put("backMsg", "自然量安卓APP, 不执行回传");
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
}
|
|
}
|
|
- //非买量, 新手引导无法回传
|
|
|
|
|
|
+ //自然量微信小游戏, 新手引导无法回传, 无法定义新手引导回传等级
|
|
if (Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_TUTORIAL_FINISH)) {
|
|
if (Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_TUTORIAL_FINISH)) {
|
|
- resultMap.put("backMsg", "非买量, 新手引导回传无法判定, 不回传");
|
|
|
|
|
|
+ resultMap.put("backMsg", "自然量微信小游戏, 新手引导回传无法判定, 不回传");
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
}
|
|
}
|
|
- //非买量, 订单回传, 不继续判断, 直接回传
|
|
|
|
|
|
+ //自然量微信小游戏, 全量回传
|
|
if (Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_PAY_ORDER)) {
|
|
if (Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_PAY_ORDER)) {
|
|
- resultMap.put("callBack", Boolean.TRUE);
|
|
|
|
- resultMap.put("backMsg", "微信小游戏自然量订单全量回传");
|
|
|
|
PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
- resultMap.put("amount", Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100));
|
|
|
|
|
|
+ if (this.orderPayAndBackCheck(platformOrderDTO, param.getMipeiSuces())) {
|
|
|
|
+ resultMap.put("callBack", Boolean.FALSE);
|
|
|
|
+ resultMap.put("backMsg", "微信小游戏自然量订单未支付或者已回传");
|
|
|
|
+ } else {
|
|
|
|
+ resultMap.put("callBack", Boolean.TRUE);
|
|
|
|
+ resultMap.put("backMsg", "微信小游戏自然量订单全量回传");
|
|
|
|
+ resultMap.put("amount", Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100));
|
|
|
|
+ }
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
return Tuple2.with(Boolean.FALSE, null);
|
|
}
|
|
}
|
|
//其他回传, 还是走判断
|
|
//其他回传, 还是走判断
|
|
return Tuple2.with(Boolean.TRUE, null);
|
|
return Tuple2.with(Boolean.TRUE, null);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private boolean orderPayAndBackCheck(PlatformOrderDTO platformOrderDTO, Boolean miPaySuccess) {
|
|
|
|
+ //未上线新版本, 直接不检测, 或者是米大师的成功回调, 直接信任
|
|
|
|
+ if (miPaySuccess == null || miPaySuccess) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ //订单是否需要回传, 不需要回传直接返回true
|
|
|
|
+ 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) {
|
|
private void checkCallBack(User user, Agent agent, Map<String, Object> resultMap, CallBackControlParam param) {
|
|
//玩家id
|
|
//玩家id
|
|
Long userId = user.getId();
|
|
Long userId = user.getId();
|
|
@@ -330,7 +353,8 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
resultMap.put("backMsg", tuple2.second);
|
|
resultMap.put("backMsg", tuple2.second);
|
|
break;
|
|
break;
|
|
case CALL_BACK_PAY_ORDER:
|
|
case CALL_BACK_PAY_ORDER:
|
|
- Tuple3<Boolean, List<Long>, String> tuple3 = this.callBackOrderCheck(param.getOrderId(), user, agent);
|
|
|
|
|
|
+ Tuple3<Boolean, List<Long>, String> tuple3 = this.callBackOrderCheck(param.getOrderId(),
|
|
|
|
+ param.getMipeiSuces(), user, agent);
|
|
resultMap.put("callBack", tuple3.first);
|
|
resultMap.put("callBack", tuple3.first);
|
|
resultMap.put("amount", tuple3.second);
|
|
resultMap.put("amount", tuple3.second);
|
|
resultMap.put("backMsg", tuple3.third);
|
|
resultMap.put("backMsg", tuple3.third);
|
|
@@ -483,7 +507,7 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
return Tuple2.with(Boolean.TRUE, "执行新手引导回传");
|
|
return Tuple2.with(Boolean.TRUE, "执行新手引导回传");
|
|
}
|
|
}
|
|
|
|
|
|
- private Tuple3<Boolean, List<Long>, String> callBackOrderCheck(String orderId, User user, Agent agent) {
|
|
|
|
|
|
+ private Tuple3<Boolean, List<Long>, String> callBackOrderCheck(String orderId, Boolean miPaySuccess, User user, Agent agent) {
|
|
Boolean doBack = Boolean.FALSE;
|
|
Boolean doBack = Boolean.FALSE;
|
|
List<Long> amount = null;
|
|
List<Long> amount = null;
|
|
String backMsg = null;
|
|
String backMsg = null;
|
|
@@ -498,30 +522,19 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
doBack = orderBackQueryRpcVO.getDoBack();
|
|
doBack = orderBackQueryRpcVO.getDoBack();
|
|
backMsg = orderBackQueryRpcVO.getBackMsg();
|
|
backMsg = orderBackQueryRpcVO.getBackMsg();
|
|
}
|
|
}
|
|
- //腾讯小游戏投腾讯广告
|
|
|
|
- if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_MINI_GAME.getValue())) {
|
|
|
|
- TencentMiniGameOrderBackQueryRpcDTO orderQuery = this.transform(user.getOpenId(), orderId, agent);
|
|
|
|
- OrderBackQueryRpcVO orderBackQueryRpcVO = tencentMiniGameBackRpc.orderBackQuery(orderQuery).getData();
|
|
|
|
- if (Objects.equals(orderBackQueryRpcVO.getDoBack(), Boolean.TRUE)) {
|
|
|
|
- amount = orderBackQueryRpcVO.getBackMoney();
|
|
|
|
- }
|
|
|
|
- doBack = orderBackQueryRpcVO.getDoBack();
|
|
|
|
- backMsg = orderBackQueryRpcVO.getBackMsg();
|
|
|
|
- //SDK接入后支付会被监听(包含米大师支付和客服支付), 漏单修正, 直接更改结果为回传
|
|
|
|
- if (Objects.equals(orderBackQueryRpcVO.getDoBack(), Boolean.FALSE)) {
|
|
|
|
- PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(orderId);
|
|
|
|
|
|
+ //微信小游戏投放腾讯广告或巨量广告 (坑逼腾讯要其他渠道的订单数据)
|
|
|
|
+ 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, miPaySuccess)) {
|
|
|
|
+ doBack = Boolean.FALSE;
|
|
|
|
+ backMsg = "微信小游戏投放腾讯广告或巨量广告, 订单未支付或已回传";
|
|
|
|
+ } else {
|
|
doBack = Boolean.TRUE;
|
|
doBack = Boolean.TRUE;
|
|
amount = Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100);
|
|
amount = Collections.singletonList(platformOrderDTO.getAmount().longValue() * 100);
|
|
- backMsg = "回传漏单, 直接修正为原订单金额回传";
|
|
|
|
|
|
+ backMsg = "微信小游戏投放腾讯广告或巨量广告, 订单全量满金额回传";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //微信小游戏投巨量广告 (坑逼腾讯要其他渠道的订单数据)
|
|
|
|
- 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);
|
|
return Tuple3.with(doBack, amount, Strings.isBlank(backMsg) ? "未知的渠道投放类型" : backMsg);
|
|
}
|
|
}
|
|
|
|
|