| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysLive; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TSysLiveService sysLiveService; |
| | | private final TokenService tokenService; |
| | | private final RedisCache redisCache; |
| | | @Autowired |
| | | public TSysLiveController(TSysLiveService sysLiveService, TokenService tokenService) { |
| | | public TSysLiveController(TSysLiveService sysLiveService, TokenService tokenService, RedisCache redisCache) { |
| | | this.sysLiveService = sysLiveService; |
| | | this.tokenService = tokenService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "获取直播管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysLiveVO>> pageList(@RequestBody TSysLiveQuery query) { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | query.setAppUserId(userId); |
| | | return R.ok(sysLiveService.pageList(query)); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 直播管理推送用户 |
| | | * 直播管理预约推送 |
| | | */ |
| | | @Log(title = "直播管理信息-推送用户", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "直播管理信息推送用户") |
| | | @PutMapping(value = "/pushUser") |
| | | public R<String> pushUser(@RequestParam(value = "id") String id, |
| | | @RequestParam(value = "pushType")String pushType) { |
| | | sysLiveService.pushUser(id,pushType); |
| | | @ApiOperation(value = "直播管理信息预约推送") |
| | | @PutMapping(value = "/appointmentPush") |
| | | public R<String> appointmentPush(@RequestParam(value = "id") String id) { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 判断是否已预约 |
| | | boolean memberInSet = redisCache.isMemberInSet(Constants.LIVE_APPOINTMENT_PUSH + id, userId); |
| | | if (memberInSet) { |
| | | return R.fail("已预约"); |
| | | } |
| | | Set<String> appointmentPush = new HashSet<>(); |
| | | appointmentPush.add(userId); |
| | | redisCache.setCacheSet(Constants.LIVE_APPOINTMENT_PUSH + id, appointmentPush); |
| | | return R.ok(); |
| | | } |
| | | |