|
@@ -14,6 +14,7 @@ import com.zanxiang.game.back.base.rpc.IGameBackPolicyRpc;
|
|
import com.zanxiang.game.back.base.rpc.ITencentMiniGameBackRpc;
|
|
import com.zanxiang.game.back.base.rpc.ITencentMiniGameBackRpc;
|
|
import com.zanxiang.game.back.base.rpc.ITtAppBackRpc;
|
|
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.AccountTypeEnum;
|
|
|
|
+import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
|
|
import com.zanxiang.game.module.mybatis.entity.*;
|
|
import com.zanxiang.game.module.mybatis.entity.*;
|
|
import com.zanxiang.game.module.mybatis.mapper.GameBackLogMediaSdkMapper;
|
|
import com.zanxiang.game.module.mybatis.mapper.GameBackLogMediaSdkMapper;
|
|
import com.zanxiang.game.module.sdk.constant.RedisKeyConstant;
|
|
import com.zanxiang.game.module.sdk.constant.RedisKeyConstant;
|
|
@@ -31,6 +32,7 @@ import org.apache.logging.log4j.util.Strings;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
@@ -93,11 +95,11 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
}
|
|
}
|
|
//判断结果返回对象
|
|
//判断结果返回对象
|
|
Map<String, Object> resultMap = this.getResultMap(param, userData);
|
|
Map<String, Object> resultMap = this.getResultMap(param, userData);
|
|
- //参数判断, 检测不通过
|
|
|
|
- if (!this.callBackParamCheck(param, resultMap)) {
|
|
|
|
- return resultMap;
|
|
|
|
- }
|
|
|
|
try {
|
|
try {
|
|
|
|
+ //参数判断, 检测不通过
|
|
|
|
+ if (!this.callBackParamCheck(param, resultMap)) {
|
|
|
|
+ return resultMap;
|
|
|
|
+ }
|
|
//查询玩家信息
|
|
//查询玩家信息
|
|
User user = userService.getById(userData.getUserId());
|
|
User user = userService.getById(userData.getUserId());
|
|
//测试账号判断
|
|
//测试账号判断
|
|
@@ -116,8 +118,9 @@ public class GameBackLogMediaSdkServiceImpl extends ServiceImpl<GameBackLogMedia
|
|
JsonUtil.toString(userData), e.getMessage(), e);
|
|
JsonUtil.toString(userData), e.getMessage(), e);
|
|
resultMap.put("backMsg", "事件回传判断, 出现异常");
|
|
resultMap.put("backMsg", "事件回传判断, 出现异常");
|
|
} finally {
|
|
} finally {
|
|
- //等级提升以外的事件释放锁, 等级变化20秒以内不更新, 不回传, 因为包含了战力变化
|
|
|
|
- if (!Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_UPDATE_LEVEL)) {
|
|
|
|
|
|
+ //等级提升和订单付费, 不释放锁, 其他事件锁释放
|
|
|
|
+ if (!Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_UPDATE_LEVEL)
|
|
|
|
+ && !Objects.equals(param.getCallBackTypeEnum(), CallBackTypeEnum.CALL_BACK_PAY_ORDER)) {
|
|
distributedLockComponent.unlock(lockKey);
|
|
distributedLockComponent.unlock(lockKey);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -237,9 +240,18 @@ 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) {
|
|
|
|
|
|
+ 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()));
|
|
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));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//返回结果
|
|
//返回结果
|
|
return true;
|
|
return true;
|