100 lines
2.8 KiB
JavaScript
100 lines
2.8 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'c4d2194+19Fs6fxS+k83+71', 'act.diamondcard.mod');
|
|
// Scripts/mod/acts/diamondcard/act.diamondcard.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动: 開服活動 钻石周卡
|
|
*
|
|
*
|
|
******************************************************************************/
|
|
|
|
var ActBase = require("act.base");
|
|
var DiamondCardMod = cc.Class({
|
|
"extends": ActBase,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
// 视图附着
|
|
nx.plugin.add(this, ["view"]);
|
|
this.vattach("Acts");
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
// // 前端准备完毕
|
|
this.RegisterProtocal(16720, this.GetDiamondCardInfo.bind(this));
|
|
this.RegisterProtocal(16721, this.GetDiamondCardRewardBack.bind(this));
|
|
this.RegisterProtocal(16722, this.GetDiamondCardFreeRewardBack.bind(this));
|
|
},
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = [this.data.config //付費活動
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
// this.reqBaseData( _cb );
|
|
nx.dt.fnInvoke(_cb, true);
|
|
_this.reqDiamondCardData();
|
|
});
|
|
},
|
|
getConfig: function getConfig() {
|
|
return this.data.config;
|
|
},
|
|
// 请求每日首次充值數據
|
|
reqDiamondCardData: function reqDiamondCardData(_cb) {
|
|
this.SendProtocal(16720, {}, _cb);
|
|
},
|
|
GetDiamondCardInfo: function GetDiamondCardInfo(_data) {
|
|
var count = 0;
|
|
var list = _data.list;
|
|
if (nx.dt.arrNEmpty(list)) {
|
|
list.forEach(function (_award) {
|
|
if (_award.status == 1) {
|
|
count++;
|
|
}
|
|
});
|
|
}
|
|
if (nx.dt.arrNEmpty(_data.list1)) {
|
|
_data.list1.forEach(function (_award) {
|
|
if (_award.status == 0) {
|
|
count++;
|
|
}
|
|
});
|
|
}
|
|
this.openTip("reward", count > 0);
|
|
this.vset("DiamondCard", _data);
|
|
// {"list":[],"list1":[{"week_id":11016,"status":0}]
|
|
},
|
|
|
|
reqGetAward: function reqGetAward(_id) {
|
|
this.SendProtocal(16721, {
|
|
week_id: _id
|
|
});
|
|
},
|
|
GetDiamondCardRewardBack: function GetDiamondCardRewardBack(_data) {
|
|
// {"code":1,"msg":"","day":1,"status":1}
|
|
if (_data.code == 1) {
|
|
|
|
// let data = nx.bridge.acts.vget( "sign30" );
|
|
// data.day = _data.day;
|
|
// data.status = _data.status;
|
|
// nx.bridge.acts.vset( "sign30", data );
|
|
}
|
|
// this.reqBaseData();
|
|
},
|
|
|
|
GetAssemblyFreeBack: function GetAssemblyFreeBack(_data) {},
|
|
reqGetFreeAward: function reqGetFreeAward(_id) {
|
|
this.SendProtocal(16722, {
|
|
week_id: _id
|
|
});
|
|
},
|
|
GetDiamondCardFreeRewardBack: function GetDiamondCardFreeRewardBack(_data) {}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = DiamondCardMod;
|
|
|
|
cc._RF.pop(); |