CashNormalData.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import { Data } from "../../../mk/data/Data";
  2. import JsbSystem from "../../../mk/system/JsbSystem";
  3. /**
  4. * 红包提现数据
  5. * @author 薛鸿潇
  6. */
  7. export class CashNormalData extends Data {
  8. public init() {
  9. // this.initTestData();// 假数据
  10. // 提现记录数据
  11. this.getRecord()
  12. }
  13. public async getRecord() {
  14. let response = await mk.http.sendData('getCashRecord', {});
  15. if (response.errcode != 0) {
  16. return;
  17. }
  18. console.log(response.data);
  19. if (response.data) {
  20. response.data.forEach(item_data => {
  21. for (const key in item_data) {
  22. if (key != 'withdrawalCode') {
  23. item_data[key] = parseInt(item_data[key]);
  24. }
  25. }
  26. });
  27. this.list_data = response.data;
  28. this.initReceipTotalRMB();
  29. this.update_list = true;
  30. }
  31. if(gData.gameData.adShowConfig.average_ecpm >= 50){
  32. if(this.list_data.length >= 1){
  33. let isSave = mk.storage.getStorage("ecpm");
  34. if(!isSave){
  35. JsbSystem.addJGTags("ecpm大于50");
  36. mk.storage.setStorage("ecpm", 1);
  37. }
  38. }
  39. }else{
  40. let isSave = mk.storage.getStorage("ecpm");
  41. if(isSave){
  42. JsbSystem.deleteTags("ecpm大于50");
  43. cc.sys.localStorage.removeItem("ecpm大于50");
  44. }
  45. }
  46. }
  47. /** 数据列表 */
  48. public list_data: Array<TCashList> = [];
  49. public update_list:boolean = false;
  50. /**
  51. * 标志位 - 是否刷新样式
  52. */
  53. public init_rmb_style = true;
  54. private _receip_total_rmb: number = 0;
  55. /**
  56. * 到账毛币总数
  57. * - 单位 分
  58. */
  59. set receip_total_rmb(value: number) {
  60. this._receip_total_rmb = value;
  61. this.init_rmb_style = true;
  62. }
  63. get receip_total_rmb() {
  64. return this._receip_total_rmb;
  65. }
  66. /**
  67. * 初始化提现总数
  68. */
  69. private initReceipTotalRMB() {
  70. let temp_total_count = 0;
  71. const count = this.list_data.length;
  72. for (let i = 0; i < count; i++) {
  73. temp_total_count += this.list_data[i].amount;
  74. }
  75. this.receip_total_rmb = temp_total_count;
  76. }
  77. /** 客户端造 假数据 */
  78. private initTestData() {
  79. for (let i = 0; i < 30; i++) {
  80. const id = i + 1;
  81. let obj = {
  82. /** 档位 */
  83. cashType: mk.math.random(1, 10),
  84. applyTime: 1623399160,
  85. amount: i * 10,
  86. remain: i * 1000,
  87. CashMode: i % 2,
  88. /** 红包码 */
  89. withdrawalCode: 'AABBC' + i,
  90. }
  91. this.list_data.push(obj);
  92. }
  93. }
  94. /**
  95. * 获取存在红包码的 数据列表
  96. */
  97. public getListDataHavCode() {
  98. let new_list_data = [];
  99. const l_count = this.list_data.length;
  100. for (let i = 0; i < l_count; i++) {
  101. if (this.list_data[i].withdrawalCode) {
  102. new_list_data.push(this.list_data[i]);
  103. }
  104. }
  105. return new_list_data;
  106. }
  107. // public cash_type = ['', 'BOSS提现', '每日提现', '夺宝提现', '钱庄提现', '招募任务提现', '每日招募提现', '累计招募提现', '', '彩蛋提现', '福袋提现', '福袋提现'];
  108. /** 提现类型 */
  109. public cash_type = {
  110. 1: '红包提现',// 常规提现
  111. 2: '每日提现',
  112. 3: '夺宝提现',
  113. 4: '富翁银行提现',
  114. 5: '裂变任务提现',
  115. 6: '裂变每日提现',
  116. 7: '裂变累计提现',
  117. 8: '彩蛋任务提现',
  118. 9: '常规彩蛋任务提现',
  119. 10: '福袋提现',// 视频红包提现
  120. 11: '大额福袋',// 视频红包提现(公众号)
  121. 12: '存钱罐提现',
  122. 13: '签到提现',// 现金提现
  123. }
  124. }
  125. /**
  126. * 提现记录类型
  127. */
  128. export type TCashList = {
  129. /**
  130. * 提现类型
  131. */
  132. cashType: number,
  133. /** 提现时间 */
  134. applyTime: number,
  135. /** 提现金额,单位分 */
  136. amount: number,
  137. /** 剩余红包币,1元===10000红包币 */
  138. remain: number,
  139. /** 2:有红包码,其他无红包码 */
  140. CashMode: number,
  141. /** 红包码 */
  142. withdrawalCode: string,
  143. }