exports.ids = ["weimob-cloud-commons"];
exports.modules = {

/***/ "./src/packages/wm-cloud-db_index/utils/db_api/dbrequest.js":
/*!******************************************************************!*\
  !*** ./src/packages/wm-cloud-db_index/utils/db_api/dbrequest.js ***!
  \******************************************************************/
/*! exports provided: dbLoginParam, dbCheckHavePower, apiCoopIndex, apiScan, uploadFile, authAvatar, getTicketStatus, getShareUserInfo, doAssist, getActivityStatus, queryOrderId, userRecord */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dbLoginParam", function() { return dbLoginParam; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dbCheckHavePower", function() { return dbCheckHavePower; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiCoopIndex", function() { return apiCoopIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiScan", function() { return apiScan; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uploadFile", function() { return uploadFile; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "authAvatar", function() { return authAvatar; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTicketStatus", function() { return getTicketStatus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getShareUserInfo", function() { return getShareUserInfo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doAssist", function() { return doAssist; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActivityStatus", function() { return getActivityStatus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "queryOrderId", function() { return queryOrderId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "userRecord", function() { return userRecord; });
// 线上测试 pre  线上正式online
// TODO 上线前检查
const app = getApp();
// const __env__ = 'pre'

// const dbDomains = {
//   'online': "https://95721.activity-18.m.duiba.com.cn",
//   'pre': "https://activity-pre.m.duiba.com.cn",
//   'test': "https://activity.m.duibatest.com.cn"
// }

// const dbDomainPaths = {
//   'online': dbDomains['online'] + "/projectx/p764e268d",
//   'pre': dbDomains['pre'] + "/projectx/p764e268d",
//   'test': dbDomains['test'] + "/projectx/pfebb155c"
// }

// /**小程序接口 */
// export const dbDomain = dbDomains[__env__]
// /**活动接口 */
// export const apiDbDomain = dbDomainPaths[__env__]

// 小程序授权登陆
const dbLoginParam = {
  url: "/weimocloud/wechat/autoLogin",
  //dbDomain +
  method: "POST",
  header: {}
};

// 验证用户是否授权过
const dbCheckHavePower = {
  url: "/weimocloud/wechat/loginCheck",
  //dbDomain +
  method: "POST",
  header: {}
};

/** 活动首页*/
const apiCoopIndex = {
  url: "/weimocloud/projectx/index",
  //apiDbDomain +
  header: {},
  method: "GET"
};

/** 扫码*/
const apiScan = {
  url: "/weimocloud/projectx/scan",
  //apiDbDomain +
  header: {},
  method: "GET"
};

// 上传头像数据
const uploadFile = {
  url: "/weimocloud/customActivity/imgUploadUrl",
  method: "POST",
  header: {}
};

//保存头像昵称
const authAvatar = {
  url: "/weimocloud/projectx/authAvatar",
  method: "GET",
  header: {}
};

// weimocloud/projectx/getTicketStatus?ticket=xx&qrcodeSign=xxx

//查询瓶盖码有没有过期
const getTicketStatus = {
  url: "/weimocloud/projectx/getTicketStatus",
  method: "GET",
  header: {}
};

//获取邀请者头像昵称
const getShareUserInfo = {
  url: "/weimocloud/projectx/getShareUserInfo",
  method: "GET",
  header: {}
};

//助力
const doAssist = {
  url: "/weimocloud/projectx/doAssist",
  method: "GET",
  header: {}
};

//获取活动状态
const getActivityStatus = {
  url: "/weimocloud/projectx/getActivityStatus",
  method: "GET",
  header: {}
};

//轮训查询奖品orderId
const queryOrderId = {
  url: "/weimocloud/projectx/getOrderId",
  method: "GET",
  header: {}
};
const userRecord = {
  url: "/weimocloud/projectx/userRecord",
  method: "GET",
  header: {}
};

/***/ }),

/***/ "./src/packages/wm-cloud-db_index/utils/db_api/globalData.js":
/*!*******************************************************************!*\
  !*** ./src/packages/wm-cloud-db_index/utils/db_api/globalData.js ***!
  \*******************************************************************/
/*! exports provided: globalData, awardUrl, rankUrl, chanllageUrl, shopUrl, exchangeUrl, getUrlParam */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "globalData", function() { return globalData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "awardUrl", function() { return awardUrl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rankUrl", function() { return rankUrl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "chanllageUrl", function() { return chanllageUrl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shopUrl", function() { return shopUrl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exchangeUrl", function() { return exchangeUrl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUrlParam", function() { return getUrlParam; });
// // 线上测试
// export const preEnv = "https://95721.activity-18.m.duiba.com.cn/projectx/p03805f35/index.html?appID=95721"

// export const prodEnv = "https://95721.activity-18.m.duiba.com.cn/projectx/pf892b6a1/index.html?appID=95721"

const globalData = {
  loginToken: "",
  indexInfo: {},
  wid: ""
};
//正式项目 pc98b8da4
//线上测试 pb4c53264

const awardUrl = "https://duiba.ioutu.cn/projectx/pc98b8da4/myPrize.html?appID=96109";
const rankUrl = "https://duiba.ioutu.cn/projectx/pc98b8da4/rank.html?appID=96109";
const chanllageUrl = "https://duiba.ioutu.cn/projectx/pc98b8da4/index.html?appID=96109";
const shopUrl = "/cms_design/index?productInstanceId=13068633342&vid=0&pageid=57840295342";
const exchangeUrl = "/cms_design/design?productInstanceId=13068633342&vid=0&pageid=58011845342";
function getUrlParam(name, search) {
  let matched = search.split('?')[1].match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
  return search.length ? matched && matched[2] : null;
}

/***/ }),

/***/ "./src/packages/wm-cloud-db_index/utils/db_api/index.js":
/*!**************************************************************!*\
  !*** ./src/packages/wm-cloud-db_index/utils/db_api/index.js ***!
  \**************************************************************/
/*! exports provided: reqDbLogin, reqDbCheckHavePower, apiDbIndexInfo, apiDbScan, apiUploadFile, apiAuthAvatar, apiGetTicketStatus, apiGetShareUserInfo, apiDoAssist, apiGetActivityStatus, apiQueryOrderId, apiUserRecord */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reqDbLogin", function() { return reqDbLogin; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reqDbCheckHavePower", function() { return reqDbCheckHavePower; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiDbIndexInfo", function() { return apiDbIndexInfo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiDbScan", function() { return apiDbScan; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUploadFile", function() { return apiUploadFile; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAuthAvatar", function() { return apiAuthAvatar; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetTicketStatus", function() { return apiGetTicketStatus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetShareUserInfo", function() { return apiGetShareUserInfo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiDoAssist", function() { return apiDoAssist; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetActivityStatus", function() { return apiGetActivityStatus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiQueryOrderId", function() { return apiQueryOrderId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUserRecord", function() { return apiUserRecord; });
/* harmony import */ var _requestFun__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./requestFun */ "./src/packages/wm-cloud-db_index/utils/db_api/requestFun.js");
/* harmony import */ var _dbrequest__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dbrequest */ "./src/packages/wm-cloud-db_index/utils/db_api/dbrequest.js");
/* harmony import */ var _globalData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./globalData */ "./src/packages/wm-cloud-db_index/utils/db_api/globalData.js");




// 小程序授权登陆
const reqDbLogin = param => {
  console.warn("reqDbLogin");
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["dbLoginParam"],
    data: param
  });
};

//查看是否绑定手机号
const reqDbCheckHavePower = param => {
  console.log(param);
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["dbCheckHavePower"],
    // url: `${dbCheckHavePower.url}`,
    data: param
  });
};

//首页
const apiDbIndexInfo = param => {
  param.loginToken = _globalData__WEBPACK_IMPORTED_MODULE_2__["globalData"].loginToken;
  console.log(param);
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["apiCoopIndex"],
    data: param
  });
};

//扫码
const apiDbScan = param => {
  param.loginToken = _globalData__WEBPACK_IMPORTED_MODULE_2__["globalData"].loginToken;
  console.log(param);
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["apiScan"],
    data: param
  });
};

//上传头像
const apiUploadFile = param => {
  param.loginToken = _globalData__WEBPACK_IMPORTED_MODULE_2__["globalData"].loginToken;
  console.log(param);
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["uploadFile"],
    data: param
  });
};

//授权头像
const apiAuthAvatar = param => {
  param.loginToken = _globalData__WEBPACK_IMPORTED_MODULE_2__["globalData"].loginToken;
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["authAvatar"],
    data: param
  });
};

//查询瓶盖码是否生效
const apiGetTicketStatus = param => {
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["getTicketStatus"],
    data: param
  });
};

//查询邀请者头像昵称
const apiGetShareUserInfo = param => {
  // param.loginToken = globalData.loginToken
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["getShareUserInfo"],
    data: param
  });
};

//助力
const apiDoAssist = param => {
  param.loginToken = _globalData__WEBPACK_IMPORTED_MODULE_2__["globalData"].loginToken;
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["doAssist"],
    data: param
  });
};

//查询活动状态
const apiGetActivityStatus = param => {
  // param.loginToken = globalData.loginToken
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["getActivityStatus"],
    data: param
  });
};

//轮训查询奖品orderId
const apiQueryOrderId = param => {
  param.loginToken = _globalData__WEBPACK_IMPORTED_MODULE_2__["globalData"].loginToken;
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["queryOrderId"],
    data: param
  });
};

//记录用户进入数据
const apiUserRecord = param => {
  return Object(_requestFun__WEBPACK_IMPORTED_MODULE_0__["default"])({
    ..._dbrequest__WEBPACK_IMPORTED_MODULE_1__["userRecord"],
    data: param
  });
};

/***/ }),

/***/ "./src/packages/wm-cloud-db_index/utils/db_api/requestFun.js":
/*!*******************************************************************!*\
  !*** ./src/packages/wm-cloud-db_index/utils/db_api/requestFun.js ***!
  \*******************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _globalData__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./globalData */ "./src/packages/wm-cloud-db_index/utils/db_api/globalData.js");

const requestFun = async dataSouce => {
  // wx.showLoading({
  //   mask: true
  // })
  console.log(dataSouce, "dataSouce");
  return await new Promise((resolve, reject) => {
    getApp().getSdk().request({
      url: dataSouce.url,
      // 接口名称相对地址
      data: {
        ...dataSouce.data
      },
      // 接口所需数据
      requestOption: {
        header: {
          ...dataSouce.header,
          "cloud-app-id": "612072719085-yxh-login" // 开发者接口所在容器应用的环境域名前缀。配置错误会导致HTTP请求404。
        },
        method: dataSouce.method
      }
    }).then(res => {
      if (res.code == '90002') {
        /**token失效，重新登陆 */
        // await login(globalData.wid)
        wx.showToast({
          title: '获取数据失败，请重新进入吧~',
          icon: "none"
        });
      }
      console.warn('收到接口返回值:' + dataSouce.url, res);
      resolve(res);
    });
  });
};
/* harmony default export */ __webpack_exports__["default"] = (requestFun);
const login = async wid => {
  await new Promise(r => {
    wx.login({
      success: ress => {
        reqDbLogin({
          code: ress.code,
          wid
        }).then(respp => {
          if (respp) {
            _globalData__WEBPACK_IMPORTED_MODULE_0__["globalData"].loginToken = encodeURIComponent(respp.data.loginToken);
            r(1);
          }
        });
      }
    });
  });
};

/***/ })

};;