|
@@ -2,6 +2,8 @@ package com.zanxiang.game.back.serve.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.zanxiang.erp.base.ErpServer;
|
|
|
|
+import com.zanxiang.erp.base.rpc.IDingTalkMsgRpc;
|
|
import com.zanxiang.game.back.serve.dao.mapper.GameTencentMiniGameCallbackMapper;
|
|
import com.zanxiang.game.back.serve.dao.mapper.GameTencentMiniGameCallbackMapper;
|
|
import com.zanxiang.game.back.serve.pojo.dto.GameTencentCallbackDTO;
|
|
import com.zanxiang.game.back.serve.pojo.dto.GameTencentCallbackDTO;
|
|
import com.zanxiang.game.back.serve.pojo.entity.GameTencentMiniGameCallback;
|
|
import com.zanxiang.game.back.serve.pojo.entity.GameTencentMiniGameCallback;
|
|
@@ -24,6 +26,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
+import java.util.Map;
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -37,6 +40,9 @@ public class GameTencentMiniGameCallbackServiceImpl extends ServiceImpl<GameTenc
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
private IAgentRpc agentRpc;
|
|
private IAgentRpc agentRpc;
|
|
|
|
|
|
|
|
+ @DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
|
|
|
|
+ private IDingTalkMsgRpc dingTalkMsgRpc;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private KafkaProducer<String, String> kafkaProducer;
|
|
private KafkaProducer<String, String> kafkaProducer;
|
|
|
|
|
|
@@ -66,6 +72,38 @@ public class GameTencentMiniGameCallbackServiceImpl extends ServiceImpl<GameTenc
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public boolean callback(Map<String, Object> paramMap) {
|
|
|
|
+ GameTencentMiniGameCallback callback = null;
|
|
|
|
+ try {
|
|
|
|
+ callback = JsonUtil.toObj(JsonUtil.toString(paramMap), GameTencentMiniGameCallback.class);
|
|
|
|
+ AgentRpcVO agent = agentRpc.getByTencentAccountId(callback.getAccountId()).getData();
|
|
|
|
+ if (agent != null) {
|
|
|
|
+ callback.setAgentKey(agent.getAgentKey());
|
|
|
|
+ callback.setGameId(agent.getGameId());
|
|
|
|
+ callback.setWechatAppId(agent.getAppId());
|
|
|
|
+ } else {
|
|
|
|
+ callback.setAgentKey("-");
|
|
|
|
+ callback.setGameId(-1L);
|
|
|
|
+ log.error("腾讯检测链接数据找不到渠道:{}", JsonUtil.toString(callback));
|
|
|
|
+ }
|
|
|
|
+ callback.setDay(callback.getClickTime() == null || callback.getClickTime() < 1000 ? LocalDate.now() : DateUtil.secondToLocalDate(callback.getClickTime()));
|
|
|
|
+ save(callback);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("接收到腾讯监测链接数据保存异常, paramMap : {}, errorMsg : {}", JsonUtil.toString(paramMap), e.getMessage(), e);
|
|
|
|
+ //发送钉钉消息通知开发
|
|
|
|
+ dingTalkMsgRpc.sendByUserId(220L, DateUtil.formatLocalDateTime(LocalDateTime.now()) + " : 腾讯小游戏监测链接数据入库异常");
|
|
|
|
+ }
|
|
|
|
+ if (callback != null) {
|
|
|
|
+ try {
|
|
|
|
+ kafkaProducer.send(new ProducerRecord<>(tencentCallbackTopic, callback.getAccountId().toString(), JsonUtil.toString(callback)));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public String getCallBackUrl(Long gameId, String wechatOpenid, String clickId, LocalDateTime registerTime, boolean matchTime) {
|
|
public String getCallBackUrl(Long gameId, String wechatOpenid, String clickId, LocalDateTime registerTime, boolean matchTime) {
|
|
try {
|
|
try {
|