mainSlice.js 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788
  1. import { initTrackAll, trackEvent, restoreQuickSaveEnv } from "../tracking/TrackAll";
  2. import { createSelector, createSlice } from "@reduxjs/toolkit";
  3. import { routes } from "@db/routes";
  4. import {
  5. ROUTE_PATH,
  6. ROUTE_TYPE_CUSTOM,
  7. ROUTE_TYPE_FULL,
  8. ROUTE_TYPE_IN,
  9. ROUTE_TYPE_OUTLINK,
  10. ROUTE_TYPE_POP,
  11. ROUTE_TYPE_POP_OR_FULL, SIDE_TYPE_NOMAL
  12. } from "@constants/routes";
  13. import { REQ_STATUS } from "@api/config";
  14. import {
  15. buildReqReducer,
  16. reqBindSMS,
  17. reqChangeEmail,
  18. reqChangeInfo,
  19. reqChangePass,
  20. reqChangePhone,
  21. reqCustomLeaveMsg,
  22. reqCustomService,
  23. reqFavoGet, reqForgetPass,
  24. reqGameCardInfo,
  25. reqGameInfo,
  26. reqGetRoutes,
  27. reqLogin,
  28. reqLogout,
  29. reqRegister,
  30. reqRegisterGold,
  31. reqSendCode,
  32. reqSMSLogin,
  33. reqUpdateFavoInfo,
  34. reqFreeWithdraw,
  35. reqFreeWithdrawMission,
  36. reqFreeWithdrawClaim,
  37. reqHolidaysGiftInfo,
  38. reqFreeBonusGiftInfo,
  39. reqHolidaysActInfo,
  40. reqGetPwaBonus,
  41. reqCheckinCheck,
  42. reqProtectCheck,
  43. reqEnterGameInterval,
  44. reqCountryCode,
  45. reqVerifyOldCode,
  46. reqChangeBindPhone,
  47. reqChangeLimitInfo,
  48. reqResetLoginState
  49. } from "@features/api";
  50. import { toast } from 'react-toastify';
  51. import { getFinger2DeviceId, getHttpMsg, getTimestampDays, localStorageGet, localStorageRemove, localStorageSet, parseNYTimeToTimestamp } from "@utils/helpers";
  52. import {
  53. LOCAL_ACTIVITY_C,
  54. LOCAL_BALANCE_POPUP_TS,
  55. LOCAL_CUSTOM_LOCK,
  56. LOCAL_DEFAULT_COUNTRY,
  57. LOCAL_GAME_URL,
  58. LOCAL_LAST_LOGIN_TYPE,
  59. LOCAL_REGISTER_DATE_TS,
  60. LOCAL_SIGN,
  61. LOCAL_VISTOR_ID,
  62. LOCAL_GOOGLE_REDIRECT_JUMPAPK,
  63. LOCAL_GOOGLE_REDIRECT_APK_ENV,
  64. LOCAL_RESET_LOGIN_STATES
  65. } from "@constants/localkey";
  66. import { APP_LOGIN_TYPE } from "@constants/app";
  67. import { v4 as uuidv4 } from 'uuid';
  68. import { VIPStatus } from "@constants/vip";
  69. import SsqHelp from "@utils/SsqHelp";
  70. const generateNavs = (routes) => {
  71. const navs = [];
  72. const allNavs = [];
  73. const allTopNavs = [];
  74. for (let i = 0; i < routes.length; i++) {
  75. let route = routes[i];
  76. if (!route.side) continue;
  77. allNavs.push(route);
  78. if (route.side === SIDE_TYPE_NOMAL) allTopNavs.push(route);
  79. let block = route.block != null ? route.block : 0;
  80. let temp = navs[block];
  81. if (temp == null) temp = [];
  82. temp.push(route);
  83. navs[block] = temp;
  84. }
  85. return { navs, allNavs, allTopNavs };
  86. };
  87. const generateRoutes = (routes, asyncRoutes = []) => {
  88. const allMap = {};
  89. const inRoutes = [];
  90. const popRoutes = [];
  91. //路由等级
  92. //ppath parent path
  93. const _generate = (list, plevel, ppath) => {
  94. Object.keys(list).forEach((key) => {
  95. let route = list[key];
  96. if (route) {
  97. if (allMap[route.path] == null) {
  98. //level
  99. route.plv = plevel;
  100. route.ppath = ppath;
  101. route.lv = plevel + key + "_";
  102. if (route.path === "#/pay") {
  103. route.component = "deposit";
  104. }
  105. if (route.path === "#/saque") {
  106. route.component = "withdraw";
  107. }
  108. allMap[route.path] = route;
  109. let type = route.type;
  110. if (type === ROUTE_TYPE_IN || type === ROUTE_TYPE_FULL) inRoutes.push(route);
  111. else if (type === ROUTE_TYPE_POP_OR_FULL) popRoutes.push(route);
  112. else if (type === ROUTE_TYPE_POP) popRoutes.push(route);
  113. else if (type === ROUTE_TYPE_CUSTOM) popRoutes.push(route);
  114. }
  115. let subs = route.subs;
  116. if (subs != null) _generate(subs, route.lv, route.path);
  117. }
  118. });
  119. };
  120. const allroutes = [...routes, ...asyncRoutes];
  121. _generate(allroutes, "", "");
  122. const gnavs = generateNavs(allroutes);
  123. return { allMap, inRoutes, popRoutes, blockNavs: gnavs.navs, allNavs: gnavs.allNavs, allTopNavs: gnavs.allTopNavs };
  124. };
  125. const parseThemeStypes = (data) => {
  126. if (data != null) {
  127. for (const key in data) {
  128. let item = data[key];
  129. if (item != null) {
  130. if (typeof item == "string") {
  131. if (item.indexOf(";") !== -1) {
  132. data[key] = item.split(";");
  133. }
  134. }
  135. }
  136. }
  137. }
  138. return data;
  139. };
  140. const parseStyles = (data) => {
  141. let styles = {};
  142. if (data != null) {
  143. for (let i = 0; i < data.length; i++) {
  144. let item = data[i];
  145. if (item) {
  146. let styleid = item.styleid;
  147. let style = item.style;
  148. let json = {};
  149. if (style != null && style !== "") {
  150. try {
  151. const parsed = typeof style === "string" ? JSON.parse(style) : style;
  152. if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
  153. json = parsed;
  154. json['dark'] = parseThemeStypes(json['dark']);
  155. json['light'] = parseThemeStypes(json['light']);
  156. }
  157. } catch (e) {
  158. // A malformed optional theme must not abort route initialization.
  159. }
  160. }
  161. styles[styleid] = { styleid, style: json };
  162. }
  163. }
  164. }
  165. return styles;
  166. };
  167. const parseBlocks = (data) => {
  168. let blocks = {};
  169. if (data != null) {
  170. for (let i = 0; i < data.length; i++) {
  171. let item = data[i];
  172. if (item) {
  173. blocks[item.block] = item;
  174. }
  175. }
  176. }
  177. return blocks;
  178. };
  179. const parseGoogleRedirectH5Conf = (conf) => {
  180. if (!conf) return null;
  181. let redirectConf = conf.googleRedirectH5 || conf.google_redirect_h5 || conf.redirectH5 || conf.redirect_h5 || null;
  182. if (typeof redirectConf === "string") {
  183. try {
  184. redirectConf = JSON.parse(redirectConf);
  185. } catch (e) {
  186. redirectConf = null;
  187. }
  188. }
  189. if (!redirectConf || typeof redirectConf !== "object") return null;
  190. if (redirectConf.enabled != null) redirectConf.enabled = Number(redirectConf.enabled) !== 0 && redirectConf.enabled !== false;
  191. if (redirectConf.source_channels == null && redirectConf.sourceChannels != null) {
  192. redirectConf.source_channels = redirectConf.sourceChannels;
  193. }
  194. if (typeof redirectConf.source_channels === "string") {
  195. redirectConf.source_channels = redirectConf.source_channels
  196. .split(",")
  197. .map((item) => Number(item.trim()))
  198. .filter((item) => !Number.isNaN(item));
  199. }
  200. return redirectConf;
  201. };
  202. const parseGoogleRedirectH5BonusConf = (conf) => {
  203. if (!conf) return null;
  204. let bonusConf = conf.googleRedirectH5Bonus || conf.google_redirect_h5_bonus || null;
  205. if (typeof bonusConf === "string") {
  206. try {
  207. bonusConf = JSON.parse(bonusConf);
  208. } catch (e) {
  209. bonusConf = null;
  210. }
  211. }
  212. if (!bonusConf || typeof bonusConf !== "object") return null;
  213. bonusConf.show = Number(bonusConf.show) || 0;
  214. bonusConf.claimed = Number(bonusConf.claimed) || 0;
  215. if (bonusConf.amount != null) bonusConf.amount = Number(bonusConf.amount) || 0;
  216. if (bonusConf.expire_in != null) bonusConf.expire_in = Number(bonusConf.expire_in) || 0;
  217. return bonusConf;
  218. };
  219. const getLocalGoogleRedirectDebugParams = () => {
  220. if (typeof window === "undefined") return null;
  221. const host = window.location.hostname;
  222. if (host !== "localhost" && host !== "127.0.0.1" && host !== "0.0.0.0") return null;
  223. const params = new URLSearchParams(window.location.search || "");
  224. return params.get("gdebug") === "1" ? params : null;
  225. };
  226. const applyGoogleRedirectDebugConf = (googleRedirectH5, googleRedirectJumpApk, googleRedirectH5Bonus) => {
  227. const params = getLocalGoogleRedirectDebugParams();
  228. if (!params) return { googleRedirectH5, googleRedirectJumpApk, googleRedirectH5Bonus };
  229. const jumpApkMode = Number(params.get("gd_jumpapk")) || 0;
  230. if (jumpApkMode === 1 || jumpApkMode === 2 || jumpApkMode === 3) {
  231. const rewardAmount = params.get("gd_reward") || googleRedirectH5?.reward_amount || googleRedirectH5?.rewardAmount || 10;
  232. const rewardCurrency = params.get("gd_currency") || googleRedirectH5?.reward_currency || googleRedirectH5?.rewardCurrency || global.DOLLAR || "$";
  233. const defaultBonusUrl = `${window.location.origin}${window.location.pathname}?gdebug=1&gd_bonus=1&gd_sk=debug_sk&gd_amount=${params.get("gd_amount") || 1000}&gd_claim_success=1`;
  234. googleRedirectJumpApk = jumpApkMode;
  235. googleRedirectH5 = {
  236. ...(googleRedirectH5 || {}),
  237. enabled: true,
  238. reward_amount: rewardAmount,
  239. reward_currency: rewardCurrency,
  240. target_h5_url: params.get("gd_h5") || googleRedirectH5?.target_h5_url || googleRedirectH5?.targetH5Url || googleRedirectH5?.h5_url || defaultBonusUrl,
  241. support_url: params.get("gd_support") || googleRedirectH5?.support_url || googleRedirectH5?.tg_support_url || ""
  242. };
  243. localStorageSet(LOCAL_GOOGLE_REDIRECT_JUMPAPK, `${jumpApkMode}`);
  244. }
  245. const bonusMode = params.get("gd_bonus");
  246. if (bonusMode === "1" || bonusMode === "claimed") {
  247. googleRedirectH5Bonus = {
  248. ...(googleRedirectH5Bonus || {}),
  249. show: 1,
  250. claimed: bonusMode === "claimed" ? 1 : Number(params.get("gd_claimed")) || 0,
  251. amount: Number(params.get("gd_amount")) || 1000,
  252. s_k: params.get("gd_sk") || googleRedirectH5Bonus?.s_k || "debug_sk",
  253. expire_in: Number(params.get("gd_expire")) || 600
  254. };
  255. }
  256. return { googleRedirectH5, googleRedirectJumpApk, googleRedirectH5Bonus };
  257. };
  258. const reducerRoutes = (state, action) => {
  259. let json = action.payload;
  260. if (json && Number(json.code) === 0) {
  261. // _dmr=1 路径首次响应仅用于把 conf.s_p 中的 env 还原到本地(cookie/LS),
  262. // 此时本次请求未带恢复后的 sign,user 必为空;若继续更新 state 会让 isLogin=0
  263. // 触发 CHashRouter 的登录守卫,把用户从 #/freewithdraw 跳到 #/signin。
  264. // 这里截获首次响应:只跑 restoreQuickSaveEnv,由其内部 signRestored 分支
  265. // 触发二次 reqGetRoutes(带 sign);同时把 status 回退到 LOADING,
  266. // 让 App 继续显示 LoadingFull,阻塞 Layout / CHashRouter 挂载避免提前触发登录守卫。
  267. if (window.__dmig_pending_reload) {
  268. // 迁移落地(到 H5):清除 APK 环境标记。APK 与 H5 同源(localStorage 共享),
  269. // 若不清,H5 仍会被 isJumpApkEnv() 判成 APK 而弹引导。APK 启动带 jumpapk(无 __dmig_pending_reload),
  270. // 不会进这里,所以不影响 APK 正常弹引导(三个 mode 都靠 isJumpApkEnv 这道闸)。
  271. localStorageSet(LOCAL_GOOGLE_REDIRECT_APK_ENV, "");
  272. restoreQuickSaveEnv(json.conf);
  273. state.status = REQ_STATUS.LOADING;
  274. return;
  275. }
  276. let data = json.data == null ? [] : json.data;
  277. let generData = generateRoutes(state.routes, data);
  278. let styles = parseStyles(json.styles);
  279. let blocks = parseBlocks(json.blocks);
  280. let user = json.user;
  281. let isLogin = 0;
  282. let userInfo = {};
  283. let hasPhone = 0;
  284. if (user) {
  285. if (typeof user == "object") {
  286. isLogin = 1;
  287. userInfo = user;
  288. let sign = user.sign;
  289. if (sign != null) localStorageSet(LOCAL_SIGN, sign);
  290. if (user.Phone !== "" && user.Phone.startsWith(user.RegisterLocation)) {
  291. hasPhone = 1;
  292. }
  293. //同步lang
  294. if (user.DefaultLanguage != null) global.i18n.setLocalLangFromS(user.DefaultLanguage);
  295. checkChannel(user);
  296. updateRegisterDate(user.RegisterDate);
  297. //设置ssq gameUserID
  298. SsqHelp.setGameId(user.GameID, user.Channel);
  299. }
  300. }
  301. let conf = json.conf;
  302. restoreQuickSaveEnv(conf);
  303. let hallServerUrl = '';
  304. let promoteInstall = 0;
  305. let guest = 0;
  306. let upgradeBonus = 0;
  307. let registerBonus = 0;
  308. let recommendGame = "";
  309. let popWheel = 0;
  310. let popBindPhone = 0;
  311. let firstBonus = 0;
  312. let openRelief = 0;
  313. let accountLogin = 1;
  314. let loginOpen = "";
  315. let registerOpen = "";
  316. let serviceLink = "";
  317. let landscapeGames = [];
  318. let area = global.getLocalAreaID();
  319. //sport 配置
  320. let bbConf = null;
  321. let popFirst = 0;
  322. let showInstall = 0;
  323. let download = {};
  324. let vipConfig = [];
  325. let popPwaBonus = 0;
  326. let outLimit = null;
  327. let withdrawChannel = null;
  328. let freeChannel = null;
  329. let slotsPartner = [];
  330. let sharePop = null;
  331. let googleRedirectH5 = null;
  332. let googleRedirectJumpApk = 0;
  333. let googleRedirectH5Bonus = null;
  334. //fb/ins浏览器延迟跳转默认浏览器(仅在提款/充值时拦截)
  335. let jumplater = 0;
  336. let fbGuideWeight = {};
  337. let isAutoEnterGame = 1;
  338. let jumpToH5 = 0;
  339. if (conf) {
  340. if (!!conf.hall) hallServerUrl = conf.hall;
  341. if (!!conf.DOLLAR) global.DOLLAR = conf.DOLLAR;
  342. if (!!conf.currency) global.currency = conf.currency;
  343. global.pf = conf.pf;
  344. //平台配置
  345. if (!!conf.pf && !!conf.pf.id) {
  346. let { type, id } = conf.pf;
  347. initTrackAll(type, id, isLogin ? userInfo.UserID : null);
  348. }
  349. //promoteInstall
  350. if (!!conf.promoteInstall) promoteInstall = conf.promoteInstall;
  351. //guest
  352. if (!!conf.guest) guest = conf.guest;
  353. //绑定手机奖励
  354. if (!!conf.upgradeBonus) upgradeBonus = conf.upgradeBonus;
  355. ///初始注册奖励
  356. if (!!conf.registerBonus) registerBonus = conf.registerBonus;
  357. ///领取注册奖励后进入的游戏
  358. if (!!conf.recommendGame) recommendGame = conf.recommendGame;
  359. //客服地址
  360. if (!!conf.serviceLink) serviceLink = conf.serviceLink;
  361. //弹出转盘
  362. if (!!conf.popWheel) popWheel = conf.popWheel;
  363. //弹出绑定电话奖励,并显示浮标
  364. if (!!conf.popBindPhone) popBindPhone = hasPhone ? 0 : conf.popBindPhone;
  365. //显示首冲浮标
  366. if (!!conf.firstBonus) firstBonus = conf.firstBonus;
  367. //显示救济浮标
  368. if (!!conf.openRelief) openRelief = conf.openRelief;
  369. //sport 配置
  370. if (!!conf.bb) {
  371. bbConf = conf.bb;
  372. if (userInfo != null) userInfo.bb = bbConf;
  373. }
  374. if (!!conf.loginOpen) loginOpen = conf.loginOpen;
  375. if (!!conf.registerOpen) registerOpen = conf.registerOpen;
  376. if (!!conf.popFirst) popFirst = conf.popFirst;
  377. if (!!conf.showInstall) showInstall = conf.showInstall;
  378. //download 配置
  379. if (!!conf.download) download = conf.download;
  380. if (!!conf.vipConfig) vipConfig = conf.vipConfig;
  381. if (!!conf.LandscapeGames) landscapeGames = conf.LandscapeGames;
  382. // adjust相关配置
  383. if (!!conf.AdjustToken && !!conf.AdjustConfig) global.tracker.initAdjust(conf.AdjustToken, conf.AdjustConfig);
  384. if (!!conf.popPwaBonus) popPwaBonus = conf.popPwaBonus;
  385. if (!!conf.outLimit) outLimit = conf.outLimit;
  386. if (!!conf.withdrawChannel) withdrawChannel = conf.withdrawChannelNew;
  387. if (!!conf.freeChannel) freeChannel = conf.freeChannel;
  388. if (!!conf.slotsPartner) slotsPartner = conf.slotsPartner;
  389. if (!!conf.sharePop) sharePop = conf.sharePop;
  390. googleRedirectH5 = parseGoogleRedirectH5Conf(conf);
  391. googleRedirectH5Bonus = parseGoogleRedirectH5BonusConf(conf);
  392. if (conf.jumpapk === 1 || conf.jumpapk === "1" || conf.jumpapk === 2 || conf.jumpapk === "2" || conf.jumpapk === 3 || conf.jumpapk === "3") {
  393. googleRedirectJumpApk = Number(conf.jumpapk);
  394. localStorageSet(LOCAL_GOOGLE_REDIRECT_JUMPAPK, conf.jumpapk);
  395. } else {
  396. localStorageSet(LOCAL_GOOGLE_REDIRECT_JUMPAPK, "");
  397. }
  398. if (conf.jumplater != null) jumplater = Number(conf.jumplater) || 0;
  399. if (conf.weight1234 != null) fbGuideWeight = conf.weight1234;
  400. // 注册后自动进游戏
  401. if (conf.isAutoEnterGame != null) isAutoEnterGame = conf.isAutoEnterGame;
  402. // 强制引导开关
  403. if (conf.jumpios != null) jumpToH5 = conf.jumpios;
  404. // 内置客服JS
  405. if (!!conf.servicejs) SsqHelp.setServicejs(conf.servicejs);
  406. }
  407. ({
  408. googleRedirectH5,
  409. googleRedirectJumpApk,
  410. googleRedirectH5Bonus
  411. } = applyGoogleRedirectDebugConf(googleRedirectH5, googleRedirectJumpApk, googleRedirectH5Bonus));
  412. Object.assign(state, {
  413. routes: state.routes,
  414. asyncRoutes: data,
  415. styles,
  416. blocks,
  417. ...generData,
  418. isLogin: isLogin,
  419. userInfo,
  420. hallServerUrl,
  421. promoteInstall,
  422. guest,
  423. upgradeBonus,
  424. recommendGame,
  425. serviceLink,
  426. registerBonus,
  427. popWheel,
  428. popBindPhone,
  429. firstBonus,
  430. openRelief,
  431. bbConf,
  432. accountLogin,
  433. area,
  434. loginOpen,
  435. registerOpen,
  436. popFirst,
  437. showInstall,
  438. download,
  439. vipConfig,
  440. landscapeGames,
  441. popPwaBonus,
  442. outLimit,
  443. withdrawChannel,
  444. freeChannel,
  445. slotsPartner,
  446. sharePop,
  447. googleRedirectH5,
  448. googleRedirectJumpApk,
  449. googleRedirectH5Bonus,
  450. jumplater,
  451. fbGuideWeight,
  452. isAutoEnterGame,
  453. jumpToH5
  454. });
  455. }
  456. };
  457. const routesStatus = (state, status, arg) => {
  458. state.status = status;
  459. };
  460. const getMsg = (payload) => {
  461. return getHttpMsg(payload);
  462. };
  463. //检查渠道
  464. const checkChannel = (userInfo) => {
  465. if (userInfo != null && userInfo.Channel != null) {
  466. let Channel = parseInt(userInfo.Channel);
  467. let localC = localStorageGet(LOCAL_ACTIVITY_C, "");
  468. if (localC != null && localC !== "") {
  469. localC = parseInt(localC);
  470. if (Channel !== localC) {
  471. localStorageSet(LOCAL_ACTIVITY_C, Channel + "");
  472. let search = window.location.search || "";
  473. const params = new URLSearchParams(search);
  474. // 移除参数c和bfp
  475. params.delete('c');
  476. params.delete('bfp');
  477. search = params.toString();
  478. let url = `${window.location.origin}${search !== "" ? "?" + search : ""}`;
  479. window.location.replace(url);
  480. }
  481. }
  482. }
  483. };
  484. const updateRegisterDate = (date) => {
  485. const local = Number(localStorageGet(LOCAL_REGISTER_DATE_TS, "0"));
  486. if (local > 0) return;
  487. const ts = parseNYTimeToTimestamp(date);
  488. localStorageSet(LOCAL_REGISTER_DATE_TS, ts);
  489. const days = getTimestampDays(ts);
  490. if (days === 0) {
  491. //注册首日不弹Balance 弹窗
  492. localStorageSet(LOCAL_BALANCE_POPUP_TS, Date.now());
  493. }
  494. }
  495. const parseLogin = (state, action, arg, isShowMsg = true) => {
  496. let payload = action.payload;
  497. let code = payload.code;
  498. let msg = getMsg(payload);
  499. //success
  500. if (Number(code) === 200) {
  501. let data = payload.data;
  502. if (data.bb == null) {
  503. if (state.userInfo != null) data.bb = state.userInfo.bb;
  504. }
  505. if (arg) {
  506. if (arg.DefaultLanguage != null) data.lang = arg.DefaultLanguage;
  507. else {
  508. if (state.userInfo != null && state.userInfo.lang != null) data.lang = state.userInfo.lang;
  509. }
  510. }
  511. state.userInfo = data;
  512. state.isLogin = 1;
  513. state.serverKick = 0;
  514. if (!!data.recommendGame) state.recommendGame = data.recommendGame;
  515. let sign = data.sign;
  516. if (sign != null) localStorageSet(LOCAL_SIGN, sign);
  517. if (isShowMsg) toast.success(msg, { toastId: "login" });
  518. if (!!data.reg) {
  519. //新注册的
  520. trackEvent("CompleteRegistration", { external_id: data.UserID, event_id: "reg_" + data.UserID });
  521. }
  522. checkChannel(data);
  523. updateRegisterDate(data.RegisterDate);
  524. localStorageRemove(LOCAL_RESET_LOGIN_STATES);
  525. //设置ssq gameUserID
  526. SsqHelp.setGameId(data.GameID, data.Channel);
  527. }
  528. else {
  529. if (isShowMsg) toast.error(msg, { toastId: "login" });
  530. }
  531. if (arg) {
  532. let callback = arg.callback;
  533. if (callback != null) callback(code, payload.data);
  534. }
  535. };
  536. const reducerLogin = (state, action, arg) => {
  537. parseLogin(state, action, arg);
  538. };
  539. const loginStatus = (state, status, arg) => {
  540. state.loginStatus.login = status;
  541. };
  542. const reducerReg = (state, action, arg) => {
  543. parseLogin(state, action, arg, false);
  544. };
  545. const regStatus = (state, status, arg) => {
  546. state.loginStatus.register = status;
  547. };
  548. const reducerRegGold = (state, action, arg) => {
  549. let payload = action.payload;
  550. //payload:{"data":{"user":{"InsureScore":10,"Registed":1,"message":"Success"}},"result":"","msg":"success","code":200}
  551. //payload:{"data":[],"msg":"Fail","code":301}
  552. let code = payload.code;
  553. let msg = getMsg(payload);
  554. if (Number(code) === 200) {
  555. let data = payload.data || {};
  556. let user = data.user;
  557. if (!!user) {
  558. if (user.InsureScore != null) {
  559. state.userInfo.InsureScore = Number(user.InsureScore);
  560. }
  561. if (user.Registed != null) {
  562. state.userInfo.Registed = Number(user.Registed);
  563. }
  564. }
  565. } else {
  566. toast.error(msg, { toastId: "regGold" });
  567. }
  568. };
  569. const regGoldStatus = (state, status, arg) => {
  570. state.loginStatus.regGold = status;
  571. };
  572. const reducerLogout = (state, action, arg) => {
  573. let payload = action.payload;
  574. let code = payload.code;
  575. let msg = getMsg(payload);
  576. if (Number(code) === 200) {
  577. state.userInfo = {};
  578. state.isLogin = 0;
  579. localStorageSet(LOCAL_SIGN, "");
  580. //清理ssq gameUserID
  581. SsqHelp.setGameId(null, null);
  582. toast.success(msg, { toastId: "logout" });
  583. }
  584. else {
  585. toast.error(msg, { toastId: "logout" });
  586. }
  587. };
  588. const logoutStatus = (state, status, arg) => {
  589. state.loginStatus.logout = status;
  590. };
  591. //login
  592. //modify
  593. const reducerChangePass = (state, action, arg) => {
  594. parseLogin(state, action, arg);
  595. };
  596. const changePassStatus = (state, status, arg) => {
  597. state.modifyStatus.password = status;
  598. };
  599. const reducerChangeInfo = (state, action, arg) => {
  600. parseLogin(state, action, arg);
  601. };
  602. const changeInfoStatus = (state, status, arg) => {
  603. state.modifyStatus.info = status;
  604. };
  605. const reducerChangePhone = (state, action, arg) => {
  606. parseLogin(state, action, arg);
  607. };
  608. const changePhoneStatus = (state, status, arg) => {
  609. state.modifyStatus.phone = status;
  610. };
  611. const reducerChangeEmail = (state, action, arg) => {
  612. parseLogin(state, action, arg);
  613. };
  614. const changeEmailStatus = (state, status, arg) => {
  615. state.modifyStatus.phone = status;
  616. };
  617. //modify
  618. //gameinfo
  619. const parseVipUpgrade = (state, prevLv, vip, preFreeBonus = -1) => {
  620. if (prevLv >= vip) return;
  621. state.vipUpgrade = {
  622. prevLv,
  623. preFreeBonus,
  624. active: true, //是否显示VIP升级弹窗
  625. }
  626. // const vipConfig = state.vipConfig || {};
  627. // let predicts = [];
  628. // let benefits = getDiffBenefits(vipConfig[prevLv], vipConfig[vip], prevLv == 0);
  629. // if (benefits.length === 0) {
  630. // if (vipConfig[vip + 1]) {
  631. // /// 预告
  632. // predicts = getDiffBenefits(vipConfig[vip], vipConfig[vip + 1]);
  633. // }
  634. // }
  635. // let active = predicts.length > 0 || benefits.length > 0;
  636. // let freeBonus = state.userInfo?.InsureScore || 0;
  637. // if (preFreeBonus < freeBonus && prevLv == 0) {
  638. // /// 刚升级成vip 并且之前的freebonus <100 才显示freeBonus这个选项
  639. // let index = Math.min(2, benefits.length);
  640. // benefits.splice(index, 0, {
  641. // key: VIPBenefits.FreeBonus,
  642. // from: freeBonus,
  643. // to: freeBonus
  644. // })
  645. // }
  646. // //需要预览的权益 预览后如果还有则自动再次打开弹窗
  647. // let previews = getPreviewBenefits(benefits);
  648. // state.vipUpgrade = {
  649. // prevLv,
  650. // previews, //需要预览的vip权益 [暂时弃用,预览需求已取消]
  651. // benefits, //升级变化的vip权益 [非vip变成vip 直接展示所有权益]
  652. // predicts, //预测再次提升的权益变化 [如果升级没有权益变化,则预告再升一级会有什么变化]
  653. // active, //是否显示VIP升级弹窗
  654. // }
  655. }
  656. const reducerGameInfo = (state, action, arg) => {
  657. const prevLv = state.userInfo?.vip || 0;
  658. const insureScore = state.userInfo?.InsureScore || 0;
  659. parseLogin(state, action, arg, false);
  660. const vip = state.userInfo?.vip || 0;
  661. parseVipUpgrade(state, prevLv, vip, insureScore);
  662. };
  663. const gameInfoStatus = (state, status, arg) => {
  664. state.gameInfoStatus = status;
  665. };
  666. //gameinfo
  667. //custom
  668. const reducerCustom = (state, action, arg) => {
  669. let payload = action.payload;
  670. if (payload && payload.code === 200) {
  671. state.customerInfo = payload.data;
  672. }
  673. };
  674. const customStatus = (state, status, arg) => {
  675. state.customServiceStatus = status;
  676. };
  677. const reducerCustomLeaveMsg = (state, action, arg) => {
  678. let payload = action.payload;
  679. if (payload != null) {
  680. if (payload && payload.code === 200) {
  681. localStorageSet(LOCAL_CUSTOM_LOCK, Date.now());
  682. toast.success(global.i18n.t("customer.TopTip_succeed"), { toastId: "customLeaveMsg" });
  683. }
  684. else {
  685. toast.error(global.i18n.t("customer.TopTip_fail"), { toastId: "customLeaveMsg" });
  686. }
  687. }
  688. if (arg && arg.callback != null) {
  689. arg.callback(payload);
  690. }
  691. };
  692. const customLeaveMsgStatus = (state, status, arg) => {
  693. state.customLeaveMsgStatus = status;
  694. };
  695. const reducerUpdateFavoInfo = (state, action, arg) => {
  696. let payload = action.payload;
  697. let msg = getHttpMsg(payload);
  698. if (payload && payload.code === 200) {
  699. if (msg != null && msg !== "") {
  700. toast.success(msg, { toastId: "updateFavoInfo" });
  701. }
  702. }
  703. else {
  704. if (msg != null && msg !== "") {
  705. toast.error(msg, { toastId: "updateFavoInfo" });
  706. }
  707. }
  708. };
  709. const reducerFavoGet = (state, action, arg) => {
  710. let payload = action.payload;
  711. if (payload && payload.code === 200) {
  712. let data = payload.data;
  713. let favorites = [];
  714. if (data != null) {
  715. for (let i = 0; i < data.length; i++) {
  716. let item = data[i];
  717. if (item) favorites.push(item.id);
  718. }
  719. }
  720. state.favorites = favorites;
  721. }
  722. };
  723. const reducerFreeWithdraw = (state, action, arg) => {
  724. let payload = action.payload;
  725. if (payload && payload.code === 200) {
  726. let data = payload.data;
  727. state.freeWithdrawInfo = data;
  728. global.freeTxTotal = data.total;
  729. if (arg === true && data?.InsureScore) {//同步InsureScore
  730. state.userInfo.InsureScore = data?.InsureScore;
  731. }
  732. }
  733. };
  734. const reducerFreeWithdrawMission = (state, action, arg) => {
  735. let payload = action.payload;
  736. if (payload && payload.code === 200) {
  737. let data = payload.data;
  738. state.freeWithdrawMission = data;
  739. }
  740. };
  741. const reducerFreeWithdrawClaim = (state, action, arg) => {
  742. let payload = action.payload;
  743. let msg = getHttpMsg(payload);
  744. if (payload && payload.code === 200) {
  745. toast.success(global.i18n?.t("withdraw.tip.success") ?? "", { toastId: "freeWithdrawClaim" });
  746. setTimeout(() => {
  747. global.dispatch(reqGameInfo());
  748. global.dispatch(reqFreeWithdrawMission());
  749. }, 1);
  750. }
  751. else {
  752. toast.error(msg, { toastId: "freeWithdrawClaim" });
  753. }
  754. if (arg && arg.callback != null) {
  755. arg.callback(payload);
  756. }
  757. };
  758. const reducerFreeBonusGiftInfo = (state, action, arg) => {
  759. let payload = action.payload;
  760. if (payload && payload.code === 200) {
  761. let data = payload.data;
  762. state.freeBonusGiftInfo = data;
  763. }
  764. };
  765. const reducerHolidaysGiftInfo = (state, action, arg) => {
  766. let payload = action.payload;
  767. if (payload && payload.code === 200) {
  768. let data = payload.data;
  769. state.holidaysGiftInfo = data;
  770. }
  771. };
  772. const reducerHolidaysActInfo = (state, action, arg) => {
  773. let payload = action.payload;
  774. //payload = JSON.parse(`{"data":{"status":1,"start_time":"2026-02-24 00:00:00.000","end_time":"2026-03-23 00:00:00.000","logo_url":"","button_url":"","button_light_url":"","lunzi_url":"","dipan_url":"","free_times":1,"slots":[777,1,177,2,77,4,32,7,16],"user":{"left_times":1,"total_times":1},"recharge_rules":[{"amount":19.99,"times":1,"gear":{"id":"1016","money":19.99,"favorable_price":19.99,"give":0,"recommend":0,"gear":"[{\\"name\\":\\"cashapp\\",\\"value\\":1,\\"status\\":1},{\\"name\\":\\"applepay\\",\\"value\\":4,\\"status\\":1}]","gift_id":402}},{"amount":39.99,"times":2,"gear":{"id":"1041","money":39.99,"favorable_price":39.99,"give":0,"recommend":1,"gear":"[{\\"name\\":\\"cashapp\\",\\"value\\":1,\\"status\\":1},{\\"name\\":\\"applepay\\",\\"value\\":4,\\"status\\":1}]","gift_id":402}},{"amount":59.99,"times":3,"gear":{"id":"1052","money":59.99,"favorable_price":59.99,"give":0,"recommend":0,"gear":"[{\\"name\\":\\"cashapp\\",\\"value\\":1,\\"status\\":1},{\\"name\\":\\"paypal\\",\\"value\\":2,\\"status\\":1},{\\"name\\":\\"applepay\\",\\"value\\":4,\\"status\\":1}]","gift_id":402}}],"now":"2026-03-29 22:28:14"},"result":"","msg":"success","code":200}`)
  775. if (payload && payload.code === 200) {
  776. let data = payload.data;
  777. state.holidaysActInfo = data;
  778. }
  779. };
  780. const updateFreeWithdrawClaimStatus = (state, status, arg) => {
  781. state.freeTxClaimStatus = status;
  782. };
  783. export const getFreeWithdrawClaimStatus = (state) => {
  784. return state.main.freeTxClaimStatus;
  785. };
  786. const reducerGameCardInfo = (state, action, arg) => {
  787. let payload = action.payload;
  788. if (payload && payload.code === 200) {
  789. let data = payload.data;
  790. if (data != null) {
  791. let id = Number(data.id);
  792. let level_info = data.level_info;
  793. let level = level_info != null ? 1 : 0;
  794. let local = parseInt(localStorageGet(LOCAL_GAME_URL + id, 0));
  795. if (local > 0) level = local;
  796. state.gameCardInfo[id] = { ...data, level: level };
  797. }
  798. }
  799. };
  800. const gameCardInfoStatus = (state, status, arg) => {
  801. state.gameCardInfoStatus = status;
  802. };
  803. //send code
  804. const reducerSendCode = (state, action, arg) => {
  805. let payload = action.payload;
  806. let msg = getHttpMsg(payload);
  807. if (payload && payload.code === 200) {
  808. toast.success(msg, { toastId: "sendCode" });
  809. state.otpTimeStamp = Date.now();
  810. const phone = arg.phone;
  811. if (!!phone) {
  812. if (!state.otpTsMap) state.otpTsMap = {};
  813. state.otpTsMap[phone] = Date.now();
  814. }
  815. }
  816. else {
  817. toast.error(msg, { toastId: "sendCode" });
  818. }
  819. };
  820. const sendCodeStatus = (state, status, arg) => {
  821. state.loginStatus.send_code = status;
  822. const phone = arg?.phone;
  823. if (!!phone) {
  824. if (!state.loginStatus.sendCodeMaps) {
  825. state.loginStatus.sendCodeMaps = {};
  826. }
  827. state.loginStatus.sendCodeMaps[phone] = status;
  828. }
  829. };
  830. //bind phone
  831. const reducerBindSMS = (state, action, arg) => {
  832. let payload = action.payload;
  833. state.oldUserInfo = null;
  834. if (Number(payload.code) === 301 && payload.data && payload.data.UserID) {
  835. // 已有账号
  836. state.oldUserInfo = payload.data;
  837. } else if (Number(payload.code) === 200) {
  838. toast.success(global.i18n.t("bindPhone.success"), { toastId: "login" });
  839. }
  840. parseLogin(state, action, arg, Number(payload.code) !== 200);
  841. };
  842. const bindSMSStatus = (state, status, arg) => {
  843. state.loginStatus.bind = status;
  844. };
  845. //sms login
  846. const reducerSMSLogin = (state, action, arg) => {
  847. parseLogin(state, action, arg);
  848. };
  849. const smsLoginStatus = (state, status, arg) => {
  850. state.loginStatus.smslogin = status;
  851. };
  852. //custom
  853. //pwa bonus
  854. const reducerGetPwaBonus = (state, action, arg) => {
  855. let payload = action.payload;
  856. if (payload && payload.code === 200) {
  857. toast.success(global.i18n?.t("popPwaBonus.claim_success") ?? "", { toastId: "popPwaBonus" });
  858. state.popPwaBonus = 0;
  859. } else {
  860. toast.error(global.i18n?.t("popPwaBonus.claim_failed") ?? "", { toastId: "popPwaBonus" });
  861. }
  862. if (arg && arg.callback != null) {
  863. arg.callback(payload);
  864. }
  865. }
  866. const updateVipStatus = (state, arg) => {
  867. let {
  868. lastRecharge,
  869. levelDown,
  870. levelDownWarn,
  871. levelDownDay,
  872. expired,
  873. expireWarn,
  874. expireDay,
  875. alpha,
  876. trialEnd,
  877. vip = -1
  878. } = arg;
  879. if (vip === -1) {
  880. vip = state.userInfo?.vip || 0;
  881. }
  882. let leftDays = 0;
  883. let status = VIPStatus.Active;
  884. if (Number(vip) === 0) {
  885. status = VIPStatus.Trial;
  886. if (trialEnd) {
  887. /// 非vip用户 体验已到期
  888. status = VIPStatus.TrialEnd;
  889. }
  890. } else {
  891. // vip 用户
  892. if (expired) {
  893. status = VIPStatus.Frozen;
  894. } else if (levelDown) {
  895. status = VIPStatus.LevelDown;
  896. }
  897. }
  898. switch (status) {
  899. case VIPStatus.Active:
  900. if (lastRecharge >= levelDownWarn) {
  901. status = VIPStatus.LevelDownWarn;
  902. leftDays = levelDownDay - lastRecharge;
  903. }
  904. break;
  905. case VIPStatus.LevelDown:
  906. if (lastRecharge >= expireWarn) {
  907. status = VIPStatus.FrozenWarn;
  908. leftDays = expireDay - lastRecharge;
  909. }
  910. break;
  911. default:
  912. break;
  913. }
  914. const vipConfig = state.vipConfig || [];
  915. state.vipStatus = {
  916. status,
  917. curAlpha: alpha,
  918. fullAlpha: vipConfig[vip]?.Alpha || 1,
  919. leftDays,
  920. levelDownDay,
  921. expireDay,
  922. }
  923. }
  924. const reducerCheckinCheck = (state, action, arg) => {
  925. let payload = action.payload;
  926. if (payload != null && payload.code === 200) {
  927. let data = payload.data;
  928. if (data) {
  929. updateVipStatus(state, {
  930. vip: data.vip,
  931. alpha: parseFloat(data.Alpha),
  932. lastRecharge: data.LastRechargeDays,
  933. levelDown: data.vip_level_down,
  934. levelDownDay: parseFloat(data.vip_level_down_days),
  935. levelDownWarn: parseFloat(data.level_down_warning_day),
  936. expired: data.vip_expire,
  937. expireDay: parseFloat(data.vip_expire_days),
  938. expireWarn: parseFloat(data.vip_expire_warning_day),
  939. trialEnd: data.new_user_thirty_days_without_recharge,
  940. })
  941. }
  942. }
  943. }
  944. const reducerProtectCheck = (state, action, arg) => {
  945. let payload = action.payload;
  946. if (payload && payload.code === 200) {
  947. let data = payload.data;
  948. if (data != null && data[0] != null) {
  949. data = data[0];
  950. updateVipStatus(state, {
  951. vip: data.vip,
  952. alpha: parseFloat(data.Alpha),
  953. lastRecharge: data.last_recharge_days,
  954. levelDown: data.vip_level_down,
  955. levelDownDay: parseFloat(data.vip_level_down_days),
  956. levelDownWarn: parseFloat(data.level_down_warning_day),
  957. expired: data.vip_expire,
  958. expireDay: parseFloat(data.vip_expire_days),
  959. expireWarn: parseFloat(data.vip_expire_warning_day),
  960. trialEnd: data.new_user_thirty_days_without_recharge,
  961. })
  962. }
  963. }
  964. }
  965. const getPwaBonusStatus = (state, status, arg) => {
  966. state.pwaBonusStatus = status;
  967. }
  968. //pwa bonus
  969. const reducerGameInterval = (state, action, arg) => {
  970. let payload = action.payload;
  971. if (payload && payload.code === 200) {
  972. //console.log("game interval", payload.data);
  973. }
  974. }
  975. const reducerCountryCode = (state, action, arg) => {
  976. let payload = action.payload;
  977. if (payload && payload.code === 200 && payload.data) {
  978. const phone_code = payload.data.phone_code || global.getLocalAreaID();
  979. if (phone_code) {
  980. localStorageSet(LOCAL_DEFAULT_COUNTRY, phone_code)
  981. }
  982. }
  983. }
  984. const reducerVerifyCode = (state, action, arg) => {
  985. let payload = action.payload;
  986. let msg = getHttpMsg(payload);
  987. if (!payload || payload.code !== 200) {
  988. toast.error(msg, { toastId: "verify_old_code" });
  989. }
  990. };
  991. const setVerifyCodeStatus = (state, status, arg) => {
  992. state.verifyCodeStatus = status;
  993. };
  994. const reducerChangeBindPhone = (state, action, arg) => {
  995. let payload = action.payload;
  996. let msg = getHttpMsg(payload);
  997. if (payload && payload.code === 200) {
  998. if (!!state.userInfo) {
  999. const country = arg.country || '';
  1000. const phone = arg.newPhone;
  1001. if (phone) state.userInfo.Phone = country + phone;
  1002. }
  1003. } else {
  1004. toast.error(msg, { toastId: "change_bind_phone" });
  1005. }
  1006. };
  1007. const reducerChangeLimitInfo = (state, action, arg) => {
  1008. let payload = action.payload;
  1009. if (payload && payload.code === 200) {
  1010. const data = payload.data;
  1011. if (!!data) {
  1012. // phone_ttl — 手机号修改后剩余锁定时长(秒),0 表示可修改
  1013. const phone_ttl = data.phone_ttl || 0;
  1014. const phone_ts = phone_ttl === 0 ? 0 : Date.now() + phone_ttl * 1000;
  1015. state.changeLimit = {
  1016. phone_ts,
  1017. };
  1018. }
  1019. }
  1020. }
  1021. const setChangeBindPhoneStatus = (state, status, arg) => {
  1022. state.changeBindPhoneStatus = status;
  1023. };
  1024. const reducerResetLogin = (state, action, arg) => {
  1025. let payload = action.payload;
  1026. if (payload && payload.code === 200) {
  1027. onLogout(state, false);
  1028. localStorageSet(LOCAL_RESET_LOGIN_STATES, "1");
  1029. }
  1030. }
  1031. const onLogout = (state, open_signin = true) => {
  1032. state.isLogin = 0;
  1033. state.userInfo = {
  1034. UserID: open_signin ? 0 : -1
  1035. };
  1036. }
  1037. export const Main = createSlice({
  1038. name: 'main',
  1039. initialState: {
  1040. status: REQ_STATUS.NONE,
  1041. routes: routes,
  1042. asyncRoutes: [],
  1043. styles: {},
  1044. blocks: {},
  1045. ...generateRoutes(routes),
  1046. loginStatus: {
  1047. login: REQ_STATUS.NONE,
  1048. register: REQ_STATUS.NONE,
  1049. regGold: REQ_STATUS.NONE,
  1050. logout: REQ_STATUS.NONE,
  1051. bind: REQ_STATUS.NONE,
  1052. send_code: REQ_STATUS.NONE,
  1053. smslogin: REQ_STATUS.NONE,
  1054. sendCodeMaps: {},
  1055. },
  1056. userInfo: null,
  1057. oldUserInfo: null,
  1058. isLogin: 0,
  1059. modifyStatus: {
  1060. info: REQ_STATUS.NONE,
  1061. password: REQ_STATUS.NONE,
  1062. phone: REQ_STATUS.NONE,
  1063. email: REQ_STATUS.NONE
  1064. },
  1065. gameInfoStatus: REQ_STATUS.NONE,
  1066. customLeaveMsgStatus: REQ_STATUS.NONE,
  1067. customServiceStatus: REQ_STATUS.NONE,
  1068. freeTxClaimStatus: REQ_STATUS.NONE,
  1069. verifyCodeStatus: REQ_STATUS.NONE,
  1070. changeBindPhoneStatus: REQ_STATUS.NONE,
  1071. //客服
  1072. customerInfo: [],
  1073. //大厅服务器
  1074. hallServerUrl: '',
  1075. //收藏列表
  1076. favorites: [],
  1077. // 免费提现信息
  1078. freeWithdrawInfo: {},
  1079. //免费提现任务
  1080. freeWithdrawMission: {},
  1081. freeBonusGiftInfo: {},
  1082. holidaysGiftInfo: {},
  1083. holidaysActInfo: {},
  1084. //当前游戏id
  1085. gameID: 0,
  1086. //服务器踢
  1087. serverKick: 0,
  1088. //安装提示
  1089. promoteInstall: 0,
  1090. //服务器返回777打开充值
  1091. openPay: 0,
  1092. gameCardInfoStatus: REQ_STATUS.NONE,
  1093. //游戏卡信息
  1094. gameCardInfo: {},
  1095. //otp 时间戳
  1096. otpTimeStamp: 0,
  1097. //是否是guest登录
  1098. guest: 0,
  1099. //绑定奖励
  1100. upgradeBonus: 0,
  1101. //初始注册奖励
  1102. registerBonus: 0,
  1103. //领取注册奖励后进入的游戏
  1104. recommendGame: "",
  1105. //客服地址
  1106. serviceLink: "",
  1107. //sport conf
  1108. bbConf: null,
  1109. accountLogin: 0,
  1110. area: 0,
  1111. loginOpen: "",
  1112. registerOpen: "",
  1113. popFirst: 0,
  1114. showInstall: 0,
  1115. download: {},
  1116. landscapeGames: [],
  1117. popPwaBonus: 0,
  1118. outLimit: null,
  1119. withdrawChannel: null,
  1120. freeChannel: null,
  1121. slotsPartner: [],
  1122. pwaBonusStatus: REQ_STATUS.NONE,
  1123. sharePop: null,
  1124. googleRedirectH5: null,
  1125. googleRedirectJumpApk: 0,
  1126. googleRedirectH5Bonus: null,
  1127. //fb/ins浏览器延迟跳转:0=关闭 1=组件级拦截(提款表单/支付下单时) 2=路由级拦截(进入 #/freewithdraw 或 #/paymentmethods 时)
  1128. jumplater: 0,
  1129. vipUpgrade: null,
  1130. vipStatus: { status: VIPStatus.Trial, alpha: 0, leftDays: 0 },
  1131. fbGuideWeight: {},
  1132. },
  1133. reducers: {
  1134. logout: (state, action) => {
  1135. onLogout(state);
  1136. },
  1137. updateUserInfo: (state, action) => {
  1138. parseLogin(state, action, {}, false);
  1139. },
  1140. updateUserScore: (state, action) => {
  1141. let score = action.payload;
  1142. if (score != null) {
  1143. if (state.userInfo) state.userInfo.Score = Number(score);
  1144. }
  1145. },
  1146. updateAddScore: (state, action) => {
  1147. let score = action.payload;
  1148. if (score != null) {
  1149. if (state.userInfo) state.userInfo.Score = state.userInfo.Score + Number(score);
  1150. }
  1151. },
  1152. updateUserBalance: (state, action) => {
  1153. const score = Number(action.payload);
  1154. if (!Number.isFinite(score) || !state.userInfo) return;
  1155. if ((state.userInfo.vip || 0) > 0) {
  1156. state.userInfo.Score = score;
  1157. }
  1158. else {
  1159. state.userInfo.InsureScore = score;
  1160. if (state.freeWithdrawInfo) {
  1161. state.freeWithdrawInfo.InsureScore = score;
  1162. }
  1163. }
  1164. },
  1165. updateGameLike: (state, action) => {
  1166. let payload = action.payload;
  1167. let id = payload.id;
  1168. let like = payload.like;
  1169. let favorites = state.favorites;
  1170. let index = favorites.indexOf(id);
  1171. if (like) {
  1172. if (index === -1) {
  1173. favorites.push(id);
  1174. state.favorites = favorites;
  1175. }
  1176. }
  1177. else {
  1178. let index = favorites.indexOf(id);
  1179. if (index !== -1) {
  1180. favorites.splice(index, 1);
  1181. state.favorites = favorites;
  1182. }
  1183. }
  1184. },
  1185. onSliceChangeUser: (state, action) => {
  1186. state.favorites = [];
  1187. },
  1188. updateCurrGame: (state, action) => {
  1189. state.gameID = action.payload;
  1190. },
  1191. updateServerKick: (state, action) => {
  1192. state.serverKick = action.payload;
  1193. },
  1194. updateOpenPay: (state, action) => {
  1195. state.openPay = action.payload;
  1196. },
  1197. updateGameRoute: (state, action) => {
  1198. let route = state.allMap[ROUTE_PATH.GAME + "/*"];
  1199. if (route != null) {
  1200. let type = action.payload;
  1201. route.type = type;
  1202. }
  1203. },
  1204. updateGameCardInfo: (state, action) => {
  1205. let { data, level } = action.payload;
  1206. if (data != null) {
  1207. if (level == null) level = 0;
  1208. let id = data.id;
  1209. state.gameCardInfo[id] = { ...data, level };
  1210. }
  1211. },
  1212. updateAreaID: (state, action) => {
  1213. let areaID = action.payload;
  1214. global.setLocalAreaID(areaID);
  1215. },
  1216. updateHolidaysGiftSpinTimes: (state, action) => {
  1217. let { left_times } = action.payload;
  1218. if (left_times != null) {
  1219. state.holidaysGiftInfo.user.left_times = left_times;
  1220. }
  1221. },
  1222. updateHolidaysActSpinTimes: (state, action) => {
  1223. let { left_times } = action.payload;
  1224. if (left_times != null) {
  1225. state.holidaysActInfo.user.left_times = left_times;
  1226. }
  1227. },
  1228. changeOldAccount: (state, action) => {
  1229. localStorageSet(LOCAL_LAST_LOGIN_TYPE, APP_LOGIN_TYPE.SMS);
  1230. localStorageSet(LOCAL_SIGN, state.oldUserInfo.sign);
  1231. window.location.reload();
  1232. },
  1233. viewedVipBenefits: (state, action) => {
  1234. const key = action.payload;
  1235. if (!key || !state.vipUpgrade) return;
  1236. let previews = state.vipUpgrade.previews;
  1237. if (!previews || !previews[key]) return;
  1238. delete previews[key];
  1239. state.vipUpgrade.active = Object.keys(previews).length > 0;
  1240. },
  1241. clearVIPUpgrade: (state, action) => {
  1242. state.vipUpgrade = null;
  1243. },
  1244. clearGoogleRedirectH5Bonus: (state) => {
  1245. state.googleRedirectH5Bonus = null;
  1246. },
  1247. testVipUpgrade: (state, action) => {
  1248. const { prevLv, vip } = action.payload;
  1249. parseVipUpgrade(state, prevLv, vip);
  1250. }
  1251. },
  1252. extraReducers: (builder) => {
  1253. // Add reducers for additional action types here, and handle loading state as needed
  1254. buildReqReducer(builder, reqGetRoutes, reducerRoutes, routesStatus);
  1255. buildReqReducer(builder, reqLogin, reducerLogin, loginStatus);
  1256. buildReqReducer(builder, reqRegister, reducerReg, regStatus);
  1257. buildReqReducer(builder, reqRegisterGold, reducerRegGold, regGoldStatus);
  1258. buildReqReducer(builder, reqLogout, reducerLogout, logoutStatus);
  1259. buildReqReducer(builder, reqChangePass, reducerChangePass, changePassStatus);
  1260. buildReqReducer(builder, reqChangeInfo, reducerChangeInfo, changeInfoStatus);
  1261. buildReqReducer(builder, reqChangePhone, reducerChangePhone, changePhoneStatus);
  1262. buildReqReducer(builder, reqChangeEmail, reducerChangeEmail, changeEmailStatus);
  1263. buildReqReducer(builder, reqGameInfo, reducerGameInfo, gameInfoStatus);
  1264. buildReqReducer(builder, reqCustomService, reducerCustom, customStatus);
  1265. buildReqReducer(builder, reqCustomLeaveMsg, reducerCustomLeaveMsg, customLeaveMsgStatus);
  1266. buildReqReducer(builder, reqUpdateFavoInfo, reducerUpdateFavoInfo, null);
  1267. buildReqReducer(builder, reqFavoGet, reducerFavoGet, null);
  1268. buildReqReducer(builder, reqGameCardInfo, reducerGameCardInfo, gameCardInfoStatus);
  1269. buildReqReducer(builder, reqSendCode, reducerSendCode, sendCodeStatus);
  1270. buildReqReducer(builder, reqBindSMS, reducerBindSMS, bindSMSStatus);
  1271. buildReqReducer(builder, reqSMSLogin, reducerSMSLogin, smsLoginStatus);
  1272. buildReqReducer(builder, reqForgetPass, reducerChangePass, changePassStatus);
  1273. buildReqReducer(builder, reqFreeWithdraw, reducerFreeWithdraw, null);
  1274. buildReqReducer(builder, reqFreeWithdrawMission, reducerFreeWithdrawMission, null);
  1275. buildReqReducer(builder, reqFreeWithdrawClaim, reducerFreeWithdrawClaim, updateFreeWithdrawClaimStatus);
  1276. buildReqReducer(builder, reqFreeBonusGiftInfo, reducerFreeBonusGiftInfo, null);
  1277. buildReqReducer(builder, reqHolidaysGiftInfo, reducerHolidaysGiftInfo, null);
  1278. buildReqReducer(builder, reqHolidaysActInfo, reducerHolidaysActInfo, null);
  1279. buildReqReducer(builder, reqGetPwaBonus, reducerGetPwaBonus, getPwaBonusStatus);
  1280. buildReqReducer(builder, reqCheckinCheck, reducerCheckinCheck);
  1281. buildReqReducer(builder, reqProtectCheck, reducerProtectCheck);
  1282. buildReqReducer(builder, reqEnterGameInterval, reducerGameInterval);
  1283. buildReqReducer(builder, reqCountryCode, reducerCountryCode, null);
  1284. buildReqReducer(builder, reqVerifyOldCode, reducerVerifyCode, setVerifyCodeStatus);
  1285. buildReqReducer(builder, reqChangeBindPhone, reducerChangeBindPhone, setChangeBindPhoneStatus);
  1286. buildReqReducer(builder, reqChangeLimitInfo, reducerChangeLimitInfo, null);
  1287. buildReqReducer(builder, reqResetLoginState, reducerResetLogin, null);
  1288. },
  1289. });
  1290. export const { logout, updateUserInfo, updateUserScore, updateAddScore, updateUserBalance, updateGameLike, updateCurrGame, updateServerKick, updateOpenPay, updateGameRoute, updateGameCardInfo, updateAreaID, updateHolidaysGiftSpinTimes, changeOldAccount, updateHolidaysActSpinTimes, viewedVipBenefits, clearVIPUpgrade, clearGoogleRedirectH5Bonus, testVipUpgrade } = Main.actions;
  1291. //数据获取
  1292. export const getFetchStatus = (state) => {
  1293. return state.main.status;
  1294. };
  1295. export const routesMap = (state) => {
  1296. return state.main.allMap;
  1297. };
  1298. export const routesIn = (state) => {
  1299. return state.main.inRoutes;
  1300. };
  1301. export const routesPop = (state) => {
  1302. return state.main.popRoutes;
  1303. };
  1304. export const nBlocks = (state) => {
  1305. return state.main.blockNavs;
  1306. };
  1307. export const allNavs = (state) => {
  1308. return state.main.allNavs;
  1309. };
  1310. export const allTopNavs = (state) => {
  1311. return state.main.allTopNavs;
  1312. };
  1313. const EMPTY_ROUTE = Object.freeze({});
  1314. const getRouteFromPath = (state, path) => {
  1315. let allMap = routesMap(state);
  1316. let route = allMap[path];
  1317. if (route == null) {
  1318. //查看是否有可变路由
  1319. let paths = path.split("/");
  1320. paths[paths.length - 1] = "*";
  1321. let newpath = paths.join("/");
  1322. route = allMap[newpath];
  1323. }
  1324. return route;
  1325. };
  1326. export const getRoute = (path) => (state) => {
  1327. let route = getRouteFromPath(state, path);
  1328. if (route == null) return EMPTY_ROUTE;
  1329. return route;
  1330. };
  1331. export const getRouteChain = (path) => createSelector(
  1332. [routesMap],
  1333. (map) => {
  1334. const list = [];
  1335. const addRouteChain = (currentPath) => {
  1336. const route = map[currentPath];
  1337. if (route != null) {
  1338. list.unshift(route);
  1339. if (route.ppath != null && route.ppath !== "") {
  1340. addRouteChain(route.ppath);
  1341. }
  1342. }
  1343. };
  1344. addRouteChain(path);
  1345. return list;
  1346. }
  1347. );
  1348. export const getRouteStyles = (state) => {
  1349. let styles = state.main.styles;
  1350. return styles;
  1351. };
  1352. export const getBlockColumn = (state) => {
  1353. let blocks = state.main.blocks;
  1354. return blocks;
  1355. };
  1356. export const isFullRoute = (path) => (state) => {
  1357. let route = getRouteFromPath(state, path);
  1358. if (route) return route.type === ROUTE_TYPE_FULL;
  1359. return false;
  1360. };
  1361. export const isPopRoute = (path) => (state) => {
  1362. let route = getRouteFromPath(state, path);
  1363. if (route) return route.type === ROUTE_TYPE_POP;
  1364. return false;
  1365. };
  1366. export const isInRoute = (path) => (state) => {
  1367. let route = getRouteFromPath(state, path);
  1368. if (route) return route.type === ROUTE_TYPE_IN;
  1369. return false;
  1370. };
  1371. export const isOutRoute = (path) => (state) => {
  1372. let route = getRouteFromPath(state, path);
  1373. if (route) return route.type === ROUTE_TYPE_OUTLINK;
  1374. return false;
  1375. };
  1376. //login
  1377. export const getLoginStatus = (state) => {
  1378. return state.main.loginStatus.login;
  1379. };
  1380. export const getRegStatus = (state) => {
  1381. return state.main.loginStatus.register;
  1382. };
  1383. export const getRegGoldStatus = (state) => {
  1384. return state.main.loginStatus.regGold;
  1385. };
  1386. export const getLogoutStatus = (state) => {
  1387. return state.main.loginStatus.logout;
  1388. };
  1389. export const getSendCodeStatus = (state) => {
  1390. return state.main.loginStatus.send_code;
  1391. };
  1392. export const getSendCodeMapStatus = (state) => {
  1393. return state.main.loginStatus.sendCodeMaps;
  1394. };
  1395. export const getBindSMSStatus = (state) => {
  1396. return state.main.loginStatus.bind;
  1397. };
  1398. export const getSMSLoginStatus = (state) => {
  1399. return state.main.loginStatus.smslogin;
  1400. };
  1401. export const getSendCodeTS = (state, phone) => {
  1402. return state.main.otpTimeStamp;
  1403. };
  1404. export const getSendCodeTSMap = (state, phone) => {
  1405. return state.main.otpTsMap;
  1406. };
  1407. //modify
  1408. export const getChangeInfoStatus = (state) => {
  1409. return state.main.modifyStatus.info;
  1410. };
  1411. export const getChangePassStatus = (state) => {
  1412. return state.main.modifyStatus.password;
  1413. };
  1414. export const getChangePhoneStatus = (state) => {
  1415. return state.main.modifyStatus.phone;
  1416. };
  1417. export const getChangeEmailStatus = (state) => {
  1418. return state.main.modifyStatus.email;
  1419. };
  1420. export const isLogined = (state) => {
  1421. return state.main.isLogin;
  1422. };
  1423. export const getUserInfo = (state) => {
  1424. return state.main.userInfo;
  1425. };
  1426. export const getOldUserInfo = (state) => {
  1427. return state.main.oldUserInfo;
  1428. };
  1429. export const getUserVip = (state) => {
  1430. let userInfo = state.main.userInfo;
  1431. if (userInfo != null) return userInfo.vip || 0;
  1432. return 0;
  1433. };
  1434. export const getUserInsureScore = (state) => {
  1435. if (state.main.freeWithdrawInfo) {
  1436. return state.main.freeWithdrawInfo.InsureScore;
  1437. }
  1438. let userInfo = state.main.userInfo;
  1439. if (userInfo != null) return userInfo.InsureScore;
  1440. return 0;
  1441. };
  1442. export const getUserID = (state) => {
  1443. let uid = -1;
  1444. let userInfo = state.main.userInfo;
  1445. if (userInfo) {
  1446. if (userInfo.UserID != null) uid = Number(userInfo.UserID);
  1447. else uid = 0;
  1448. }
  1449. return uid;
  1450. };
  1451. export const getCustomInfo = (state) => {
  1452. return state.main.customerInfo;
  1453. };
  1454. export const getCustomTypeInfo = (type) => (state) => {
  1455. let item = null;
  1456. let customerInfo = state.main.customerInfo;
  1457. if (customerInfo) {
  1458. for (let i = 0; i < customerInfo.length; i++) {
  1459. let info = customerInfo[i];
  1460. if (info.StatusName === type) {
  1461. item = info;
  1462. break;
  1463. }
  1464. }
  1465. }
  1466. return item;
  1467. };
  1468. export const getCustomStatus = (state) => {
  1469. return state.main.customLeaveMsgStatus;
  1470. };
  1471. export const getCustomServiceStatus = (state) => {
  1472. return state.main.customServiceStatus;
  1473. };
  1474. export const getHallServerUrl = (state) => {
  1475. return state.main.hallServerUrl;
  1476. };
  1477. export const getGameLikes = (state) => {
  1478. return state.main.favorites;
  1479. };
  1480. export const getGameLike = (id) => (state) => {
  1481. let favorites = state.main.favorites;
  1482. if (favorites.includes(id)) return 1;
  1483. return 0;
  1484. };
  1485. export const getKickState = (state) => {
  1486. return state.main.serverKick;
  1487. };
  1488. export const getPromoteInstall = (state) => {
  1489. return state.main.promoteInstall;
  1490. };
  1491. export const getPopWheel = (state) => {
  1492. return state.main.popWheel;
  1493. };
  1494. export const getOpenPay = (state) => {
  1495. return state.main.openPay;
  1496. };
  1497. export const getGameCardInfo = (id) => (state) => {
  1498. id = Number(id);
  1499. return state.main.gameCardInfo[id];
  1500. };
  1501. export const getIsGuest = (state) => {
  1502. return state.main.guest;
  1503. };
  1504. export const getIsBindPhone = (state) => {
  1505. let phone = "";
  1506. if (state.main.userInfo != null) {
  1507. phone = state.main.userInfo.Phone || "";
  1508. }
  1509. return phone.length > 0;
  1510. };
  1511. export const getBindPhone = (state) => {
  1512. const userInfo = getUserInfo(state);
  1513. return userInfo?.Phone;
  1514. }
  1515. export const getUpgradeBonus = (state) => {
  1516. return state.main.upgradeBonus;
  1517. };
  1518. export const getreRisterBonus = (state) => {
  1519. return state.main.registerBonus;
  1520. };
  1521. export const getreRecommendGame = (state) => {
  1522. return state.main.recommendGame;
  1523. };
  1524. export const getServiceLink = (state) => {
  1525. return state.main.serviceLink;
  1526. };
  1527. export const getPopBindPhone = (state) => {
  1528. return state.main.popBindPhone;
  1529. };
  1530. export const getFirstBonus = (state) => {
  1531. return state.main.firstBonus;
  1532. };
  1533. export const getOpenRelief = (state) => {
  1534. return state.main.openRelief;
  1535. };
  1536. export const getBBConf = (state) => {
  1537. return state.main.bbConf;
  1538. };
  1539. export const getAccountLogin = (state) => {
  1540. return state.main.accountLogin;
  1541. };
  1542. export const getArea = (state) => {
  1543. return state.main.area;
  1544. };
  1545. export const getUserBBToken = (state) => {
  1546. let token = null;
  1547. let userInfo = state.main.userInfo;
  1548. if (userInfo) {
  1549. if (userInfo.bb != null && userInfo.bb.token != null) token = userInfo.bb.token;
  1550. }
  1551. return token;
  1552. };
  1553. export const getUserLang = (state) => {
  1554. let lang = "";
  1555. let userInfo = state.main.userInfo;
  1556. if (userInfo) {
  1557. lang = userInfo.lang;
  1558. }
  1559. return lang;
  1560. };
  1561. export const getUserNick = (state) => {
  1562. let nick = "";
  1563. let userInfo = state.main.userInfo;
  1564. if (userInfo) {
  1565. nick = userInfo.NickName;
  1566. }
  1567. return nick;
  1568. };
  1569. export const getUserRegisted = (state) => {
  1570. let userInfo = state.main.userInfo;
  1571. if (userInfo) {
  1572. return Number(userInfo.Registed) === 1;
  1573. }
  1574. return false;
  1575. };
  1576. export const getLoginOpen = (state) => {
  1577. return state.main.loginOpen;
  1578. };
  1579. export const getRegisterOpen = (state) => {
  1580. return state.main.registerOpen;
  1581. };
  1582. export const getPopFirst = (state) => {
  1583. return state.main.popFirst;
  1584. };
  1585. export const getShowInstall = (state) => {
  1586. return state.main.showInstall;
  1587. };
  1588. export const getDownloadConf = (state) => {
  1589. return state.main.download;
  1590. };
  1591. export const getVipConfig = (state) => {
  1592. return state.main.vipConfig;
  1593. };
  1594. export const getVipUpgrade = (state) => {
  1595. return state.main.vipUpgrade;
  1596. }
  1597. const DefaultVipStatus = {
  1598. status: VIPStatus.Trial,
  1599. curAlpha: 0,
  1600. fullAlpha: 0,
  1601. leftDays: 0,
  1602. levelDownDay: 0,
  1603. expireDay: 0,
  1604. }
  1605. export const getVipStatus = (state) => {
  1606. return state.main.vipStatus || DefaultVipStatus;
  1607. }
  1608. //数据获取
  1609. export default Main.reducer;
  1610. export const getBFP = () => {
  1611. return async (dispatch, getState) => {
  1612. //Finger2 添加指纹
  1613. global.FF = await getFinger2DeviceId();
  1614. let bfp = "";
  1615. if (window.Capacitor?.isNativePlatform?.()) {
  1616. bfp = window.AndroidAdjust?.getAdid();
  1617. } else {
  1618. bfp = localStorageGet(LOCAL_VISTOR_ID, "");
  1619. }
  1620. if (bfp != null && bfp !== "") {
  1621. global.BFP = bfp;
  1622. return bfp;
  1623. }
  1624. bfp = uuidv4();
  1625. localStorageSet(LOCAL_VISTOR_ID, bfp);
  1626. global.BFP = bfp;
  1627. return bfp;
  1628. };
  1629. };
  1630. export const getFreeWithdraw = (state) => {
  1631. return state.main.freeWithdrawInfo;
  1632. };
  1633. export const getFreeWithdrawMission = (state) => {
  1634. return state.main.freeWithdrawMission;
  1635. };
  1636. export const getFreeBonusGiftInfo = (state) => {
  1637. return state.main.freeBonusGiftInfo;
  1638. };
  1639. export const checkFreeBonusGift = (state) => {
  1640. const freeBonusGift = getFreeBonusGiftInfo(state);
  1641. if (!freeBonusGift) return false;
  1642. const list = freeBonusGift.list;
  1643. if (!list || !Array.isArray(list)) return false;
  1644. return list.length > 0;
  1645. }
  1646. export const getHolidaysGiftInfo = (state) => {
  1647. return state.main.holidaysGiftInfo;
  1648. };
  1649. export const getHolidaysActInfo = (state) => {
  1650. return state.main.holidaysActInfo;
  1651. };
  1652. export const checkHolidaysActInfo = (state) => {
  1653. const holidayAct = getHolidaysActInfo(state);
  1654. if (!holidayAct) return false;
  1655. const list = holidayAct.recharge_rules;
  1656. if (!list || !Array.isArray(list)) return false;
  1657. return list.length > 0;
  1658. }
  1659. export const getLandscapeGames = (state) => {
  1660. return state.main.landscapeGames;
  1661. }
  1662. export const getPopPwaBonus = (state) => {
  1663. return state.main.popPwaBonus;
  1664. }
  1665. export const getPwaCliamStatus = (state) => {
  1666. return state.main.pwaBonusStatus;
  1667. }
  1668. export const getOutLimit = (state) => {
  1669. return state.main.outLimit;
  1670. }
  1671. export const getwithdrawChannel = state => state.main.withdrawChannel;
  1672. export const getFreeChannel = state => state.main.freeChannel;
  1673. export const getSlotsPartner = (state) => {
  1674. return state.main.slotsPartner;
  1675. }
  1676. export const getSharePopConf = state => state.main.sharePop;
  1677. export const getJumpLater = state => state.main.jumplater;
  1678. export const getGoogleRedirectH5Conf = state => state.main.googleRedirectH5;
  1679. export const getGoogleRedirectJumpApk = state => state.main.googleRedirectJumpApk;
  1680. export const getGoogleRedirectH5BonusConf = state => state.main.googleRedirectH5Bonus;
  1681. export const getFBGuideWeight = state => state.main.fbGuideWeight;
  1682. export const getVerifyCodeStatus = state => state.main.verifyCodeStatus;
  1683. export const getChangeBindPhoneStatus = state => state.main.changeBindPhoneStatus;
  1684. export const getChangeLimitInfo = state => state.main.changeLimit;
  1685. export const getIsAutoEnterGame = state => state.main.isAutoEnterGame;
  1686. export const getJumpToH5 = state => state.main.jumpToH5;