package com.zhongzheng.controller.polyv; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.core.domain.model.LoginUser; import com.zhongzheng.common.utils.ServletUtils; import com.zhongzheng.framework.web.service.TokenService; import com.zhongzheng.framework.web.service.WxTokenService; import com.zhongzheng.modules.polyv.bo.PolyvLiveQueryBo; import com.zhongzheng.modules.polyv.service.IPolyvVideoService; import com.zhongzheng.modules.polyv.vo.PolyvVideoQuerVo; import com.zhongzheng.modules.user.entity.ClientLoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; /** * 保利威视频信息Controller * * @author change * @date 2021-06-11 */ @Api(value = "保利威视频信息控制器", tags = {"保利威视频信息管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/polyv/video") public class PolyvVideoController extends BaseController { private final IPolyvVideoService iPolyvVideoService; @Autowired private WxTokenService wxTokenService; @ApiOperation("获取保利威视频小程序播放凭证") @GetMapping("/sign/{vid}") public AjaxResult getPlayMobileSign(@PathVariable("vid") String vid) throws Exception { ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest()); String viewerId = String.valueOf(loginUser.getUser().getUserId()); Map map = iPolyvVideoService.polyvbMobileSignRequest(vid,viewerId); return AjaxResult.success(map); } @ApiOperation("保利威视频小程序播放回调") @GetMapping("/sign/auth") public AjaxResult callAuth(PolyvLiveQueryBo bo) throws Exception { Map map = new HashMap<>(); map.put("uid","egsxlptzdq"); return AjaxResult.success(map); } @ApiOperation("获取保利威PC视频播放凭证") @PreAuthorize("@ss.hasPermi('modules.polyv:video:query')") @GetMapping("/sign/pc/{vid}") public AjaxResult getPlayPcSign(@PathVariable("vid") String vid) throws Exception { ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest()); String viewerId = String.valueOf(loginUser.getUser().getUserId()); String token = iPolyvVideoService.polyvbPcSignRequest(vid,viewerId); return AjaxResult.success("成功",token); } }