init
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
package com.ruoyi.cai.controller.app;
|
||||
|
||||
import com.ruoyi.cai.domain.User;
|
||||
import com.ruoyi.cai.dto.app.vo.rank.RankLoveRemark;
|
||||
import com.ruoyi.cai.dto.app.RankIdReq;
|
||||
import com.ruoyi.cai.dto.app.vo.rank.RankRemark;
|
||||
import com.ruoyi.cai.dto.app.vo.rank.RankNodeInvite;
|
||||
import com.ruoyi.cai.dto.app.vo.rank.RankNodeLove;
|
||||
import com.ruoyi.cai.enums.GenderEnum;
|
||||
import com.ruoyi.cai.manager.AwardManager;
|
||||
import com.ruoyi.cai.rank.RankManager;
|
||||
import com.ruoyi.cai.rank.RankNode;
|
||||
import com.ruoyi.cai.service.RankService;
|
||||
import com.ruoyi.cai.service.UserService;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -31,11 +33,14 @@ public class RankAppController {
|
||||
private RankManager rankManager;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private RankService rankService;
|
||||
@Autowired
|
||||
private AwardManager awardManager;
|
||||
|
||||
@GetMapping("/loveRemark")
|
||||
@Operation(summary = "榜单说明")
|
||||
public R<RankLoveRemark> remark(){
|
||||
@Operation(summary = "魅力榜榜单说明")
|
||||
public R<RankRemark> loveRemark(){
|
||||
String remark =
|
||||
"(魅力上周榜排名奖励)\n" +
|
||||
"第一名:888元\n" +
|
||||
@@ -52,11 +57,43 @@ public class RankAppController {
|
||||
"第五名:38元\n" +
|
||||
"第六至十名:28元\n" +
|
||||
"提示:凡是刷魅力榜的封号,平台拥有对本次活动的最终解释权。";
|
||||
RankLoveRemark res = new RankLoveRemark();
|
||||
RankRemark res = new RankRemark();
|
||||
res.setRemark(remark);
|
||||
return R.ok(res);
|
||||
}
|
||||
|
||||
@GetMapping("/inviteRemark")
|
||||
@Operation(summary = "邀请榜榜单说明")
|
||||
public R<RankRemark> inviteRemark(){
|
||||
String remark =
|
||||
"(邀请上周榜排名奖励)\n" +
|
||||
"第一名:888元\n" +
|
||||
"第二名:588元\n" +
|
||||
"第三名:388元\n" +
|
||||
"第四名:288元\n" +
|
||||
"第五名:188元\n" +
|
||||
"第六至十名:138元\n" +
|
||||
"(邀请昨日榜排名奖励)\n" +
|
||||
"第一名:138元\n" +
|
||||
"第二名:108元\n" +
|
||||
"第三名:88元\n" +
|
||||
"第四名:58元\n" +
|
||||
"第五名:38元\n" +
|
||||
"第六至十名:28元\n" +
|
||||
"提示:凡是刷邀请榜的封号,平台拥有对本次活动的最终解释权。";
|
||||
RankRemark res = new RankRemark();
|
||||
res.setRemark(remark);
|
||||
return R.ok(res);
|
||||
}
|
||||
|
||||
@PostMapping("/giveRank")
|
||||
@Operation(summary = "领取榜单")
|
||||
public R<Void> inviteRank(@RequestBody RankIdReq rankIdReq){
|
||||
Long userId = LoginHelper.getUserId();
|
||||
awardManager.giveRank(rankIdReq.getRankId(),userId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/love")
|
||||
@Operation(summary = "魅力榜")
|
||||
public R<List<RankNodeLove>> loveRank(
|
||||
@@ -66,9 +103,9 @@ public class RankAppController {
|
||||
}
|
||||
List<RankNode> rankNodeList;
|
||||
if(type == 1){
|
||||
rankNodeList = rankManager.getLoveRankLastWeek(10);
|
||||
rankNodeList = rankService.getLoveRankLastWeek(10);
|
||||
}else if(type == 2){
|
||||
rankNodeList = rankManager.getLoveRankLastDay(10);
|
||||
rankNodeList = rankService.getLoveRankLastDay(10);
|
||||
}else if(type == 3){
|
||||
rankNodeList = rankManager.getLoveRankToday(30);
|
||||
}else if(type == 4){
|
||||
@@ -99,6 +136,8 @@ public class RankAppController {
|
||||
love.setAvatar(user.getAvatar());
|
||||
love.setNickname(user.getNickname());
|
||||
love.setValue(rankNode.getScore());
|
||||
love.setDraw(rankNode.getDraw());
|
||||
love.setRankId(rankNode.getRankId());
|
||||
love.setHide(false);
|
||||
if(i == 0){
|
||||
love.setDiffLastValue(0L);
|
||||
@@ -120,9 +159,9 @@ public class RankAppController {
|
||||
}
|
||||
List<RankNode> rankNodeList;
|
||||
if(type == 1){
|
||||
rankNodeList = rankManager.getInviteRankLastWeek(10);
|
||||
rankNodeList = rankService.getInviteRankLastWeek(10);
|
||||
}else if(type == 2){
|
||||
rankNodeList = rankManager.getInviteRankLastDay(10);
|
||||
rankNodeList = rankService.getInviteRankLastDay(10);
|
||||
}else if(type == 3){
|
||||
rankNodeList = rankManager.getInviteRankToday(30);
|
||||
}else if(type == 4){
|
||||
@@ -152,6 +191,8 @@ public class RankAppController {
|
||||
invite.setAvatar(GenderEnum.WOMEN.getDefaultAvatar());
|
||||
invite.setNickname(minNickname(user.getNickname()));
|
||||
invite.setValue(rankNode.getScore());
|
||||
invite.setDraw(rankNode.getDraw());
|
||||
invite.setRankId(rankNode.getRankId());
|
||||
if(i == 0){
|
||||
invite.setDiffLastValue(0L);
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user