| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import { get, getL, post } from './http';
- const apis = {
- LIST: '/api/luckRoom',
- DETAIL: '/api/luckRoom/detail',
- JOIN: '/api/luckRoom/participate',
- RECORD: '/api/luckRoom/participateRecordMy',
- LIST_CREATE: '/api/luckRoom/myCreate',
- CREATE: '/api/luckRoom/create',
- ROOM_AUDIT_RECORD: '/api/luckRoom/roomParticipateRecord',
- ROOM_AUDIT_PASS: '/api/luckRoom/auditPass',
- ROOM_AUDIT_UNPASS: '/api/luckRoom/auditUnpass',
- WINNINGRECORD: '/api/luckRoom/winningTheLotteryRecord',
- LUCKNUMLIST: '/api/luckRoom/mySign',
- ROOM_TYPE: '/api/luckRoom/roomType',
- DATE_TIME_SCOPE: '/api/wallet/dateTimeScope', // 用于首页活动时间判断
- };
- export const getWealList = async (current: number, size: number, keyword?: string, type?: string, loading = false) => {
- const res = await post(apis.LIST, { current, size, keyword, type }, { loading });
- return res.data;
- };
- export const getWealDetail = async (roomId: string, loading = false) => {
- const res = await get(apis.DETAIL, { roomId }, { loading });
- return res.data;
- };
- export const joinWealRoom = async (roomId: string, password = '', shareId?: string) => {
- const res = await getL(apis.JOIN, { roomId, password, shareId });
- return res;
- };
- export const getWealRecord = async (current: number, size: number, loading = false) => {
- const res = await post(apis.RECORD, { current, size }, { loading });
- return res.data;
- };
- export const getWinningRecord = async (roomId: string) => {
- const res = await get(apis.WINNINGRECORD, { roomId });
- return res.data;
- };
- export const getLuckNumList = async (roomId: string) => {
- const res = await getL(`${apis.LUCKNUMLIST}?roomId=${roomId}`);
- return res.data;
- };
- export const getRoomTypePermission = async () => {
- const res = await getL(apis.ROOM_TYPE);
- return res.data;
- };
- export const getDateTimeScope = async () => {
- const res = await get(apis.DATE_TIME_SCOPE);
- return res.data;
- };
- // 后续如有创建相关需求可继续添加
- export const getMyCreateList = async (current: number, size: number, loading = false) => {
- const res = await post(apis.LIST_CREATE, { current, size }, { loading });
- return res.data;
- };
- export const createRoom = async (params: {
- description: string;
- inventoryIds: string[];
- luckTime: string;
- name: string;
- password?: string;
- participateMode?: number;
- }) => {
- console.log('Service: createRoom called', params);
- try {
- const res = await post(apis.CREATE, params, { loading: true });
- console.log('Service: createRoom response', res);
- return res;
- } catch (error) {
- console.error('Service: createRoom error', error);
- return { success: false, msg: '网络或未知错误' };
- }
- };
- export default {
- getWealList,
- getWealDetail,
- joinWealRoom,
- getWealRecord,
- getWinningRecord,
- getLuckNumList,
- getRoomTypePermission,
- getDateTimeScope,
- getMyCreateList,
- createRoom,
- // 扭蛋机相关 API
- catchDollDetail: async () => {
- const res = await get('/api/activity/dollMachine/detail');
- return res;
- },
- dollLottery: async (params: { quantity: number }) => {
- const res = await post('/api/activity/dollMachine/participate', params);
- return res;
- },
- prizeResult: async (params: { current: number; size: number }, loading = false) => {
- const res = await post('/api/activity/dollMachine/pageAllParticipate', params, { loading });
- return res.data;
- },
- };
|