This commit is contained in:
张良(004796)
2024-03-28 18:20:50 +08:00
parent e955c21991
commit c25e43359c
14 changed files with 180 additions and 29 deletions

View File

@@ -18,7 +18,7 @@ public class Clear2HoursJob {
// 每隔小时执行一次
@Scheduled(cron = "0 0 0/2 * * ? *")
@Scheduled(cron = "0 0 0/1 * * ?")
public void clearRun() {
try {
log.info("定时删除动态== 开始");

View File

@@ -15,7 +15,7 @@ public class HomeRecommendJob {
// 每6分钟执行一次
@Scheduled(cron = "0 0/6 * * * ? ")
@Scheduled(cron = "0 0/6 * * * ?")
public void clearRun() {
try {
homeManager.refreshHomeActiveCache();
@@ -32,6 +32,11 @@ public class HomeRecommendJob {
}catch (Exception e){
log.error("刷新首页推荐用户失败",e);
}
try {
homeManager.refreshHomeAnchorTopCache();
}catch (Exception e){
log.error("刷新首页推荐置顶用户失败",e);
}
}

View File

@@ -0,0 +1,91 @@
package com.ruoyi.web.controller.cai.admin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.cai.domain.AnchorTop;
import com.ruoyi.cai.dto.admin.vo.AnchorTopAdminVo;
import com.ruoyi.cai.service.AnchorTopService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
/**
* 主播限时置顶
*
* @author 77
* @date 2024-03-28
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/cai/anchorTop")
public class AnchorTopController extends BaseController {
private final AnchorTopService anchorTopService;
/**
* 查询主播限时置顶列表
*/
@SaCheckPermission("cai:anchorTop:list")
@GetMapping("/list")
public TableDataInfo<AnchorTopAdminVo> list(AnchorTopAdminVo bo, PageQuery pageQuery) {
Page<AnchorTopAdminVo> page = anchorTopService.pageAdmin(pageQuery, bo);
return TableDataInfo.build(page);
}
/**
* 获取主播限时置顶详细信息
*
* @param id 主键
*/
@SaCheckPermission("cai:anchorTop:query")
@GetMapping("/{id}")
public R<AnchorTop> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(anchorTopService.getById(id));
}
@GetMapping("/getAnchorTopByUserCode")
public R<AnchorTopAdminVo> getAnchorTopByUserCode(String usercode) {
AnchorTopAdminVo anchorTop = anchorTopService.getAnchorTopByUserCode(usercode);
return R.ok(anchorTop);
}
@SaCheckPermission("cai:anchorTop:add")
@Log(title = "主播限时置顶", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@RequestBody AnchorTopAdminVo bo) {
boolean save = anchorTopService.saveOrUpdateAnchorTop(bo);
return R.ok();
}
/**
* 删除主播限时置顶
*
* @param ids 主键串
*/
@SaCheckPermission("cai:anchorTop:remove")
@Log(title = "主播限时置顶", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(anchorTopService.removeBatchByIds(Arrays.asList(ids)));
}
}