init
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.cai.controller.app;
|
||||
|
||||
import com.fasterxml.jackson.databind.ser.std.CollectionSerializer;
|
||||
import com.ruoyi.cai.dto.app.vo.rank.RankNodeLove;
|
||||
import com.ruoyi.cai.rank.RankManager;
|
||||
import com.ruoyi.cai.rank.RankNode;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/rank")
|
||||
@Tag(name = "排行榜接口")
|
||||
public class RankController {
|
||||
|
||||
@Autowired
|
||||
private RankManager rankManager;
|
||||
|
||||
@GetMapping("/love")
|
||||
@Operation(summary = "魅力榜")
|
||||
public R<List<RankNodeLove>> loveRank(
|
||||
@Parameter(description = "类型 1-上周 2-昨日 3-日榜 4-周榜 5-月榜 6-总榜") Integer type){
|
||||
if(type == null){
|
||||
return R.ok(Collections.emptyList());
|
||||
}
|
||||
List<RankNode> rankNodeList = null;
|
||||
if(type == 1){
|
||||
rankNodeList = rankManager.getLoveRankDayLastWeek(10);
|
||||
}else if(type == 2){
|
||||
rankNodeList = rankManager.getLoveRankDayLastDay(10);
|
||||
}else if(type == 3){
|
||||
rankNodeList = rankManager.getLoveRankDayToday(30);
|
||||
}else if(type == 4){
|
||||
rankNodeList = rankManager.getLoveRankDayWeek(30);
|
||||
}else if(type == 5){
|
||||
rankNodeList = rankManager.getLoveRankDayMonth(30);
|
||||
}else if(type == 6){
|
||||
rankNodeList = rankManager.getLoveRankTotal(30);
|
||||
}else{
|
||||
rankNodeList = Collections.emptyList();
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.cai.dto.app.vo.rank;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "魅力榜")
|
||||
public class RankNodeLove {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
@Schema(description = "魅力值")
|
||||
private Long love;
|
||||
@Schema(description = "距离上一个魅力值差距")
|
||||
private Long diffLastLove;
|
||||
@Schema(description = "是否开启隐身模式")
|
||||
private boolean hide;
|
||||
}
|
||||
Reference in New Issue
Block a user