import { get, post } from '../utils/request'; import { showMessage } from '../common/toast/toast'; interface BlogInfo { blogId: number; blogName: string; blogNickName: string; bigAvaImg: string; selfIntro: string; isAuth: boolean; isVerify: boolean; signAuth: boolean; } export interface ProcessBar { id: number; activityId: number; /** * 进度条类型 0:发文量,1:蹲蹲 2:支持力 */ type: 0 | 1 | 2; /** * type是0 tag type是1 postId */ target: string; targetCount: number; currentCount: number; /** * 0:无,1 */ buttonAct: number; } export interface ProcessBarResponseData { itemList: { blogInfo: BlogInfo, time: number, type: number }[]; processBar: ProcessBar; /** * 0 未蹲 1 已蹲 */ dun: 0 | 1; } export const fetchProcess = async ( processBarId: string | number, activityId: string | number ): Promise => { const res: any = await get( '//www.lofter.com/spread/common/processBar/getInfo.json', // 'https://nei.hz.netease.com/api/apimock-v2/c6da9202198a943efec7f11c8a937f16/spread/common/processBar/getInfo.json?activityId=&processBarId=', { processBarId, activityId } ) if (res.code === 200) { return res.data; } showMessage({ text: res.msg }) throw new Error(res.meg); } export const postDunToProcess = async ( processBarId: string | number, activityId: string | number, targetPostId: string | number, ) => { const res: any = await post( '//www.lofter.com/spread/common/useract/dun', // 'https://nei.hz.netease.com/api/apimock-v2/c6da9202198a943efec7f11c8a937f16/spread/common/rank/getItems.json?activityId=&rankId=', { processBarId, activityId, targetPostId } ) if (res.code === 200) { return res.data; } showMessage({ text: res.msg }) throw new Error(res.meg); }