index.js 2.44 KB
import api from '../../common/api';

export default {
  /**
     *
     */
  getLimitSaleList(data) { // 获取限定发售列表
    return api.get({
      url: '',
      data: data
    });
  },

  /**
     * 获取活动信息
     */
  getActivityInfo(actId) {
    if (!actId) {
      return Promise.reject({
        code: 403,
        message: '缺少actId参数'
      });
    }
    return api.get({
      url: '',
      data: {
        method: 'app.drawline.getActivityInfo',
        activityId: actId
      }
    });
  },

  /**
     * 获取用户参与排队的信息
     */
  getUserActivityInfo(actId) {
    if (!actId) {
      return Promise.reject({
        code: 403,
        message: '缺少actId参数'
      });
    }
    return api.get({
      url: '',
      data: {
        method: 'app.drawline.getUserActivityInfo',
        activityId: actId
      }
    });
  },

  /**
     * 获取排队列表
     */
  getQueueList(actId, start = 0, limit = 50) {
    if (!actId) {
      return Promise.reject({
        code: 403,
        message: '缺少actId参数'
      });
    }

    return api.get({
      url: '',
      data: {
        activityId: actId,
        sort: start,
        limit: limit,
        method: 'app.drawline.getQueueList',
        randCode: (new Date()).getTime()
      }
    });
  },

  /**
     * 加入排队
     */
  addQueue(actId, userId) {
    if (!actId) {
      return Promise.reject({
        code: 403,
        message: '缺少actId参数'
      });
    }
    return api.post({
      url: '',
      data: {
        method: 'app.drawline.addQueueForHelp',
        activityId: actId,
        userId: userId
      }
    });
  },

  /**
     * 获取中奖名单
     */
  getPrizeUserList(actId, limit = 30, page = 1) {
    if (!actId) {
      return Promise.reject({
        code: 403,
        message: '缺少actId参数'
      });
    }
    return api.get({
      url: '',
      data: {
        activityId: actId,
        limit: limit,
        page: page,
        method: 'app.drawline.getLuckyUserList'
      }
    });
  },

  /**
   * 获取用户排队列表(用户好友助力列表)
   */
  getMyQueueList(actId, limit = 10, page = 1) {
    if (!actId) {
      return Promise.reject({
        code: 403,
        message: '缺少actId参数'
      });
    }
    return api.get({
      url: '',
      data: {
        activityId: actId,
        limit: limit,
        page: page,
        method: 'app.drawline.getMyQueueList'
      }
    });
  },
};