This commit is contained in:
张良(004796)
2024-05-10 10:51:46 +08:00
parent f9fbd1bda0
commit 49a5edf0e6
10 changed files with 57 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ public class EveryDaysJob {
public void run() {
try {
log.info("执行用户VIP状态码回转-开始");
busOp.refreshUserVipStatus();
// busOp.refreshUserVipStatus();
}catch (Exception e){
log.error("执行用户VIP状态码回转-失败!",e);
}finally {

View File

@@ -39,41 +39,59 @@ public class RankJob {
LocalDate now = LocalDate.now();
LocalDate date = now.plusDays(-1);
try {
log.info("保存魅力 日榜开始执行");
rankService.saveDayRank(date,1);
} catch (Exception e) {
log.error("保存魅力 日榜失败", e);
} finally {
log.info("保存魅力 日榜结束执行");
}
try {
log.info("保存邀请 日榜开始执行");
rankService.saveDayRank(date,2);
} catch (Exception e) {
log.error("保存邀请 日榜失败", e);
} finally {
log.info("保存邀请 日榜结束执行");
}
DayOfWeek week = now.getDayOfWeek();
if (week.getValue() == 1) { // 今天是周一 做一下持久化
LocalDate lastWeekDate = now.plusDays(-7);
try {
log.info("保存魅力 周榜开始执行");
rankService.saveWeekRank(lastWeekDate,1);
} catch (Exception e) {
log.error("保存魅力 周榜失败", e);
} finally {
log.info("保存魅力 周榜结束执行");
}
try {
log.info("保存邀请 周榜开始执行");
rankService.saveWeekRank(lastWeekDate,2);
} catch (Exception e) {
log.error("保存邀请 周榜失败", e);
} finally {
log.info("保存邀请 周榜结束执行");
}
}
int month = now.getDayOfMonth();
if (month == 1) { // 昨天是1号
LocalDate lastMonthDate = now.plusMonths(-1);
try {
log.info("保存魅力 月榜开始执行");
rankService.saveMonthRank(lastMonthDate,1);
} catch (Exception e) {
log.error("保存魅力 月榜失败", e);
} finally {
log.info("保存魅力 月榜结束执行");
}
try {
log.info("保存邀请 月榜开始执行");
rankService.saveMonthRank(lastMonthDate,2);
} catch (Exception e) {
log.error("保存邀请 月榜失败", e);
} finally {
log.info("保存邀请 月榜结束执行");
}
}
try {
@@ -83,9 +101,12 @@ public class RankJob {
}
try {
log.info("刷新用户年龄 开始执行");
userService.refreshByAge();
}catch (Exception e){
log.error("刷新用户年龄失败!",e);
} finally {
log.info("刷新用户年龄 结束执行");
}
try {
long anchorNum = anchorService.count(Wrappers.emptyWrapper());

View File

@@ -73,7 +73,7 @@ public class BusOp {
public void refreshUserVipStatus(){
int current = 0;
Page<User> page = new Page<>(0, 10);
Page<User> page = new Page<>(0, 100);
while (true){
current++;
page.setCurrent(current);

View File

@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;
@@ -103,6 +104,10 @@ public class IndexController {
if(query.getType() == null){
query.setType(1);
}
if(page.checkPageNum(5)){
return R.ok(Collections.emptyList());
}
page.resetPageSize();
Page<UserListVo> res = userService.pageApp(page,query);
return R.ok(res.getRecords());
}
@@ -111,6 +116,10 @@ public class IndexController {
@Operation(summary = "群打招呼界面-用户搜索接口")
@Log(title = "群打招呼界面-用户搜索接口", businessType = BusinessType.OTHER, isPrintResponseData = false, isSaveDb = false)
public R<List<UserListVo>> greetQuery(PageQuery page, GreetQuery query){
if(page.checkPageNum(5)){
return R.ok(Collections.emptyList());
}
page.resetPageSize();
Page<UserListVo> res = userService.greetPageApp(page,query);
return R.ok(res.getRecords());
}