|
|
@@ -6,8 +6,8 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.life.param.LifeFeedParam;
|
|
|
import com.fs.life.service.IFsLifeVideoService;
|
|
|
+import com.fs.life.vo.LifeLiveCardVO;
|
|
|
import com.fs.life.vo.LifeVideoCardVO;
|
|
|
-import com.fs.live.domain.Live;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -22,6 +22,11 @@ import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 生活号 C 端接口
|
|
|
+ * <p>
|
|
|
+ * 公域直播规则(对齐验收用例):
|
|
|
+ * - 「全部」:仅 status=2 且 visible_scope=1 的直播,按开播时间从早到晚,展示马甲昵称/头像,置于视频流上方
|
|
|
+ * - 「今日主推」:lives 为空,仅视频
|
|
|
+ * - 私域直播不上生活号(制单分享等内容入口另走)
|
|
|
*/
|
|
|
@Api(tags = "生活号")
|
|
|
@RestController
|
|
|
@@ -40,14 +45,16 @@ public class LifeController extends AppBaseController {
|
|
|
if (param.getPageSize() == null || param.getPageSize() < 1) {
|
|
|
param.setPageSize(10);
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(getUserId())) {
|
|
|
- param.setUserId(Long.parseLong(getUserId()));
|
|
|
+ Long userId = parseUserIdQuietly();
|
|
|
+ if (userId != null) {
|
|
|
+ param.setUserId(userId);
|
|
|
}
|
|
|
|
|
|
String tab = StringUtils.isEmpty(param.getTab()) ? "all" : param.getTab();
|
|
|
- List<Live> lives = new ArrayList<>();
|
|
|
+ List<LifeLiveCardVO> lives = new ArrayList<>();
|
|
|
+ // 仅「全部」展示进行中公域直播;今日主推只有视频
|
|
|
if ("all".equalsIgnoreCase(tab)) {
|
|
|
- lives = fsLifeVideoService.selectPublicLivingList();
|
|
|
+ lives = fsLifeVideoService.selectPublicLivingCardList();
|
|
|
}
|
|
|
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
@@ -60,14 +67,22 @@ public class LifeController extends AppBaseController {
|
|
|
return R.ok().put("data", data);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("进行中的公域直播列表(双列置顶区,含马甲昵称头像)")
|
|
|
+ @GetMapping("/lives")
|
|
|
+ public R livingList() {
|
|
|
+ return R.ok().put("data", fsLifeVideoService.selectPublicLivingCardList());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("公域直播卡片详情(含马甲信息;非公域或不存在报错)")
|
|
|
+ @GetMapping("/live/{liveId}")
|
|
|
+ public R liveDetail(@PathVariable("liveId") Long liveId) {
|
|
|
+ return R.ok().put("data", fsLifeVideoService.selectPublicLivingCardById(liveId));
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("视频详情")
|
|
|
@GetMapping("/video/{id}")
|
|
|
public R detail(@PathVariable("id") Long id) {
|
|
|
- Long userId = null;
|
|
|
- if (StringUtils.isNotEmpty(getUserId())) {
|
|
|
- userId = Long.parseLong(getUserId());
|
|
|
- }
|
|
|
- LifeVideoCardVO detail = fsLifeVideoService.detail(id, userId);
|
|
|
+ LifeVideoCardVO detail = fsLifeVideoService.detail(id, parseUserIdQuietly());
|
|
|
return R.ok().put("data", detail);
|
|
|
}
|
|
|
|
|
|
@@ -118,4 +133,16 @@ public class LifeController extends AppBaseController {
|
|
|
public R products(@PathVariable("id") Long id) {
|
|
|
return R.ok().put("data", fsLifeVideoService.listProducts(id));
|
|
|
}
|
|
|
+
|
|
|
+ private Long parseUserIdQuietly() {
|
|
|
+ String uid = getUserId();
|
|
|
+ if (StringUtils.isEmpty(uid)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ return Long.parseLong(uid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|