fix: 修复番剧评分问题

This commit is contained in:
wushuo
2026-02-28 17:57:54 +08:00
parent 8936c2d1f7
commit cb3a3ec9b6
3 changed files with 30 additions and 3 deletions

View File

@@ -52,9 +52,18 @@ public class BgmController extends BaseController {
}
@Auth
@Operation(summary = "评分")
@Operation(summary = "获取评分")
@PostMapping("/rate")
public Result<Integer> rate(@RequestBody Ani ani) {
String subjectId = BgmUtil.getSubjectId(ani);
Integer rate = BgmUtil.rate(subjectId, null);
return Result.success(rate);
}
@Auth
@Operation(summary = "进行评分")
@PostMapping("/setRate")
public Result<Integer> setRate(@RequestBody Ani ani) {
String subjectId = BgmUtil.getSubjectId(ani);
Integer score = Opt.ofNullable(ani.getScore())
.map(Double::intValue)

View File

@@ -11,7 +11,7 @@
</div>
<div class="flex bgm-rate-button-container">
<el-button :icon="Ban" bg text @click="clearRate">清空评分</el-button>
<el-button :icon="Save" bg text @click="rate(ani)">保存评分</el-button>
<el-button :icon="Save" bg text @click="setRate(ani)">保存评分</el-button>
</div>
</div>
</el-dialog>
@@ -58,6 +58,17 @@ let clearRate = () => {
let rate = (v) => {
loading.value = true
http.rate(v)
.then(res => {
ani.value.score = res.data
})
.finally(() => {
loading.value = false
})
}
let setRate = (v) => {
loading.value = true
http.setRate(v)
.then(res => {
ani.value.score = res.data

View File

@@ -216,12 +216,19 @@ export let stop = (status) => api.post(`api/stop?status=${status}`)
export let refreshCover = (ani) => api.post('api/refreshCover', ani)
/**
* 评分
* 获取评分
* @param ani 订阅
* @returns {Promise<unknown>}
*/
export let rate = (ani) => api.post('api/rate', ani)
/**
* 进行评分
* @param ani 订阅
* @returns {Promise<unknown>}
*/
export let setRate = (ani) => api.post('api/setRate', ani)
/**
* 获取下载位置
* @param ani 订阅