|
@@ -0,0 +1,101 @@
|
|
|
+package com.fs.app.controller;
|
|
|
+
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import com.fs.live.domain.LiveWatchUser;
|
|
|
+import com.fs.live.service.ILiveWatchUserService;
|
|
|
+import com.fs.live.vo.LiveWatchUserVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 直播间观看用户Controller
|
|
|
+ *
|
|
|
+ * @author fs
|
|
|
+ * @date 2025-01-18
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/app/live/liveWatchUser")
|
|
|
+public class LiveWatchUserController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private ILiveWatchUserService liveWatchUserService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('live:liveWatchUser:list')")
|
|
|
+ @GetMapping("/watchUserList")
|
|
|
+ public TableDataInfo watchUserList(@RequestParam Long liveId) {
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("liveId", liveId);
|
|
|
+
|
|
|
+ startPage();
|
|
|
+ List<LiveWatchUserVO> onLineUserList = liveWatchUserService.selectWatchUserList(params).stream().filter(liveWatchUserVO -> liveWatchUserVO.getOnline() == 1).collect(Collectors.toList());
|
|
|
+ return getDataTable(onLineUserList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取直播间观看用户详细信息
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('live:liveWatchUser:query')")
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(liveWatchUserService.selectLiveWatchUserById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增直播间观看用户
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('live:liveWatchUser:add')")
|
|
|
+ @Log(title = "直播间观看用户", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody LiveWatchUser liveWatchUser)
|
|
|
+ {
|
|
|
+ return toAjax(liveWatchUserService.insertLiveWatchUser(liveWatchUser));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改直播间观看用户
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('live:liveWatchUser:edit')")
|
|
|
+ @Log(title = "直播间观看用户", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody LiveWatchUser liveWatchUser)
|
|
|
+ {
|
|
|
+ return toAjax(liveWatchUserService.updateLiveWatchUser(liveWatchUser));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除直播间观看用户
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('live:liveWatchUser:remove')")
|
|
|
+ @Log(title = "直播间观看用户", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
+ {
|
|
|
+ return toAjax(liveWatchUserService.deleteLiveWatchUserByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改直播间用户禁言状态
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('live:liveWatchUser:edit')")
|
|
|
+ @Log(title = "直播间观看用户", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/changeUserState")
|
|
|
+ public AjaxResult changeUserState(@RequestParam Long liveId, @RequestParam Long userId) {
|
|
|
+ return toAjax(liveWatchUserService.changeUserState(liveId, userId));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|