|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.github.sd4324530.jtuple.Tuple2;
|
|
|
import com.zanxiang.advertising.tencent.base.AdvertisingTencentServer;
|
|
|
import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetRpc;
|
|
|
import com.zanxiang.game.back.serve.dao.mapper.GameTencentMiniGameUserMapper;
|
|
@@ -54,12 +55,12 @@ public class GameTencentMiniGameUserServiceImpl extends ServiceImpl<GameTencentM
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean userBack(GameTencentMiniGameUser userLog, boolean mustBack) {
|
|
|
+ public boolean userBack(GameTencentMiniGameUser userLog) {
|
|
|
if (StringUtils.isBlank(userLog.getClickId())) {
|
|
|
// 没有点击 id(之后做监测链接,从监测链接里面找)
|
|
|
return false;
|
|
|
}
|
|
|
- BackStatusEnum backStatus = doCallback(userLog, mustBack);
|
|
|
+ BackStatusEnum backStatus = doCallback(userLog).first;
|
|
|
return update(new LambdaUpdateWrapper<GameTencentMiniGameUser>()
|
|
|
.set(GameTencentMiniGameUser::getBackStatus, backStatus.getBackStatus())
|
|
|
.eq(GameTencentMiniGameUser::getId, userLog.getId())
|
|
@@ -91,7 +92,7 @@ public class GameTencentMiniGameUserServiceImpl extends ServiceImpl<GameTencentM
|
|
|
@Override
|
|
|
public boolean doReport(List<Long> userLogIds) {
|
|
|
listByIds(userLogIds).forEach(userLog -> {
|
|
|
- BackStatusEnum backStatus = doCallback(userLog, true);
|
|
|
+ BackStatusEnum backStatus = doCallback(userLog).first;
|
|
|
update(new LambdaUpdateWrapper<GameTencentMiniGameUser>()
|
|
|
.set(GameTencentMiniGameUser::getBackStatus, backStatus.getBackStatus())
|
|
|
.eq(GameTencentMiniGameUser::getId, userLog.getId())
|
|
@@ -121,8 +122,8 @@ public class GameTencentMiniGameUserServiceImpl extends ServiceImpl<GameTencentM
|
|
|
}
|
|
|
|
|
|
|
|
|
- private BackStatusEnum doCallback(GameTencentMiniGameUser userLog, boolean mustBack) {
|
|
|
- boolean isBack = mustBack ? false : gameTencentMiniGameBackLogService.count(new LambdaQueryWrapper<GameTencentMiniGameBackLog>()
|
|
|
+ private Tuple2<BackStatusEnum, String> doCallback(GameTencentMiniGameUser userLog) {
|
|
|
+ boolean isBack = gameTencentMiniGameBackLogService.count(new LambdaQueryWrapper<GameTencentMiniGameBackLog>()
|
|
|
.eq(GameTencentMiniGameBackLog::getGameId, userLog.getGameId())
|
|
|
.eq(GameTencentMiniGameBackLog::getWechatAppId, userLog.getWechatAppId())
|
|
|
.eq(GameTencentMiniGameBackLog::getWechatOpenid, userLog.getWechatOpenid())
|
|
@@ -130,7 +131,7 @@ public class GameTencentMiniGameUserServiceImpl extends ServiceImpl<GameTencentM
|
|
|
.eq(GameTencentMiniGameBackLog::getBackStatus, BackStatusEnum.SUCCESS.getBackStatus())
|
|
|
) > 0;
|
|
|
if (isBack) {
|
|
|
- return BackStatusEnum.NO;
|
|
|
+ return Tuple2.with(BackStatusEnum.SUCCESS, null);
|
|
|
}
|
|
|
return gameTencentMiniGameBackLogService.userBack(userLog);
|
|
|
}
|