Commit 66c730f0 authored by 邱旭's avatar 邱旭

1

parent 6f00a0d1
......@@ -84,6 +84,8 @@ export enum NetName {
SCRATCH_DOHELP,
HBRAIN_BASEINFO,
GET_TASKINFO,
EXCHANGE_COIN,
GET_CLOUD_NUM,
}
\ No newline at end of file
......@@ -875,13 +875,13 @@ export class NetManager extends ABNetManager {
this.send(net);
}
public hc_redBombBaseInfo(callback: Function ): void {
public hc_redBombBaseInfo(callback: Function): void {
const net: INetData = {
name: 'hc_redBombBaseInfo',
uri: window['duiba'] + '/customActivity/happyclear/redBomb/baseInfo',
type: 'get',
dataType: 'json',
hideMsg:true,
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
},
......@@ -896,7 +896,7 @@ export class NetManager extends ABNetManager {
uri: window['duiba'] + '/customActivity/happyclear/redBomb/award',
type: 'post',
dataType: 'json',
hideMsg:true,
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
detect: window['detect'],
......@@ -936,12 +936,13 @@ export class NetManager extends ABNetManager {
uri: window['duiba'] + '/customActivity/happyclear/exchange',
type: 'post',
dataType: 'json',
hideMsg:true,
hideMsg: true,
param: d,
callback: callback
};
this.send(net);
}
public hc_getRecord(origins) {
return new Promise((r) => {
const param: any = {
......@@ -951,7 +952,7 @@ export class NetManager extends ABNetManager {
};
const net: INetData = {
name: 'hc_getRecord',
uri: window['duiba'] +'/crecord/getrecord',
uri: window['duiba'] + '/crecord/getrecord',
type: 'get',
dataType: 'json',
param: param,
......@@ -960,6 +961,7 @@ export class NetManager extends ABNetManager {
this.send(net);
})
}
public hc_turnableBaseInfo(callback: Function): void {
const d: any = {
activityId: DataManager.ins.customCfgData.actId
......@@ -969,12 +971,13 @@ export class NetManager extends ABNetManager {
uri: window['duiba'] + '/customActivity/happyclear/bigWheel/baseInfo',
type: 'get',
dataType: 'json',
hideMsg:true,
hideMsg: true,
param: d,
callback: callback
};
this.send(net);
}
// public hc_getBackReward(callback: Function): void {
// const d: any = {
// activityId: DataManager.ins.customCfgData.actId,
......@@ -1003,7 +1006,7 @@ export class NetManager extends ABNetManager {
uri: window['duiba'] + '/customActivity/happyclear/bigWheel/dojoin',
type: 'post',
dataType: 'json',
hideMsg:true,
hideMsg: true,
param: d,
callback: callback
};
......@@ -1371,43 +1374,45 @@ export class NetManager extends ABNetManager {
public hc_totalNumRank(callback: Function): void {
const net: INetData = {
name:'hc_totalNumRank',
uri: window['duiba']+'/customActivity/happyclear/totalNumRank',
name: 'hc_totalNumRank',
uri: window['duiba'] + '/customActivity/happyclear/totalNumRank',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId
},
hideMsg:true,
hideMsg: true,
callback: callback
};
this.send(net);
}
public hc_mapRank(callback: Function): void {
const net: INetData = {
name:'hc_mapRank',
uri: window['duiba']+'/customActivity/happyclear/mapRank',
name: 'hc_mapRank',
uri: window['duiba'] + '/customActivity/happyclear/mapRank',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId
},
hideMsg:true,
hideMsg: true,
callback: callback
};
this.send(net);
}
public hc_levelNumRank(callback: Function,levelNum): void {
public hc_levelNumRank(callback: Function, levelNum): void {
const net: INetData = {
name:'hc_levelNumRank',
uri: window['duiba']+'/customActivity/happyclear/levelNumRank',
name: 'hc_levelNumRank',
uri: window['duiba'] + '/customActivity/happyclear/levelNumRank',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
levelNum: levelNum
},
hideMsg:true,
hideMsg: true,
callback: callback
};
this.send(net);
......@@ -1415,14 +1420,14 @@ export class NetManager extends ABNetManager {
public hc_userInfo(callback: Function): void {
const net: INetData = {
name:'hc_userInfo',
uri: window['duiba']+'/customActivity/happyclear/userInfo',
name: 'hc_userInfo',
uri: window['duiba'] + '/customActivity/happyclear/userInfo',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId
},
hideMsg:true,
hideMsg: true,
callback: callback
};
this.send(net);
......@@ -1430,14 +1435,14 @@ export class NetManager extends ABNetManager {
public hc_advert(callback: Function): void {
const net: INetData = {
name:'hc_advert',
uri: window['duiba']+'/customActivity/happyclear/advert',
name: 'hc_advert',
uri: window['duiba'] + '/customActivity/happyclear/advert',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId
},
hideMsg:true,
hideMsg: true,
callback: callback
};
this.send(net);
......@@ -2033,7 +2038,7 @@ export class NetManager extends ABNetManager {
if(!net.hideMsg) {
GDispatcher.dispatchEvent(ABNetManager.ERROR, net);
showToast('网络开小差了,再试一次吧');
console.log('接口错误',net.uri)
console.log('接口错误', net.uri)
}
}
......@@ -2047,10 +2052,10 @@ export class NetManager extends ABNetManager {
public getShareCode(callback: Function): void {
const net: INetData = {
name: NetName.GET_SHARECODE,
uri: window['duiba'] +'/customActivity/happyclear/getShareCode',
uri: window['duiba'] + '/customActivity/happyclear/getShareCode',
type: 'get',
dataType: 'json',
hideMsg:true,
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
},
......@@ -2068,10 +2073,10 @@ export class NetManager extends ABNetManager {
public doHelp(callback: Function, shareCode: any, orderId: number): void {
const net: INetData = {
name: NetName.DO_HELP,
uri: window['duiba'] +'/customActivity/happyclear/doHelp',
uri: window['duiba'] + '/customActivity/happyclear/doHelp',
type: 'get',
dataType: 'json',
hideMsg:true,
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
shareCode: shareCode,
......@@ -2089,7 +2094,7 @@ export class NetManager extends ABNetManager {
public getInviteInfo(callback: Function): void {
const net: INetData = {
name: NetName.GET_INVATE_INFO,
uri: window['duiba'] +'/customActivity/happyclear/invitationInfo',
uri: window['duiba'] + '/customActivity/happyclear/invitationInfo',
type: 'get',
dataType: 'json',
param: {
......@@ -2107,7 +2112,7 @@ export class NetManager extends ABNetManager {
public acceptInvitationInfo(callback: Function): void {
const net: INetData = {
name: NetName.ACCEPT_INVITATION,
uri: window['duiba'] +'/customActivity/happyclear/acceptInvitationInfo',
uri: window['duiba'] + '/customActivity/happyclear/acceptInvitationInfo',
type: 'get',
dataType: 'json',
param: {
......@@ -2121,7 +2126,7 @@ export class NetManager extends ABNetManager {
public acceptInvitationPrize(callback: Function): void {
const net: INetData = {
name: NetName.ACCEPT_INVITATION,
uri: window['duiba'] +'/customActivity/happyclear/acceptInvitationPrize',
uri: window['duiba'] + '/customActivity/happyclear/acceptInvitationPrize',
type: 'get',
dataType: 'json',
hideMsg: true,
......@@ -2134,6 +2139,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// 消消乐刮刮卡 /////////////////////////////////////
/**
......@@ -2143,7 +2149,7 @@ export class NetManager extends ABNetManager {
public scratchGetTaskInfo(callback: Function): void {
const net: INetData = {
name: NetName.SCRATCH_GET_TASKINFO,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/getTaskInfo',
uri: window['duiba'] + '/customActivity/happyclear/scratchCard/getTaskInfo',
type: 'get',
dataType: 'json',
hideMsg: true,
......@@ -2163,13 +2169,13 @@ export class NetManager extends ABNetManager {
public scratchTakePrize(callback: Function, scratchCardTaskId): void {
const net: INetData = {
name: NetName.SCRATCH_TAKEPRIZE,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/takePrize',
uri: window['duiba'] + '/customActivity/happyclear/scratchCard/takePrize',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
scratchCardTaskId:scratchCardTaskId,
scratchCardTaskId: scratchCardTaskId,
detect: window['detect'],
deviceSessionId: window['_device_session_id']
},
......@@ -2186,13 +2192,13 @@ export class NetManager extends ABNetManager {
public scratchGetShareCode(callback: Function, scratchCardTaskId): void {
const net: INetData = {
name: NetName.SCRATCH_GET_SHARECODE,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/getShareCode',
uri: window['duiba'] + '/customActivity/happyclear/scratchCard/getShareCode',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
scratchCardTaskId:scratchCardTaskId
scratchCardTaskId: scratchCardTaskId
},
callback: callback
};
......@@ -2207,18 +2213,19 @@ export class NetManager extends ABNetManager {
public scratchDoHelp(callback: Function, shareCode): void {
const net: INetData = {
name: NetName.SCRATCH_DOHELP,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/doHelp',
uri: window['duiba'] + '/customActivity/happyclear/scratchCard/doHelp',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
shareCode:shareCode
shareCode: shareCode
},
callback: callback
};
this.send(net);
}
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// 消消乐红包雨 /////////////////////////////////////
/**
......@@ -2228,7 +2235,7 @@ export class NetManager extends ABNetManager {
public hbRainBaseInfo(callback: Function): void {
const net: INetData = {
name: NetName.HBRAIN_BASEINFO,
uri: window['duiba'] +'/customActivity/happyclear/redRain/baseInfo',
uri: window['duiba'] + '/customActivity/happyclear/redRain/baseInfo',
type: 'get',
dataType: 'json',
hideMsg: true,
......@@ -2239,10 +2246,11 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hbRainDoJoin(callback: Function, session, score): void {
const net: INetData = {
name: NetName.HBRAIN_BASEINFO,
uri: window['duiba'] +'/customActivity/happyclear/redRain/doJoin',
uri: window['duiba'] + '/customActivity/happyclear/redRain/doJoin',
type: 'post',
dataType: 'json',
hideMsg: true,
......@@ -2257,6 +2265,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////// 任务中心 /////////////////////////////////////
/**
......@@ -2266,7 +2275,7 @@ export class NetManager extends ABNetManager {
public getTaskInfo(callback: Function): void {
const net: INetData = {
name: NetName.GET_TASKINFO,
uri: window['duiba'] +'/customActivity/happyclear/taskSystem/getTaskInfo',
uri: window['duiba'] + '/customActivity/happyclear/taskSystem/getTaskInfo',
type: 'get',
dataType: 'json',
hideMsg: true,
......@@ -2286,13 +2295,13 @@ export class NetManager extends ABNetManager {
public taskAward(callback: Function, subActivityId): void {
const net: INetData = {
name: NetName.GET_TASKINFO,
uri: window['duiba'] +'/customActivity/happyclear/taskSystem/award',
uri: window['duiba'] + '/customActivity/happyclear/taskSystem/award',
type: 'post',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
subActivityId:subActivityId,
subActivityId: subActivityId,
detect: window['detect'],
deviceSessionId: window['_device_session_id']
},
......@@ -2300,5 +2309,40 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public getCloudNum(callback: Function): void {
const net: INetData = {
name: NetName.GET_CLOUD_NUM,
uri: window['duiba'] + '/customActivity/happyclear/cloudDrill/getCloudDrillBalance',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
},
callback: callback
};
this.send(net);
}
public exchangeCoin(callback: Function, coinAmount): void {
const net: INetData = {
name: NetName.EXCHANGE_COIN,
uri: window['duiba'] + '/customActivity/happyclear/cloudDrill/exchangeCoin',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
coinAmount: coinAmount,
detect: window['detect'],
deviceSessionId: window['_device_session_id']
},
callback: callback
};
this.send(net);
}
///////////////////////////////////////////////////////////////////////////////////
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { getlogItem } from "../Main";
import Utils from "../Utils";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
const MIN: number = 1;
const MAX: number = 100;
......@@ -24,7 +25,7 @@ export default class RechargePanel extends Panel {
private nowNumber: number = MIN; // 当前显示的数值
// private totalNum:number = 0; // 总共的数值
private totalNum: number = 0; // 总共的数值
private holdTimer = null;
private setNumTimer = null;
......@@ -134,7 +135,29 @@ export default class RechargePanel extends Panel {
private onTouchBtn(e: egret.TouchEvent) {
/// TODO 发接口兑换
NetManager.ins.clickLog(getlogItem(73));
if(this.nowNumber * 10 > this.totalNum) {
showToast('抱歉,您的云钻不足哦');
return;
}
this.btn.touchEnabled = false;
try {
if(window['getRST']) window['getRST']();
} catch(error) {
console.warn(error)
}
NetManager.ins.exchangeCoin((success, res) => {
this.btn.touchEnabled = true;
if(!success) {
showToast('网络开小差啦,请稍后再试');
return;
}
const data = res.data;
showToast('兑换成功,继续闯关吧');
PanelCtrl.instance.show('Shop');
NetManager.ins.hc_home(() => {
}, window['collectRuleId']);
}, this.nowNumber);
}
onTouchTap_closeBtn() {
......@@ -145,6 +168,14 @@ export default class RechargePanel extends Panel {
private getYunZuan() {
/// TODO 通过接口获取云钻数量并显示
this.zuanLabel.text = '我的云钻:0';
NetManager.ins.getCloudNum((success, res) => {
if(!success) {
return;
}
const data = res.data;
this.totalNum = data;
this.zuanLabel.text = `我的云钻:${data}`;
})
}
initEvents() {
......
......@@ -179,6 +179,13 @@ const config = {
'/customActivity/happyclear/taskSystem/award':{
data: './happyclear/taskAward.json'
},
//////////////////// 消消乐云钻兑换 ////////////////////
'/customActivity/happyclear/cloudDrill/getCloudDrillBalance':{
data: './happyclear/getCloudNum.json'
},
'/customActivity/happyclear/cloudDrill/exchangeCoin':{
data: './happyclear/exchangeCoin.json'
}
};
for (let item in config) {
......
{
"code": "0000000000",
"data": {
"changeCoin": 0,
"cloudDrillCost": 0,
"coinBalance": 0
},
"desc": "OK",
"success": true,
"timestamp": 1576225291430
}
\ No newline at end of file
{
"code": "0000000000",
"data": 999,
"desc": "OK",
"success": true,
"timestamp": 1576225291348
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment