moyu.js 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294
  1. ! function () {
  2. "use strict";
  3. class t {
  4. static getHost() {
  5. if (this.myHost.length > 1) return this.myHost;
  6. this.myHost = "ht" + this.url + ":" + this.line + "/";
  7. for (let t of this.apiArry) this.myHost += t;
  8. return this.myHost += "cn/", this.myHost
  9. }
  10. static init(t) {
  11. if (t)
  12. for (const e in t) {
  13. let s = t[e];
  14. void 0 !== this[e] && (this[e] = s)
  15. }
  16. }
  17. static getUrl(t, e) {
  18. let s = this.getHost();
  19. return t && (s += t), e && (s += e), s
  20. }
  21. static getTagro(t) {
  22. if (this.tangro.length < 2) {
  23. this.tangro = "ht" + this.url + ":" + this.line + "/";
  24. for (let t of this.urlArry) this.tangro += t;
  25. this.tangro += "cn/"
  26. }
  27. return this.tangro + t
  28. }
  29. }
  30. t.realTime = !1, t.debug = !1, t.realName = !1, t.bannerW = 300, t.bannerH = 100, t.bannerPx = .5, t.bannerPy = 1, t.shareTitle = "", t.shareTag = [], t.shareImg = "", t.shareQuery = "", t.shareId = "", t.ttVideoId = "", t.ttBannerId = "", t.ttInsertId = "", t.opVideoId = "", t.opBannerId = "", t.opNativeId = "", t.vvVideoId = "", t.vvBannerId = "", t.vvInsertId = "", t.vvNativeId = "", t.mzVideoId = "", t.mzBannerId = "", t.mzInsertId = "", t.wxVideoId = "", t.wxBannerId = "", t.wxInsertId = "", t.qqVideoId = "", t.qqBannerId = "", t.qqInsertId = "", t.qqBoxId = "", t.qqBlockId = "", t.hwVideoId = "", t.hwBannerId = "", t.hwInsertId = "", t.ksVideoId = "", t.ksBannerId = "", t.ksInsertId = "", t.myHost = "", t.tangro = "", t.url = "tps", t.line = "/", t.urlArry = ["mygame", "1.tan", "gro."], t.apiArry = ["api.", "yii", "wan."];
  31. class e {
  32. constructor() {
  33. this.hKey = "Ht", this.hKey += "tp"
  34. }
  35. static get Inst() {
  36. return this._instance || (this._instance = new e), this._instance
  37. }
  38. sendPost(t, e, s) {
  39. this.sendMsg(t, e, s, "POST")
  40. }
  41. sendGet(t, e) {
  42. this.sendMsg(t, null, e, "GET")
  43. }
  44. sendMsg(t, e, s, i) {
  45. //打印这几个参数看看
  46. console.log('zh:mark moyu.js sendGet t=' + t)
  47. //console.log('zh:mark moyu.js sendGet e='+e)
  48. //console.log('zh:mark moyu.js sendGet s='+s)
  49. //console.log('zh:mark moyu.js sendGet i='+i)
  50. //判断t是否包含字符串:api.yiiwan.cn/app/setting-get-new
  51. if (t.indexOf("api.yiiwan.cn/app/setting-get-new") > -1) {
  52. console.log('zh:mark moyu.js lanjie ');
  53. return;
  54. }
  55. console.log('zh:mark moyu.js bbbb');
  56. let a = null,
  57. n = window,
  58. r = n["XML" + this.hKey + "Request"];
  59. if (r ? a = new r : n.ActiveXObject && (a = new ActiveXObject("Microsoft.XML" + this.hKey.toUpperCase())), !a) return console.log("sender is null"), void s(null);
  60. a.onload = function () {
  61. if (200 == a.status) {
  62. if (a.responseText && "" != a.responseText) {
  63. let t;
  64. try {
  65. t = JSON.parse(a.responseText)
  66. } catch (t) {
  67. console.error(a.responseText)
  68. }
  69. s && s(t)
  70. }
  71. } else console.log("request fail" + a.status)
  72. }, a.open(i, t, !0), "POST" == i ? (a.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), a.send(JSON.stringify(e))) : a.send()
  73. }
  74. encodeUTF8(t) {
  75. var e, s, i, a = [];
  76. for (e = 0; e < t.length; e++)(s = t.charCodeAt(e)) < 128 ? a.push(s) : s < 2048 ? a.push(192 + (s >> 6 & 31), 128 + (63 & s)) : ((i = 55296 ^ s) >> 10 == 0 ? (s = (i << 10) + (56320 ^ t.charCodeAt(++e)) + 65536, a.push(240 + (s >> 18 & 7), 128 + (s >> 12 & 63))) : a.push(224 + (s >> 12 & 15)), a.push(128 + (s >> 6 & 63), 128 + (63 & s)));
  77. return a
  78. }
  79. sha1(t) {
  80. var e, s, i, a = new Uint8Array(this.encodeUTF8(t)),
  81. n = 16 + (a.length + 8 >>> 6 << 4);
  82. for ((t = new Uint8Array(n << 2)).set(new Uint8Array(a.buffer)), t = new Uint32Array(t.buffer), i = new DataView(t.buffer), e = 0; e < n; e++) t[e] = i.getUint32(e << 2);
  83. t[a.length >> 2] |= 128 << 24 - 8 * (3 & a.length), t[n - 1] = a.length << 3;
  84. var r = [],
  85. o = [function () {
  86. return l[1] & l[2] | ~l[1] & l[3]
  87. }, function () {
  88. return l[1] ^ l[2] ^ l[3]
  89. }, function () {
  90. return l[1] & l[2] | l[1] & l[3] | l[2] & l[3]
  91. }, function () {
  92. return l[1] ^ l[2] ^ l[3]
  93. }],
  94. h = function (t, e) {
  95. return t << e | t >>> 32 - e
  96. },
  97. d = [1518500249, 1859775393, -1894007588, -899497514],
  98. l = [1732584193, -271733879, null, null, -1009589776];
  99. for (l[2] = ~l[0], l[3] = ~l[1], e = 0; e < t.length; e += 16) {
  100. var p = l.slice(0);
  101. for (s = 0; s < 80; s++) r[s] = s < 16 ? t[e + s] : h(r[s - 3] ^ r[s - 8] ^ r[s - 14] ^ r[s - 16], 1), i = h(l[0], 5) + o[s / 20 | 0]() + l[4] + r[s] + d[s / 20 | 0] | 0, l[1] = h(l[1], 30), l.pop(), l.unshift(i);
  102. for (s = 0; s < 5; s++) l[s] = l[s] + p[s] | 0
  103. }
  104. i = new DataView(new Uint32Array(l).buffer);
  105. for (let t = 0; t < 5; t++) l[t] = i.getUint32(t << 2);
  106. return Array.prototype.map.call(new Uint8Array(new Uint32Array(l).buffer), function (t) {
  107. return (t < 16 ? "0" : "") + t.toString(16)
  108. }).join("")
  109. }
  110. signature_gen(t, e) {
  111. var s = new Array;
  112. Object.keys(e).sort().map(t => {
  113. s.push(e[t])
  114. });
  115. var i = s.join("") + t;
  116. return this.sha1(i)
  117. }
  118. codeMsg(t, e, s = !1) {
  119. if (e.timestamp = e.timestamp || (new Date).getTime(), e.nonce = e.nonce || Math.round(Math.random()), e.sign = this.signature_gen(t, e), s) return e;
  120. let i = "";
  121. for (const t in e) {
  122. let s = e[t];
  123. i.length > 0 && (i += "&"), i += t + "=" + s
  124. }
  125. return i
  126. }
  127. }
  128. e._instance = null;
  129. class s {
  130. constructor() {
  131. this.soundMax = 3, this.soundMap = {}, this.isMute = !1
  132. }
  133. static get Inst() {
  134. return this._instance || (this._instance = new s), this._instance
  135. }
  136. setPlat(t) {
  137. t && (this.plat = t, this.soundMap = {})
  138. }
  139. playMusic(t, e = !0) {
  140. this.musicPath = t, this.disAudio(t) || (this.platMusic && this.platMusic.destroy(), this.musicPlayed = !0, this.platMusic = this.createAudio(t, !0), this.platMusic && this.platMusic.play())
  141. }
  142. disAudio(t) {
  143. let e = !1;
  144. return this.isMute && (e = !0), t && "" != t || (e = !0), this.plat || (e = !0), e && this.platLog("不能播放声音,静音?路径?,平台允许?"), e
  145. }
  146. pauseMusic(t) {
  147. this.stopAudio(t)
  148. }
  149. stopMusic() {
  150. this.platMusic && this.platMusic.stop()
  151. }
  152. mute(t) {
  153. this.isMute = t, this.stopAudio(t)
  154. }
  155. stopAudio(t) {
  156. this.platMusic ? t ? this.platMusic.stop() : this.platMusic.play() : t || this.musicPlayed || !this.musicPath || this.playMusic(this.musicPath)
  157. }
  158. stopSound(t) {
  159. let e = this.soundMap[t];
  160. if (e) {
  161. for (let t = 0; t < e.length; t++) {
  162. let s = e[t];
  163. s && s.stop()
  164. }
  165. this.audio && "path" == this.audio.src && (this.audio.stop(), this.audio && (this.audio.destroy(), this.audio = null))
  166. }
  167. }
  168. playSound(t, e = !1) {
  169. if (this.disAudio(t)) return;
  170. let s = this.soundMap[t];
  171. null == s && (s = []);
  172. let i = null;
  173. s.length > this.soundMax ? (i = s.pop()).stop() : i = this.createAudio(t, e), i && (i.play(), s.push(i), this.soundMap[t] = s)
  174. }
  175. playAudioWithEnd(t, e) {
  176. this.disAudio(t) || (this.audio = this.createAudio(t, !1), this.audio && (this.audio.play(), this.audio.onEnded ? this.audio.onEnded(() => {
  177. e && e(), this.audio && (this.audio.destroy(), this.audio = null)
  178. }) : this.platLog("未检测到平台有音频结束回调")))
  179. }
  180. createAudio(t, e) {
  181. let s = this.plat.createAudio();
  182. if (!s) return this.platLog("该平台创建音频失败"), null;
  183. s.autoplay = !0, s.loop = e, s.obeyMuteSwitch && (s.obeyMuteSwitch = !1), s.src = t
  184. }
  185. platLog(e) {
  186. t.debug && (console.log("moyusdk log:"), console.log(e))
  187. }
  188. destroy() {
  189. this.audio && this.audio.destroy()
  190. }
  191. }
  192. s._instance = null;
  193. class i {
  194. constructor() {
  195. this.zeroTime = 16094304e5, this.timeSpan = 0, this.sending = !1, this.weekNum = 0
  196. }
  197. static get Inst() {
  198. return this._instance || (this._instance = new i), this._instance
  199. }
  200. getNetTime(s) {
  201. if (t.realTime && !this.sending) {
  202. let i = t.getUrl("tool/timestamp");
  203. this.sending = !0, e.Inst.sendGet(i, t => {
  204. if (t) {
  205. let e = t.timestamp;
  206. this.setTimeSpan(e)
  207. }
  208. s && s(), this.sending = !1
  209. })
  210. } else s && s()
  211. }
  212. setTimeSpan(t) {
  213. let e = Number(t),
  214. s = this.getTime();
  215. e && e > 0 && (this.timeSpan = s - e)
  216. }
  217. getTime(t = !1) {
  218. let e = (new Date).getTime() - this.timeSpan;
  219. return e < 999999999999 && (e *= 10), t ? Math.floor(.001 * e) : e
  220. }
  221. getDate(t = 0, e = !0) {
  222. t < 1 && (t = this.getTime());
  223. let s = new Date(Number(t));
  224. return e ? 1e4 * s.getUTCFullYear() + 100 * (s.getUTCMonth() + 1) + s.getUTCDate() : s.getFullYear() + "/" + (s.getMonth() + 1) + "/" + s.getDate()
  225. }
  226. getWeek() {
  227. let t = this.getTime();
  228. return new Date(Number(t)).getDay()
  229. }
  230. getWeekNum() {
  231. let t = this.getTime() - this.zeroTime,
  232. e = Math.ceil(t / 864e5);
  233. return this.weekNum = Math.ceil((e - 3) / 7), this.weekNum % 52
  234. }
  235. }
  236. i._instance = null;
  237. class a {
  238. constructor() {
  239. this.isAuth = !1, this.realName = "", this.realCode = "", this.userId = "", this.openId = "", this.nickName = "", this.headIcon = "", this.gender = 0, this.city = "", this.age = 0, this.loginCount = 0, this.videoCount = [0, 0]
  240. }
  241. }
  242. class n {
  243. safe_add(t, e) {
  244. var s = (65535 & t) + (65535 & e);
  245. return (t >> 16) + (e >> 16) + (s >> 16) << 16 | 65535 & s
  246. }
  247. rol(t, e) {
  248. return t << e | t >>> 32 - e
  249. }
  250. cmn(t, e, s, i, a, n) {
  251. return this.safe_add(this.rol(this.safe_add(this.safe_add(e, t), this.safe_add(i, n)), a), s)
  252. }
  253. ff(t, e, s, i, a, n, r) {
  254. return this.cmn(e & s | ~e & i, t, e, a, n, r)
  255. }
  256. gg(t, e, s, i, a, n, r) {
  257. return this.cmn(e & i | s & ~i, t, e, a, n, r)
  258. }
  259. hh(t, e, s, i, a, n, r) {
  260. return this.cmn(e ^ s ^ i, t, e, a, n, r)
  261. }
  262. ii(t, e, s, i, a, n, r) {
  263. return this.cmn(s ^ (e | ~i), t, e, a, n, r)
  264. }
  265. coreMD5(t) {
  266. for (var e = 1732584193, s = -271733879, i = -1732584194, a = 271733878, n = 0; n < t.length; n += 16) {
  267. var r = e,
  268. o = s,
  269. h = i,
  270. d = a;
  271. e = this.ff(e, s, i, a, t[n + 0], 7, -680876936), a = this.ff(a, e, s, i, t[n + 1], 12, -389564586), i = this.ff(i, a, e, s, t[n + 2], 17, 606105819), s = this.ff(s, i, a, e, t[n + 3], 22, -1044525330), e = this.ff(e, s, i, a, t[n + 4], 7, -176418897), a = this.ff(a, e, s, i, t[n + 5], 12, 1200080426), i = this.ff(i, a, e, s, t[n + 6], 17, -1473231341), s = this.ff(s, i, a, e, t[n + 7], 22, -45705983), e = this.ff(e, s, i, a, t[n + 8], 7, 1770035416), a = this.ff(a, e, s, i, t[n + 9], 12, -1958414417), i = this.ff(i, a, e, s, t[n + 10], 17, -42063), s = this.ff(s, i, a, e, t[n + 11], 22, -1990404162), e = this.ff(e, s, i, a, t[n + 12], 7, 1804603682), a = this.ff(a, e, s, i, t[n + 13], 12, -40341101), i = this.ff(i, a, e, s, t[n + 14], 17, -1502002290), s = this.ff(s, i, a, e, t[n + 15], 22, 1236535329), e = this.gg(e, s, i, a, t[n + 1], 5, -165796510), a = this.gg(a, e, s, i, t[n + 6], 9, -1069501632), i = this.gg(i, a, e, s, t[n + 11], 14, 643717713), s = this.gg(s, i, a, e, t[n + 0], 20, -373897302), e = this.gg(e, s, i, a, t[n + 5], 5, -701558691), a = this.gg(a, e, s, i, t[n + 10], 9, 38016083), i = this.gg(i, a, e, s, t[n + 15], 14, -660478335), s = this.gg(s, i, a, e, t[n + 4], 20, -405537848), e = this.gg(e, s, i, a, t[n + 9], 5, 568446438), a = this.gg(a, e, s, i, t[n + 14], 9, -1019803690), i = this.gg(i, a, e, s, t[n + 3], 14, -187363961), s = this.gg(s, i, a, e, t[n + 8], 20, 1163531501), e = this.gg(e, s, i, a, t[n + 13], 5, -1444681467), a = this.gg(a, e, s, i, t[n + 2], 9, -51403784), i = this.gg(i, a, e, s, t[n + 7], 14, 1735328473), s = this.gg(s, i, a, e, t[n + 12], 20, -1926607734), e = this.hh(e, s, i, a, t[n + 5], 4, -378558), a = this.hh(a, e, s, i, t[n + 8], 11, -2022574463), i = this.hh(i, a, e, s, t[n + 11], 16, 1839030562), s = this.hh(s, i, a, e, t[n + 14], 23, -35309556), e = this.hh(e, s, i, a, t[n + 1], 4, -1530992060), a = this.hh(a, e, s, i, t[n + 4], 11, 1272893353), i = this.hh(i, a, e, s, t[n + 7], 16, -155497632), s = this.hh(s, i, a, e, t[n + 10], 23, -1094730640), e = this.hh(e, s, i, a, t[n + 13], 4, 681279174), a = this.hh(a, e, s, i, t[n + 0], 11, -358537222), i = this.hh(i, a, e, s, t[n + 3], 16, -722521979), s = this.hh(s, i, a, e, t[n + 6], 23, 76029189), e = this.hh(e, s, i, a, t[n + 9], 4, -640364487), a = this.hh(a, e, s, i, t[n + 12], 11, -421815835), i = this.hh(i, a, e, s, t[n + 15], 16, 530742520), s = this.hh(s, i, a, e, t[n + 2], 23, -995338651), e = this.ii(e, s, i, a, t[n + 0], 6, -198630844), a = this.ii(a, e, s, i, t[n + 7], 10, 1126891415), i = this.ii(i, a, e, s, t[n + 14], 15, -1416354905), s = this.ii(s, i, a, e, t[n + 5], 21, -57434055), e = this.ii(e, s, i, a, t[n + 12], 6, 1700485571), a = this.ii(a, e, s, i, t[n + 3], 10, -1894986606), i = this.ii(i, a, e, s, t[n + 10], 15, -1051523), s = this.ii(s, i, a, e, t[n + 1], 21, -2054922799), e = this.ii(e, s, i, a, t[n + 8], 6, 1873313359), a = this.ii(a, e, s, i, t[n + 15], 10, -30611744), i = this.ii(i, a, e, s, t[n + 6], 15, -1560198380), s = this.ii(s, i, a, e, t[n + 13], 21, 1309151649), e = this.ii(e, s, i, a, t[n + 4], 6, -145523070), a = this.ii(a, e, s, i, t[n + 11], 10, -1120210379), i = this.ii(i, a, e, s, t[n + 2], 15, 718787259), s = this.ii(s, i, a, e, t[n + 9], 21, -343485551), e = this.safe_add(e, r), s = this.safe_add(s, o), i = this.safe_add(i, h), a = this.safe_add(a, d)
  272. }
  273. return [e, s, i, a]
  274. }
  275. binl2hex(t) {
  276. for (var e = "", s = 0; s < 4 * t.length; s++) e += "0123456789abcdef".charAt(t[s >> 2] >> s % 4 * 8 + 4 & 15) + "0123456789abcdef".charAt(t[s >> 2] >> s % 4 * 8 & 15);
  277. return e
  278. }
  279. binl2b64(t) {
  280. for (var e = "", s = 0; s < 32 * t.length; s += 6) e += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t[s >> 5] << s % 32 & 63 | t[s >> 6] >> 32 - s % 32 & 63);
  281. return e
  282. }
  283. str2binl(t) {
  284. for (var e = 1 + (t.length + 8 >> 6), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0;
  285. for (i = 0; i < t.length; i++) s[i >> 2] |= (255 & t.charCodeAt(i)) << i % 4 * 8;
  286. return s[i >> 2] |= 128 << i % 4 * 8, s[16 * e - 2] = 8 * t.length, s
  287. }
  288. strw2binl(t) {
  289. for (var e = 1 + (t.length + 4 >> 5), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0;
  290. for (i = 0; i < t.length; i++) s[i >> 1] |= t.charCodeAt(i) << i % 2 * 16;
  291. return s[i >> 1] |= 128 << i % 2 * 16, s[16 * e - 2] = 16 * t.length, s
  292. }
  293. hexMD5(t) {
  294. return this.binl2hex(this.coreMD5(this.str2binl(t)))
  295. }
  296. hexMD5w(t) {
  297. return this.binl2hex(this.coreMD5(this.strw2binl(t)))
  298. }
  299. b64MD5(t) {
  300. return this.binl2b64(this.coreMD5(this.str2binl(t)))
  301. }
  302. b64MD5w(t) {
  303. return this.binl2b64(this.coreMD5(this.strw2binl(t)))
  304. }
  305. calcMD5(t) {
  306. return this.binl2hex(this.coreMD5(this.str2binl(t)))
  307. }
  308. }
  309. class r {
  310. constructor() {
  311. this.id = "", this.title = "", this.desc = "", this.btnTxt = "", this.icon = "", this.image = ""
  312. }
  313. }
  314. var o, h;
  315. ! function (t) {
  316. t.total = "total", t.month = "month", t.week = "week", t.day = "day"
  317. }(o || (o = {}));
  318. class d {
  319. constructor() {
  320. this.ttVideoId = "", this.ttBannerId = "", this.ttInsertId = "", this.opVideoId = "", this.opBannerId = "", this.opNativeId = "", this.vvVideoId = "", this.vvBannerId = "", this.vvInsertId = "", this.vvNativeId = "", this.mzVideoId = "", this.mzBannerId = "", this.mzInsertId = "", this.wxVideoId = "", this.wxBannerId = "", this.wxInsertId = "", this.qqVideoId = "", this.qqBannerId = "", this.qqInsertId = "", this.qqBoxId = "", this.qqBlockId = "", this.hwVideoId = "", this.hwBannerId = "", this.hwInsertId = "", this.ksVideoId = "", this.ksBannerId = "", this.ksInsertId = ""
  321. }
  322. } ! function (t) {
  323. t[t.web = 0] = "web", t[t.tt = 1] = "tt", t[t.op = 2] = "op", t[t.vv = 3] = "vv", t[t.mz = 4] = "mz", t[t.wx = 5] = "wx", t[t.qq = 6] = "qq", t[t.f399 = 7] = "f399", t[t.ks = 8] = "ks", t[t.hw = 9] = "hw", t[t.xm = 10] = "xm", t[t.csj = 11] = "csj", t[t.mmy = 12] = "mmy", t[t.xmApk = 13] = "xmApk", t[t.vvApk = 14] = "vvApk", t[t.ios = 15] = "ios", t[t.t33 = 16] = "t33", t[t.hwkb = 17] = "hwkb", t[t.opApk = 18] = "opApk", t[t.hhw = 19] = "hhw", t[t.f399Apk = 20] = "f399Apk", t[t.ttApk = 21] = "ttApk", t[t.a233 = 22] = "a233"
  324. }(h || (h = {}));
  325. class l {
  326. constructor() {
  327. this.authUser = !1, this.userId = "", this.realName = "", this.realCode = "", this.age = 0, this.nickName = "", this.headIcon = "", this.openId = "", this.focused = !1, this.curDate = 0, this.curWeek = 0, this.createTime = 0, this.gameTime = 999, this.fcmDate = 0, this.minScore = 0, this.loginCount = 0, this.adScusNum = 0, this.adFailNum = 0
  328. }
  329. saveData(t) {
  330. console.log('zh: saveData ' + t);
  331. let e = {};
  332. for (let t in this) e[t.toString()] = this[t];
  333. localStorage.setItem("moyudata_" + t, JSON.stringify(e))
  334. }
  335. getData(t) {
  336. let e = localStorage.getItem("moyudata_" + t);
  337. if (e) {
  338. let t = JSON.parse(e);
  339. if (t)
  340. for (let e in this) {
  341. let s = t[e.toString()];
  342. null != s && (this[e] = s)
  343. }
  344. }
  345. }
  346. clear(t) {
  347. localStorage.removeItem("moyudata_" + t)
  348. }
  349. }
  350. class p {
  351. constructor() {
  352. this.platName = "", this.platVersion = 0, this.isDouyin = !1, this.isQq3002 = !1, this.hasShortCut = !0, this.canFocus = !1, this.realName = 0, this.isLegal = !0, this.isMasked = !1, this.autoAd = 0, this.videoCount = 0, this.gameBit = 0, this.markBit = 0, this.appId = "", this.appSecret = "", this.platCode = "", this.pkgName = "", this.token = "", this.fcmActive = !1, this.hasAd = !1, this.videoErro = !1, this.bannerClose = !1, this.bannerShow = !1, this.platWidth = 750, this.platHeight = 1334, this.adTime = 0, this.hideTime = 0, this.myId = 0, this.myKey = ""
  353. }
  354. static get Inst() {
  355. return null == p._instance && (p._instance = new p), p._instance
  356. }
  357. init(e) {
  358. //原來的
  359. // if (t.debug = e, this.moyuUser = new a, this.data = new l, this.nativeInfo = new r, this.data.getData(this.myId), this.data.userId.length < 2) {
  360. // let e = this.getRandStr(5);
  361. // //this.data.headIcon = t.getTagro("headimg/0.jpg"); //zh:用户默认昵称
  362. // this.data.headIcon = 'res/ty_touxiang.png';
  363. // this.data.userId = "my" + this.myId + e;
  364. // this.data.nickName = "player_" + e;
  365. // this.data.loginCount = 1; this.data.createTime = this.getTime();
  366. // } else {
  367. // this.data.loginCount++;
  368. // }
  369. console.log('zh:11111111initinitinitinitinitinitinitinitinit')
  370. const data_userInfo = Laya.LocalStorage.getItem('userInfo');
  371. if (t.debug = e, this.moyuUser = new a, this.data = new l, this.nativeInfo = new r, this.data.getData(this.myId), this.data.userId.length < 2) {
  372. console.log('zh:222222')
  373. let e = this.getRandStr(5);
  374. this.data.headIcon = 'res/ty_touxiang.png';
  375. this.data.userId = "my" + this.myId + e;
  376. this.data.loginCount = 1;
  377. this.data.createTime = this.getTime();
  378. if (data_userInfo === null) {
  379. this.data.nickName = "player_" + e;
  380. } else {
  381. console.log('zh:33333333333')
  382. let data_userInfo_obj = JSON.parse(data_userInfo);
  383. this.data.nickName = data_userInfo_obj.username;
  384. this.moyuUser.nickName = data_userInfo_obj.username;
  385. console.log('zh:444444444')
  386. }
  387. } else {
  388. this.data.loginCount++;
  389. }
  390. this.moyuUser.loginCount = this.data.loginCount;
  391. this.moyuUser.userId = this.data.userId;
  392. this.moyuUser.nickName = this.data.nickName;
  393. this.moyuUser.headIcon = this.data.headIcon;
  394. this.moyuUser.openId = this.data.openId;
  395. this.moyuUser.createTime = this.data.createTime;
  396. this.moyuUser.videoCount = [this.data.adScusNum, this.data.adFailNum];
  397. this.moyuUser.realName = this.data.realName;
  398. this.moyuUser.realCode = this.data.realCode;
  399. this.moyuUser.age = this.data.age;
  400. this.setGameTime();
  401. this.data.saveData(this.myId);
  402. }
  403. initFCM(t) {
  404. t && this.moyuUser.age < 18 && this.moyuUser.realCode.length > 1 ? (this.fcmActive = !0, setInterval(() => {
  405. this.data.gameTime > 0 && (this.data.gameTime -= 1, this.saveData())
  406. }, 6e4)) : this.fcmActive = !1
  407. }
  408. setGameTime(s = !1) {
  409. let a = i.Inst.getDate();
  410. if (a > this.data.fcmDate || s) {
  411. if (this.data.fcmDate = a, this.data.age < 18) {
  412. let s = (new Date).getDay();
  413. this.data.gameTime = s > 0 && s < 5 ? 0 : 60;
  414. let i = t.getUrl("tool/holiday");
  415. e.Inst.sendGet(i, t => {
  416. t && 0 == t.code && t.data && 0 != t.data.type && (this.data.gameTime = 60)
  417. })
  418. } else this.data.gameTime = 9999;
  419. this.saveData()
  420. }
  421. }
  422. getRandStr(t) {
  423. let e = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"],
  424. s = "";
  425. for (let i = 0; i < t; i++) {
  426. s += e[this.getRandom(0, e.length)]
  427. }
  428. return s
  429. }
  430. getRandom(t, e) {
  431. var s = e - t,
  432. i = Math.random() * s;
  433. return Math.floor(i) + t
  434. }
  435. saveData() {
  436. this.data && this.data.saveData(this.myId)
  437. }
  438. getRankUser() {
  439. return {
  440. userId: this.moyuUser.userId,
  441. nickName: this.moyuUser.nickName,
  442. headIcon: this.moyuUser.headIcon
  443. }
  444. }
  445. saveSeverData(s, i) {
  446. let a = this.moyuUser.openId;
  447. if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11111, "存储错误,检查唯一id");
  448. let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(),
  449. r = {
  450. uid: this.myId + n + "00" + a,
  451. userData: JSON.stringify(s)
  452. },
  453. o = t.getUrl("app-user-data/save");
  454. e.Inst.sendPost(o, r, t => {
  455. t && 0 == t.code ? this.platLog("数据已保存") : this.platError(11112, t)
  456. })
  457. }
  458. getSeverData(s, i) {
  459. let a = this.moyuUser.openId;
  460. if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11113, "错误的id");
  461. let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(),
  462. r = this.myId + n + "00" + a,
  463. o = t.getUrl("app-user-data/get", "?uid=" + r);
  464. e.Inst.sendGet(o, t => {
  465. t && 0 == t.code ? s && s(JSON.parse(t.data.userData)) : (this.platLog("未获取到数据", t), s && s(null))
  466. })
  467. }
  468. onVideoDone(t) {
  469. t ? p.Inst.data.adScusNum++ : p.Inst.data.adFailNum++, this.moyuUser.videoCount = [this.data.adScusNum, this.data.adFailNum], this.saveData()
  470. }
  471. onRealName(t, e) {
  472. this.moyuUser.realName = this.data.realName = t, this.moyuUser.realCode = this.data.realCode = e;
  473. let s = i.Inst.getDate(),
  474. a = Number(e.substring(6, 14)),
  475. n = Math.floor((s - a) / 1e4);
  476. this.moyuUser.age = this.data.age = n, this.initFCM(!0), this.setGameTime(!0), this.saveData()
  477. }
  478. clearData() {
  479. this.data && this.data.clear(this.myId)
  480. }
  481. initUser(t, e = 0) {
  482. if (t) {
  483. switch (this.platType) {
  484. case h.tt:
  485. case h.wx:
  486. this.moyuUser.nickName = t.userInfo.nickName, this.moyuUser.headIcon = t.userInfo.avatarUrl, this.setCity(t.userInfo.city), this.moyuUser.gender = t.userInfo.gender;
  487. break;
  488. case h.op:
  489. 0 == e ? (this.moyuUser.openId = t.uid, this.moyuUser.nickName = t.nickName, this.moyuUser.headIcon = t.avatar, this.moyuUser.gender = "M" == t.sex ? 1 : "F" == t.sex ? 2 : 0, this.setAge(t.age)) : (this.moyuUser.openId = t.userInfo.userId, this.moyuUser.nickName = t.userInfo.userName, this.moyuUser.headIcon = t.userInfo.avatar, this.setCity(t.userInfo.location), this.moyuUser.gender = "M" == t.userInfo.sex ? 1 : "F" == t.userInfo.sex ? 2 : 0, this.setAge(t.userInfo.age));
  490. break;
  491. case h.vv:
  492. this.moyuUser.nickName = t.nickName, this.moyuUser.headIcon = t.smallAvatar, this.moyuUser.gender = t.gender;
  493. break;
  494. case h.mz:
  495. this.moyuUser.nickName = t.nickname, this.moyuUser.headIcon = t.icon, this.moyuUser.openId = t.uid;
  496. break;
  497. case h.ks:
  498. this.moyuUser.nickName = t.userName, this.moyuUser.headIcon = t.userHead, this.moyuUser.openId = t.unionID, this.setCity(t.userCity), this.moyuUser.gender = "M" == t.gender ? 1 : "F" == t.gender ? 2 : 0, this.setAge(t.age);
  499. break;
  500. case h.xmApk:
  501. "string" == typeof t && (this.moyuUser.nickName = t);
  502. break;
  503. case h.f399:
  504. this.moyuUser.headIcon = t.icon, this.moyuUser.nickName = t.userName, this.moyuUser.openId = t.uId;
  505. break;
  506. default:
  507. console.log("zh:该平台没有用户信息")
  508. }
  509. this.moyuUser.userId = this.data.userId, this.moyuUser.isAuth = !0, this.data.authUser = !0, this.data.openId = this.moyuUser.openId, this.data.nickName = this.moyuUser.nickName, this.data.headIcon = this.moyuUser.headIcon, this.saveData()
  510. }
  511. }
  512. setAge(t) {
  513. null == t ? this.moyuUser.age = 0 : t instanceof String && (this.moyuUser.age = Number(t)), this.moyuUser.age < 0 && (this.moyuUser.age = 0)
  514. }
  515. setCity(t) {
  516. t ? this.moyuUser.city.length < 1 && (this.moyuUser.city = t) : this.moyuUser.city = ""
  517. }
  518. isGameBit(t) {
  519. if (0 == this.gameBit) return !0;
  520. return ((t = Number(t)) & this.gameBit) == t
  521. }
  522. showTip(t) {
  523. this.onTipCall && this.onTipCall(t)
  524. }
  525. platLog(...e) {
  526. if (t.debug) {
  527. console.log("moyusdk log:");
  528. for (const t of e) console.log(t)
  529. }
  530. }
  531. platError(t, e) {
  532. console.error("moyusdk error:" + t), e && console.error(e)
  533. }
  534. onShow(t = !0) {
  535. t ? (this.platLog("plat onShow"), Math.abs(i.Inst.getTime() - this.hideTime) > 6e5 && i.Inst.getNetTime()) : (this.hideTime = i.Inst.getTime(), this.platLog("plat onHide")), this.pauseMusic(!t), this.showTip(t ? 20011 : 20012)
  536. }
  537. pauseMusic(t) {
  538. s.Inst.pauseMusic(t)
  539. }
  540. onConnected(t) {
  541. t ? (i.Inst.getNetTime(), this.showTip(20021)) : this.showTip(20022), this.platLog("net changed:", t)
  542. }
  543. getTime() {
  544. return i.Inst.getTime()
  545. }
  546. isNewDay() {
  547. let t = i.Inst.getDate();
  548. return t > this.data.curDate && (this.data.curDate = t, this.saveData(), !0)
  549. }
  550. isNewWeek() {
  551. return i.Inst.getWeekNum(), i.Inst.weekNum > this.data.curWeek && (this.data.curWeek = i.Inst.weekNum, this.saveData(), !0)
  552. }
  553. onBannerHide() {
  554. this.bannerClose || (this.platLog("banner 广告背关闭/隐藏"), this.showTip(20111))
  555. }
  556. onNativeLoad(t) {
  557. if (t) {
  558. let e = t.icon;
  559. this.nativeInfo.id = t.adId, this.nativeInfo.title = t.title, this.nativeInfo.btnTxt = t.clickBtnTxt, this.nativeInfo.desc = t.desc;
  560. let s = t.imgUrlList[0];
  561. s && s.length > 0 && (this.nativeInfo.image = s), e && e.length > 0 && (this.nativeInfo.icon = e)
  562. } else this.nativeInfo.icon = "", this.nativeInfo.image = "";
  563. this.onNativeCall && this.onNativeCall(), this.onNativeCall = null
  564. }
  565. getUserInfo(t) { }
  566. oppoSign(t, e, s, i, a) {
  567. let r = {
  568. appKey: t,
  569. appSecret: e,
  570. pkgName: s,
  571. timeStamp: a,
  572. token: i
  573. },
  574. o = "";
  575. for (const t in r) {
  576. let e = r[t];
  577. o.length > 0 && (o += "&"), o += t + "=" + e
  578. }
  579. return (new n).hexMD5(o).toUpperCase()
  580. }
  581. signMap(t) {
  582. var e = new Array;
  583. return Object.keys(t).sort().map(s => {
  584. e.push(t[s])
  585. }), e.join("")
  586. }
  587. }
  588. p._instance = null;
  589. let u = p.Inst;
  590. class c {
  591. constructor() {
  592. this.videoId = "", this.bannerId = "", this.insertId = "", this.nativeId = "", this.boxId = "", this.blockId = "", this.customAd = {}, this.videoType = 0, this.bannerType = 0, this.insertType = 0, this.nativeIdx = -1
  593. }
  594. init() {
  595. if (!this.sdk) return void u.platError(10001, "Platform super");
  596. this.sdk.onShow && this.sdk.onShow(t => {
  597. u.onShow(!0)
  598. }), this.sdk.onHide && this.sdk.onHide(t => {
  599. u.onShow(!1)
  600. });
  601. let t = null;
  602. this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (u.platOptions = t), this.subLoader = this.sdk.loadSubpackage
  603. }
  604. initApp(t) { }
  605. initAds() {
  606. if (!this.sdk || !this.sdk.getSystemInfoSync) return;
  607. let e = this.sdk.getSystemInfoSync(),
  608. s = t.bannerW = e.windowWidth;
  609. t.bannerW > 1440 && (t.bannerW = 1440), t.bannerH = s / 6.7
  610. }
  611. initUser(t, e = !1) {
  612. t && t()
  613. }
  614. getOpenId(t) { }
  615. getLocation(t) {
  616. t && t()
  617. }
  618. userAgree(t) { }
  619. onAdMsg(t) { }
  620. onUserInfo(t) {
  621. this.userCall && this.userCall()
  622. }
  623. showMoreGame() { }
  624. createAudio() {
  625. if (this.sdk.createInnerAudioContext) return this.sdk.createInnerAudioContext();
  626. u.platLog("audio is null")
  627. }
  628. setWH() {
  629. let t = this.sdk.getSystemInfoSync && this.sdk.getSystemInfoSync();
  630. t && (u.platWidth = t.screenWidth ? t.screenWidth : 750, u.platHeight = t.screenHeight ? t.screenHeight : 1334)
  631. }
  632. exit() { }
  633. addLnk(t) {
  634. t && t()
  635. }
  636. focus(t) { }
  637. shareGame(t, e, s) { }
  638. recordeGame(t, e) { }
  639. recordPause(t) { }
  640. recordeStart() { }
  641. recordeEnd(t) {
  642. t && t()
  643. }
  644. showBlock(t) { }
  645. showBox() { }
  646. sendDataEvent(t, e) { }
  647. toVideoView(t) { }
  648. vibrate(t) {
  649. this.sdk && (t && this.sdk.vibrateLong ? this.sdk.vibrateLong() : this.sdk.vibrateShort && this.sdk.vibrateShort())
  650. }
  651. showVideoAd(t) {
  652. this.adCall = t, u.videoAd ? u.hasAd ? (u.platLog("videoAd show"), u.videoAd.show()) : (2 != this.videoType && u.showTip(20102), u.videoAd.load()) : this.voidId(this.videoId) ? t && t(!0) : u.platLog("videoAd is null")
  653. }
  654. initVideoAd(t) {
  655. this.voidId(t) || (this.videoId = t, u.videoAd = this.sdk.createRewardedVideoAd({
  656. adUnitId: this.videoId
  657. }), u.videoAd.onError(t => {
  658. 3 != this.videoType && (u.hasAd = !1), u.videoErro = !0, u.platError(10201, t)
  659. }), u.videoAd.onLoad && u.videoAd.onLoad(() => {
  660. u.hasAd = !0, u.videoErro = !1, u.platLog("videoAd onLoad"), 2 == this.videoType && u.videoAd.show()
  661. }), u.videoAd.onClose(t => {
  662. if (u.hasAd = 3 == this.videoType, 2 == this.videoType) setTimeout(() => {
  663. this.adCall && this.adCall(!0), this.adCall = null
  664. }, 500);
  665. else {
  666. let e = !1;
  667. (t && t.isEnded || void 0 === t) && (e = !0), this.adCall && this.adCall(e), this.adCall = null, 1 == this.videoType && u.videoAd.load()
  668. }
  669. }), 1 == this.videoType && u.videoAd.load(), u.platLog("videoAd inited"))
  670. }
  671. showBannerAd(t) {
  672. u.bannerAd ? t ? u.bannerAd.show() : u.bannerAd.hide() : this.voidId(this.bannerId) || u.platLog("bannerAd is null")
  673. }
  674. initBannerAd(e, s = 30) {
  675. if (this.voidId(e)) return;
  676. this.bannerId = e;
  677. let i = this.sdk.getSystemInfoSync(),
  678. a = i.windowHeight,
  679. n = i.windowHeight,
  680. r = {};
  681. r = 1 == this.bannerType ? {
  682. adUnitId: this.bannerId,
  683. style: {
  684. left: a / 2 - t.bannerW / 2,
  685. top: n - t.bannerH,
  686. width: t.bannerW,
  687. height: t.bannerH
  688. }
  689. } : {
  690. adUnitId: this.bannerId,
  691. adIntervals: s,
  692. style: {
  693. left: a / 2 - t.bannerW / 2,
  694. top: n - t.bannerH
  695. }
  696. }, u.bannerAd = this.sdk.createBannerAd(r), u.bannerAd.onError(t => {
  697. u.platError(10211, t)
  698. }), u.bannerAd.onLoad(() => {
  699. this.setBannerPos(), u.bannerShow ? 0 == this.bannerType && u.bannerAd.show() : u.bannerAd.hide()
  700. }), u.bannerAd.onClose && u.bannerAd.onClose(function () {
  701. u.onBannerHide()
  702. }), u.bannerAd.onHide && u.bannerAd.onHide(function () {
  703. u.onBannerHide()
  704. }), u.platLog("BannerAd inited")
  705. }
  706. setBannerPos() {
  707. if (!u.bannerAd || !u.bannerAd.style) return void u.platLog("banner or style is null");
  708. let e = this.sdk.getSystemInfoSync(),
  709. s = e.windowWidth,
  710. i = e.windowHeight,
  711. a = u.bannerAd.style,
  712. n = t.bannerPy * i;
  713. n = n < t.bannerH ? 0 : n > i - t.bannerH ? i - t.bannerH : t.bannerPy * i - t.bannerH / 2, a.width && (a.width = t.bannerW), a.height && (a.height = t.bannerH), a.left = t.bannerPx * s - .5 * t.bannerW, a.top = n, u.bannerAd.style = a
  714. }
  715. initInsertAd(t) {
  716. this.voidId(t) || (this.insertId = t, u.insertAd = this.sdk.createInterstitialAd({
  717. adUnitId: this.insertId
  718. }), u.insertAd && (u.insertAd.onError(t => {
  719. u.platError(10221, t)
  720. }), u.insertAd.onLoad && u.insertAd.onLoad(() => {
  721. 1 == this.insertType && u.insertAd.show()
  722. }), u.platLog("InsertAd inited")))
  723. }
  724. showInsertAd(t) {
  725. u.insertAd ? 0 == this.insertType ? u.insertAd.show() : 1 == this.insertType ? u.insertAd.load() : 2 == this.insertType && u.insertAd.show().catch(t => {
  726. u.platError(10221, t)
  727. }) : this.voidId(this.insertId) || u.platLog("InsertAd is null")
  728. }
  729. initCustomAd(t, e, s, i) {
  730. if (this.voidId(t)) return;
  731. let a = this.customAd[t];
  732. a && (a.destroy(), this.customAd[t] = null), i < 30 && (i = 30), (e > 1 || s > 1) && u.platLog("CustomAd位置不合理");
  733. let n = this.sdk.getSystemInfoSync(),
  734. r = n.screenWidth * e,
  735. o = n.screenHeight * s,
  736. h = this.sdk.createCustomAd({
  737. adUnitId: t,
  738. adIntervals: i,
  739. style: {
  740. left: r,
  741. top: o
  742. }
  743. });
  744. h.onError(t => {
  745. u.platError(10241, t)
  746. }), h.onLoad(() => {
  747. u.platLog(t + "CustomAd onload")
  748. }), this.customAd[t] = h
  749. }
  750. showCustomAd(t, e) {
  751. let s = this.customAd[t];
  752. s ? e ? s.show() : s.hide() : this.voidId(t) || u.platLog("CustomAd is null")
  753. }
  754. reportNative(t) {
  755. if (!u.nativeAd) return;
  756. let e = u.nativeInfo.id;
  757. u.platLog("reportNative:" + t, e), !e || e.length < 1 || (1 == t ? u.nativeAd.reportAdShow({
  758. adId: e
  759. }) : u.nativeAd.reportAdClick({
  760. adId: e
  761. }))
  762. }
  763. getNativeAd(t) {
  764. u.onNativeCall = t, u.nativeAd ? u.nativeAd.load() : this.setNative()
  765. }
  766. setNative(t = !1) {
  767. if (this.nativeId.length < 2) return;
  768. let e = this.nativeId.split(",");
  769. this.nativeIdx < 0 ? this.nativeIdx = u.getRandom(0, e.length) : (this.nativeIdx++, this.nativeIdx >= e.length && (this.nativeIdx = 0));
  770. let s = e[this.nativeIdx];
  771. t ? setTimeout(() => {
  772. this.initNative(s)
  773. }, 5e3) : this.initNative(s)
  774. }
  775. initNative(t) {
  776. this.voidId(t) || (u.nativeAd && u.nativeAd.destroy(), u.nativeAd = this.sdk.createNativeAd({
  777. adUnitId: t
  778. }), u.nativeAd && (u.nativeAd.onError(t => {
  779. this.setNative(!0), u.onNativeLoad(null), u.platError(10231, t)
  780. }), u.nativeAd.onLoad(function (t) {
  781. let e = t.adList.pop();
  782. u.platLog("native onload"), u.onNativeLoad(e), u.nativeAd.reportAdShow({
  783. adId: u.nativeInfo.id
  784. })
  785. }), u.nativeAd.load()))
  786. }
  787. voidId(t) {
  788. return null == t || t.length < 2
  789. }
  790. }
  791. class g extends c {
  792. constructor() {
  793. super(...arguments), this.recordStop = !0, this.appOptions = [{
  794. appId: "tt7c920a2fe3a914da",
  795. query: "k=v",
  796. extraData: {}
  797. }, {
  798. appId: "tt84e2f25f1bda296b",
  799. query: "k=v",
  800. extraData: {}
  801. }], this.url1 = "/gate.snssdk.c", this.url2 = "ht"
  802. }
  803. init() {
  804. if (this.sdk = window.tt, this.sdk) {
  805. this.subLoader = this.sdk.loadSubpackage;
  806. var e = this.sdk.getLaunchOptionsSync();
  807. e && (p.Inst.platOptions = e), this.sdk.login({
  808. success(e) {
  809. p.Inst.platCode = e.code, window.tt.onTouchEnd(() => {
  810. t.realName || window.tt.authenticateRealName({
  811. complete() {
  812. p.Inst.platLog("实名认证"), t.realName = !0
  813. }
  814. })
  815. })
  816. },
  817. fail(t) {
  818. p.Inst.platError(10011, t)
  819. }
  820. }), this.sdk.getSystemInfo({
  821. success(t) {
  822. p.Inst.platName = t.appName, "Douyin" != t.appName && "douyin_lite" != t.appName || (p.Inst.isDouyin = !0)
  823. }
  824. }), this.initRecoder(), this.sdk.checkShortcut && this.sdk.checkShortcut({
  825. success: function (t) {
  826. p.Inst.hasShortCut = t.status.exist
  827. },
  828. fail: function (t) {
  829. p.Inst.platLog("Shortcut失败", t), p.Inst.hasShortCut = !0
  830. }
  831. }), this.sdk.onShareAppMessage(e => {
  832. const s = {
  833. title: t.shareTitle,
  834. imageUrl: t.shareImg,
  835. extra: {},
  836. query: t.shareQuery,
  837. success(t) {
  838. p.Inst.platLog("分享成功", t)
  839. },
  840. fail(t) {
  841. p.Inst.platLog("分享失败", t), p.Inst.showTip(20301)
  842. }
  843. },
  844. i = Object.assign({
  845. channel: e.channel
  846. }, s);
  847. return i.extra = {
  848. withVideoId: !0,
  849. videoTopics: t.shareTag,
  850. hashtag_list: t.shareTag,
  851. videoTag: p.Inst.getTime()
  852. }, i
  853. }), super.init()
  854. } else p.Inst.platError(10001)
  855. }
  856. initAds() {
  857. this.sdk && (this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ttVideoId), this.initBannerAd(t.ttBannerId), this.initInsertAd(t.ttInsertId))
  858. }
  859. getLocation(t) {
  860. this.sdk && this.sdk.getLocation({
  861. success(e) {
  862. t && t(e)
  863. },
  864. fail(t) {
  865. p.Inst.platLog("getLocation失败", t)
  866. }
  867. })
  868. }
  869. showMoreGame() {
  870. "ios" !== this.sdk.getSystemInfoSync().platform ? this.sdk.showMoreGamesModal({
  871. appLaunchOptions: this.appOptions,
  872. success(t) {
  873. p.Inst.platLog("success", t.errMsg)
  874. },
  875. fail(t) {
  876. p.Inst.platLog("fail", t.errMsg)
  877. }
  878. }) : this.sdk.showToast({
  879. title: " iOS不支持"
  880. })
  881. }
  882. getOpenId() { }
  883. initUser(t, e) {
  884. this.sdk ? (this.sdk.getSetting({
  885. success: s => {
  886. let i = s.authSetting["scope.userInfo"];
  887. void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({
  888. success: e => {
  889. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  890. },
  891. fail: e => {
  892. p.Inst.platLog("openSetting 失败", e), t()
  893. }
  894. }) : t()
  895. },
  896. fail: e => {
  897. p.Inst.platLog("getSetting 失败", e), t()
  898. }
  899. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t()
  900. }
  901. getUserInfo(t) {
  902. this.sdk.getUserInfo({
  903. success: e => {
  904. p.Inst.initUser(e), t(!0)
  905. },
  906. fail: e => {
  907. p.Inst.platLog("getUserInfo 失败", e), t()
  908. }
  909. })
  910. }
  911. recordeGame(t, e) {
  912. "devtools" != p.Inst.platName && (p.Inst.shareMp4 = "", this.recordTime = t, this.recordClip = e, e && (t = 300), p.Inst.onRecordCall = null, this.recorder ? (this.recordStop || (this.recordStop = !0, p.Inst.platLog("上一次录屏没结束,注意检查逻辑")), p.Inst.platLog("recordGame"), this.recorder.start({
  913. duration: t,
  914. isMarkOpen: !0,
  915. locLeft: 0,
  916. locTop: 0,
  917. frameRate: 30
  918. })) : p.Inst.platError(10401, "recorder is null"))
  919. }
  920. recordPause(t) {
  921. "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume())
  922. }
  923. recordeEnd(t) {
  924. p.Inst.onRecordCall = t, this.recorder && this.recorder.stop()
  925. }
  926. addLnk(t) {
  927. this.sdk ? this.sdk.addShortcut({
  928. success: function (e) {
  929. p.Inst.hasShortCut = !0, t && t()
  930. },
  931. fail: function (t) {
  932. p.Inst.hasShortCut = !1
  933. }
  934. }) : t && t(!0)
  935. }
  936. focus(t) {
  937. this.sdk.openAwemeUserProfile(), t && t(!0)
  938. }
  939. shareGame(e, s, i) {
  940. this.sdk && (null == s && (s = t.shareImg), null == i && (i = t.shareQuery), p.Inst.shareMp4 && p.Inst.shareMp4.length > 0 ? (p.Inst.platLog("视频分享"), this.sdk.shareAppMessage({
  941. channel: "video",
  942. title: t.shareTitle,
  943. desc: t.shareTitle + "-视频分享",
  944. imageUrl: s,
  945. templateId: t.shareId,
  946. query: i,
  947. extra: {
  948. videoPath: p.Inst.shareMp4,
  949. videoTag: t.shareTitle,
  950. videoTopics: t.shareTag,
  951. hashtag_list: t.shareTag,
  952. video_title: t.shareTitle
  953. },
  954. success(t) {
  955. p.Inst.platLog("分享视频成功", t), e(!0)
  956. },
  957. fail(t) {
  958. p.Inst.platLog("分享视频失败", t), p.Inst.showTip(20301), e(!1)
  959. }
  960. })) : (p.Inst.platLog("普通分享"), this.sdk.shareAppMessage({
  961. templateId: "",
  962. title: t.shareTitle,
  963. desc: t.shareTitle + "-分享",
  964. imageUrl: s,
  965. query: i,
  966. success() {
  967. p.Inst.platLog("分享成功"), e(!0)
  968. },
  969. fail(t) {
  970. p.Inst.platLog("分享失败"), p.Inst.showTip(20301)
  971. }
  972. })))
  973. }
  974. initRecoder() {
  975. this.sdk.getSystemInfo({
  976. success: t => {
  977. this.recorder = this.sdk.getGameRecorderManager(), this.recorder.onStart(t => {
  978. p.Inst.platLog("record start"), this.recordStop = !1
  979. }), this.recorder.onStop(t => {
  980. this.recordStop ? p.Inst.platLog("已结束过了") : (this.recordStop = !0, p.Inst.shareMp4 = t.videoPath, p.Inst.platLog("record stop:" + t.videoPath), this.recordClip ? this.recorder.clipVideo({
  981. path: t.videoPath,
  982. timeRange: [this.recordTime, 0],
  983. success(t) {
  984. p.Inst.platLog("clipVideo:" + t.videoPath), p.Inst.shareMp4 = t.videoPath, p.Inst.onRecordCall && p.Inst.onRecordCall()
  985. },
  986. fail(t) {
  987. p.Inst.platLog("裁剪出错,使用未裁剪视频", t), p.Inst.onRecordCall && p.Inst.onRecordCall()
  988. }
  989. }) : p.Inst.onRecordCall && p.Inst.onRecordCall())
  990. })
  991. },
  992. fail(t) {
  993. p.Inst.platLog("record fail", t)
  994. }
  995. })
  996. }
  997. getVideoList(t, e, s) {
  998. if (!this.sdk) return;
  999. let i = () => {
  1000. this.sdk.request({
  1001. url: this.url2 + "tps:/" + this.url1 + "om/developer/api/get_top_video_ids_by_like",
  1002. method: "POST",
  1003. data: {
  1004. app_id: t,
  1005. number_of_top: 100,
  1006. tag: "",
  1007. access_token: p.Inst.token,
  1008. rank_type: "month"
  1009. },
  1010. success: t => {
  1011. p.Inst.platLog("视频获取成功"), s && s(t)
  1012. },
  1013. fail: t => {
  1014. p.Inst.platLog("视频获取失败", t)
  1015. }
  1016. })
  1017. };
  1018. p.Inst.token.length < 1 ? this.getToken(t, e, () => {
  1019. i()
  1020. }) : i()
  1021. }
  1022. getToken(t, e, s) { }
  1023. toVideoView(t) {
  1024. t.length < 2 || this.sdk.navigateToVideoView({
  1025. videoId: t,
  1026. success: t => { },
  1027. fail: t => {
  1028. p.Inst.platLog("toVideoView fail:", t), 1006 === t.errCode && this.sdk.showToast({
  1029. title: "something wrong with your network"
  1030. })
  1031. }
  1032. })
  1033. }
  1034. }
  1035. class m extends c {
  1036. init() {
  1037. if (this.sdk || (this.sdk = window.qg), !this.sdk) return void p.Inst.platError(10001);
  1038. this.subLoader = this.sdk.loadSubpackage, this.sdk.getLaunchOptionsSync().referrerInfo, this.sdk.hasShortcutInstalled({
  1039. success: function (t) {
  1040. 0 == t && (p.Inst.hasShortCut = !1)
  1041. },
  1042. fail: function (t) {
  1043. p.Inst.hasShortCut = !1, p.Inst.platLog("ShortCut出错", t)
  1044. }
  1045. }), super.init()
  1046. }
  1047. initAds() {
  1048. this.videoType = 1, this.insertType = 1, t.bannerW = 900, t.bannerH = 300, this.initVideoAd(t.opVideoId), this.initBannerAd(t.opBannerId), this.nativeId = t.opNativeId
  1049. }
  1050. initBannerAd(e, s = 30) {
  1051. super.initBannerAd(e, s), p.Inst.bannerAd && p.Inst.bannerAd.bannerAd.onResize(e => {
  1052. t.bannerH = e.height, t.bannerW = e.width, this.setBannerPos()
  1053. })
  1054. }
  1055. addLnk(t) {
  1056. this.sdk && this.sdk.installShortcut({
  1057. success: function () {
  1058. p.Inst.platLog("ShortCut成功"), p.Inst.hasShortCut = !0, t && t()
  1059. },
  1060. fail: function (t) {
  1061. p.Inst.platError(10301, t)
  1062. }
  1063. })
  1064. }
  1065. initUser(t) {
  1066. this.sdk.login({
  1067. success: function (e) {
  1068. p.Inst.platCode = e.data.token, p.Inst.appSecret.length > 1 ? p.Inst.getUserInfo(t) : (p.Inst.initUser(e.data), t && t(!0))
  1069. },
  1070. fail: function (t) {
  1071. p.Inst.platError(10011, t)
  1072. }
  1073. })
  1074. }
  1075. }
  1076. let I = p.Inst;
  1077. class f extends c {
  1078. init() {
  1079. this.sdk || (this.sdk = window.qg), this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.sdk.hasShortcutInstalled({
  1080. success: function (t) {
  1081. I.hasShortCut = !!t
  1082. }
  1083. }), super.init()) : I.platError(10001)
  1084. }
  1085. initAds() {
  1086. super.initAds(), this.insertId = t.vvInsertId, this.initVideoAd(t.vvVideoId), this.initBannerAd(t.vvBannerId), this.nativeId = t.vvNativeId
  1087. }
  1088. initUser(t) {
  1089. this.sdk && this.sdk.getSystemInfoSync().platformVersionCode >= 1063 && this.sdk.getUserInfo().then(e => {
  1090. e.data && (I.initUser(e.data), t(!0))
  1091. }, e => {
  1092. I.platLog("userinfo失败", e), t(!1)
  1093. })
  1094. }
  1095. addLnk(t) {
  1096. this.sdk && this.sdk.installShortcut({
  1097. success: function () {
  1098. I.platLog("ShortCut成功"), I.hasShortCut = !0, t && t()
  1099. },
  1100. fail: function (t) {
  1101. I.platError(10301, t), I.hasShortCut = !1
  1102. }
  1103. })
  1104. }
  1105. initBannerAd(t, e = 30) {
  1106. this.bannerId = t, this.bannerId.length < 2 || (I.bannerAd = this.sdk.createBannerAd({
  1107. posId: this.bannerId,
  1108. adIntervals: e,
  1109. style: {}
  1110. }), I.bannerAd.onError(t => {
  1111. I.platError(10211, t)
  1112. }), I.bannerAd.onLoad(() => {
  1113. I.bannerShow ? I.bannerAd.show() : I.bannerAd.hide()
  1114. }), I.bannerAd.onClose(function () {
  1115. I.onBannerHide()
  1116. }))
  1117. }
  1118. initInsertAd() {
  1119. this.insertId.length < 1 || (I.insertAd = this.sdk.createInterstitialAd({
  1120. posId: this.insertId
  1121. }), I.insertAd && (I.insertAd.onError(t => {
  1122. I.platError(10221, t)
  1123. }), I.insertAd.onLoad(() => {
  1124. I.insertAd.show()
  1125. }), I.insertAd.onClose(() => {
  1126. I.insertAd = null
  1127. }), I.insertAd.load()))
  1128. }
  1129. showInsertAd() {
  1130. I.insertAd ? I.insertAd.load() : this.initInsertAd()
  1131. }
  1132. }
  1133. class y {
  1134. static get Inst() {
  1135. return null == y._instance && (y._instance = new y), y._instance
  1136. }
  1137. init(s, i) {
  1138. let a = p.Inst.platVersion % 2,
  1139. n = {
  1140. appKey: p.Inst.myId,
  1141. platform: s,
  1142. settingIndex: a
  1143. },
  1144. r = e.Inst.codeMsg(p.Inst.myKey, n),
  1145. o = t.getUrl("app/setting-get-new?", r);
  1146. e.Inst.sendGet(o, e => {
  1147. console.log('zh:moyu.js init=' + 0);
  1148. let s = p.Inst;
  1149. if (e && 0 == e.code && e.data) {
  1150. let i = JSON.parse(e.data.settingData),
  1151. a = JSON.parse(e.data.testData),
  1152. n = JSON.parse(e.data.onlineData),
  1153. r = null == i.status ? e.data.status : i.status;
  1154. if (s.realName = null == i.realname ? 0 : i.realname, s.isLegal = r < 2, s.isMasked = !(r > 2) && !e.data.security.status, s.gameBit = i.gameBit, s.markBit = i.markBit, s.gameData = i.data, s.autoAd = null == i.autoAd ? 0 : i.autoAd, s.gameConfig = s.isLegal || s.isMasked ? a : n, i.config)
  1155. for (let t in i.config) s.gameConfig[t] = i.config[t];
  1156. (!s.gameConfig || s.gameConfig.length < 1) && (s.gameConfig = null), s.setCity(e.data.cityName), t.init(i.ads)
  1157. } else e && s.platError(10010, e);
  1158. i && i()
  1159. })
  1160. }
  1161. }
  1162. y._instance = null;
  1163. class k extends c {
  1164. constructor() {
  1165. super(...arguments), this.shared = !1, this.shareTime = 0
  1166. }
  1167. init() {
  1168. if (this.sdk = window.wx, !this.sdk) return void p.Inst.platError(10001);
  1169. this.insertType = 2, this.subLoader = this.sdk.loadSubpackage, this.sdk.showShareMenu({
  1170. withShareTicket: !0,
  1171. menus: ["shareAppMessage", "shareTimeline"]
  1172. }), this.sdk.onShow(t => {
  1173. p.Inst.onShow(!0), this.onShare()
  1174. }), this.sdk.onHide(t => {
  1175. p.Inst.onShow(!1)
  1176. });
  1177. let t = null;
  1178. this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (p.Inst.platOptions = t)
  1179. }
  1180. initAds() {
  1181. this.initVideoAd(t.wxVideoId), this.initBannerAd(t.wxBannerId), this.initInsertAd(t.wxInsertId)
  1182. }
  1183. initUser(t, e) {
  1184. this.sdk ? (this.sdk.login({
  1185. success(t) {
  1186. p.Inst.platCode = t.code
  1187. },
  1188. fail(t) {
  1189. p.Inst.platError(10011, t)
  1190. }
  1191. }), this.sdk.getSetting({
  1192. success: s => {
  1193. let i = s.authSetting["scope.userInfo"];
  1194. void 0 === i ? (p.Inst.platLog("微信授权请使用createWXUserBtn"), t()) : i ? this.getUserInfo(t) : e ? (p.Inst.platLog("授权设置请求"), this.sdk.openSetting({
  1195. success: e => {
  1196. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  1197. },
  1198. fail: e => {
  1199. p.Inst.platLog("openSetting 失败", e), t()
  1200. }
  1201. })) : t()
  1202. },
  1203. fail: e => {
  1204. p.Inst.platLog("getSetting 失败", e), t()
  1205. }
  1206. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t()
  1207. }
  1208. getUserInfo(t) {
  1209. this.sdk.getUserInfo({
  1210. success: e => {
  1211. p.Inst.initUser(e), t(!0)
  1212. },
  1213. fail: e => {
  1214. p.Inst.platLog("getUserInfo 失败", e), t()
  1215. }
  1216. })
  1217. }
  1218. getOpenId() { }
  1219. onShare() {
  1220. this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0)))
  1221. }
  1222. shareGame(e, s, i) {
  1223. this.sdk ? (this.shareCall = e, null == s && (s = t.shareImg), null == i && (i = t.shareQuery), this.shared = !1, this.shareTime = p.Inst.getTime(), this.sdk.shareAppMessage({
  1224. title: t.shareTitle,
  1225. imageUrl: s,
  1226. query: i,
  1227. imageUrlId: t.shareId
  1228. })) : e && e()
  1229. }
  1230. }
  1231. class v {
  1232. constructor() {
  1233. this.appid = 100, this.isMask = !1, this.isLegal = !0, this.imgId = "", this.waitTime = 60
  1234. }
  1235. static get Inst() {
  1236. return this.instance || (this.instance = new v), this.instance
  1237. }
  1238. init(t) {
  1239. this.appid = t;
  1240. let e = location.href.lastIndexOf("=");
  1241. e < 0 || (this.imgId = location.href.substring(e + 1, location.href.length), !this.imgId || this.imgId.length < 1 || this.getData(() => {
  1242. this.isLegal || this.isMask || this.imgId.length < 1 || this.waitTime < 1 || setTimeout(() => {
  1243. this.waitTime > 0 && this.createInfo()
  1244. }, 1e3 * this.waitTime)
  1245. }))
  1246. }
  1247. createInfo() {
  1248. let e = new Image;
  1249. e.src = t.getTagro("issuer/" + this.imgId + ".jpg"), e.style.position = "absolute", e.style.zIndex = "999";
  1250. let s = document.body.clientWidth,
  1251. i = document.body.clientHeight,
  1252. a = i > 500 ? 500 : i,
  1253. n = .6 * a;
  1254. e.width = n, e.height = a, document.body.appendChild(e), e.style.top = (.5 * i - a / 2).toString(), e.style.left = (s / 2 - n / 2).toString(), e.onload = (() => {
  1255. var r = new Image;
  1256. r.src = t.getTagro("issuer/close.png"), r.style.position = "absolute", r.style.zIndex = "1000", r.width = 36, r.height = 36, r.style.top = (.5 * i - a / 2).toString(), r.style.left = (s / 2 + n / 2 - 36).toString(), document.body.appendChild(r), r.onclick = (t => {
  1257. e.hidden = !0, r.hidden = !0
  1258. })
  1259. })
  1260. }
  1261. getData(s) {
  1262. console.log('zh:moyu.js getData=' + s);
  1263. let i = e.Inst.codeMsg("bc48cbce46946057", {
  1264. appKey: 100,
  1265. platform: "web",
  1266. settingIndex: 0
  1267. }),
  1268. a = t.getUrl("app/setting-get-new?", i);
  1269. e.Inst.sendGet(a, t => {
  1270. if (t && 0 == t.code && t.data) {
  1271. let e = JSON.parse(t.data.settingData),
  1272. s = !t.data.security.status;
  1273. if (this.isLegal = e.legals.indexOf(this.appid) >= 0, this.isMask = s && e.masks.indexOf(this.appid) >= 0, this.waitTime = e.time, e.apps) {
  1274. let t = "app" + this.appid,
  1275. s = e.apps[t];
  1276. if (s && s.length > 1) {
  1277. this.waitTime = s[0];
  1278. let t = e[s[1]];
  1279. t && t.indexOf(this.imgId) < 0 && (this.imgId = "")
  1280. } else e.imgs ? e.imgs.indexOf(this.imgId) < 0 && (this.imgId = "") : this.imgId = ""
  1281. }
  1282. }
  1283. s && s()
  1284. })
  1285. }
  1286. destroy() {
  1287. this.waitTime = 0
  1288. }
  1289. }
  1290. class A extends c {
  1291. constructor() {
  1292. super(...arguments), this.shared = !1, this.shareTime = 0
  1293. }
  1294. init() {
  1295. if (this.sdk = window.qq, this.sdk) {
  1296. if (this.subLoader = this.sdk.loadSubpackage, this.sdk.onShow(t => {
  1297. p.Inst.onShow(!0), this.onShare()
  1298. }), this.sdk.onHide(t => {
  1299. p.Inst.onShow(!1)
  1300. }), this.sdk.getLaunchOptionsSync) {
  1301. let t = this.sdk.getLaunchOptionsSync();
  1302. p.Inst.platOptions = t
  1303. }
  1304. this.sdk.showShareMenu({
  1305. withShareTicket: !0,
  1306. menus: ["shareAppMessage", "shareTimeline"]
  1307. }), this.sdk.onShareAppMessage(() => ({
  1308. title: t.shareTitle,
  1309. imageUrl: t.shareImg
  1310. }))
  1311. } else p.Inst.platError(10001)
  1312. }
  1313. initAds() {
  1314. this.videoId = t.qqVideoId, this.bannerId = t.qqBannerId, this.insertId = t.qqInsertId, this.boxId = t.qqBoxId, this.blockId = t.qqBlockId, this.initVideoAd(t.qqVideoId), this.initBannerAd(t.qqBannerId), this.initInsertAd(t.qqInsertId)
  1315. }
  1316. initUser(t, e) {
  1317. this.sdk.login({
  1318. success(t) {
  1319. p.Inst.platCode = t.code
  1320. },
  1321. fail(t) {
  1322. p.Inst.platError(10011, t)
  1323. }
  1324. }), this.sdk.getSetting({
  1325. success: s => {
  1326. let i = s.authSetting["scope.userInfo"];
  1327. void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({
  1328. success: e => {
  1329. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  1330. },
  1331. fail: e => {
  1332. p.Inst.platLog("openSetting 失败", e), t()
  1333. }
  1334. }) : t()
  1335. },
  1336. fail: e => {
  1337. p.Inst.platLog("getSetting 失败", e), t()
  1338. }
  1339. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()
  1340. }
  1341. getUserInfo(t) {
  1342. this.sdk.getUserInfo({
  1343. success: e => {
  1344. p.Inst.initUser(e), t(!0)
  1345. },
  1346. fail: e => {
  1347. p.Inst.platLog("getUserInfo 失败", e), t()
  1348. }
  1349. })
  1350. }
  1351. getOpenId() { }
  1352. onShare() {
  1353. this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0)))
  1354. }
  1355. shareGame(e, s, i) {
  1356. this.sdk ? (this.shareCall = e, null == s && (s = t.shareImg), null == i && (i = t.shareQuery), this.shared = !1, this.shareTime = p.Inst.getTime(), this.sdk.shareAppMessage({
  1357. title: t.shareTitle,
  1358. imageUrl: s,
  1359. query: i
  1360. })) : e && e()
  1361. }
  1362. initBox() {
  1363. this.boxId.length < 1 || (p.Inst.boxAd = this.sdk.createAppBox({
  1364. adUnitId: this.boxId
  1365. }), p.Inst.boxAd && p.Inst.boxAd.load())
  1366. }
  1367. initBlock() {
  1368. if (this.blockId.length < 1) return;
  1369. let t = this.sdk.getSystemInfoSync(),
  1370. e = (t.windowWidth, t.windowHeight);
  1371. if (this.sdk.createBlockAd) {
  1372. if (p.Inst.blockAd = this.sdk.createBlockAd({
  1373. size: 5,
  1374. adUnitId: this.blockId,
  1375. orientation: "landscape",
  1376. style: {
  1377. left: 12,
  1378. top: e - 100
  1379. }
  1380. }), !p.Inst.blockAd || !p.Inst.blockAd.onError) return p.Inst.platLog("blockAd is null"), void (p.Inst.blockAd = null);
  1381. p.Inst.blockAd.onError(t => {
  1382. p.Inst.platError(10241, t)
  1383. }), p.Inst.blockAd.onLoad(() => {
  1384. p.Inst.platLog("blockAd onLoad show"), p.Inst.blockAd.show()
  1385. })
  1386. }
  1387. }
  1388. showBox() {
  1389. p.Inst.boxAd && p.Inst.boxAd.show()
  1390. }
  1391. showBlock(t) {
  1392. p.Inst.blockAd && (p.Inst.blockAd.hide(), p.Inst.blockAd.destroy(), p.Inst.blockAd = null), t && this.initBlock()
  1393. }
  1394. createCash(t, e) { }
  1395. }
  1396. class w extends c {
  1397. constructor() {
  1398. super(...arguments), this.recordDelta = 0, this.recordloop = !1
  1399. }
  1400. init() {
  1401. this.sdk = window.ks, this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.initRecoder(), this.sdk.login({
  1402. success(t) { },
  1403. fail(t) {
  1404. p.Inst.platLog("ks login fail", t)
  1405. }
  1406. }), this.sdk.getAPKShortcutInstallStatus(t => {
  1407. -10005 === t.code ? p.Inst.platLog("当前环境不支持") : 1 === t.code && (t.installed || (p.Inst.hasShortCut = !1))
  1408. }), super.init()) : p.Inst.platError(10001)
  1409. }
  1410. addLnk(t) {
  1411. this.sdk.saveAPKShortcut(e => {
  1412. -10005 === e.code ? p.Inst.hasShortCut = !0 : 1 === e.code ? (p.Inst.hasShortCut = !0, p.Inst.platLog("Shortcut成功"), t && t()) : (p.Inst.hasShortCut = !1, p.Inst.platError(10301, e))
  1413. })
  1414. }
  1415. focus(t) {
  1416. this.sdk.openUserProfile({
  1417. accountType: "MiniGameOfficialAccount",
  1418. callback: e => {
  1419. 1 == e.errorCode ? p.Inst.canFocus = !1 : p.Inst.platLog("关注失败", e), t && t(1 == e.errorCode)
  1420. }
  1421. })
  1422. }
  1423. initUser(t) {
  1424. this.sdk.getSetting({
  1425. success: e => {
  1426. let s = e["scope.userInfo"];
  1427. void 0 === s ? this.sdk.authorize({
  1428. scope: "scope.userInfo",
  1429. success: e => {
  1430. this.getUserInfo(t)
  1431. },
  1432. fail: e => {
  1433. p.Inst.platLog("userinfo失败: ", e), t && t()
  1434. }
  1435. }) : s && this.getUserInfo(t)
  1436. },
  1437. fail: e => {
  1438. p.Inst.platLog("getSetting 失败", e), t && t()
  1439. }
  1440. })
  1441. }
  1442. getUserInfo(t) {
  1443. this.sdk.getUserInfo({
  1444. success: e => {
  1445. p.Inst.initUser(e), t(!0)
  1446. },
  1447. fail: e => {
  1448. p.Inst.platLog("getUserInfo 失败", e), t()
  1449. }
  1450. })
  1451. }
  1452. initAds() {
  1453. this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ksVideoId), this.initInsertAd(t.ksInsertId)
  1454. }
  1455. recordeGame(t, e) {
  1456. "devtools" != p.Inst.platName && (p.Inst.shareMp4 = "", this.recordloop = !1, this.recorder && this.recorder.abort(), this.doRecord())
  1457. }
  1458. recordPause(t) {
  1459. "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume())
  1460. }
  1461. doRecord() {
  1462. this.recorder ? (this.recordDelta = p.Inst.getTime(), p.Inst.platLog("recordeGame", this.recordDelta), this.recorder.start()) : p.Inst.platError(10401, "recorder is null")
  1463. }
  1464. recordeEnd(t) {
  1465. if (this.recordCall = t, this.recordloop && p.Inst.shareMp4.length > 0 && p.Inst.getTime() - this.recordDelta < 5e3) return this.recordDelta = 0, this.recordloop = !1, this.recordCall && this.recordCall(), void (this.recorder && this.recorder.pause());
  1466. this.recordloop = !1, this.recordDelta = 0, this.recorder && this.recorder.stop()
  1467. }
  1468. shareGame(e, s) {
  1469. null == s && (s = t.shareQuery), p.Inst.shareMp4 && this.recorder ? (p.Inst.platLog("视频分享"), this.recorder.publishVideo({
  1470. video: p.Inst.shareMp4,
  1471. mouldId: t.shareId,
  1472. query: s,
  1473. callback: t => {
  1474. if (null != t && null != t) return p.Inst.platLog("分享失败: ", JSON.stringify(t)), void e();
  1475. p.Inst.platLog("分享成功"), e && e(!0)
  1476. }
  1477. })) : p.Inst.platLog("无法分享:", p.Inst.shareMp4)
  1478. }
  1479. initRecoder() {
  1480. this.recorder = this.sdk.getGameRecorder(), this.recorder.on("start", () => { }), this.recorder.on("error", t => {
  1481. p.Inst.platLog("recorder error", t)
  1482. }), this.recorder.on("stop", t => {
  1483. t && t.videoID ? (p.Inst.platLog("record stop", t.videoID), p.Inst.shareMp4 = t.videoID, this.recordCall && this.recordCall(), this.recordloop && setTimeout(() => {
  1484. this.doRecord()
  1485. }, 1e3)) : p.Inst.platLog("录制失败")
  1486. })
  1487. }
  1488. }
  1489. class T extends c {
  1490. init() {
  1491. this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001)
  1492. }
  1493. initAds() {
  1494. this.sdk && (super.initAds(), this.videoType = 2, this.insertType = 1, this.bannerType = 1, this.initVideoAd(t.mzVideoId), this.initBannerAd(t.mzBannerId), this.initInsertAd(t.mzInsertId))
  1495. }
  1496. initUser(t) {
  1497. this.sdk.login({
  1498. success: e => {
  1499. p.Inst.initUser(e), t(!0)
  1500. },
  1501. fail: e => {
  1502. p.Inst.platLog("mz授权失败", e), t()
  1503. }
  1504. })
  1505. }
  1506. }
  1507. class b extends c {
  1508. init() {
  1509. this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001)
  1510. }
  1511. initAds() {
  1512. this.videoType = 1, this.insertType = 1, this.initVideoAd(t.hwVideoId), this.initBannerAd(t.hwBannerId), this.initInsertAd(t.hwInsertId)
  1513. }
  1514. }
  1515. class S extends c {
  1516. constructor() {
  1517. super(...arguments), this.adNum = 1, this.canAd = !0
  1518. }
  1519. init() {
  1520. this.sdk = window.h5api, this.sdk || p.Inst.platError(10001)
  1521. }
  1522. shareGame(t) {
  1523. this.sdk.share(), t && t()
  1524. }
  1525. showMoreGame() {
  1526. this.sdk.showRecommend()
  1527. }
  1528. showVideoAd(t) {
  1529. this.adCall = t, this.sdk.canPlayAd(t => {
  1530. this.canAd = t.canPlayAd, this.adNum = t.remain, p.Inst.showTip(20200 + this.adNum), this.adNum > 0 || this.canAd ? this.sdk.playAd(t => {
  1531. p.Inst.platLog("4399H5ad:" + t.code + " " + t.message), 1e4 === t.code || (10001 === t.code ? (this.adCall && this.adCall(!0), this.adCall = null) : p.Inst.showTip(20110))
  1532. }) : this.adNum < 1 && (this.adCall && this.adCall(!0), this.adCall = null)
  1533. })
  1534. }
  1535. }
  1536. class L extends c {
  1537. init() {
  1538. let t = window.conchConfig;
  1539. if (null == t) return void this.error(10001);
  1540. var e = t.getOS();
  1541. let s = window.PlatformClass;
  1542. s ? ("Conch-ios" == e ? this.sdk = s.createClass("ViewController") : "Conch-android" == e && (this.sdk = s.createClass("demo.MainActivity")), this.sdk || this.error(10002)) : this.error(10001)
  1543. }
  1544. initApp(t) {
  1545. this.sdk.call("initApp", t)
  1546. }
  1547. initUser(t) {
  1548. this.userCall = t, this.sdk.call("initUser")
  1549. }
  1550. showMoreGame() {
  1551. this.sdk.call("showMoreGame")
  1552. }
  1553. showVideoAd(t) {
  1554. this.adCall = t, this.sdk.call("showVideoAd")
  1555. }
  1556. showInsertAd(t) {
  1557. this.sdk.call("showInsertAd", t)
  1558. }
  1559. showBannerAd(t) {
  1560. this.sdk.call("showBannerAd", t)
  1561. }
  1562. vibrate(t = !0) {
  1563. this.sdk.call("vibrate", t)
  1564. }
  1565. userAgree(t) {
  1566. this.sdk.call("userAgree", t)
  1567. }
  1568. exit() {
  1569. this.sdk.call("exit")
  1570. }
  1571. onAdMsg(t) {
  1572. p.Inst.platLog("onAdMsg", t), "0" == t ? this.adCall && this.adCall(!0) : "1" == t ? p.Inst.showTip(20101) : "2" == t ? p.Inst.showTip(20102) : p.Inst.showTip(20103)
  1573. }
  1574. onUserInfo(t) {
  1575. p.Inst.platLog("onUserInfo"), p.Inst.initUser(t), this.userCall && this.userCall()
  1576. }
  1577. log(...t) {
  1578. p.Inst.platLog(t)
  1579. }
  1580. error(t) {
  1581. p.Inst.platError(t)
  1582. }
  1583. }
  1584. var U;
  1585. ! function (t) {
  1586. t.adDataId = "AdStatis", t.gameLogin = "GameLogin", t.gameStart = "GameStart", t.gameEnd = "GameEnd"
  1587. }(U || (U = {}));
  1588. let C = p.Inst,
  1589. M = i.Inst,
  1590. N = e.Inst;
  1591. class V {
  1592. constructor() {
  1593. this.isVibrat = !0, this.onVibrat = !1, this.vibratTime = 1e3, this.lastInsertTime = 0, this.recordTime = 0, this.recordMark = 0, this.recordIsPause = !1, this.lastVideoTime = 0, this.platMarks = ["web", "tt", "op", "vv", "mz", "wx", "qq", "f399", "ks", "hw", "xm", "csj", "mmy", "xmapk", "vvapk", "ios", "233", "hwkb", "opapk", "hhw", "f399apk", "ttapk", "a233"], this.authDone = !1, this.targoData = {}, this.gameList = [], this.rankList = [], window.onMoyuAdBack = this.onMoyuAdBack, window.onMoyuUserBack = this.onMoyuUserBack, window.onTargoBack = this.onTargoBack
  1594. }
  1595. static get Inst() {
  1596. return this.instance || (this.instance = new V), this.instance
  1597. }
  1598. init(e, i, a, n = !1) {
  1599. if (C.platType = 0, C.myId = 0, C.myKey = "", e) {
  1600. C.myId = e.myId ? e.myId : 0, C.myKey = e.myKey ? e.myKey : "", C.platType = e.plat ? e.plat : 0, C.platVersion = e.version ? Math.ceil(e.version) : 0;
  1601. let s = e.ads ? e.ads : null;
  1602. t.init(s)
  1603. } else console.log("本地测试:" + this.platMarks[0]);
  1604. if (C.platType > this.platMarks.length || C.platType < 0) return void console.error("参数不合法:" + C.platType);
  1605. switch (C.init(n), C.platType) {
  1606. case h.tt:
  1607. this.platform = new g;
  1608. break;
  1609. case h.op:
  1610. this.platform = new m;
  1611. break;
  1612. case h.vv:
  1613. this.platform = new f;
  1614. break;
  1615. case h.mz:
  1616. this.platform = new T;
  1617. break;
  1618. case h.wx:
  1619. this.platform = new k;
  1620. break;
  1621. case h.qq:
  1622. this.platform = new A;
  1623. break;
  1624. case h.hw:
  1625. this.platform = new b;
  1626. break;
  1627. case h.f399:
  1628. this.platform = new S;
  1629. break;
  1630. case h.ks:
  1631. this.platform = new w;
  1632. break;
  1633. case h.csj:
  1634. case h.hwkb:
  1635. case h.t33:
  1636. case h.mmy:
  1637. case h.xmApk:
  1638. case h.vvApk:
  1639. case h.opApk:
  1640. case h.ios:
  1641. case h.hhw:
  1642. case h.f399Apk:
  1643. case h.ttApk:
  1644. case h.a233:
  1645. this.platform = new L
  1646. }
  1647. let r = this.platMarks[C.platType];
  1648. this.platform ? (C.platLog("平台初始化:" + r), this.platform.init()) : C.onShow(), C.myId > 0 && C.myKey.length > 1 ? y.Inst.init(r, () => {
  1649. this.platform && this.platform.initAds(), 1 == (1 & C.markBit) && this.sendEvent(U.gameLogin), a && a.apply(i)
  1650. }) : this.isVoidPlat || this.platform.initAds(), v.Inst.init(C.myId), s.Inst.setPlat(this.platform), C.data.authUser && this.platform && setTimeout(() => {
  1651. this.lastInsertTime = C.getTime() + 1e4, this.platform && this.platform.initUser(t => {
  1652. t ? (this.authDone = !0, C.platLog("获取到已授权用户")) : (this.authDone = !1, C.platLog("用户可能已设置拒绝"), C.data.authUser = !1, C.saveData())
  1653. })
  1654. }, 2e3)
  1655. }
  1656. initApp(t) {
  1657. this.isVoidPlat || this.platform.initApp(t)
  1658. }
  1659. initTargoApp(t, e) {
  1660. this.targoData.appid = t, this.targoData.key = e
  1661. }
  1662. exit() {
  1663. this.isVoidPlat || (C.platType > 10 ? this.platform.exit() : this.platform.sdk.exitApplication && this.platform.sdk.exitApplication({}))
  1664. }
  1665. initFCM(t) {
  1666. C.initFCM(t)
  1667. }
  1668. get gameTime() {
  1669. if (C.fcmActive) {
  1670. let t = new Date;
  1671. return 20 != t.getHours() ? 0 : (t = null, C.data.gameTime)
  1672. }
  1673. return 9999
  1674. }
  1675. get isRealName() {
  1676. return this.getUserInfo().realCode.length > 1
  1677. }
  1678. get needRealName() {
  1679. return !!this.isPlat(h.ttApk) && !this.isRealName
  1680. }
  1681. authenticate(e, s, i) {
  1682. if (!this.isName(e) || !this.isID(s)) return void (i && i(!1));
  1683. if (!(C.realName ? C.getRandom(0, 100) < C.realName : this.isLegal) || this.isVoidPlat) return C.onRealName(e, s), void (i && i(!0));
  1684. let a = t.getUrl("real-info/enter"),
  1685. n = this.getUserInfo(),
  1686. r = {
  1687. appKey: C.myId,
  1688. userId: n.userId,
  1689. numberId: s,
  1690. realName: e
  1691. },
  1692. o = N.codeMsg(C.myKey, r, !0);
  1693. N.sendPost(a, o, t => {
  1694. let a = !1;
  1695. t && 0 == t.code && "ok" == t.data && (C.onRealName(e, s), a = !0), i && i(a)
  1696. })
  1697. }
  1698. isName(t) {
  1699. if (t.length < 2 || t.length > 4) return !1;
  1700. let e = new RegExp("^[一-鿿]+$"),
  1701. s = !0;
  1702. return e.test(t) || (s = !1), e = null, s
  1703. }
  1704. isID(t) {
  1705. if (18 != t.length) return !1;
  1706. let e = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2],
  1707. s = 0;
  1708. for (let i = 0; i < t.length - 1; i++) {
  1709. let a = t.substring(i, i + 1),
  1710. n = Number(a);
  1711. if (Number.isNaN(n)) return !1;
  1712. s += n * e[i]
  1713. }
  1714. return t.substring(t.length - 1, t.length).toUpperCase() == [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2][s % 11].toString()
  1715. }
  1716. onGameStart(t) {
  1717. 2 == (2 & C.markBit) && this.sendEvent(U.gameStart, {
  1718. id: t
  1719. })
  1720. }
  1721. onGameEnd(t, e = 0) {
  1722. 2 == (2 & C.markBit) && this.sendEvent(U.gameEnd, {
  1723. id: t,
  1724. res: e
  1725. }), C.getTime() - this.lastVideoTime > 3e4 && C.getRandom(0, 100) < C.autoAd && this.showVideoAd(() => { }, 0)
  1726. }
  1727. needRealTime(e = !0) {
  1728. t.realTime = e, M.getNetTime()
  1729. }
  1730. getTime(t = !1) {
  1731. return M.getTime(t)
  1732. }
  1733. isNewDay(t, e) {
  1734. if (0 == M.timeSpan) M.getNetTime(() => {
  1735. let s = C.isNewDay();
  1736. e && e.apply(t, [s])
  1737. });
  1738. else {
  1739. let s = C.isNewDay();
  1740. e && e.apply(t, [s])
  1741. }
  1742. }
  1743. isNewWeek(t, e) {
  1744. if (0 == M.timeSpan) M.getNetTime(() => {
  1745. let s = C.isNewWeek();
  1746. e.apply(t, [s])
  1747. });
  1748. else {
  1749. let s = C.isNewWeek();
  1750. e.apply(t, [s])
  1751. }
  1752. }
  1753. getDate(t = 0, e = !0) {
  1754. return M.getDate(t, e)
  1755. }
  1756. getWeek() {
  1757. return M.getWeek()
  1758. }
  1759. getWeekNum() {
  1760. return M.getWeekNum()
  1761. }
  1762. getPlatSize() {
  1763. return this.isVoidPlat ? (C.platWidth = 750, C.platHeight = 1334) : this.platform.setWH(), {
  1764. width: C.platWidth,
  1765. height: C.platHeight
  1766. }
  1767. }
  1768. userAgree(t) {
  1769. this.isVoidPlat || this.platform.userAgree(t)
  1770. }
  1771. onSetting(t, e) {
  1772. this.isVibrat = e, s.Inst.mute(!t)
  1773. }
  1774. showMoreGame() {
  1775. this.isVoidPlat || this.platform.showMoreGame()
  1776. }
  1777. onMoyuAdBack(t) {
  1778. C.platLog("onMoyuAdBack:", t);
  1779. let e = V.Inst.platform;
  1780. e && e.onAdMsg(t)
  1781. }
  1782. onMoyuUserBack(t) {
  1783. let e = V.Inst.platform;
  1784. e && e.onUserInfo(t)
  1785. }
  1786. onTargoBack(e) {
  1787. let s = V.Inst.targoData.appid;
  1788. if (!s || s.length < 2 || !e) return void console.error("targo appid is null");
  1789. let i = V.Inst.targoData.key,
  1790. a = JSON.parse(e);
  1791. a.appId = s, (!a.deviceId || a.deviceId < 5) && (a.deviceId = C.moyuUser.userId);
  1792. let n = N.codeMsg(i, a, !0),
  1793. r = t.getTagro("v3/app/launch").replace("mygame1", "click");
  1794. N.sendPost(r, n, t => {
  1795. t && 0 == t.code ? C.platLog("targoapp send done") : console.error("targoapp send erro", t)
  1796. })
  1797. }
  1798. showVideoAd(t, e = 0, s, i) {
  1799. let a = C.getTime();
  1800. if (a - this.lastVideoTime < 1e3) return C.platLog("video请求太频繁"), void C.showTip(20100);
  1801. if (this.lastVideoTime = a, this.isVoidPlat) C.platLog("本地广告测试,直接返回成功"), t && (s ? t.apply(s) : t());
  1802. else {
  1803. if (C.videoErro && this.isWx) return C.platLog("分享代替视频"), void this.shareGame(e => {
  1804. e ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i())
  1805. });
  1806. C.videoCount += 1, this.lastInsertTime = a, C.platLog("展示视频广告"), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, {
  1807. type: e,
  1808. result: 0
  1809. }), this.platform.showVideoAd(a => {
  1810. a ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i()), C.onVideoDone(a), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, {
  1811. type: e,
  1812. result: a ? 1 : 2
  1813. })
  1814. })
  1815. }
  1816. }
  1817. upRankData(e, s, i = !1, a = !1, n, r) {
  1818. if (!(a || this.hasUserInfo && C.moyuUser.isAuth)) return void C.platLog("未授权暂不上传");
  1819. if (Math.floor(e / 100) != C.myId) return void C.platError(11301, "rankid不合法");
  1820. if (C.data.minScore > s && !i) return;
  1821. let o = C.getRankUser(),
  1822. h = {
  1823. user: o,
  1824. data: n
  1825. },
  1826. d = r || o.userId,
  1827. l = t.getUrl("rank/push"),
  1828. p = {
  1829. rankId: e,
  1830. userId: d,
  1831. rankScore: s,
  1832. userData: JSON.stringify(h)
  1833. };
  1834. N.sendPost(l, p, t => {
  1835. t && 0 == t.code ? (C.platLog("rank上传成功"), C.data.minScore = s) : C.platLog("rank上传失败", t)
  1836. })
  1837. }
  1838. getRankList(e, s, i, a = !1) {
  1839. let n = e.rankId;
  1840. if (n && Math.floor(n / 100) == C.myId)
  1841. if (this.rankList.length < 1 || a) {
  1842. let a = t.getUrl("rank/list");
  1843. N.sendPost(a, e, t => {
  1844. t && 0 == t.code ? (t.data.lastScore > C.data.minScore && (C.data.minScore = t.data.lastScore), this.rankList = t.data.list) : C.platLog("rank获取失败", t), i && i.apply(s, [this.rankList])
  1845. })
  1846. } else i && i.apply(s, [this.rankList]);
  1847. else C.platError(11301, "rankid不合法")
  1848. }
  1849. getGameList(e, s) {
  1850. if (this.gameList.length < 1) {
  1851. let i = "";
  1852. if (this.isTT) i = t.getUrl("recommend/get");
  1853. else {
  1854. if (!this.isWx) return void C.platError(11201, "该平台没有推荐列表");
  1855. i = t.getUrl("recommend/wechat-get")
  1856. }
  1857. N.sendGet(i, t => {
  1858. if (t) {
  1859. let e = t.data.recommendList;
  1860. for (let t = 0; t < e.length; t++) {
  1861. let s = e[t];
  1862. if (C.gameBit < 1 || (C.gameBit & s.group) == s.group) {
  1863. let t = {
  1864. myId: s.appKey,
  1865. type: s.type,
  1866. name: s.name,
  1867. icon: s.icon,
  1868. banner: s.banner,
  1869. appId: s.wx_app_id ? s.wx_app_id : "",
  1870. videoId: s.videoid ? s.videoid : "",
  1871. launchNum: s.launch_num
  1872. };
  1873. this.gameList.push(t)
  1874. }
  1875. }
  1876. }
  1877. s && s.apply(e, [this.gameList])
  1878. })
  1879. } else s && s.apply(e, [this.gameList]);
  1880. C.platLog("获取推荐列表")
  1881. }
  1882. saveServerData(t, e) {
  1883. C.saveSeverData(t, e)
  1884. }
  1885. getServerData(t, e, s) {
  1886. C.getSeverData(s => {
  1887. t && (e ? t.apply(e, [s]) : t(s))
  1888. }, s)
  1889. }
  1890. reportNative(t = 2) {
  1891. this.isVoidPlat || (this.platform.reportNative(t), C.platLog("原生上报" + t))
  1892. }
  1893. getNativeAd(t, e) {
  1894. this.isVoidPlat ? e && e.apply(t, [C.nativeInfo]) : (this.platform.getNativeAd(() => {
  1895. e && e.apply(t, [C.nativeInfo])
  1896. }), C.platLog("获取原生ad"))
  1897. }
  1898. loadSubRes(t, e) {
  1899. let s = this.platform;
  1900. return new Promise(function (i) {
  1901. s && s.subLoader || (C.platLog("平台无分包"), i(!0));
  1902. var a = s.subLoader({
  1903. name: t,
  1904. success: function () {
  1905. C.platLog(t + "完成"), i(!0)
  1906. },
  1907. fail: function (t) {
  1908. C.platError(10121, t), i(!1)
  1909. }
  1910. });
  1911. e && a.onProgressUpdate(function (t) {
  1912. let s = t.progress > 1 ? .01 * t.progress : t.progress;
  1913. e(s)
  1914. })
  1915. })
  1916. }
  1917. setShareInfo(e, s, i, a, n) {
  1918. t.shareTitle = e, s && s.length > 0 && (t.shareTag = s), a && a.length > 1 && (t.shareImg = a), n && n.length > 1 && (t.shareQuery = n), i && i.length > 1 && (t.shareId = i)
  1919. }
  1920. addLnk(t, e) {
  1921. this.isVoidPlat || (this.platform && !C.hasShortCut ? this.platform.addLnk(() => {
  1922. t && (e ? t.apply(e) : t())
  1923. }) : t && (e ? t.apply(e) : t()))
  1924. }
  1925. get canFocus() {
  1926. return !this.isVoidPlat && (this.isDouyin ? C.canFocus = !C.data.focused : this.isKs && this.platform.sdk.checkFollowState({
  1927. accountType: "CPServiceAccount",
  1928. callback: t => {
  1929. -10005 === t.errorCode ? C.canFocus = !1 : C.canFocus = !t.hasFollow
  1930. }
  1931. }), C.canFocus)
  1932. }
  1933. focus(t, e) {
  1934. this.isVoidPlat || (this.canFocus ? (C.platLog("发起关注"), this.platform.focus(s => {
  1935. s && (C.data.focused = !0, C.saveData()), t && (e ? t.apply(e, [s]) : t(s))
  1936. })) : C.platLog("不能关注,通过canFocus()获取当前能否关注?"))
  1937. }
  1938. shareGame(e, s, i, a, n) {
  1939. this.isVoidPlat ? e && (s ? e.apply(s) : e()) : (C.platLog("分享调用"), (null == t.shareTitle || t.shareTitle.length < 1) && C.platError(10311, "分享标题为空,可能会拒审"), this.platform.shareGame(t => {
  1940. e && (s ? e.apply(s, [t]) : e(t)), t && (this.recordTime = 0)
  1941. }, a, n))
  1942. }
  1943. canShare() {
  1944. return this.isQq || this.isWx || this.isTT || this.isKs || this.isF399 ? this.isTT || this.isKs ? null == C.shareMp4 || C.shareMp4.length < 1 ? 2 : this.recordTime < 4e3 ? 3 : 101 : 1 : 0
  1945. }
  1946. set shareVideo(t) {
  1947. C.shareMp4 = t
  1948. }
  1949. get shareVideo() {
  1950. return C.shareMp4
  1951. }
  1952. recordGame(t, e = !1) {
  1953. this.isVoidPlat || (t > 300 ? t = 300 : t < 5 && (C.platLog("录屏时间太短"), t = 5), this.recordTime = 0, this.recordIsPause = !1, this.recordMark = this.getTime(), this.platform.recordeGame(t, e))
  1954. }
  1955. recordPause(t) {
  1956. if (this.isVoidPlat) return;
  1957. if (this.recordIsPause == t) return;
  1958. this.recordIsPause = t;
  1959. let e = this.getTime();
  1960. t && (this.recordTime += e - this.recordMark), this.recordMark = e, this.platform.recordPause(t)
  1961. }
  1962. recordEnd(t, e) {
  1963. if (this.isVoidPlat) return C.platLog("测试录屏完成"), void (e && e.apply(t));
  1964. let s = this.getTime();
  1965. this.recordTime += s - this.recordMark, this.platform.recordeEnd(() => {
  1966. e && e.apply(t, [C.shareMp4])
  1967. })
  1968. }
  1969. get isVoidPlat() {
  1970. return !this.platform || !this.platform.sdk
  1971. }
  1972. initUser(t, e, s = !1, i, a, n) {
  1973. C.pkgName = n || "", C.appId = i || "", C.appSecret = a || "", s = !C.isLegal && s, this.authDone || this.isVoidPlat || !this.hasUserInfo || C.moyuUser.isAuth && (!a || a.length < 5 || C.moyuUser.openId.length > 1) ? e && e.apply(t, [C.moyuUser]) : (this.platform.initUser(() => {
  1974. this.authDone = C.moyuUser.isAuth, e && e.apply(t, [C.moyuUser])
  1975. }, s), C.platLog("初始化个人信息"))
  1976. }
  1977. createWXUserBtn(t, e, s, i, a, n) {
  1978. if (this.isVoidPlat || this.authDone || !this.isWx) return null;
  1979. let r = this.platform.sdk.getSystemInfoSync(),
  1980. o = r.windowWidth * t - .5 * s,
  1981. h = r.windowHeight * e - .5 * i,
  1982. d = this.platform.sdk.createUserInfoButton({
  1983. type: "image",
  1984. image: a,
  1985. style: {
  1986. left: o,
  1987. top: h,
  1988. width: s,
  1989. height: i,
  1990. lineHeight: 40,
  1991. backgroundColor: "",
  1992. color: "",
  1993. textAlign: "center",
  1994. fontSize: 16,
  1995. borderRadius: 4
  1996. }
  1997. });
  1998. return d.onTap(t => {
  1999. "getUserInfo:ok" == t.errMsg ? (C.initUser(t), n && n()) : C.platLog("授权失败"), this.authDone = !0, d.destroy()
  2000. }), d
  2001. }
  2002. getSystemInfo() {
  2003. if (!this.isVoidPlat && this.platform.sdk.getSystemInfo) return this.platform.sdk.getSystemInfoSync()
  2004. }
  2005. createClubBtn(t, e) {
  2006. if (this.isVoidPlat) return null;
  2007. return this.platform.sdk.createGameClubButton({
  2008. type: "image",
  2009. image: e,
  2010. icon: "green",
  2011. style: t
  2012. })
  2013. }
  2014. getUserInfo() {
  2015. return C.moyuUser
  2016. }
  2017. /**
  2018. * zh
  2019. * @param {*} loginUserName
  2020. */
  2021. updateUserInfo(loginUserName) {
  2022. console.log('zh: aaaaaaaa 1111111');
  2023. console.log('zh:updateUserInfo' + loginUserName)
  2024. //C.moyuUser.nickName = loginUserName;
  2025. ////////this.moyuUser.nickName = this.data.nickName;
  2026. C.moyuUser.nickName = loginUserName;
  2027. //let user = Moyu.getUserInfo();
  2028. console.log('zh: aaaaaaaa 2222=' + C.moyuUser.nickName);
  2029. }
  2030. clearData() {
  2031. C.clearData()
  2032. }
  2033. sendDataEvent(t, e) {
  2034. 8 == (8 & C.markBit) ? this.sendEvent(t, e) : C.platError(11102, "自定义打点未激活")
  2035. }
  2036. sendEvent(e, s) {
  2037. if (C.myId < 1) return void C.platError(11102, "应用id错误");
  2038. if (this.isVoidPlat) return void C.platLog(11101, "测试环境,不打点");
  2039. if (s) {
  2040. let t = 0;
  2041. for (const e in s)
  2042. if (++t > 2) return void C.platError(11101, "打点数据格式错误")
  2043. } else s = {};
  2044. let i = t.getUrl("event/push"),
  2045. a = {
  2046. appKey: C.myId,
  2047. eventKey: e,
  2048. platformKey: this.platMarks[C.platType],
  2049. userId: C.moyuUser.userId,
  2050. eventParams: JSON.stringify(s)
  2051. };
  2052. N.codeMsg(C.myKey, a), N.sendPost(i, a, t => {
  2053. t && 0 == t.code ? C.platLog("打点成功:" + e) : C.platLog("打点失败", t)
  2054. })
  2055. }
  2056. getLocation(t, e) {
  2057. this.isVoidPlat || this.platform.getLocation(s => {
  2058. t && (e ? t.apply(e, s) : t(s))
  2059. })
  2060. }
  2061. playVideo(t) {
  2062. this.isVoidPlat || this.platform.toVideoView(t)
  2063. }
  2064. getRandom(t, e) {
  2065. return C.getRandom(t, e)
  2066. }
  2067. getRandString(t) {
  2068. return C.getRandStr(t)
  2069. }
  2070. setOnTipCall(t, e) {
  2071. C.onTipCall = (s => {
  2072. t && (e ? t.apply(e, [s]) : t(s))
  2073. })
  2074. }
  2075. playAudioWithEnd(t, e, i) {
  2076. this.isVoidPlat || s.Inst.playAudioWithEnd(i, () => {
  2077. e && e.apply(t)
  2078. })
  2079. }
  2080. playSound(t, e = !1) {
  2081. this.isVoidPlat || s.Inst.playSound(t, e)
  2082. }
  2083. stopSound(t) {
  2084. this.isVoidPlat || s.Inst.stopSound(t)
  2085. }
  2086. stopMusic() {
  2087. this.isVoidPlat || s.Inst.stopMusic()
  2088. }
  2089. pauseMusic(t) {
  2090. this.isVoidPlat || s.Inst.pauseMusic(t)
  2091. }
  2092. playMusic(t) {
  2093. this.isVoidPlat || s.Inst.playMusic(t)
  2094. }
  2095. mute(t) {
  2096. this.isVoidPlat || s.Inst.mute(t)
  2097. }
  2098. createAudio() {
  2099. return this.isVoidPlat ? null : this.platform.createAudio()
  2100. }
  2101. sendPost(t, e, s) {
  2102. N.sendPost(t, e, s)
  2103. }
  2104. sendGet(t, e) {
  2105. N.sendGet(t, e)
  2106. }
  2107. get platData() {
  2108. return C.gameData
  2109. }
  2110. get platConfig() {
  2111. return C.gameConfig
  2112. }
  2113. getLaunchOptions() {
  2114. return C.platOptions
  2115. }
  2116. get isLegal() {
  2117. return C.isLegal || C.isMasked
  2118. }
  2119. set isLegal(t) {
  2120. C.isLegal = t
  2121. }
  2122. get isMasked() {
  2123. return C.isMasked
  2124. }
  2125. get isDouyin() {
  2126. return C.isDouyin
  2127. }
  2128. get hasShortCut() {
  2129. return C.hasShortCut
  2130. }
  2131. get hasShadow() {
  2132. return this.isTT
  2133. }
  2134. get isNeedPlatAudio() {
  2135. return !1
  2136. }
  2137. get platType() {
  2138. return C.platType
  2139. }
  2140. isPlat(t) {
  2141. return t == C.platType
  2142. }
  2143. get isWx() {
  2144. return h.wx == C.platType
  2145. }
  2146. get isQq() {
  2147. return h.qq == C.platType
  2148. }
  2149. get isWeb() {
  2150. return h.web == C.platType
  2151. }
  2152. get isXMApk() {
  2153. return h.xmApk == C.platType
  2154. }
  2155. get isF399() {
  2156. return h.f399 == C.platType
  2157. }
  2158. get isVivo() {
  2159. return h.vv == C.platType
  2160. }
  2161. get isOppo() {
  2162. return h.op == C.platType
  2163. }
  2164. get isTT() {
  2165. return h.tt == C.platType
  2166. }
  2167. get isTTApk() {
  2168. return h.ttApk == C.platType
  2169. }
  2170. get isMZ() {
  2171. return h.mz == C.platType
  2172. }
  2173. get isT33() {
  2174. return h.t33 == C.platType
  2175. }
  2176. get isMmy() {
  2177. return h.mmy == C.platType
  2178. }
  2179. get isKs() {
  2180. return h.ks == C.platType
  2181. }
  2182. get isHw() {
  2183. return h.hw == C.platType
  2184. }
  2185. get isVVApk() {
  2186. return h.vvApk == C.platType
  2187. }
  2188. get isOPApk() {
  2189. return this.isPlat(h.opApk)
  2190. }
  2191. get isIos() {
  2192. return h.ios == C.platType
  2193. }
  2194. get hasUserInfo() {
  2195. return this.isTT || this.isWx || this.isQq || this.isVivo || this.isOppo || this.isKs || this.isMZ
  2196. }
  2197. get isNeedOgg() {
  2198. return C.platType > 10
  2199. }
  2200. get hasAgree() {
  2201. return !this.isIos && (this.isOppo || this.isVivo || C.platType > 10)
  2202. }
  2203. vibration(t = 100) {
  2204. if (this.isVibrat && !this.onVibrat)
  2205. if (this.onVibrat = !0, setTimeout(() => {
  2206. this.onVibrat = !1
  2207. }, this.vibratTime), this.isVoidPlat) {
  2208. if (!navigator || navigator.vibrate) return;
  2209. navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate, navigator.vibrate && navigator.vibrate(t)
  2210. } else this.platform.vibrate(t >= 400)
  2211. }
  2212. waitNext() {
  2213. return new Promise(function (t) {
  2214. requestAnimationFrame(() => {
  2215. t()
  2216. })
  2217. })
  2218. }
  2219. waitFrames(t) {
  2220. return new Promise(function (e) {
  2221. let s = t + 1,
  2222. i = !0;
  2223. setInterval(() => {
  2224. i && (i = !1, --s < 1 ? e() : requestAnimationFrame(() => {
  2225. i = !0
  2226. }))
  2227. }, 8)
  2228. })
  2229. }
  2230. waitSeconds(t) {
  2231. return new Promise(function (e) {
  2232. setTimeout(() => {
  2233. e()
  2234. }, 1e3 * t)
  2235. })
  2236. }
  2237. initVideoAd(t) {
  2238. this.isVoidPlat || this.platform.initVideoAd(t)
  2239. }
  2240. initBannerAd(e, s = 30, i = .5, a = 1) {
  2241. this.isVoidPlat || (t.bannerPx = i, t.bannerPy = a, this.platform.initBannerAd(e, s))
  2242. }
  2243. setBannerPos(e = .5, s = 1) {
  2244. this.isVoidPlat || (t.bannerPx = e, t.bannerPy = s, this.platform.setBannerPos(), C.platLog("banner调整"))
  2245. }
  2246. showBannerAd(t) {
  2247. this.isVoidPlat || C.bannerShow != t && (this.platform.showBannerAd(t), C.bannerShow = t, C.bannerClose = !t, C.platLog("banner:" + t))
  2248. }
  2249. showBlock(t) {
  2250. this.isVoidPlat || this.platform.showBlock(t)
  2251. }
  2252. showBox() {
  2253. this.isVoidPlat || this.platform.showBox()
  2254. }
  2255. initCustomAd(t, e, s, i = 30) {
  2256. this.isVoidPlat || this.platform.initCustomAd(t, e, s, i)
  2257. }
  2258. showCustomAd(t, e) {
  2259. this.isVoidPlat || this.platform.showCustomAd(t, e)
  2260. }
  2261. initInsertAd(t) {
  2262. this.isVoidPlat || this.platform.initInsertAd(t)
  2263. }
  2264. showInsertAd(t = 0, e = 0, s = "") {
  2265. if (this.isVoidPlat) return;
  2266. let i = C.getTime(),
  2267. a = i - this.lastInsertTime;
  2268. if (a < e) return C.platLog("插屏间隔太短:" + a), void C.showTip(20122);
  2269. (!s || s.length < 1) && (this.lastInsertTime = i), t > 100 ? setTimeout(() => {
  2270. this.platform.showInsertAd(s)
  2271. }, t) : this.platform.showInsertAd(s), C.platLog("插屏显示")
  2272. }
  2273. }
  2274. window.Moyu = V.Inst, window.MoyuPlat = h, window.MoyuUser = a, window.MoyuRankType = o, window.MoyuCfg = class {
  2275. constructor() {
  2276. this.myId = 0, this.myKey = "", this.plat = h.web, this.version = 0, this.ads = null, this.ads = new d
  2277. }
  2278. }, window.MoyuAds = d, window.MoyuNative = r
  2279. }();