diff --git a/src/main/java/com/peanut/modules/common/service/AiVipLogService.java b/src/main/java/com/peanut/modules/common/service/AiVipLogService.java index 7ba240ee..997e23af 100644 --- a/src/main/java/com/peanut/modules/common/service/AiVipLogService.java +++ b/src/main/java/com/peanut/modules/common/service/AiVipLogService.java @@ -7,4 +7,8 @@ public interface AiVipLogService extends IService { void openAiVip(int aiBuyConfigId); + boolean isAiVip(); + + void userCount(); + } diff --git a/src/main/java/com/peanut/modules/common/service/impl/AiVipLogServiceImpl.java b/src/main/java/com/peanut/modules/common/service/impl/AiVipLogServiceImpl.java index 3a7fe801..51c64676 100644 --- a/src/main/java/com/peanut/modules/common/service/impl/AiVipLogServiceImpl.java +++ b/src/main/java/com/peanut/modules/common/service/impl/AiVipLogServiceImpl.java @@ -1,6 +1,8 @@ package com.peanut.modules.common.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.peanut.common.utils.DateUtil; import com.peanut.common.utils.DateUtils; import com.peanut.common.utils.ShiroUtils; import com.peanut.modules.common.dao.AiBuyConfigDao; @@ -13,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; +import java.util.List; @Slf4j @Service("commonAiVipLogService") @@ -42,4 +45,38 @@ public class AiVipLogServiceImpl extends ServiceImpl impl } } + + @Override + public boolean isAiVip() { + List aiVipLogs = this.list(new LambdaQueryWrapper() + .eq(AiVipLog::getUserId,ShiroUtils.getUId()) + .orderByAsc(AiVipLog::getStartTime)); + for (AiVipLog aiVipLog:aiVipLogs){ + if (aiVipLog.getSurplusCount()>0&&new Date().getTime() aiVipLogs = this.list(new LambdaQueryWrapper() + .eq(AiVipLog::getUserId,ShiroUtils.getUId()) + .orderByAsc(AiVipLog::getStartTime)); + boolean flag = false; + for (AiVipLog aiVipLog:aiVipLogs){ + if (aiVipLog.getSurplusCount()>0&&new Date().getTime()