无关风月
2024-11-15 353cf91d3679e68d9b8c07652e4f7791d606dbd4
xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserTreeController.java
@@ -32,6 +32,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
@@ -130,7 +131,10 @@
                    .between(AppUserViewingHistory::getCreateTime, startOfDay, endOfDay).list();
            int temp = 0;
            for (AppUserViewingHistory appUserViewingHistory : list) {
                temp += appUserViewingHistory.getTimeLook();
                if (appUserViewingHistory.getTimeLook()!=null){
                    temp += appUserViewingHistory.getTimeLook();
                }
            }
            AppUserTree one = appUserTreeService.lambdaQuery().eq(AppUserTree::getAppUserId, userId)
                    .eq(AppUserTree::getSowAgain, 2).one();
@@ -148,7 +152,7 @@
                } else {
                    appUserTree.setIsSign(2);
                }
                if (temp >= 120) {
                if (temp >= 3600) {
                    if (appUserTree.getTaskOne() == 2) {
                        AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord();
                        appUserEnergyRecord.setAppUserId(userId);
@@ -170,7 +174,7 @@
                    }
                    appUserTree.setTaskOne(1);
                    appUserTree.setTaskTwo(1);
                } else if (temp >= 60) {
                } else if (temp >= 1800) {
                    if (appUserTree.getTaskOne() == 2) {
                        AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord();
                        appUserEnergyRecord.setAppUserId(userId);
@@ -192,7 +196,7 @@
                appUserTree.setTotalEnergyValue(byId.getTotalEnergyValue());
                return R.ok(appUserTree);
            } else {
                if (temp >= 120) {
                if (temp >= 3600) {
                    if (one.getTaskOne() == 2) {
                        AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord();
                        appUserEnergyRecord.setAppUserId(userId);
@@ -214,7 +218,7 @@
                    }
                    one.setTaskOne(1);
                    one.setTaskTwo(1);
                } else if (temp >= 60) {
                } else if (temp >= 1800) {
                    if (one.getTaskOne() == 2) {
                        AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord();
                        appUserEnergyRecord.setAppUserId(userId);
@@ -406,7 +410,7 @@
            noticeRecord.setReadStatus(1);
            noticeRecord.setNoticeType(1);
            noticeRecord.setTitle("树苗升级通知");
            noticeRecord.setContent("恭喜,您的树苗已升至"+y+"级,"+"继续加油哦");
            noticeRecord.setContent("恭喜,您的树苗已升至"+x+"级,"+"继续加油哦");
            noticeRecordService.save(noticeRecord);
        }
        return R.ok(wateringVO);
@@ -421,6 +425,10 @@
        Long userId = loginUser.getUserid();
        // 给用户加10能量
        AppUser byId = appUserService.getById(userId);
        if (byId.getSignTime()!=null
                && byId.getSignTime().toLocalDate().equals(LocalDate.now())){
        return R.fail("您今日已签到");
        }
        byId.setEnergyValue(byId.getEnergyValue()+10);
        byId.setSignTime(LocalDateTime.now());
        byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10);
@@ -445,6 +453,7 @@
        Long userId = loginUser.getUserid();
        if(userId ==null || userId == 0)return R.tokenError("登录失效");
        AppUser byId = appUserService.getById(userId);
        System.err.println("调用是否弹窗"+byId.getIsFirst());
        if (byId.getIsFirst() == 1){
            byId.setIsFirst(2);
            appUserService.updateById(byId);