GradeRewardData.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @description 等级奖励数据
  3. */
  4. import { Data } from "../../../mk/data/Data";
  5. import { ExpAddType, GameProp } from "../GameData";
  6. const { ccclass } = cc._decorator;
  7. @ccclass
  8. export class GradeRewardData extends Data {
  9. //提现id
  10. private cashId: number;
  11. public changeExp = false;
  12. /**
  13. * 等级奖励提现
  14. * @param cb 提现回调
  15. */
  16. public async HttpCashOut(id: number) {
  17. this.cashId = id;
  18. let data = { id: this.cashId };
  19. let response = await mk.http.sendData('farmGrade/farmGradeCash', data);
  20. if (response.errcode != 0) {
  21. return null;
  22. }
  23. gData.gameData.gameData.farmGradeData = response.data.userFarmGrageRewardInfo
  24. //const rewardNum = Math.round(gData.blessingBag.taskRbNum * 100);
  25. gData.receiptNotice.receip_rmb = 30;
  26. mk.ui.openPanel('module/newNotice/newNotice');
  27. return response
  28. }
  29. /**
  30. * 加进度
  31. */
  32. async addGradeExp() {
  33. let data = { "expAddType": ExpAddType.EAT_video };
  34. let response = await mk.http.sendData('farmGrade/updateFarmGrageInfo', data);
  35. if (response.errcode != 0) {
  36. return;
  37. }
  38. this.changeExp = true;
  39. gData.gameData.gameData.gradeLevel = response.data.farmLevel;
  40. gData.gameData.gameData.farmExpValue = response.data.userExp;
  41. gData.gameData.gameData.farmGradeData = response.data.userFarmGrageRewardInfo;
  42. }
  43. }