初始化
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
export default class AcgApi {
|
||||
// 获取模块下所有视频
|
||||
static getModuleList() {
|
||||
return request.get('/modules/list');
|
||||
}
|
||||
// 获取acg排行榜
|
||||
static getAcgRanking(data: any) {
|
||||
return request.get('/media/ranking', data);
|
||||
}
|
||||
// 获取排行榜
|
||||
static getRanking(data: any) {
|
||||
return request.get('/vid/ranking', data);
|
||||
}
|
||||
// 热门漫画
|
||||
static getMediaHot(data: any) {
|
||||
return request.get('/media/hot', data);
|
||||
}
|
||||
// 标签列表
|
||||
static getTagList(data: any) {
|
||||
return request.get('/tag/list', data);
|
||||
}
|
||||
|
||||
//首页推荐
|
||||
static getMediaRecommend(data: any) {
|
||||
return request.get('/media/recommend', data);
|
||||
}
|
||||
|
||||
//金刚区专题
|
||||
static getSectionList(data: any) {
|
||||
return request.get('/section/list', data);
|
||||
}
|
||||
|
||||
//子集列表
|
||||
static getMediaContentList(data: any) {
|
||||
return request.get('/media_content/list', data);
|
||||
}
|
||||
//子集详情
|
||||
static getMediaContentInfo(data: any): Promise<Types.Acg.MediaContentInfo> {
|
||||
return request.get('/media_content/info', data);
|
||||
}
|
||||
//任务奖励领取
|
||||
static getMediaTaskReceive(data: any) {
|
||||
return request.post('/media_task/receive', data);
|
||||
}
|
||||
|
||||
static getDiscountAreaRecommend(data: any) {
|
||||
return request.get('/discount_area/recommend', data);
|
||||
}
|
||||
|
||||
static getDiscountAreaList(data: any) {
|
||||
return request.get('/discount_area/list', data);
|
||||
}
|
||||
|
||||
static getActivitiesDraw(data: any) {
|
||||
return request.post('/activities/draw', data);
|
||||
}
|
||||
|
||||
static getActivitiesInfo(data: any) {
|
||||
return request.get('/activities/info', data);
|
||||
}
|
||||
|
||||
static getActressInfo(data: any) {
|
||||
return request.get('/actress/info', data);
|
||||
}
|
||||
|
||||
static getActressMediaList(data: any) {
|
||||
return request.get('/actress/media/list', data);
|
||||
}
|
||||
|
||||
static getLinkList(data: any) {
|
||||
return request.get('/link/list', data);
|
||||
}
|
||||
|
||||
static getLinkInfo(data: any) {
|
||||
return request.get('/link/info', data);
|
||||
}
|
||||
// acg标签页
|
||||
static getTagMediaList(data: any) {
|
||||
return request.get('/tag/media/list', data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
import { imgEncrypt } from '@/utils/key';
|
||||
import request from '@/utils/request';
|
||||
export default class AppApi {
|
||||
// LRU缓存: url->objectURL
|
||||
private static readonly MAX_IMG_DECRYPT_CACHE = 200;
|
||||
private static imgDecryptCache: Map<string, string> = new Map();
|
||||
// 当前正在解密的 promise,避免并发同 url 多次请求
|
||||
private static imgDecryptInFlight: Map<string, Promise<string>> = new Map();
|
||||
|
||||
/**
|
||||
* @description 登录
|
||||
* @param {String} devID 设备ID
|
||||
* @param {String} sysType 设备类型
|
||||
* @param {string} cutInfos 渠道码
|
||||
* @returns
|
||||
*/
|
||||
static async login(
|
||||
devID: string,
|
||||
sysType: string,
|
||||
cutInfos?: string,
|
||||
isAppStore?: boolean,
|
||||
): Promise<Types.User.UserInfoType> {
|
||||
return request.post('/mine/login/h5', {
|
||||
devID,
|
||||
sysType,
|
||||
cutInfos,
|
||||
isAppStore,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取配置信息
|
||||
* @returns
|
||||
*/
|
||||
static async queryDomain(): Promise<Types.App.ConfigInfo> {
|
||||
return request.get('/ping/domain/h5');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 刷新付费分层弹窗配置
|
||||
*/
|
||||
static async refreshPaymentPopup(): Promise<Types.App.PaymentPopupRefreshResponse> {
|
||||
return request.get('/ping/domain/refresh', { keys: 'paymentPopup' });
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 刷新付费引导 Ping 缓存(登录/退出/会员状态变化后调用)
|
||||
*/
|
||||
static async refreshPaymentGuide(): Promise<Types.App.PaymentGuideRefreshResponse> {
|
||||
return request.get('/ping/domain/refresh', { keys: 'paymentGuide' });
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 按浮窗ID单查 banner(红包雨场次切换后用于刷新某条浮窗)
|
||||
* @param id 浮窗ID(24位 ObjectID hex 字符串)
|
||||
* @param signal AbortSignal,用于在组件卸载时取消请求
|
||||
*/
|
||||
static async queryBannerById(id: string, signal?: AbortSignal): Promise<Types.App.BannerJump> {
|
||||
return request.get(`/ping/banner/${id}`, undefined, signal ? { signal } : undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 场景 Banner 列表(如评论区置顶 COMMENT_TOP)
|
||||
*/
|
||||
static getBannerList(params: { scene: string }): Promise<Types.App.CommentBannerListResponse> {
|
||||
return request.get('/banner/list', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片解密
|
||||
* @param url 需要解密的url
|
||||
* @returns 解密过后的图片链接
|
||||
*/
|
||||
static async imgDecypt(url: string): Promise<string> {
|
||||
if (!url) {
|
||||
return Promise.reject(new Error('image decrypt url empty'));
|
||||
}
|
||||
|
||||
// 已经是可直接使用的 URL,不需要再网络请求解密
|
||||
if (/^(blob:|data:)/.test(url)) {
|
||||
return Promise.resolve(url);
|
||||
}
|
||||
|
||||
const cached = AppApi.imgDecryptCache.get(url);
|
||||
if (cached) {
|
||||
// LRU refresh: 删除再重新设置,将 key移动到Map末尾
|
||||
AppApi.imgDecryptCache.delete(url);
|
||||
AppApi.imgDecryptCache.set(url, cached);
|
||||
return Promise.resolve(cached);
|
||||
}
|
||||
|
||||
const inFlight = AppApi.imgDecryptInFlight.get(url);
|
||||
if (inFlight) {
|
||||
return inFlight;
|
||||
}
|
||||
|
||||
const promise = fetch(url, {
|
||||
// 图床按 Referer 防盗链:localhost 会 403,空 Referer / 白名单域名可通过;
|
||||
// XHR 无法去掉 Referer,这里用 fetch 显式 no-referrer,本地与线上一致可拉图。
|
||||
referrerPolicy: 'no-referrer',
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res.ok) {
|
||||
throw new Error(`image decrypt http ${res.status}`);
|
||||
}
|
||||
const arrayBuffer = await res.arrayBuffer();
|
||||
const objectUrl = imgEncrypt(arrayBuffer);
|
||||
|
||||
AppApi.imgDecryptCache.set(url, objectUrl);
|
||||
// LRU 清理最旧的 objectURL
|
||||
if (AppApi.imgDecryptCache.size > AppApi.MAX_IMG_DECRYPT_CACHE) {
|
||||
const oldestKey = AppApi.imgDecryptCache.keys().next().value;
|
||||
if (oldestKey) {
|
||||
const oldUrl = AppApi.imgDecryptCache.get(oldestKey);
|
||||
if (oldUrl) {
|
||||
URL.revokeObjectURL(oldUrl);
|
||||
}
|
||||
AppApi.imgDecryptCache.delete(oldestKey);
|
||||
}
|
||||
}
|
||||
|
||||
AppApi.imgDecryptInFlight.delete(url);
|
||||
return objectUrl;
|
||||
})
|
||||
.catch((err) => {
|
||||
AppApi.imgDecryptInFlight.delete(url);
|
||||
return Promise.reject(err);
|
||||
});
|
||||
|
||||
AppApi.imgDecryptInFlight.set(url, promise);
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 清理解密缓存的 objectUrl,防止内存泄漏
|
||||
*/
|
||||
static clearImgDecryptCache() {
|
||||
AppApi.imgDecryptInFlight.clear();
|
||||
AppApi.imgDecryptCache.forEach((objectUrl) => {
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
});
|
||||
AppApi.imgDecryptCache.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 上传图片
|
||||
* @param data 需要参数
|
||||
* @returns
|
||||
*/
|
||||
static async uploadFile(data: any): Promise<string> {
|
||||
return request.post(`/vid/uploadStatic`, data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 获取跑马灯数据
|
||||
* @param data 无参数
|
||||
* @returns
|
||||
*/
|
||||
static getAnnounce() {
|
||||
return request.get('/modules/announce');
|
||||
}
|
||||
/**
|
||||
* @description 广告统计
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static clickAdv(data: any) {
|
||||
return request.post('/ads/click', data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
import request from '@/utils/request';
|
||||
export default class CommunityApi {
|
||||
/**
|
||||
* @description 分片上传视频
|
||||
* @param data 需要参数
|
||||
* @returns
|
||||
*/
|
||||
static async uploadVideo(data: any, processCallback: any): Promise<string> {
|
||||
return request.post(`/vid/uploadDotJson`, data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
timeout: 1000 * 120,
|
||||
onUploadProgress: processCallback,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 获取话题
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getTagList(data: any): Promise<any> {
|
||||
return request.get('/tag/v2/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 关注或者取消关注接口
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static careOrcancle(data: any): Promise<any> {
|
||||
return request.post('/mine/follow', data);
|
||||
}
|
||||
/**
|
||||
* @description 点赞
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static zan(data: any): Promise<string> {
|
||||
return request.post('/thumbsUp', data);
|
||||
}
|
||||
/**
|
||||
* @description 取消点赞
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static cancleZan(data: any): Promise<string> {
|
||||
return request.post('/thumbsDown', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取帖子评论
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getCommentList(data: any): Promise<any> {
|
||||
return request.get('/comment/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取帖子二级评论
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getSecCommentList(data: any): Promise<any> {
|
||||
return request.get('/comment/info', data);
|
||||
}
|
||||
/**
|
||||
* @description 帖子评论
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static sendComment(data: any): Promise<any> {
|
||||
return request.post('/comment/send', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取官方交流群
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getBusiness(data: any): Promise<any> {
|
||||
return request.get('/official/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 发布图文
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static publishGraphics(data: any): Promise<string> {
|
||||
return request.post('/vid/submit', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取话题详情
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static queryTagDetail(data: any): Promise<any> {
|
||||
return request.get('/tag/info', data);
|
||||
}
|
||||
/**
|
||||
* @description 收藏
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static collect(data: any): Promise<any> {
|
||||
return request.post('/mine/collect', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取公告
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getAnnouList(data: any): Promise<any> {
|
||||
return request.get('/annou/msg/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取公告
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getCommunityRecommend(data: any): Promise<any> {
|
||||
return request.get('/vid/community/recommend', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取AI广场列表
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryAiSquareList(data: any): Promise<any> {
|
||||
return request.get('/aiplaza/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取评论表情包
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getEmojiList(data: any): Promise<any> {
|
||||
return request.get('/emoji/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取ai广场帖子详情
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryAiSquareDetail(data: any): Promise<any> {
|
||||
return request.get('/aiplaza/info', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取群列表
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryImgroupList(data: any): Promise<any> {
|
||||
return request.get('/imgroup/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取im群组是否加入
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryImgroupHasjoin(data: any): Promise<any> {
|
||||
return request.get('/imgroup/hasjoin', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取群聊im消息列表
|
||||
*/
|
||||
static imMessageList(data: any) {
|
||||
return request.get('/immessage/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取im群组详情
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryImgroupInfo(data: any): Promise<any> {
|
||||
return request.get('/imgroup/info', data);
|
||||
}
|
||||
/**
|
||||
* @description 发送群聊im消息
|
||||
*/
|
||||
static imMessageSend(data: any) {
|
||||
return request.post('/immessage/send', data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
import request from '@/utils/request';
|
||||
export default class HomeApi {
|
||||
/**
|
||||
* @description 获取专题
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getTabs(): Promise<Types.Home.HomeTabItem> {
|
||||
return request.get('/modules/list');
|
||||
}
|
||||
|
||||
static getModuleList(data: any): Promise<Types.Home.SectionsItem> {
|
||||
return request.get('/vid/module/' + data.id, data.data);
|
||||
}
|
||||
static getModuleList2(data: any): Promise<Types.Home.SectionsItem> {
|
||||
return request.get('/vid/v2/module/' + data.id, data.data);
|
||||
}
|
||||
|
||||
// 短视频发现模块
|
||||
static getVidListDiscover(data: any): Promise<Types.Home.SectionsItem> {
|
||||
return request.get('/recommend/vid/list/discover', data);
|
||||
}
|
||||
|
||||
/** 亚模块热门随机刷新 */
|
||||
static refreshModuleVideos(
|
||||
subModuleId: string,
|
||||
data: { moduleSort: number; pageSize?: number; refreshToken: string },
|
||||
): Promise<Types.Home.ModuleRefreshResult> {
|
||||
return request.get(`/vid/module/${subModuleId}/refresh`, data);
|
||||
}
|
||||
|
||||
/** 首页更新红点 */
|
||||
static getContentUpdateMarkers(): Promise<Types.Home.ContentUpdateMarkers> {
|
||||
return request.get('/content/update-markers');
|
||||
}
|
||||
|
||||
// 短视频关注模块
|
||||
static getDynamicslist(data: any) {
|
||||
return request.get('/follow/dynamics/list', data);
|
||||
}
|
||||
static getAnnounce(data: any) {
|
||||
return request.get('/mine/announce/list', data);
|
||||
}
|
||||
// 获取所有专题
|
||||
static getSectionList(data: any) {
|
||||
return request.post('/section/allList', data);
|
||||
}
|
||||
// 获取专题详情
|
||||
static getSectionDetails(data: any) {
|
||||
return request.post('/section/details', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参赛作品列表
|
||||
*/
|
||||
static queryActVidList(data: any) {
|
||||
return request.get('/video_activity/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 视频热榜
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getVideoHotList(data: any): Promise<Types.Video.VInfosItem> {
|
||||
return request.get('/search/hotVid/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取专题数据
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getVidSectionList(id: string, data: any): Promise<Types.Video.VInfosItem> {
|
||||
return request.get('/vid/section/' + id, data);
|
||||
}
|
||||
/**
|
||||
* @description 获取配置标签数据
|
||||
* @param data 无参数
|
||||
* @returns
|
||||
*/
|
||||
static queryTagConfigList(): Promise<Types.Video.VInfosItem> {
|
||||
return request.get('/tag/conf/list');
|
||||
}
|
||||
/**
|
||||
* @description 获取随机短视频
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static queryRecommendVidList(data: any): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/vid/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 任务列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getSignList() {
|
||||
return request.get('/task/sign');
|
||||
}
|
||||
/**
|
||||
* @description 签到
|
||||
*/
|
||||
static taskSign(data: any) {
|
||||
return request.post('/task/sign', data);
|
||||
}
|
||||
/**
|
||||
* @description 补签
|
||||
*/
|
||||
static taskReSign(data: any) {
|
||||
return request.post('/task/resign', data);
|
||||
}
|
||||
/**
|
||||
* @description 额外奖励任务列表
|
||||
*/
|
||||
static getSignExtraPrizesList() {
|
||||
return request.get('/task/sign-extra-prizes');
|
||||
}
|
||||
/**
|
||||
* @description 获取新版签到奖品
|
||||
*/
|
||||
static checkinPrize(data: any = {}) {
|
||||
return request.post('/checkin/prize', data);
|
||||
}
|
||||
/**
|
||||
* @description 新版签到
|
||||
*/
|
||||
static checkinClick(data: any = {}) {
|
||||
return request.post('/checkin/click', data);
|
||||
}
|
||||
/**
|
||||
* @description 会员补领签到奖励
|
||||
*/
|
||||
static checkinClaimVip(data: any = {}) {
|
||||
return request.post('/checkin/claim_vip', data);
|
||||
}
|
||||
/**
|
||||
* @description 做任务
|
||||
*/
|
||||
static taskDo(data: any) {
|
||||
return request.post('/task/do', data);
|
||||
}
|
||||
/**
|
||||
* @description 领取积分
|
||||
*/
|
||||
static taskReceive(data: any) {
|
||||
return request.post('/task/receive', data);
|
||||
}
|
||||
//每日推荐-根据年月获取日
|
||||
static homeDailyRecommedYearMonth(data: any) {
|
||||
return request.post('/daily/recommendList', data);
|
||||
}
|
||||
/**
|
||||
* @description 预售金币视频
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getPresaleList(data: any) {
|
||||
return request.get('/video_gold_coin/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取娱乐数据--广告列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getRecreatio() {
|
||||
return request.get('/recreation/list');
|
||||
}
|
||||
/**
|
||||
* @description 获取娱乐数据--广告点击上报
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static upperRecreatio(data: any) {
|
||||
return request.post('/recreation/click', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询预售配置列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getConfigList() {
|
||||
return request.get('/advance_config/list');
|
||||
}
|
||||
/**
|
||||
* @description 获取积分兑换列表
|
||||
*/
|
||||
static getIntegral() {
|
||||
return request.get('/integral/list');
|
||||
}
|
||||
/**
|
||||
* @description 积分兑换
|
||||
*/
|
||||
static exchangeIntegral(data: any) {
|
||||
return request.post('/integral/exchangeIntegral', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取VIP公告
|
||||
* @param 无
|
||||
* @returns
|
||||
*/
|
||||
static queryAnnounce() {
|
||||
return request.get('/mine/announce/list');
|
||||
}
|
||||
/**
|
||||
* @description 收藏
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static collect(data: any): Promise<any> {
|
||||
return request.post('/mine/collect', data);
|
||||
}
|
||||
/**
|
||||
* @description 任务列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getTaskList() {
|
||||
return request.get('/task/list');
|
||||
}
|
||||
/**
|
||||
* @description 获取积分兑换记录列表
|
||||
*/
|
||||
static getIntegralRecord() {
|
||||
return request.get('/integral/record/list');
|
||||
}
|
||||
/**
|
||||
* @description 获取积分兑换记录列表
|
||||
*/
|
||||
static getMidSectionList(data: any) {
|
||||
return request.get('/vid/section/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 片库搜索
|
||||
*/
|
||||
static getVidLibrary(data: any) {
|
||||
return request.get('/vid/library', data);
|
||||
}
|
||||
/**
|
||||
* @description 片库搜索
|
||||
*/
|
||||
static getVidLibrarySearch(data: any) {
|
||||
return request.post('/vid/library/search', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取专题下的换一批视频列表
|
||||
*/
|
||||
static queryVidChange(id: string) {
|
||||
return request.get('/vid/section/changeVideo/' + id);
|
||||
}
|
||||
/**
|
||||
* @description 获取专题下的换一批视频列表(acg)
|
||||
*/
|
||||
static queryMediaChange(id: string) {
|
||||
return request.get('/vid/section/changeMedia/' + id);
|
||||
}
|
||||
/**
|
||||
* @description 获取首页最新模块下视频数据列表
|
||||
*/
|
||||
static queryHomeNewList(data: any) {
|
||||
return request.get('/vid/home/new/list', data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import request from '@/utils/request';
|
||||
export default class LiveApi {
|
||||
static getLiveModuleList(param: any): Promise<Types.Live.ModuleListData> {
|
||||
return request.post('/live/module/list/91porn', param);
|
||||
}
|
||||
|
||||
static getLiveAnchorList(param: any): Promise<Types.Live.AnchorListData> {
|
||||
return request.post('/live/anchor/list/91porn', param);
|
||||
}
|
||||
|
||||
static getLiveAnchorRecom(param: any): Promise<Types.Live.ModuleListData> {
|
||||
return request.post('/live/anchor/recom/91porn', param);
|
||||
}
|
||||
|
||||
static getLiveAnchorWatch(param: any): Promise<Types.Live.AnchorsItem> {
|
||||
return request.post('/live/anchor/watch/91porn', param);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import request from '@/utils/request';
|
||||
export default class MediaApi {
|
||||
// 获取动漫标签详情
|
||||
static getMediaTagInfo() {
|
||||
return request.get('/media_tag/info');
|
||||
}
|
||||
// 获取动漫标签列表
|
||||
static getMediaTagList(param: Types.Media.listParams) {
|
||||
return request.get('/media_tag/list', param);
|
||||
}
|
||||
|
||||
// 动漫列表详情
|
||||
static getMediaInfo(param: { id: string }) {
|
||||
return request.get('/media/info', param);
|
||||
}
|
||||
|
||||
//动漫片库接口
|
||||
static getMediaLibrary(): Promise<Types.Media.Library[]> {
|
||||
return request.get('/media/library');
|
||||
}
|
||||
|
||||
//动漫推荐
|
||||
static getMediaRandom(param: Types.Media.RandomPara) {
|
||||
return request.get('/media/random', param);
|
||||
}
|
||||
|
||||
// 动漫内容列表
|
||||
static getMediaContentInfo(param: { id: string }) {
|
||||
return request.get('/media_content/info', param);
|
||||
}
|
||||
|
||||
// 动漫专题
|
||||
static getMediaTopic(param: any): Promise<Types.Media.Topic> {
|
||||
return request.get('/media/topic', param);
|
||||
}
|
||||
static getMediaTopicV2(param: any): Promise<Types.Media.Topic> {
|
||||
return request.get('/media/v2/topic', param);
|
||||
}
|
||||
// 动漫片库搜索接口
|
||||
static getMediaSearch(param: Types.Media.SearchParam) {
|
||||
return request.get('/media/search', param);
|
||||
}
|
||||
// 动漫片库搜索接口【标签搜索】
|
||||
static getMediaLibrarySearch(param: Types.Media.LibrarySearchParam): Promise<Types.Media.LibrarySearchData> {
|
||||
return request.post('/media/library/search', param);
|
||||
}
|
||||
|
||||
// 专题投票
|
||||
static postSctionVote(param: { sId: string; status: number }) {
|
||||
return request.post('/vid/section/vote', param);
|
||||
}
|
||||
|
||||
static postBookshelfAdd(param: { id: string }) {
|
||||
return request.post('/media_bookshelf/add', param);
|
||||
}
|
||||
|
||||
static postBookshelfDel(param: { id: string }) {
|
||||
return request.post('/media_bookshelf/del', param);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取书架列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static queryBookshelfs(data: any): Promise<any> {
|
||||
return request.get('/media_bookshelf/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 批量删除书架列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static delBookshelfs(data: any): Promise<any> {
|
||||
return request.post('/media_bookshelf/del/batch', data);
|
||||
}
|
||||
|
||||
// 专题视频列表
|
||||
static getVidSctionList(id: string, param: Types.Media.VidSctionParam): Promise<Types.Media.Topic> {
|
||||
return request.get('/vid/section/' + id, param);
|
||||
}
|
||||
|
||||
static getTagList(data: any) {
|
||||
return request.get('/search/tags', data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import request from '@/utils/request';
|
||||
export default class MessageApi {
|
||||
/**
|
||||
* @description 发消息--私信
|
||||
* @param data
|
||||
*/
|
||||
static messagePriLetter(data: any) {
|
||||
return request.get('/message/priLetter', data);
|
||||
}
|
||||
/**
|
||||
* @description 消息已读
|
||||
* @param data
|
||||
*/
|
||||
static messageRead(data: any) {
|
||||
return request.get('/message/read', data);
|
||||
}
|
||||
/**
|
||||
* @description 动态列表
|
||||
*/
|
||||
static messageDyList(data: any) {
|
||||
return request.get('/msg/dynamic/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 动态列表
|
||||
*/
|
||||
static messageDyNum() {
|
||||
return request.get('/msg/dynamic/noRedNum');
|
||||
}
|
||||
/**
|
||||
* @description 会话消息列表
|
||||
*/
|
||||
static messageList(data: any) {
|
||||
return request.get('/msg/message/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 删除会话
|
||||
*/
|
||||
static sessionDel(data: any) {
|
||||
return request.post('/msg/session/del', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取sessionId
|
||||
*/
|
||||
static sessionGet(data: any) {
|
||||
return request.get('/msg/session/get', data);
|
||||
}
|
||||
/**
|
||||
* @description 消息会话列表
|
||||
*/
|
||||
static sessionList(data: any) {
|
||||
return request.get('/msg/session/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 私聊里面发送消息
|
||||
*/
|
||||
static priLetterAdd(data: any) {
|
||||
return request.post('/msg/priLetter/add', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 跑马灯
|
||||
*/
|
||||
static announce() {
|
||||
return request.get('/mine/announce/list', {});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
/* eslint-disable prettier/prettier */
|
||||
import request from '@/utils/request';
|
||||
export default class MineApi {
|
||||
/**
|
||||
* @description 获取金币列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getGoldCoinList(data: any): Promise<Types.Recharge.Data> {
|
||||
return request.get('/mine/currencys', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询优惠券列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getCouponList(data: any) {
|
||||
return request.get('/goldExtra/userList', data);
|
||||
}
|
||||
/**
|
||||
* @description 去充值
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getPay(data: Types.Recharge.PayTrackingFields & Record<string, unknown>) {
|
||||
return request.post('/mine/topay', data);
|
||||
}
|
||||
/**
|
||||
* @description 金币兑换(会员购买可附带 experimentId / experimentVariant / sessionId)
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static goldExchange(
|
||||
data: Pick<Types.Recharge.PayTrackingFields, 'experimentId' | 'experimentVariant' | 'sessionId'> &
|
||||
Record<string, unknown>,
|
||||
) {
|
||||
return request.post('/product/buy', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询vip种类(含 A/B 实验字段)
|
||||
* @param 无
|
||||
* @returns
|
||||
*/
|
||||
static queryVipProduct(data?: Record<string, unknown>): Promise<Types.Recharge.VipProductResponse> {
|
||||
return request.get('/vip/product', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询提现方式
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static queryWithdrawMethod(data: any) {
|
||||
return request.get('/withdraw/type', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询银行卡
|
||||
* @param 无
|
||||
* @returns
|
||||
*/
|
||||
static queryBankCards() {
|
||||
return request.get('/mine/txnact/yh/get');
|
||||
}
|
||||
/**
|
||||
* @description 绑定银行卡
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static bindBankCard(data: any) {
|
||||
return request.post('/mine/txnact/yh/add', data);
|
||||
}
|
||||
/**
|
||||
* @description 删除银行卡
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static delBankCard(data: any) {
|
||||
return request.deletes('/mine/txnact/del', data);
|
||||
}
|
||||
/**
|
||||
* @description 提现
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static withdraw(data: any) {
|
||||
return request.post('/withdraw', data);
|
||||
}
|
||||
/**
|
||||
* @description 充值记录
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static rechargeRecord(data: any) {
|
||||
return request.post('/mine/transaction', data);
|
||||
}
|
||||
/**
|
||||
* @description 提现记录
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static withdrawRecord(data: any) {
|
||||
return request.get('/withdraw/order', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询新手优惠剩余时间
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static queryNewcomerCountdown() {
|
||||
return request.get('/vip/tiroCountdown');
|
||||
}
|
||||
/**
|
||||
* @description 我的收藏列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static queryCollectionList(data: any) {
|
||||
return request.get('/mine/collect/infoList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 我的收藏列表(视频的收藏)
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static queryMineLikeInfo(data: any) {
|
||||
return request.get('/mine/like', data);
|
||||
}
|
||||
/**
|
||||
* @description 作品管理列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static collectionInfoList(data: any) {
|
||||
return request.get('/mine/collect/infoList', data);
|
||||
}
|
||||
/**
|
||||
* @description 消耗预售卡预付权益
|
||||
* @param data 参数
|
||||
* {
|
||||
* count* integer
|
||||
* privilegeType* coinVideo:金币视频 luckDraw:抽奖 aiUndress:AI脱衣 download:下载
|
||||
* }
|
||||
* @returns
|
||||
*/
|
||||
static privilegeConsume(data: any): Promise<any> {
|
||||
return request.post('/mine/privilege/consume', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取预售状态
|
||||
* @returns
|
||||
*/
|
||||
static advanceStatus(): Promise<any> {
|
||||
return request.get('/product/advanceStatus');
|
||||
}
|
||||
/**
|
||||
* @description 获取AI抵用卷
|
||||
*/
|
||||
static getAiCoupon() {
|
||||
return request.get('/ai/changeface/coupon');
|
||||
}
|
||||
/**
|
||||
* @description 获取AI优惠券
|
||||
*/
|
||||
static getAibackpack(data: any) {
|
||||
return request.get('/backpack', data);
|
||||
}
|
||||
/**
|
||||
* @description ai模版列表
|
||||
*/
|
||||
static getAiMod() {
|
||||
return request.get('/ai/mod/list');
|
||||
}
|
||||
/**
|
||||
* @description ai模版列表v2
|
||||
*/
|
||||
static getAiMod2(data: any) {
|
||||
return request.get('/ai/mod/v2/list', data);
|
||||
}
|
||||
// ai图生视频--------------------------------------------
|
||||
/* @description 生成ai图生视频
|
||||
*/
|
||||
static generateImageToVideo(data: any) {
|
||||
return request.post('/ai/imagetovideo/generate', data);
|
||||
}
|
||||
/**
|
||||
* @description AI图生视频生成记录列表
|
||||
*/
|
||||
static getAiImageToVideoRecord(data: any) {
|
||||
return request.get(`/ai/imagetovideo/list`, data);
|
||||
}
|
||||
/**
|
||||
* @description ai图生视频隐藏
|
||||
*/
|
||||
static delelteImageToVideo(data: any) {
|
||||
return request.post('/ai/imagetovideo/hide', data);
|
||||
}
|
||||
// ai脱衣--------------------------------------------
|
||||
/**
|
||||
* @description ai脱衣--生成ai脱衣记录
|
||||
*/
|
||||
static generateImg(data: any) {
|
||||
return request.post('/ai/undress/generate', data);
|
||||
}
|
||||
/**
|
||||
* @description ai脱衣隐藏
|
||||
*/
|
||||
static delelteUndress(data: any) {
|
||||
return request.post('/ai/undress/hide', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description AI脱衣生成记录列表
|
||||
*/
|
||||
static getAiUndressRecord(data: any) {
|
||||
return request.get('/ai/undress/list', data);
|
||||
}
|
||||
|
||||
// ai视频换脸模块-------------------------------------------
|
||||
/**
|
||||
* @description ai换脸隐藏
|
||||
*/
|
||||
static delelteChangeVideoFace(data: any) {
|
||||
return request.post('/ai/changeface/hide', data);
|
||||
}
|
||||
/**
|
||||
* @description ai换脸
|
||||
*/
|
||||
static generateChangeVideo(data: any) {
|
||||
return request.post('/ai/changeface/generate', data);
|
||||
}
|
||||
/**
|
||||
* @description AI视频换脸生成记录列表
|
||||
*/
|
||||
static getAiChangeFaceVideoRecord(data: any) {
|
||||
return request.get('/ai/changeface/list', data);
|
||||
}
|
||||
// ai图片换脸模块-------------------------------------------
|
||||
|
||||
/**
|
||||
* @description ai换脸
|
||||
*/
|
||||
static generateChangeImg(data: any) {
|
||||
return request.post('/ai/img/generate', data);
|
||||
}
|
||||
/**
|
||||
* @description AI视频换脸生成记录列表
|
||||
*/
|
||||
static getAiChangeFaceImgRecord(data: any) {
|
||||
return request.get('/ai/img/list', data);
|
||||
}
|
||||
/**
|
||||
* @description ai换脸隐藏
|
||||
*/
|
||||
static delelteChangeImgFace(data: any) {
|
||||
return request.post('/ai/img/hide', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description ai换脸模版
|
||||
*/
|
||||
static getChangeFaceMod(data: any) {
|
||||
return request.get('/ai/changeface/mod/list', data);
|
||||
}
|
||||
// ai绘图-------------------------------------------
|
||||
/**
|
||||
* @description ai绘图
|
||||
*/
|
||||
static setAiTextToImageGenerate(data: any) {
|
||||
return request.post('/ai/text_to_image/generate', data);
|
||||
}
|
||||
/**
|
||||
* @description ai绘图记录
|
||||
*/
|
||||
static getChangeTextCoverMod(data: any) {
|
||||
return request.get('/ai/text_to_image/list', data);
|
||||
}
|
||||
/**
|
||||
* @description ai绘图删除
|
||||
*/
|
||||
static delelteChangeTextCover(data: any) {
|
||||
return request.post('/ai/text_to_image/hide', data);
|
||||
}
|
||||
/**
|
||||
* @description 分享到ai广场
|
||||
*/
|
||||
static aiplazaShare(data: any) {
|
||||
return request.post('/aiplaza/share', data);
|
||||
}
|
||||
/**
|
||||
* @description 暗网vip会员卡
|
||||
*/
|
||||
static getAwVip() {
|
||||
return request.get('/product/getAwVip');
|
||||
}
|
||||
/**
|
||||
* @description 检查消息小红点
|
||||
*/
|
||||
static getCheckMessageTip() {
|
||||
return request.get('/ping/checkMessageTip');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户余额查询
|
||||
*/
|
||||
static getAimateGetBalance(data: any) {
|
||||
return request.get('/aimate/getBalance', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 登陆
|
||||
*/
|
||||
static getAimateLogin(data: any) {
|
||||
return request.get('/aimate/login', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description AI女友货币列表
|
||||
*/
|
||||
static getAimateCurrencys(data: any) {
|
||||
return request.get('/aimate/currencys', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description AI女友积分兑换
|
||||
*/
|
||||
static postAimateExchange(data: any) {
|
||||
return request.post('/aimate/exchange', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取原味商城链接
|
||||
*/
|
||||
static getStoreUrl() {
|
||||
return request.get('/ping/store_url');
|
||||
}
|
||||
|
||||
/* @description 生成ai小说
|
||||
*/
|
||||
static generateTextToNovel(data: any) {
|
||||
return request.post('/ai_text_to_novel/generate', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description ai小说详情
|
||||
*/
|
||||
static getAiTextNovelDetail(data: any) {
|
||||
return request.get('/ai_text_to_novel/info', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description AI小说记录
|
||||
*/
|
||||
static getAiTextNovelRecord(data: any) {
|
||||
return request.get('/ai_text_to_novel/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description ai小说删除
|
||||
*/
|
||||
static delelteAiTextNovel(data: any) {
|
||||
return request.post('/ai_text_to_novel/hide', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取 AI 女友 H5 链接
|
||||
*/
|
||||
static getAimatev2Url() {
|
||||
return request.post<{ url?: string }>('/aimatev2/url');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
export default class PaymentApi {
|
||||
/**
|
||||
* @description 获取付费引导
|
||||
*/
|
||||
static getPaymentGuide(params: Types.Payment.GetPaymentGuideParams): Promise<Types.Payment.PaymentGuide> {
|
||||
return request.get('/payment/guide', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 付费引导展示回执,仅在弹窗实际展示成功后调用
|
||||
*/
|
||||
static reportGuideImpression(data: Types.Payment.GuideImpressionParams): Promise<void> {
|
||||
return request.post('/payment/guide/impression', data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import request from '@/utils/request';
|
||||
export default class personal {
|
||||
/**
|
||||
* @description 签到任务列表详情
|
||||
*/
|
||||
static mineInfo() {
|
||||
return request.get('/mine/info');
|
||||
}
|
||||
/**
|
||||
* @description 签到任务列表详情
|
||||
*/
|
||||
static mineRights(data: any) {
|
||||
return request.get('/mine/rights', data);
|
||||
}
|
||||
/**
|
||||
* @description 个人中心作品
|
||||
*/
|
||||
static mineCollection(data: any): Promise<Types.Personal.WorksListItem> {
|
||||
return request.get('/mine/collection', data);
|
||||
}
|
||||
/**
|
||||
* @description 个人中心广场列表
|
||||
*/
|
||||
static vidList(data: any) {
|
||||
return request.get('/vid/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 已购
|
||||
*/
|
||||
static buyVid(data: any) {
|
||||
return request.get('/mine/buyVid', data);
|
||||
}
|
||||
/**
|
||||
* @description 个人中心喜欢
|
||||
*/
|
||||
static likeList(data: any) {
|
||||
return request.get('/mine/like', data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
export default class PromoteApi {
|
||||
|
||||
/**
|
||||
* @description 查询app推广信息
|
||||
*/
|
||||
static queryUserinviteInfo() {
|
||||
return request.post('/userinvite/info');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
import request from '@/utils/request';
|
||||
import { createUuid } from '@/utils/uuid';
|
||||
import MediaApi from '@/service/media';
|
||||
|
||||
const DRAMA_EPISODE_PRODUCT_TYPE = 19 as const;
|
||||
|
||||
const SORT_TYPE_MAP: Record<Types.ShortDrama.HotDramaSort, Types.ShortDrama.DramaSortType> = {
|
||||
hot: 1,
|
||||
latest: 2,
|
||||
collect: 4,
|
||||
};
|
||||
|
||||
/** 标签详情页 /media/library/search 排序码 */
|
||||
const TAG_SORT_TYPE_MAP: Record<Types.ShortDrama.HotDramaSort, Types.ShortDrama.DramaTagSortType> = {
|
||||
hot: 1,
|
||||
latest: 2,
|
||||
collect: 4,
|
||||
};
|
||||
|
||||
function mapLockStatus(episode: Types.ShortDrama.EpisodeListItem): Types.ShortDrama.EpisodeLockStatus {
|
||||
if (episode.isFree) return 'free';
|
||||
if (episode.canPlay) return 'unlocked';
|
||||
return 'locked';
|
||||
}
|
||||
|
||||
function normalizeDramaTags(raw: unknown): Types.ShortDrama.DramaTag[] {
|
||||
if (!Array.isArray(raw)) return [];
|
||||
const list: Types.ShortDrama.DramaTag[] = [];
|
||||
for (const item of raw) {
|
||||
if (!item || typeof item !== 'object') continue;
|
||||
const name = String((item as { name?: string }).name || '').trim();
|
||||
if (!name) continue;
|
||||
list.push({
|
||||
id: String((item as { id?: string }).id || ''),
|
||||
name,
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
function mapSeries(info: Types.ShortDrama.DramaInfo): Types.ShortDrama.DramaSeries {
|
||||
return {
|
||||
id: info.id,
|
||||
title: info.title || (info as { name?: string }).name || '',
|
||||
coverUrl: info.verticalCover || info.horizontalCover || '',
|
||||
totalEpisodes: Number(info.totalEpisode || 0),
|
||||
heatCount: Number(info.countBrowse || 0),
|
||||
commentCount: Number(info.countComment || 0),
|
||||
likeCount: Number(info.countLike || 0),
|
||||
collectCount: Number(info.countCollect || 0),
|
||||
hasLiked: info.mediaStatus?.hasLiked,
|
||||
hasCollected: info.mediaStatus?.hasCollected,
|
||||
tags: normalizeDramaTags(info.tagDetails),
|
||||
seriesStatus: info.updateStatus === 2 ? 'finished' : 'serializing',
|
||||
resume: info.resume || null,
|
||||
};
|
||||
}
|
||||
|
||||
function getSeriesCover(series?: Types.ShortDrama.DramaInfo | Types.ShortDrama.DramaSeries): string {
|
||||
if (!series) return '';
|
||||
if ('verticalCover' in series) return series.verticalCover || series.horizontalCover || '';
|
||||
return series.coverUrl || '';
|
||||
}
|
||||
|
||||
/** 接口 playTime 与站内其它视频一致,按秒;≥10000 兼容误传毫秒 */
|
||||
function toDurationSec(playTime: number): number {
|
||||
const n = Number(playTime) || 0;
|
||||
if (n <= 0) return 0;
|
||||
if (n >= 10000) return Math.round(n / 1000);
|
||||
return Math.round(n);
|
||||
}
|
||||
|
||||
function mapEpisode(
|
||||
episode: Types.ShortDrama.EpisodeListItem,
|
||||
series?: Types.ShortDrama.DramaInfo | Types.ShortDrama.DramaSeries,
|
||||
): Types.ShortDrama.DramaEpisode {
|
||||
const isDramaInfo = Boolean(series && 'countLike' in series);
|
||||
const dramaInfo = isDramaInfo ? (series as Types.ShortDrama.DramaInfo) : undefined;
|
||||
const seriesView = isDramaInfo ? undefined : (series as Types.ShortDrama.DramaSeries | undefined);
|
||||
return {
|
||||
id: episode.id,
|
||||
mediaId: episode.mediaId,
|
||||
episodeNumber: episode.episodeNumber,
|
||||
title: episode.name,
|
||||
coverUrl: episode.cover || getSeriesCover(series),
|
||||
videoUrl: episode.videoUrl || '',
|
||||
h265Url: episode.h265Url || '',
|
||||
playUrl: episode.videoUrl || episode.h265Url || '',
|
||||
likeCount: Number(dramaInfo?.countLike || seriesView?.likeCount || 0),
|
||||
commentCount: Number(dramaInfo?.countComment || seriesView?.commentCount || 0),
|
||||
collectCount: Number(dramaInfo?.countCollect || seriesView?.collectCount || 0),
|
||||
hasLiked: dramaInfo?.mediaStatus?.hasLiked ?? seriesView?.hasLiked,
|
||||
hasCollected: dramaInfo?.mediaStatus?.hasCollected ?? seriesView?.hasCollected,
|
||||
durationSec: toDurationSec(episode.playTime),
|
||||
// 播放进度只走本地 IndexedDB,不使用后端 progressSeconds
|
||||
// currentTimeSec: Number(episode.progressSeconds || 0),
|
||||
currentTimeSec: 0,
|
||||
ratio: Number(episode.ratio) || 0,
|
||||
tags: dramaInfo?.tagDetails || seriesView?.tags,
|
||||
lockStatus: mapLockStatus(episode),
|
||||
unlockCoins: Number(episode.price || 0),
|
||||
canPlay: Boolean(episode.canPlay),
|
||||
accessType: episode.accessType,
|
||||
};
|
||||
}
|
||||
|
||||
const EPISODE_PAGE_SIZE = 200;
|
||||
|
||||
async function fetchEpisodeListPage(
|
||||
mediaId: string,
|
||||
pageNumber: number,
|
||||
pageSize = EPISODE_PAGE_SIZE,
|
||||
): Promise<Types.ShortDrama.EpisodeListData> {
|
||||
return (
|
||||
(await request.get<Types.ShortDrama.EpisodeListData>('/media_content/list', {
|
||||
mediaId,
|
||||
sortType: 0,
|
||||
pageNumber,
|
||||
pageSize,
|
||||
})) || { total: 0, hasNext: false, list: [] }
|
||||
);
|
||||
}
|
||||
|
||||
/** 拉取分集,直到 predicate 为真或没有更多(用于尽快拿到开播集,其余页后台补) */
|
||||
async function fetchEpisodesUntil(
|
||||
mediaId: string,
|
||||
predicate: (list: Types.ShortDrama.EpisodeListItem[]) => boolean,
|
||||
): Promise<{ list: Types.ShortDrama.EpisodeListItem[]; nextPage: number; hasMore: boolean }> {
|
||||
let pageNumber = 1;
|
||||
let hasNext = true;
|
||||
const list: Types.ShortDrama.EpisodeListItem[] = [];
|
||||
|
||||
while (hasNext) {
|
||||
const res = await fetchEpisodeListPage(mediaId, pageNumber);
|
||||
const pageList = res?.list || [];
|
||||
list.push(...pageList);
|
||||
hasNext = Boolean(res?.hasNext) && pageList.length > 0;
|
||||
pageNumber += 1;
|
||||
if (predicate(list) || pageNumber > 20) break;
|
||||
if (!hasNext) break;
|
||||
}
|
||||
|
||||
return {
|
||||
list,
|
||||
nextPage: pageNumber,
|
||||
hasMore: hasNext,
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchEpisodesFromPage(
|
||||
mediaId: string,
|
||||
startPage: number,
|
||||
): Promise<Types.ShortDrama.EpisodeListItem[]> {
|
||||
let pageNumber = Math.max(1, startPage);
|
||||
let hasNext = true;
|
||||
const list: Types.ShortDrama.EpisodeListItem[] = [];
|
||||
|
||||
while (hasNext && pageNumber <= 20) {
|
||||
const res = await fetchEpisodeListPage(mediaId, pageNumber);
|
||||
const pageList = res?.list || [];
|
||||
list.push(...pageList);
|
||||
hasNext = Boolean(res?.hasNext) && pageList.length > 0;
|
||||
pageNumber += 1;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
function getRequestErrorCode(error: unknown): string {
|
||||
if (error instanceof Error && error.message) return error.message;
|
||||
return '';
|
||||
}
|
||||
|
||||
export default class ShortDramaApi {
|
||||
static async getAiDramaFeed(pageSize = 20): Promise<Types.ShortDrama.AiDramaFeedResp> {
|
||||
const res = await request.get<Types.ShortDrama.DramaFeedData>('/media/drama/feed', { pageSize });
|
||||
const list = (res?.list || []).map((item) => ({
|
||||
series: mapSeries(item.media),
|
||||
episode: mapEpisode(item.content, item.media),
|
||||
}));
|
||||
return {
|
||||
list,
|
||||
hasNext: Boolean(res?.hasNext),
|
||||
queueVersion: res?.queueVersion,
|
||||
};
|
||||
}
|
||||
|
||||
static async getHotDramaList(
|
||||
sort: Types.ShortDrama.HotDramaSort,
|
||||
pageNumber: number,
|
||||
pageSize = 20,
|
||||
): Promise<Types.ShortDrama.HotDramaListResp> {
|
||||
const res = await request.get<Types.ShortDrama.DramaListData>('/media/drama/list', {
|
||||
sortType: SORT_TYPE_MAP[sort],
|
||||
pageNumber,
|
||||
pageSize,
|
||||
});
|
||||
return {
|
||||
list: (res?.list || []).map(mapSeries),
|
||||
hasNext: Boolean(res?.hasNext),
|
||||
};
|
||||
}
|
||||
|
||||
/** 短剧标签详情列表 */
|
||||
static async getDramaTagList(
|
||||
tagID: string,
|
||||
sort: Types.ShortDrama.HotDramaSort,
|
||||
pageNumber: number,
|
||||
pageSize = 20,
|
||||
): Promise<Types.ShortDrama.HotDramaListResp> {
|
||||
const res = await MediaApi.getMediaLibrarySearch({
|
||||
tagIds: [tagID],
|
||||
sortType: TAG_SORT_TYPE_MAP[sort],
|
||||
pageNumber,
|
||||
pageSize,
|
||||
mediaType: 'drama',
|
||||
});
|
||||
return {
|
||||
list: (res?.list || []).map((item) =>
|
||||
mapSeries({
|
||||
...(item as unknown as Types.ShortDrama.DramaInfo),
|
||||
title: item.title || item.name || '',
|
||||
tagDetails: Array.isArray(item.tagDetails) ? item.tagDetails : [],
|
||||
countBrowse: Number(item.countBrowse || 0),
|
||||
countComment: Number(item.countComment || 0),
|
||||
countCollect: Number(item.countCollect || 0),
|
||||
countLike: Number(item.countLike || 0),
|
||||
totalEpisode: Number(item.totalEpisode || 0),
|
||||
updateStatus: (item.updateStatus === 2 ? 2 : 1) as 1 | 2,
|
||||
}),
|
||||
),
|
||||
hasNext: Boolean(res?.hasNext),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 首屏:media/info 与分集列表并行;只拉到「开播目标集」所在页即返回,其余页可后台补。
|
||||
*/
|
||||
static async getDramaDetailBootstrap(
|
||||
seriesId: string,
|
||||
opts?: { targetEpisodeNumber?: number; targetEpisodeId?: string },
|
||||
): Promise<{
|
||||
series: Types.ShortDrama.DramaSeries;
|
||||
episodes: Types.ShortDrama.DramaEpisode[];
|
||||
nextPage: number;
|
||||
hasMore: boolean;
|
||||
}> {
|
||||
const targetNumber = opts?.targetEpisodeNumber;
|
||||
const targetId = opts?.targetEpisodeId;
|
||||
|
||||
const infoPromise = request.get<Types.ShortDrama.DramaInfo>('/media/info', { id: seriesId });
|
||||
const listPromise = fetchEpisodesUntil(seriesId, (list) => {
|
||||
if (targetId && list.some((ep) => ep.id === targetId)) return true;
|
||||
if (targetNumber != null && list.some((ep) => ep.episodeNumber === targetNumber)) return true;
|
||||
// 无明确目标:有第一页数据即可开播
|
||||
if (!targetId && targetNumber == null) return list.length > 0;
|
||||
return false;
|
||||
});
|
||||
|
||||
const [info, pageResult] = await Promise.all([infoPromise, listPromise]);
|
||||
const series = mapSeries(info);
|
||||
return {
|
||||
series,
|
||||
episodes: pageResult.list.map((item) => mapEpisode(item, info)),
|
||||
nextPage: pageResult.nextPage,
|
||||
hasMore: pageResult.hasMore,
|
||||
};
|
||||
}
|
||||
|
||||
/** 从指定页起拉完剩余分集(后台补齐选集列表) */
|
||||
static async getDramaEpisodesFromPage(
|
||||
seriesId: string,
|
||||
series: Types.ShortDrama.DramaSeries,
|
||||
startPage: number,
|
||||
): Promise<Types.ShortDrama.DramaEpisode[]> {
|
||||
if (startPage < 1) return [];
|
||||
const list = await fetchEpisodesFromPage(seriesId, startPage);
|
||||
return list.map((item) => mapEpisode(item, series));
|
||||
}
|
||||
|
||||
static async getDramaDetail(seriesId: string): Promise<Types.ShortDrama.DramaDetailResp> {
|
||||
const boot = await this.getDramaDetailBootstrap(seriesId);
|
||||
if (!boot.hasMore) {
|
||||
return { series: boot.series, episodes: boot.episodes };
|
||||
}
|
||||
const rest = await this.getDramaEpisodesFromPage(seriesId, boot.series, boot.nextPage);
|
||||
return {
|
||||
series: boot.series,
|
||||
episodes: [...boot.episodes, ...rest],
|
||||
};
|
||||
}
|
||||
|
||||
static async getEpisodeInfo(contentId: string): Promise<Types.ShortDrama.EpisodeInfo> {
|
||||
return request.get<Types.ShortDrama.EpisodeInfo>('/media_content/info', { id: contentId });
|
||||
}
|
||||
|
||||
static applyEpisodeInfo(
|
||||
info: Types.ShortDrama.EpisodeInfo,
|
||||
series?: Types.ShortDrama.DramaSeries,
|
||||
): Types.ShortDrama.DramaEpisode {
|
||||
return mapEpisode(info, series);
|
||||
}
|
||||
|
||||
static async buyEpisode(params: {
|
||||
mediaId: string;
|
||||
contentId: string;
|
||||
checkoutContextId: string;
|
||||
}): Promise<Types.ShortDrama.BuyDramaEpisodeData> {
|
||||
return request.post<Types.ShortDrama.BuyDramaEpisodeData>(
|
||||
'/product/buy',
|
||||
{
|
||||
productType: DRAMA_EPISODE_PRODUCT_TYPE,
|
||||
productID: params.mediaId,
|
||||
contentID: params.contentId,
|
||||
checkoutContextId: params.checkoutContextId,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'X-Request-ID': createUuid(),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static getBuyErrorCode(error: unknown): string {
|
||||
return getRequestErrorCode(error);
|
||||
}
|
||||
|
||||
/** 我的喜欢-短剧 */
|
||||
static async getMineLikeList(pageNumber: number, pageSize = 12): Promise<Types.ShortDrama.HotDramaListResp> {
|
||||
const res = await request.get<Types.ShortDrama.DramaListData>('/mine/like', {
|
||||
likeType: 'drama',
|
||||
pageNumber,
|
||||
pageSize,
|
||||
});
|
||||
return {
|
||||
list: (res?.list || []).map(mapSeries),
|
||||
hasNext: Boolean(res?.hasNext),
|
||||
};
|
||||
}
|
||||
|
||||
/** 我的收藏-短剧(书架) */
|
||||
static async getMineCollectList(pageNumber: number, pageSize = 12): Promise<Types.ShortDrama.HotDramaListResp> {
|
||||
const res = await request.get<Types.ShortDrama.DramaListData>('/media_bookshelf/list', {
|
||||
type: 'drama',
|
||||
pageNumber,
|
||||
pageSize,
|
||||
});
|
||||
return {
|
||||
list: (res?.list || []).map(mapSeries),
|
||||
hasNext: Boolean(res?.hasNext),
|
||||
};
|
||||
}
|
||||
|
||||
/** 我的已购-短剧 */
|
||||
static async getMineBuyList(pageNumber: number, pageSize = 12): Promise<Types.ShortDrama.HotDramaListResp> {
|
||||
const res = await request.get<Types.ShortDrama.DramaListData>('/media/my_buy', {
|
||||
mediaType: 'drama',
|
||||
pageNumber,
|
||||
pageSize,
|
||||
});
|
||||
return {
|
||||
list: (res?.list || []).map(mapSeries),
|
||||
hasNext: Boolean(res?.hasNext),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
import request from '@/utils/request';
|
||||
export default class UserApi {
|
||||
/**
|
||||
* @description 获取金币钱包信息
|
||||
* @returns
|
||||
*/
|
||||
static queryWallet(): Promise<Types.User.WalletInfo> {
|
||||
return request.get('/mine/wallet');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询用户信息
|
||||
* @param data
|
||||
*/
|
||||
static queryUserInfo(data: any): Promise<Types.User.UserInfoType> {
|
||||
return request.get('/mine/info', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 补签打卡
|
||||
* @param data
|
||||
*/
|
||||
static reSigin(data: any) {
|
||||
return request.post('/sign_record/resign', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 修改个人资料
|
||||
* @param data
|
||||
*/
|
||||
static editPersonInfo(data: any) {
|
||||
return request.post('/mine/info', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 填写推广码
|
||||
* @param data
|
||||
*/
|
||||
static inviteBind(data: any) {
|
||||
return request.post('/mine/inviteBind', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param followUID 用户id
|
||||
* @param isFollow 是否关注
|
||||
* @description 关注或者取消关注
|
||||
* @returns
|
||||
*/
|
||||
static followCancel(followUID: number, isFollow: boolean) {
|
||||
return request.post('/mine/follow', { followUID, isFollow });
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取用户凭证
|
||||
*/
|
||||
static queryCertificate() {
|
||||
return request.get('/mine/certificate/qr');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取我的推广信息
|
||||
*/
|
||||
static queryUserInviteInfo() {
|
||||
return request.post('/userinvite/info');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取我的推广用户列表
|
||||
*/
|
||||
static queryUserInviteList(data: any) {
|
||||
return request.post('/userinvite/userlist', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 使用兑换码
|
||||
*/
|
||||
static useExchange(data: any) {
|
||||
return request.post('/code/exchange', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取我的兑换记录列表
|
||||
*/
|
||||
static queryExchangeRecord(data: any) {
|
||||
return request.get('/code/userRecord', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取客服链接接口
|
||||
*/
|
||||
static queryCustomerServiceUrl() {
|
||||
return request.get('/customer/url');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 意见反馈
|
||||
*/
|
||||
static feedback(data: object) {
|
||||
return request.post('/mine/feedback', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取优惠卷
|
||||
*/
|
||||
static queryBackpack(data: any) {
|
||||
return request.get('/backpack', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取加购卷
|
||||
*/
|
||||
static queryGoldExtraList(data: any) {
|
||||
return request.get('/goldExtra/userList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 上传解析二维码
|
||||
*/
|
||||
static parseQrcode(data: any) {
|
||||
return request.post('/mine/qrcode/extract', data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 上传图片
|
||||
*/
|
||||
static upload(data: any) {
|
||||
return request.post('/vid/uploadStatic', data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 扫码登录
|
||||
*/
|
||||
static loginGuest(data: any) {
|
||||
return request.post('/mine/login/h5/qr', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取交易记录
|
||||
*/
|
||||
static queryZhangdanList(data: any) {
|
||||
return request.get('/mine/zhangdan', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取已购视频
|
||||
*/
|
||||
static queryBuyVidList(data: any) {
|
||||
return request.get('/mine/buyVid', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询作品管理
|
||||
*/
|
||||
static queryCollectionList(data: any) {
|
||||
return request.get('/mine/collection', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询创作中心的创作视频数据
|
||||
*/
|
||||
static queryPublishDetails() {
|
||||
return request.get('/publish/details');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询周榜详情
|
||||
*/
|
||||
static queryLeaderboardList(data: any) {
|
||||
return request.get('/publish/leaderboard', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询我的收藏视频
|
||||
*/
|
||||
static queryCollectList(data: any) {
|
||||
return request.get('/mine/collect/infoList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询我的收藏视频(喜欢)
|
||||
*/
|
||||
static queryLikeList(data: any) {
|
||||
return request.get('/mine/like', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 发送验证码
|
||||
*/
|
||||
static getCaptcha(data: any) {
|
||||
return request.post('/notification/captcha', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 绑定手机/邮箱
|
||||
*/
|
||||
static bindAccount(data: any) {
|
||||
return request.post('/mine/mobileBind', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询推广记录(邀请列表)
|
||||
*/
|
||||
static queryUserinviteList(data: any) {
|
||||
return request.post('/userinvite/userlist', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取推广收益列表
|
||||
*/
|
||||
static queryIncomelist(data: any) {
|
||||
return request.post('/userinvite/incomelist', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取视频推广收益列表
|
||||
*/
|
||||
static queryVideolist(data: any) {
|
||||
return request.post('/userinvite/videolist', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取粉丝列表
|
||||
*/
|
||||
static queryFollowFansList(data: any) {
|
||||
return request.get('/follow/fans/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取关注列表
|
||||
*/
|
||||
static queryFollowList(data: any) {
|
||||
return request.get('/follow/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取获赞列表
|
||||
*/
|
||||
static queryLikeRecordList(data: any) {
|
||||
return request.get('/like/record/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 兑换码
|
||||
*/
|
||||
static exchangeCode(data: any) {
|
||||
return request.post('/code/exchange', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 积分兑换
|
||||
*/
|
||||
static exchangeIntegral(data: any) {
|
||||
return request.post('/product/exchangeIntegral', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 收益列表
|
||||
*/
|
||||
static getIncomList(data: any) {
|
||||
return request.get('/mine/iIncomes', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 我的评论
|
||||
*/
|
||||
static getCmment(data: any) {
|
||||
return request.get('/mine/comment', data);
|
||||
}
|
||||
/**
|
||||
* @description 取消收藏
|
||||
*/
|
||||
static delCollect(data: any) {
|
||||
return request.post('/mine/collect', data);
|
||||
}
|
||||
// /**
|
||||
// * @description vip推荐展示
|
||||
// */
|
||||
// static getVipRecommend() {
|
||||
// return request.get('/vip/recommend');
|
||||
// }
|
||||
/**
|
||||
* @description 找回手机/邮箱
|
||||
*/
|
||||
static findAccount(data: any) {
|
||||
return request.post('/mine/mobileLoginOnly', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取已购 动漫 小说 漫画
|
||||
*/
|
||||
static mediaMybuy(data: any) {
|
||||
return request.get('/media/my_buy', data);
|
||||
}
|
||||
/**
|
||||
* @description 我发布的帖子列表
|
||||
*/
|
||||
static minePublish(data: any) {
|
||||
return request.get('/mine/publish', data);
|
||||
}
|
||||
/**
|
||||
* @description 删除我发布的帖子
|
||||
*/
|
||||
static minePublishDelete(data: any) {
|
||||
return request.post('/mine/publish/delete', data);
|
||||
}
|
||||
/**
|
||||
* @description 头像列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static avatarList(data: Record<string, any>) {
|
||||
return request.get('/mine/userresource/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 头像列表新
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static portraitList(data: Record<string, any>) {
|
||||
return request.get('/mine/portrait', data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
import { LikeType } from '@/enums/app';
|
||||
import request from '@/utils/request';
|
||||
export default class VideoApi {
|
||||
/**
|
||||
* @description 获取随机短视频
|
||||
* @param pageNumber 页数
|
||||
* @param pageSize 每页数量
|
||||
* @returns
|
||||
*/
|
||||
static getRecommendVidList(pageNumber: number, pageSize = 20): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/recommend/vid/list', {
|
||||
pageNumber,
|
||||
pageSize,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 获取随机短视频
|
||||
* @param productType 产品类型
|
||||
* @param productID 产品id
|
||||
* @param chapterID 章节名字
|
||||
* @param couponId 优惠卷ID
|
||||
* @param serviceId 裸聊服务ID
|
||||
* @param goldVideoCouponNum 金币视频抵用券金币面值
|
||||
* @param IsH5 是否H5
|
||||
* @returns
|
||||
*/
|
||||
static videoBuying(data: Types.Video.ProductBuyType): Promise<string> {
|
||||
return request.post('/product/buy', {
|
||||
productType: data.productType,
|
||||
productID: data.productID,
|
||||
chapterID: data.chapterID,
|
||||
couponId: data.couponId,
|
||||
serviceId: data.serviceId,
|
||||
goldVideoCouponNum: data.goldVideoCouponNum,
|
||||
IsH5: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取短视频广告
|
||||
* @param vid 视频id
|
||||
* @returns
|
||||
*/
|
||||
static getShortVideoAd() {
|
||||
return request.get('/recommend/vid/ad');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取免费
|
||||
* @param vid 视频id
|
||||
* @returns
|
||||
*/
|
||||
static getPlayCount(vid: string): Promise<Types.Video.UserFreeCount> {
|
||||
return request.get('/vid/user/count', {
|
||||
vid,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 点赞
|
||||
* @param objID 视频id
|
||||
* @param LikeType 类型
|
||||
* @returns
|
||||
*/
|
||||
static like(objID: string, type: LikeType) {
|
||||
return request.post('/thumbsUp', {
|
||||
objID,
|
||||
type,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 取消点赞
|
||||
* @param vid 视频id
|
||||
* @param LikeType 类型
|
||||
* @returns
|
||||
*/
|
||||
static cancleLike(objID: string, type: LikeType) {
|
||||
return request.post('/thumbsDown', {
|
||||
objID,
|
||||
type,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 点赞
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static zan(data: any): Promise<string> {
|
||||
return request.post('/thumbsUp', data);
|
||||
}
|
||||
/**
|
||||
* @description 取消点赞
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static cancleZan(data: any): Promise<string> {
|
||||
return request.post('/thumbsDown', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取关注用户的视频列表
|
||||
* @param pageNumber 页数
|
||||
* @param pageSize 每页数量
|
||||
* @returns
|
||||
*/
|
||||
static queryFocusVideoList(pageNumber: number, pageSize: number): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/follow/dynamics/list', {
|
||||
pageNumber,
|
||||
pageSize,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 获取城市视频
|
||||
* @param pageNumber 页数
|
||||
* @param pageSize 每页数量
|
||||
* @param city 城市
|
||||
* @returns
|
||||
*/
|
||||
static queryLocationList(pageNumber: number, pageSize: number, city: string): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/vid/location/list', {
|
||||
pageNumber,
|
||||
pageSize,
|
||||
city,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询我的已购视频
|
||||
* @param pageNumber 页数
|
||||
* @param pageSize 每页数量
|
||||
* @returns
|
||||
*/
|
||||
static querybuyVid(pageNumber: number, pageSize: number): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/mine/buyVid', {
|
||||
pageNumber,
|
||||
pageSize,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @description 查询视频详情
|
||||
* @param videoID 视频ID
|
||||
* @returns
|
||||
*/
|
||||
static queryVideoInfo(data: any): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/vid/info', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询视频
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryCollection(data: any): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/mine/collection', data);
|
||||
}
|
||||
/**
|
||||
* @description 精彩推荐
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryRecommend(data: any): Promise<Types.Video.VideoModel> {
|
||||
return request.get('/vid/recommend/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 查询推荐视频
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
static queryModuleVideoList(data: any): Promise<Types.Video.VideoModel> {
|
||||
return request.post('/vid/moduleVideo', data);
|
||||
}
|
||||
/**
|
||||
* @description 获取帖子评论
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getCommentList(data: any): Promise<Types.Video.CommentItem> {
|
||||
return request.get('/comment/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 帖子评论
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static sendComment(data: any): Promise<Types.Video.CommentItem> {
|
||||
return request.post('/comment/send', data);
|
||||
}
|
||||
/**
|
||||
* @description 热点推荐
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getHotRecommend(data: any): Promise<Types.Video.Tag> {
|
||||
return request.get('/search/hotTag', data);
|
||||
}
|
||||
/**
|
||||
* @description 猜你喜欢的帖子
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getPost(data: any): Promise<Types.Video.VInfosItem> {
|
||||
return request.get('/search/hotPublisher/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 搜索帖子
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static searchPost(data: any): Promise<Types.Video.VInfosItem> {
|
||||
return request.post('/search/list', data);
|
||||
}
|
||||
/**
|
||||
* @description 根据标签搜索帖子
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static searchTagPost(data: any): Promise<Types.Video.VInfosItem> {
|
||||
return request.get('/tag/vid/list', data);
|
||||
}
|
||||
//视频播放调用接口
|
||||
static getPlayVideo(data: any): Promise<Types.Video.UserFreeCount> {
|
||||
return request.post(`/vid/play`, data);
|
||||
}
|
||||
/**
|
||||
* @description 搜索帖子--只用于发布
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static searchPublishPost(): Promise<Types.Video.VInfosItem> {
|
||||
return request.get('/search/publisher/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 热门视频列表
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getHotVidList(data: any) {
|
||||
return request.get('/search/hotVid/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取vip折扣专区
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getVidDiscountArea() {
|
||||
return request.get('/vid/discount/area');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取vip折扣专区下的视频
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getVidDiscountList(data: any) {
|
||||
return request.get('/vid/discount/list', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 猜你喜欢
|
||||
* @param data 参数
|
||||
* @returns
|
||||
*/
|
||||
static getGuessYouLike(data: any) {
|
||||
return request.get('/vid/module/all/' + data.id, data.data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user