huosdk-1.0.2.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. /*
  2. * @Author: your name
  3. * @Date: 2021-05-12 14:09:37
  4. * @LastEditTime: 2021-05-12 14:14:11
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: \ewqeqwqe\huo\huosdk-1.0.2.js
  8. */
  9. module.exports = function (e) {
  10. var t = {};
  11. function a(r) {
  12. if (t[r]) return t[r].exports;
  13. var n = t[r] = {i: r, l: !1, exports: {}};
  14. return e[r].call(n.exports, n, n.exports, a), n.l = !0, n.exports
  15. }
  16. return a.m = e, a.c = t, a.d = function (e, t, r) {
  17. a.o(e, t) || Object.defineProperty(e, t, {enumerable: !0, get: r})
  18. }, a.r = function (e) {
  19. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(e, "__esModule", {value: !0})
  20. }, a.t = function (e, t) {
  21. if (1 & t && (e = a(e)), 8 & t) return e;
  22. if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  23. var r = Object.create(null);
  24. if (a.r(r), Object.defineProperty(r, "default", {
  25. enumerable: !0,
  26. value: e
  27. }), 2 & t && "string" != typeof e) for (var n in e) a.d(r, n, function (t) {
  28. return e[t]
  29. }.bind(null, n));
  30. return r
  31. }, a.n = function (e) {
  32. var t = e && e.__esModule ? function () {
  33. return e.default
  34. } : function () {
  35. return e
  36. };
  37. return a.d(t, "a", t), t
  38. }, a.o = function (e, t) {
  39. return Object.prototype.hasOwnProperty.call(e, t)
  40. }, a.p = "", a(a.s = 2)
  41. }([function (e, t, a) {
  42. "use strict";
  43. var r = {
  44. debug: !1,
  45. baseParams: {app_id: "", client_id: "", format: "json"},
  46. gameParams: {"game-pkg_name": "", "game-app_ver": "", "game-h_ver": "", "game-sdk_ver": "", "game-mp_id": ""},
  47. agentParams: {"agent-ch": "", "agent-sub_ch": ""},
  48. deviceParams: {
  49. "device-device_id": "",
  50. "device-mac": "",
  51. "device-ip": "",
  52. "device-brand": "",
  53. "device-model": "",
  54. "device-os": "",
  55. "device-os_version": "",
  56. "device-screen": "",
  57. "device-net": "",
  58. "device-imsi": "",
  59. "device-longitude": "",
  60. "device-latitude": "",
  61. "device-userua": "",
  62. "device-disk_space": "",
  63. "device-open_time": "",
  64. "device-is_charge": "",
  65. "device-screen_luminance": "",
  66. "device-has_sim": "",
  67. "device-is_break": ""
  68. },
  69. extParams: {
  70. brand: "",
  71. model: "",
  72. pixelRatio: "",
  73. screenWidth: "",
  74. screenHeight: "",
  75. windowWidth: "",
  76. windowHeight: "",
  77. statusBarHeight: "",
  78. language: "",
  79. version: "",
  80. system: "",
  81. platform: "",
  82. fontSizeSetting: "",
  83. SDKVersion: "",
  84. benchmarkLevel: "",
  85. albumAuthorized: "",
  86. cameraAuthorized: "",
  87. locationAuthorized: "",
  88. microphoneAuthorized: "",
  89. notificationAuthorized: "",
  90. notificationAlertAuthorized: "",
  91. notificationBadgeAuthorized: "",
  92. notificationSoundAuthorized: "",
  93. bluetoothEnabled: "",
  94. locationEnabled: "",
  95. wifiEnabled: "",
  96. safeArea: ""
  97. },
  98. setting: {showLoading: !0, loadingParams: {title: "加载中", mask: !0}, showToast: !1, toastParams: {icon: "none"}},
  99. launchOptions: {},
  100. baseUrl: ""
  101. };
  102. try {
  103. r.gameParams["game-pkg_name"] = wx.canIUse ? "" : "game", wx.getSystemInfo({
  104. success: function (e) {
  105. r.deviceParams["device-brand"] = encodeURIComponent(e.brand), r.deviceParams["device-model"] = encodeURIComponent(e.model), r.deviceParams["device-screen"] = encodeURIComponent(e.screenWidth + "x" + e.screenHeight), r.deviceParams["device-os"] = "devtools" === e.platform ? "android" : encodeURIComponent(e.platform), r.deviceParams["device-os_version"] = encodeURIComponent(e.system), r.extParams.brand = e.brand, r.extParams.model = e.model, r.extParams.pixelRatio = e.pixelRatio, r.extParams.windowWidth = e.windowWidth, r.extParams.windowHeight = e.windowHeight, r.extParams.statusBarHeight = e.statusBarHeight, r.extParams.language = e.language, r.extParams.version = e.version, r.extParams.system = e.system, r.extParams.platform = e.platform, r.extParams.fontSizeSetting = e.fontSizeSetting, r.extParams.SDKVersion = e.SDKVersion, r.extParams.benchmarkLevel = e.benchmarkLevel, r.extParams["albumAuthorized\t"] = e.albumAuthorized, r.extParams.cameraAuthorized = e.cameraAuthorized, r.extParams.locationAuthorized = e.locationAuthorized, r.extParams.microphoneAuthorized = e.microphoneAuthorized, r.extParams.notificationAuthorized = e.notificationAuthorized, r.extParams.notificationAlertAuthorized = e.notificationAlertAuthorized, r.extParams.notificationBadgeAuthorized = e.notificationBadgeAuthorized, r.extParams.notificationSoundAuthorized = e.notificationSoundAuthorized, r.extParams.bluetoothEnabled = e.bluetoothEnabled, r.extParams.locationEnabled = e.locationEnabled, r.extParams.wifiEnabled = e.wifiEnabled, r.extParams.safeArea = e.safeArea
  106. }
  107. }), r.extParams.userua = window.navigator.userAgent, wx.getNetworkType({
  108. success: function (e) {
  109. r.deviceParams["device-net"] = encodeURIComponent(e.networkType), r.extParams.net = e.networkType
  110. }
  111. }), wx.getScreenBrightness({
  112. success: function (e) {
  113. r.deviceParams["device-screen_luminance"] = encodeURIComponent(parseInt(100 * e.value)), r.extParams.screen_luminance = parseInt(100 * e.value)
  114. }
  115. })
  116. } catch (e) {
  117. }
  118. e.exports = r
  119. }, function (e, t, a) {
  120. "use strict";
  121. var r = Object.assign || function (e) {
  122. for (var t = 1; t < arguments.length; t++) {
  123. var a = arguments[t];
  124. for (var r in a) Object.prototype.hasOwnProperty.call(a, r) && (e[r] = a[r])
  125. }
  126. return e
  127. }, n = i(a(0)), o = i(a(4));
  128. function i(e) {
  129. return e && e.__esModule ? e : {default: e}
  130. }
  131. var s = void 0, c = {
  132. ajax: function (e) {
  133. var t = this.setting(e.conf);
  134. return e.conf && delete e.conf, t.showLoading && wx.showLoading(t.loadingParams), e = this.params(e), n.default.debug && console.log((new Date).getTime(), e.url, e.data), new Promise((function (a, o) {
  135. wx.request(r({}, e, {
  136. success: function (r) {
  137. n.default.debug && console.log((new Date).getTime(), e.url, r), t.showLoading && wx.hideLoading(), 200 !== r.statusCode || !r.data || void 0 !== r.data.code && 200 !== r.data.code ? (t.showToast && (r.data && r.data.msg && (t.toastParams.title = r.data.msg), wx.showToast(t.toastParams)), o(r)) : a(r)
  138. }, fail: function (a) {
  139. n.default.debug && console.log((new Date).getTime(), e.url, a), t.showLoading && wx.hideLoading(), t.showToast && (a.errMsg && (t.toastParams.title = a.errMsg), wx.showToast(t.toastParams)), o(a)
  140. }
  141. }))
  142. }))
  143. }, params: function (e) {
  144. if (e.method = (e.method || "get").toUpperCase(), "POST" !== e.method || e.header || (e.header = {"Content-Type": "application/x-www-form-urlencoded"}), !e.private) {
  145. var t = wx.getStorageSync("userInfo");
  146. e.data = r({}, n.default.baseParams, n.default.gameParams, n.default.agentParams, n.default.deviceParams, e.data, {
  147. "device-ext": encodeURIComponent(JSON.stringify(n.default.extParams)),
  148. token: t ? t.user_token : "",
  149. ts: (new Date).getTime()
  150. })
  151. }
  152. return e.data.sign = this.sign(e), /^http/.test(e.url) || (e.url = n.default.baseUrl + e.url), delete e.private, delete e.signUrl, e
  153. }, setting: function () {
  154. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  155. return r({}, n.default.setting, e)
  156. }, sign: function (e) {
  157. var t = "";
  158. t = e.data.channel_id ? "&clientkey&MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDleNmoD8CwcsVduQnG7UAMqD2aYpwwwswmMLSKvwNZ6pQeC4ugwGaG3E8jfzRvMYzIUcCYkQ9uROuKiA3+LGZ9Zyvy3uIVycCcMwM88WgRMjospa2EoGVI4Ef8qcvbfPGC3vwdIKQRs4dnaG6yQsOcyVkgyRtDq4iQnnlG9Onw5QIDAQAB" : "&clientkey&MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHrJSESIbzCdsC0+zIwSn3ft9RGaau0izFCdXodH3i/sWgYcoF+wvbvAMB9336tpTYMSfbks4HfSyt8PDunChqyeCnnraj60DRrySOxAIbjjSAxVxI437R5qZt3mFbH1rgptLfi5RP3N6XIWDk8Ecw2XCdlqfDPiQhGCYleldsdQIDAQAB", e.app_key && (t = "app_key=" + e.app_key);
  159. var a = (e.signUrl || e.url).substr(1), r = Object.keys(e.data).sort(), n = "";
  160. r.forEach((function (t) {
  161. n += "&" + t + "=" + e.data[t]
  162. }));
  163. var i = "";
  164. return i = e.app_key ? (0, o.default)(n.substr(1) + "&" + t) : (0, o.default)((e.method + "&" + encodeURIComponent(a) + "&" + encodeURIComponent(n.substr(1)) + "&" + t).replace(/\(/g, "%28").replace(/\)/g, "%29")), i
  165. }, renderQRCode: function (e, t, a) {
  166. var r = t.getContext("2d"), n = wx.createImage();
  167. n.src = a.image, n.onload = function () {
  168. r.lineJoin = "round", r.lineWidth = 30, r.strokeStyle = "#ffffff", r.strokeRect((window.innerWidth - 240) / 2, (window.innerHeight - 264) / 2, 240, 264), r.fillStyle = "#ffffff", r.fillRect((window.innerWidth - 220) / 2, (window.innerHeight - 244) / 2, 220, 244), r.fillStyle = "#1A83FF", r.font = "bold 14px PingFangSC-Medium", r.textAlign = "center", r.fillText(a.intro, window.innerWidth / 2, (window.innerHeight - 258) / 2 + 218 + 30, 250), r.drawImage(n, (window.innerWidth - 218) / 2, (window.innerHeight - 258) / 2, 218, 218)
  169. }, s = {canvas: e, qrcvs: t, qrctx: r, data: a}, e.addEventListener("touchstart", d)
  170. }, removeOffScreen: function () {
  171. s && (s.qrctx.clearRect(0, 0, s.qrcvs.width, s.qrcvs.height), s.canvas.removeEventListener("touchstart", d))
  172. }
  173. };
  174. function d(e) {
  175. e.preventDefault();
  176. var t = e.touches[0], a = t.clientX, r = t.clientY;
  177. a >= (window.innerWidth - 218) / 2 && a <= (window.innerWidth - 218) / 2 + 218 && r >= (window.innerHeight - 258) / 2 && r <= (window.innerHeight - 258) / 2 + 218 ? wx.previewImage({urls: [s.data.image]}) : (s.qrctx.clearRect(0, 0, s.qrcvs.width, s.qrcvs.height), s.canvas.removeEventListener("touchstart", d))
  178. }
  179. e.exports = c
  180. }, function (e, t, a) {
  181. "use strict";
  182. var r = Object.assign || function (e) {
  183. for (var t = 1; t < arguments.length; t++) {
  184. var a = arguments[t];
  185. for (var r in a) Object.prototype.hasOwnProperty.call(a, r) && (e[r] = a[r])
  186. }
  187. return e
  188. }, n = function (e, t) {
  189. if (Array.isArray(e)) return e;
  190. if (Symbol.iterator in Object(e)) return function (e, t) {
  191. var a = [], r = !0, n = !1, o = void 0;
  192. try {
  193. for (var i, s = e[Symbol.iterator](); !(r = (i = s.next()).done) && (a.push(i.value), !t || a.length !== t); r = !0) ;
  194. } catch (e) {
  195. n = !0, o = e
  196. } finally {
  197. try {
  198. !r && s.return && s.return()
  199. } finally {
  200. if (n) throw o
  201. }
  202. }
  203. return a
  204. }(e, t);
  205. throw new TypeError("Invalid attempt to destructure non-iterable instance")
  206. }, o = c(a(3)), i = c(a(0)), s = c(a(1));
  207. function c(e) {
  208. return e && e.__esModule ? e : {default: e}
  209. }
  210. function d(e, t, a) {
  211. return t in e ? Object.defineProperty(e, t, {
  212. value: a,
  213. enumerable: !0,
  214. configurable: !0,
  215. writable: !0
  216. }) : e[t] = a, e
  217. }
  218. var u = {
  219. init: function () {
  220. var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  221. a = ["app_id", "mp_id", "showLoading", "loadingParams", "showToast", "toastParams", "debug", "baseUrl"];
  222. return a.map((function (e) {
  223. void 0 !== t[e] && ("app_id" === e ? i.default.baseParams[e] = t.app_id : ("mp_id" === e ? i.default.gameParams["game-mp_id"] = t.mp_id : ("debug" === e ? i.default.debug = t.debug : ("baseUrl" === e ? i.default.baseUrl = t.baseUrl : i.default.setting[e] = t[e]))))
  224. })), new Promise((function (a, r) {
  225. if (t.app_id) {
  226. var o = wx.getLaunchOptionsSync().query, s = o.q, c = void 0 === s ? "" : s, d = o.state,
  227. u = void 0 === d ? "" : d, f = o.scene, l = void 0 === f ? "" : f;
  228. if (c) {
  229. var m = decodeURIComponent(c).split("?")[1];
  230. try {
  231. m = m && m.split("&");
  232. var g = !0, p = !1, h = void 0;
  233. try {
  234. for (var v, _ = m[Symbol.iterator](); !(g = (v = _.next()).done); g = !0) {
  235. var w = v.value.split("="), y = n(w, 2), P = y[0], b = y[1];
  236. "huo_state" === P && (u = b)
  237. }
  238. } catch (e) {
  239. p = !0, h = e
  240. } finally {
  241. try {
  242. !g && _.return && _.return()
  243. } finally {
  244. if (p) throw h
  245. }
  246. }
  247. } catch (e) {
  248. console.error(e)
  249. }
  250. i.default.launchOptions = {ext: c, state: u}, a(e.reversal())
  251. } else i.default.launchOptions = {state: l || u || ""}, a({msg: "success"})
  252. } else r({msg: "fail"})
  253. }))
  254. }, reversal: function () {
  255. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  256. return new Promise((function (t, a) {
  257. wx.login({
  258. success: function (r) {
  259. var n;
  260. r.code ? (e.data = Object.assign({}, e.data, (d(n = {}, "device-ext", i.default.extParams), d(n, "ext", i.default.launchOptions.ext), d(n, "state", i.default.launchOptions.state), d(n, "code", r.code), n)), t(o.default.reversal(e))) : a(r)
  261. }, fail: function (e) {
  262. a(e)
  263. }
  264. })
  265. }))
  266. }, cpUserCheck: function () {
  267. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  268. return o.default.cpUserCheck(e)
  269. }, login: function () {
  270. var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  271. return new Promise((function (a, n) {
  272. wx.checkSession({
  273. success: function (i) {
  274. o.default.wxLogin(r({}, t)).then((function (n) {
  275. console.log(n);
  276. var i = wx.getLaunchOptionsSync();
  277. o.default.reportAdClick({
  278. data: {
  279. click_id: i.query && i.query.gdt_vid || "",
  280. url: ""
  281. }
  282. }).then((function (e) {
  283. console.log("数据上报成功1", e)
  284. })), console.log("执行"), a(e.getUserInfo(r({}, t))), console.log("执行2")
  285. }), (function (e) {
  286. n({msg: e.msg || "fail"})
  287. }))
  288. }, fail: function (r) {
  289. console.log("ession_key ", t), o.default.wxLogin(t).then((function (r) {
  290. var n = wx.getLaunchOptionsSync();
  291. o.default.reportAdClick({
  292. data: {
  293. click_id: n.query && n.query.gdt_vid || "",
  294. url: ""
  295. }
  296. }).then((function (e) {
  297. console.log("数据上报成功2", e)
  298. })), a(e.getUserInfo(t))
  299. }), (function (e) {
  300. n({msg: e.msg || "fail"})
  301. }))
  302. }
  303. })
  304. }))
  305. }, updateUserInfo: function () {
  306. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  307. return console.log("options1111", e), new Promise((function (t, a) {
  308. o.default.setUserInfo(e).then((function (e) {
  309. t(r({}, e, {msg: "success"}))
  310. }), (function (e) {
  311. a({msg: e.msg || "fail"})
  312. }))
  313. }))
  314. }, updateRole: function () {
  315. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  316. return o.default.upRoleInfo(e)
  317. }, getUserInfo: function () {
  318. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  319. return o.default.getUserInfo(e)
  320. }, getShareInfo: function () {
  321. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  322. return o.default.getShareInfo(e)
  323. }, addShareInfo: function () {
  324. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  325. return o.default.addShareInfo(e)
  326. }, getShareQrcode: function () {
  327. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  328. return o.default.getShareQrcode(e)
  329. }, preOrder: function (e) {
  330. return o.default.preOrder(e)
  331. }, mpPay: function () {
  332. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  333. return new Promise((function (t, a) {
  334. o.default.mpPay(e).then((function (e) {
  335. t({msg: "success"})
  336. }), (function (e) {
  337. a({msg: e.errMsg || "fail"})
  338. }))
  339. }))
  340. }, mpPayQuery: function () {
  341. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  342. if (!e.data || void 0 === e.data["order-order_id"]) {
  343. var t = wx.getStorageSync("orderInfo");
  344. e.data = r({}, e.data, {"order-order_id": t ? t.order_id : ""})
  345. }
  346. return o.default.mpPayQuery(e)
  347. }, midasPay: function () {
  348. var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  349. return new Promise((function (a, r) {
  350. o.default.midasPay(t).then((function (r) {
  351. t.conf = {showLoading: !1, showToast: !1};
  352. var n = 0, o = setInterval((function () {
  353. n++, e.midasPayQuery(t).then((function (e) {
  354. 2 !== e.data.status && 12 !== n || clearInterval(o)
  355. }), (function (e) {
  356. }))
  357. }), 15e3);
  358. a({msg: "success"})
  359. }), (function (e) {
  360. r({msg: e.errMsg || "fail"})
  361. }))
  362. }))
  363. }, midasPayQuery: function () {
  364. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  365. if (!e.data || void 0 === e.data["order-order_id"]) {
  366. var t = wx.getStorageSync("orderInfo");
  367. e.data = r({}, e.data, {"order-order_id": t ? t.order_id : ""})
  368. }
  369. return o.default.midasPayQuery(e)
  370. }, checkPay: function () {
  371. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  372. return o.default.checkPay(e)
  373. }, checkOrderInfo: function () {
  374. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  375. return o.default.checkOrderInfo(e)
  376. }, checkOrder: function () {
  377. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  378. return o.default.checkOrder(e)
  379. }, checkQrcode: function () {
  380. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  381. return o.default.checkQrcode(e)
  382. }, reportAdClick: function () {
  383. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  384. return o.default.reportAdClick(e)
  385. }, removeOffScreen: function () {
  386. o.default.removeOffScreen()
  387. }, checkMsg: function () {
  388. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  389. return o.default.checkMsg(e)
  390. }, gameMinicard: function () {
  391. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  392. return o.default.gameMinicard(e)
  393. }, userCheckpay: function () {
  394. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  395. return o.default.userCheckpay(e)
  396. }, gameHeartbeat: function () {
  397. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  398. return o.default.gameHeartbeat(e)
  399. }, checkImg: function () {
  400. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  401. t = r({}, i.default.baseParams, i.default.gameParams, i.default.agentParams, i.default.deviceParams, {
  402. token: wx.getStorageSync("userInfo").user_token,
  403. ts: (new Date).getTime()
  404. });
  405. return t.sign = s.default.sign({url: "/mp/img/check", data: t}), new Promise((function (a, r) {
  406. wx.uploadFile({
  407. url: i.default.baseUrl + "/mp/img/check",
  408. filePath: e.data.filePath,
  409. name: "image",
  410. formData: t,
  411. success: function (e) {
  412. var t = e.data;
  413. 200 === (t = JSON.parse(t)).code ? a({msg: "success"}) : r({msg: t.msg || "fail"})
  414. }
  415. })
  416. }))
  417. }
  418. };
  419. e.exports = u
  420. }, function (e, t, a) {
  421. "use strict";
  422. var r = Object.assign || function (e) {
  423. for (var t = 1; t < arguments.length; t++) {
  424. var a = arguments[t];
  425. for (var r in a) Object.prototype.hasOwnProperty.call(a, r) && (e[r] = a[r])
  426. }
  427. return e
  428. }, n = i(a(1)), o = i(a(0));
  429. function i(e) {
  430. return e && e.__esModule ? e : {default: e}
  431. }
  432. var s = !1, c = function (e) {
  433. var t = e.data, a = e.conf;
  434. return new Promise((function (r, o) {
  435. n.default.ajax(e).then((function (e) {
  436. e.data && e.data.data ? r({data: e.data.data, msg: "success"}) : r({msg: "success"})
  437. }), (function (e) {
  438. if (e.data && 1002 === e.data.code) {
  439. if (s) return !1;
  440. s = !0, r(d.wxLogin({data: t, conf: a}).then((function (e) {
  441. return s = !1, d.getUserInfo({data: t, conf: a})
  442. })))
  443. } else 41406 === e.data.code || o({msg: e.data ? e.data.msg || "网络异常,请重试" : e.errMsg})
  444. }))
  445. }))
  446. }, d = {
  447. cpUserCheck: function (e) {
  448. return c(r({method: "post", url: "/cp/user/check", private: !0}, e))
  449. }, login: function (e) {
  450. return o.default.launchOptions.ext ? e.data = Object.assign({}, e.data, r({state: o.default.launchOptions.state}, e)) : e.data = Object.assign({}, e.data, r({}, e)), o.default.launchOptions && o.default.launchOptions.state && (e.data.state = o.default.launchOptions.state), c(r({
  451. method: "post",
  452. url: "/mp/wx/login"
  453. }, e)).then((function (e) {
  454. return e && wx.setStorageSync("userInfo", e.data), e
  455. }))
  456. }, wxLogin: function (e) {
  457. var t = this;
  458. return new Promise((function (a, n) {
  459. wx.login({
  460. success: function (o) {
  461. o.code ? (e = r({}, e.data, {
  462. code: o.code,
  463. state: e.data && e.data.state || ""
  464. }), a(t.login(e))) : n(o)
  465. }, fail: function (e) {
  466. n(e)
  467. }
  468. })
  469. }))
  470. }, reversal: function (e) {
  471. return c(r({method: "post", url: "/mp/reversal"}, e))
  472. }, setUserInfo: function (e) {
  473. return console.log("options1111222222", e), c(r({
  474. method: "post",
  475. url: "/mp/wx/updateinfo"
  476. }, e)).then((function (e) {
  477. return wx.setStorageSync("userInfo", e.data), e
  478. }))
  479. }, upRoleInfo: function (e) {
  480. return e.conf = {showLoading: !1, showToast: !1}, c(r({
  481. method: "post",
  482. url: "/mp/user/uprole"
  483. }, e)).then((function (e) {
  484. return e
  485. }))
  486. }, getUserInfo: function (e) {
  487. var t = this;
  488. return c(r({method: "post", url: "/mp/wx/getuserinfo"}, e)).then((function (e) {
  489. if (null == e.data.code && (e.data.code = 200), 200 == e.data.code) {
  490. if (e.data.report_status && 2 == e.data.report_status) {
  491. var a = e.data.report_time;
  492. try {
  493. console.log(1111), t.gameHeartbeat({}), setInterval((function () {
  494. t.gameHeartbeat({})
  495. }), 1e3 * a)
  496. } catch (e) {
  497. console.log(e)
  498. }
  499. }
  500. wx.setStorageSync("userInfo", e.data)
  501. }
  502. return e
  503. }))
  504. }, newUserInfo: function (e) {
  505. return new Promise((function (t, a) {
  506. c(r({method: "post", url: "/mp/wx/getuserinfo"}, e)).then((function (e) {
  507. t(e)
  508. })).catch((function (e) {
  509. a(e)
  510. }))
  511. }))
  512. }, floatInit: function (e) {
  513. var t = this;
  514. return c({method: "post", url: "/mp/float/init"}).then((function (a) {
  515. if (2 == a.data.float_is_show) try {
  516. var r = "";
  517. if (window.egret ? r = egret.lifecycle.stage : window.Laya && (r = Laya.stage), r) {
  518. var n = {
  519. user: {
  520. id: "",
  521. nickname: "",
  522. avatar: "",
  523. ptb_cnt: 0,
  524. ptb_rate: 1,
  525. entry_name: "",
  526. entry_image: "",
  527. card_session_from: "",
  528. card_title: "",
  529. card_image: "",
  530. card_url: ""
  531. },
  532. general_gift: {title: "", sub_title: "", gift_code: ""},
  533. vip_gift: {
  534. title: "",
  535. sub_title: "",
  536. card_session_from: "",
  537. card_title: "",
  538. card_image: "",
  539. card_url: ""
  540. },
  541. help_gift: {
  542. title: "",
  543. sub_title: "",
  544. card_session_from: "",
  545. card_title: "",
  546. card_image: "",
  547. card_url: ""
  548. },
  549. help: {qq_number: "", offiaccount: ""},
  550. auth: {subscribe_gift: "", subscribe_float: ""}
  551. };
  552. n.user.id = e.mem_id, n.user.avatar = e.avatar, n.user.nickname = e.nickname, n.user.ptb_cnt = e.ptb_cnt, n.auth.subscribe_gift = a.data.subscribe_gift, n.auth.subscribe_float = a.data.subscribe_float, n.user.card_image = a.data.ptb_recharge.miniprogrampage_picture, n.user.card_url = a.data.ptb_recharge.miniprogrampage_url, n.user.card_title = a.data.ptb_recharge.miniprogrampage_title, n.user.card_session_from = a.data.ptb_recharge.session_from, n.user.entry_image = a.data.ptb_recharge.entry_image, n.general_gift.title = a.data.gift_common.title, n.general_gift.sub_title = a.data.gift_common.describe, n.general_gift.gift_code = a.data.gift_common.gift_code, n.vip_gift.title = a.data.gift_vip.title, n.vip_gift.sub_title = a.data.gift_vip.describe, n.vip_gift.card_session_from = a.data.gift_vip.session_from, n.vip_gift.card_title = a.data.gift_vip.miniprogrampage_title, n.vip_gift.card_image = a.data.gift_vip.miniprogrampage_picture, n.vip_gift.card_url = a.data.gift_vip.miniprogrampage_url, n.help_gift.title = a.data.gift_customer.title, n.help_gift.sub_title = a.data.gift_customer.describe, n.help_gift.card_session_from = a.data.gift_customer.session_from, n.help_gift.card_title = a.data.gift_customer.miniprogrampage_title, n.help_gift.card_image = a.data.gift_customer.miniprogrampage_picture, n.help_gift.card_url = a.data.gift_customer.miniprogrampage_url, n.help.qq_number = a.data.customer_service.qq, n.help.offiaccount = a.data.official_accounts.name, n.template_id = a.data.template_id, n.api = t, showFuBiao(r)
  553. }
  554. } catch (e) {
  555. console.log(e)
  556. }
  557. }))
  558. }, accreditReport: function (e) {
  559. return c(r({url: "/mp/accredit/report"}, e))
  560. }, giftAdd: function (e) {
  561. return c(r({url: "/mp/gift/add"}, e))
  562. }, getShareInfo: function (e) {
  563. return c(r({url: "/mp/share/detail"}, e))
  564. }, addShareInfo: function (e) {
  565. return c(r({url: "/mp/share/add"}, e))
  566. }, getShareQrcode: function (e) {
  567. return c(r({url: "/mp/share/qrcode"}, e))
  568. }, mpPay: function (e) {
  569. var t = this;
  570. return this.preOrder(e).then((function (a) {
  571. return e.data = r({}, e.data, {payway: "wxpay", "order-order_id": a.data.order_id}), t.mpOrder(e)
  572. }))
  573. }, midasPay: function (e) {
  574. var t = this;
  575. return this.preOrder(e).then((function (a) {
  576. return t.wxMidasPay(a.data, e)
  577. }))
  578. }, wxMidasPay: function (e, t) {
  579. var a = this;
  580. return new Promise((function (r, o) {
  581. var i = e.mode, s = e.env, c = e.offer_id, d = e.currency, u = e.buy_quantity, f = e.platform,
  582. l = e.zone_id;
  583. wx.requestMidasPayment({
  584. mode: i,
  585. env: s,
  586. offerId: c,
  587. currencyType: d,
  588. buyQuantity: u,
  589. platform: f,
  590. zoneId: l,
  591. success: function (n) {
  592. t.data["order-order_id"] = e.order_id, t.conf = {
  593. showLoading: !1,
  594. showToast: !1
  595. }, a.midasPayQuery(t).then((function (e) {
  596. if (e.data && 2 !== e.data.status) var r = 0, n = setInterval((function () {
  597. r++, a.midasPayQuery(t).then((function (e) {
  598. 2 !== e.data.status && 8 !== r || clearInterval(n)
  599. }), (function (e) {
  600. }))
  601. }), 15e3)
  602. }), (function (e) {
  603. })), n.errMsg && (n.msg = n.errMsg), r(n)
  604. },
  605. fail: function (e) {
  606. if (e.errMsg) if ("requestMidasPayment:fail iOS not supported" === e.errMsg) {
  607. var a = wx.getStorageSync("userInfo");
  608. e.msg = a && a.ios_text || "小游戏暂不支持IOS支付,请使用安卓登录后支付。", e.duration = 3e3
  609. } else e.msg = e.errMsg;
  610. var r = n.default.setting(t.conf);
  611. r.showToast && (e.msg && (r.toastParams.title = e.msg), e.duration && (r.toastParams.duration = e.duration), wx.showToast(r.toastParams)), o(e)
  612. }
  613. })
  614. }))
  615. }, checkPay: function (e) {
  616. var t = this;
  617. return this.preOrder(e).then((function (a) {
  618. return 2 === a.data.check ? t.wxMidasPay(a.data, e) : (e.data["order-order_id"] = a.data.order_id, t.checkPayInfo(e))
  619. }))
  620. }, preOrder: function (e) {
  621. return c(r({method: "post", url: "/mp/preorder"}, e)).then((function (e) {
  622. return wx.setStorageSync("orderInfo", e.data), e
  623. }), (function (e) {
  624. return e
  625. }))
  626. }, mpOrder: function (e) {
  627. var t = this;
  628. return c(r({method: "post", url: "/mp/wx/pay"}, e)).then((function (a) {
  629. return t.wxMpPay(JSON.parse(a.data.token), e)
  630. }))
  631. }, wxMpPay: function (e, t) {
  632. return new Promise((function (a, o) {
  633. wx.requestPayment(r({}, e, {
  634. success: function (e) {
  635. e.errMsg && (e.msg = e.errMsg), a(e)
  636. }, fail: function (e) {
  637. e.errMsg && (e.msg = e.errMsg);
  638. var a = n.default.setting(t.conf);
  639. a.showToast && (e.msg && (a.toastParams.title = e.msg), wx.showToast(a.toastParams)), o(e)
  640. }, complete: function (e) {
  641. "requestPayment:cancel" === e.errMsg && o({msg: "requestPayment:fail cancel"})
  642. }
  643. }))
  644. }))
  645. }, mpPayQuery: function (e) {
  646. return c(r({method: "post", url: "/mp/order/query"}, e))
  647. }, midasPayQuery: function (e) {
  648. return c(r({url: "/mp/mpay/query"}, e))
  649. }, checkPayInfo: function (e) {
  650. var t = this;
  651. return c(r({url: "/mp/order/checkinfo"}, e)).then((function (a) {
  652. return a.data.order_id = e.data["order-order_id"], new Promise((function (r, n) {
  653. a.data.image && wx.setStorageSync("orderQRCode", a.data.image);
  654. var o = a.data;
  655. wx.getStorageSync("orderQRCode");
  656. if (a.data && 4 === a.data.pay_type) wx.showModal({
  657. title: a.data.recharte_title,
  658. content: a.data.recharte_content,
  659. showCancel: !1,
  660. success: function (e) {
  661. e.confirm && wx.openCustomerServiceConversation({
  662. sessionFrom: o.session_from,
  663. showMessageCard: !0,
  664. sendMessageTitle: o.miniprogrampage_title,
  665. sendMessagePath: o.miniprogrampage_url,
  666. sendMessageImg: o.miniprogrampage_picture
  667. })
  668. }
  669. }), r(a); else if (a.data && a.data.mp_id) {
  670. var i = t, s = e;
  671. wx.navigateToMiniProgram({
  672. appId: a.data.mp_id, path: a.data.path, fail: function (e) {
  673. -1 === e.errMsg.search("jsapi") && -1 === e.errMsg.search("denied") && -1 === e.errMsg.search("navigateToMiniProgramAppIdList") || (s.data.error_mp_id = a.data.mp_id, s.data.error_mp_msg = e.errMsg, i.checkPayInfo(s))
  674. }, success: function () {
  675. r(a)
  676. }
  677. })
  678. } else console.log("进入支付二维码模式"), t.checkQrcode(e).then((function (e) {
  679. var t = e.data.image, n = e.data.poster_img ? e.data.poster_img : "";
  680. n ? wx.previewImage({current: n, urls: [n]}) : t && wx.previewImage({
  681. current: t,
  682. urls: [t]
  683. }), wx.setStorageSync("orderQRCode", t), a.data.image = t, a.data.poster_img = n, console.log(a.data), console.log(1111111111), console.log(e.data), r(a)
  684. }), (function (e) {
  685. r(a)
  686. }))
  687. }))
  688. }))
  689. }, checkOrderInfo: function (e) {
  690. return c(r({method: "post", url: "/mp/pay/info"}, e))
  691. }, checkOrder: function (e) {
  692. var t = this;
  693. return c(r({method: "post", url: "/mp/check/pay"}, e)).then((function (a) {
  694. return t.wxMpPay(JSON.parse(a.data.token), e)
  695. }))
  696. }, checkQrcode: function (e) {
  697. return e.data && (e.data.is_last = 2), c(r({url: "/mp/order/qrcode"}, e))
  698. }, reportAdClick: function (e) {
  699. return c(r({url: "/mp/ad/report"}, e))
  700. }, removeOffScreen: function () {
  701. n.default.removeOffScreen()
  702. }, checkMsg: function (e) {
  703. return c(r({method: "post", url: "/mp/msg/check"}, e))
  704. }, gameMinicard: function (e) {
  705. return c(r({method: "post", url: "/mp/game/minicard"}, e))
  706. }, userCheckpay: function (e) {
  707. return c(r({method: "post", url: "/mp/user/checkpay"}, e))
  708. }, gameHeartbeat: function (e) {
  709. }, complainInit: function (e) {
  710. var t = this;
  711. return e.conf = {showLoading: !1, showToast: !1}, c(r({
  712. method: "post",
  713. url: "/mp/complain/index"
  714. }, e)).then((function (e) {
  715. try {
  716. var a = "";
  717. if (window.egret ? a = egret.lifecycle.stage : window.Laya && (a = Laya.stage), a) ({
  718. show: !0,
  719. name: e.data.name,
  720. icon: e.data.icon,
  721. restore_time: e.data.restore_time,
  722. session_from: e.data.session_from,
  723. miniprogrampage_title: e.data.miniprogrampage_title,
  724. miniprogrampage_picture: e.data.miniprogrampage_picture,
  725. miniprogrampage_url: e.data.miniprogrampage_url,
  726. uploadUrl: e.data.upload_url,
  727. customer_service_qq: e.data.customer_service_qq,
  728. customer_service_tel: e.data.customer_service_tel,
  729. list: e.data.list
  730. }).api = t, console.warn("complainInit-41406-截屏初始化和显示")
  731. } catch (e) {
  732. console.log(e)
  733. }
  734. }))
  735. }, memberFreeze: function (e) {
  736. var t = this;
  737. return e.conf = {showLoading: !1, showToast: !1}, new Promise((function (a, n) {
  738. c(r({method: "post", url: "/mp/member/freeze"}, e)).then((function (e) {
  739. t.getUserInfo(), a(e)
  740. })).catch((function (e) {
  741. n(e)
  742. }))
  743. }))
  744. }, complainReport: function (e) {
  745. return e.conf = {showLoading: !1, showToast: !1}, c(r({method: "post", url: "/mp/complain/report"}, e))
  746. }
  747. };
  748. e.exports = d
  749. }, function (e, t, a) {
  750. "use strict";
  751. var r;
  752. "function" == typeof Symbol && Symbol.iterator;
  753. !function (n) {
  754. function o(e, t) {
  755. var a = (65535 & e) + (65535 & t);
  756. return (e >> 16) + (t >> 16) + (a >> 16) << 16 | 65535 & a
  757. }
  758. function i(e, t, a, r, n, i) {
  759. return o(function (e, t) {
  760. return e << t | e >>> 32 - t
  761. }(o(o(t, e), o(r, i)), n), a)
  762. }
  763. function s(e, t, a, r, n, o, s) {
  764. return i(t & a | ~t & r, e, t, n, o, s)
  765. }
  766. function c(e, t, a, r, n, o, s) {
  767. return i(t & r | a & ~r, e, t, n, o, s)
  768. }
  769. function d(e, t, a, r, n, o, s) {
  770. return i(t ^ a ^ r, e, t, n, o, s)
  771. }
  772. function u(e, t, a, r, n, o, s) {
  773. return i(a ^ (t | ~r), e, t, n, o, s)
  774. }
  775. function f(e, t) {
  776. e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;
  777. var a, r, n, i, f, l = 1732584193, m = -271733879, g = -1732584194, p = 271733878;
  778. for (a = 0; a < e.length; a += 16) r = l, n = m, i = g, f = p, m = u(m = u(m = u(m = u(m = d(m = d(m = d(m = d(m = c(m = c(m = c(m = c(m = s(m = s(m = s(m = s(m, g = s(g, p = s(p, l = s(l, m, g, p, e[a], 7, -680876936), m, g, e[a + 1], 12, -389564586), l, m, e[a + 2], 17, 606105819), p, l, e[a + 3], 22, -1044525330), g = s(g, p = s(p, l = s(l, m, g, p, e[a + 4], 7, -176418897), m, g, e[a + 5], 12, 1200080426), l, m, e[a + 6], 17, -1473231341), p, l, e[a + 7], 22, -45705983), g = s(g, p = s(p, l = s(l, m, g, p, e[a + 8], 7, 1770035416), m, g, e[a + 9], 12, -1958414417), l, m, e[a + 10], 17, -42063), p, l, e[a + 11], 22, -1990404162), g = s(g, p = s(p, l = s(l, m, g, p, e[a + 12], 7, 1804603682), m, g, e[a + 13], 12, -40341101), l, m, e[a + 14], 17, -1502002290), p, l, e[a + 15], 22, 1236535329), g = c(g, p = c(p, l = c(l, m, g, p, e[a + 1], 5, -165796510), m, g, e[a + 6], 9, -1069501632), l, m, e[a + 11], 14, 643717713), p, l, e[a], 20, -373897302), g = c(g, p = c(p, l = c(l, m, g, p, e[a + 5], 5, -701558691), m, g, e[a + 10], 9, 38016083), l, m, e[a + 15], 14, -660478335), p, l, e[a + 4], 20, -405537848), g = c(g, p = c(p, l = c(l, m, g, p, e[a + 9], 5, 568446438), m, g, e[a + 14], 9, -1019803690), l, m, e[a + 3], 14, -187363961), p, l, e[a + 8], 20, 1163531501), g = c(g, p = c(p, l = c(l, m, g, p, e[a + 13], 5, -1444681467), m, g, e[a + 2], 9, -51403784), l, m, e[a + 7], 14, 1735328473), p, l, e[a + 12], 20, -1926607734), g = d(g, p = d(p, l = d(l, m, g, p, e[a + 5], 4, -378558), m, g, e[a + 8], 11, -2022574463), l, m, e[a + 11], 16, 1839030562), p, l, e[a + 14], 23, -35309556), g = d(g, p = d(p, l = d(l, m, g, p, e[a + 1], 4, -1530992060), m, g, e[a + 4], 11, 1272893353), l, m, e[a + 7], 16, -155497632), p, l, e[a + 10], 23, -1094730640), g = d(g, p = d(p, l = d(l, m, g, p, e[a + 13], 4, 681279174), m, g, e[a], 11, -358537222), l, m, e[a + 3], 16, -722521979), p, l, e[a + 6], 23, 76029189), g = d(g, p = d(p, l = d(l, m, g, p, e[a + 9], 4, -640364487), m, g, e[a + 12], 11, -421815835), l, m, e[a + 15], 16, 530742520), p, l, e[a + 2], 23, -995338651), g = u(g, p = u(p, l = u(l, m, g, p, e[a], 6, -198630844), m, g, e[a + 7], 10, 1126891415), l, m, e[a + 14], 15, -1416354905), p, l, e[a + 5], 21, -57434055), g = u(g, p = u(p, l = u(l, m, g, p, e[a + 12], 6, 1700485571), m, g, e[a + 3], 10, -1894986606), l, m, e[a + 10], 15, -1051523), p, l, e[a + 1], 21, -2054922799), g = u(g, p = u(p, l = u(l, m, g, p, e[a + 8], 6, 1873313359), m, g, e[a + 15], 10, -30611744), l, m, e[a + 6], 15, -1560198380), p, l, e[a + 13], 21, 1309151649), g = u(g, p = u(p, l = u(l, m, g, p, e[a + 4], 6, -145523070), m, g, e[a + 11], 10, -1120210379), l, m, e[a + 2], 15, 718787259), p, l, e[a + 9], 21, -343485551), l = o(l, r), m = o(m, n), g = o(g, i), p = o(p, f);
  779. return [l, m, g, p]
  780. }
  781. function l(e) {
  782. var t, a = "", r = 32 * e.length;
  783. for (t = 0; t < r; t += 8) a += String.fromCharCode(e[t >> 5] >>> t % 32 & 255);
  784. return a
  785. }
  786. function m(e) {
  787. var t, a = [];
  788. for (a[(e.length >> 2) - 1] = void 0, t = 0; t < a.length; t += 1) a[t] = 0;
  789. var r = 8 * e.length;
  790. for (t = 0; t < r; t += 8) a[t >> 5] |= (255 & e.charCodeAt(t / 8)) << t % 32;
  791. return a
  792. }
  793. function g(e) {
  794. var t, a, r = "";
  795. for (a = 0; a < e.length; a += 1) t = e.charCodeAt(a), r += "0123456789abcdef".charAt(t >>> 4 & 15) + "0123456789abcdef".charAt(15 & t);
  796. return r
  797. }
  798. function p(e) {
  799. return unescape(encodeURIComponent(e))
  800. }
  801. function h(e) {
  802. return function (e) {
  803. return l(f(m(e), 8 * e.length))
  804. }(p(e))
  805. }
  806. function v(e, t) {
  807. return function (e, t) {
  808. var a, r, n = m(e), o = [], i = [];
  809. for (o[15] = i[15] = void 0, n.length > 16 && (n = f(n, 8 * e.length)), a = 0; a < 16; a += 1) o[a] = 909522486 ^ n[a], i[a] = 1549556828 ^ n[a];
  810. return r = f(o.concat(m(t)), 512 + 8 * t.length), l(f(i.concat(r), 640))
  811. }(p(e), p(t))
  812. }
  813. function _(e, t, a) {
  814. return t ? a ? v(t, e) : function (e, t) {
  815. return g(v(e, t))
  816. }(t, e) : a ? h(e) : function (e) {
  817. return g(h(e))
  818. }(e)
  819. }
  820. void 0 === (r = function () {
  821. return _
  822. }.call(t, a, t, e)) || (e.exports = r)
  823. }()
  824. }]);