WalletCashOutData.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /**
  2. * @description 提现数据
  3. */
  4. import { Data } from "../../../mk/data/Data";
  5. import { AdFun } from "../AdData";
  6. import { DataEventId } from "../GameData";
  7. export class WalletCashOutData extends Data {
  8. public init_novice = false;
  9. public init_cashOut = false;
  10. public curID = 0;
  11. public async HttpCashOut(value: number) {
  12. // gData.cashPro.openCashPro(value);
  13. let data = {};
  14. let response = await mk.http.sendData('noviceWeFare/noviceWeFareCash', data);
  15. mk.console.logSingle('wallet1=>', response);
  16. if (response.errcode != 0) {
  17. // gData.cashPro.init_fail = true;
  18. if (response.errcode == 405) {
  19. mk.tip.pop("今日提现额度已到上限,请明天再提现");
  20. mk.data.sendDataEvent(DataEventId.cashLimit, "提现触发上限");
  21. }
  22. return null;
  23. }
  24. this.init_novice = true;
  25. gData.gameData.playerProp.userNoviceWeFareInfo = response.data.userNoviceWeFareInfo;
  26. // gData.cashPro.init_success = true;
  27. gData.receiptNotice.receip_rmb = value;
  28. mk.ui.openPanel('module/newNotice/newNotice');
  29. //gData.safeDepositBoxData.updateQipao();
  30. gData.cashNormal.getRecord();
  31. gData.gameData.doPointToXYLogic();
  32. //gData.gameData.addCashOutTimes();
  33. }
  34. async addProgress() {
  35. let data = {};
  36. let response = await mk.http.sendData('noviceWeFare/updateNoviceWeFareInfo', data);
  37. if (response.errcode != 0) {
  38. return;
  39. }
  40. gData.gameData.playerProp.userNoviceWeFareInfo = response.data.userNoviceWeFareInfo;
  41. mk.tip.pop('现金进度已增加');
  42. this.init_novice = true;
  43. }
  44. async HttpCashOut2(id: number) {
  45. // gData.cashPro.openCashPro(0);
  46. this.curID = id;
  47. let data = { index: id };
  48. let response = await mk.http.sendData('redMoney/cashPay', data);
  49. mk.console.logSingle('wallet2=>', response);
  50. if (response.errcode != 0) {
  51. if (response.errcode == 405) {
  52. mk.tip.pop("今日提现额度已到上限,请明天再提现");
  53. mk.data.sendDataEvent(DataEventId.cashLimit, "提现触发上限");
  54. return;
  55. }
  56. if (response.data.count > 0) {
  57. // gData.cashPro.init_fail = true;
  58. gData.lineUpUIData.personCount = response.data.count;
  59. gData.lineUpUIData.cashId = id;
  60. gData.lineUpUIData.refresh = true;
  61. gData.lineUpUIData.popType = 0;
  62. mk.ui.openPanel("module/newNotice/lineUpUI");
  63. mk.data.sendDataEvent(DataEventId.queue, '触发插队人数');
  64. }
  65. return;
  66. } else {
  67. mk.ui.closePanel("lineUpUI");
  68. }
  69. gData.gameData.playerProp.redMoneyCashPayRecordList = response.data.redMoneyCashPayRecordList;
  70. this.init_cashOut = true;
  71. setTimeout(() => {
  72. this.init_cashOut = false;
  73. }, 500);
  74. let cashData = gData.gameData.configs.CashCfg;
  75. if (cashData) {
  76. gData.gameData.playerProp.redMoney -= cashData[id - 1].redMoney;
  77. // gData.cashPro.cashPro_money = cashData[id - 1].money;
  78. // gData.cashPro.init_success = true;
  79. gData.receiptNotice.receip_rmb = cashData[id - 1].money;
  80. mk.ui.openPanel('module/newNotice/newNotice');
  81. }
  82. //gData.safeDepositBoxData.updateQipao();
  83. gData.cashNormal.getRecord();
  84. mk.data.sendDataEvent(DataEventId.Sundry, '红包币提现成功');
  85. gData.gameData.doPointToXYLogic();
  86. //gData.gameData.addCashOutTimes();
  87. }
  88. /** 获取当前最小可提现金额,单位红包币
  89. * @returns 最小可提现需要的红包币
  90. */
  91. getMinCanCashMoney() {
  92. let redMoney = 0;
  93. if (gData.gameData.configs.CashCfg) {
  94. let data = gData.gameData.configs.CashCfg
  95. for (let i = 0; i != 6; ++i) {
  96. if (i < data.length) {
  97. let isRemainTimes = data[i].cashFrequency - gData.gameData.playerProp.getRedMoneyCashOutTimesByIndex(data[i].index);
  98. if (isRemainTimes) {
  99. redMoney = data[i].money * 100;
  100. break;
  101. }
  102. }
  103. }
  104. }
  105. return redMoney;
  106. }
  107. }