/******************************************************************************* * * 活动: 開服活動 钻石周卡 * * ******************************************************************************/ const ActBase = require( "act.base" ); const DiamondCardMod = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { // // 前端准备完毕 this.RegisterProtocal( 16720, this.GetDiamondCardInfo.bind( this ) ); this.RegisterProtocal( 16721, this.GetDiamondCardRewardBack.bind( this ) ); this.RegisterProtocal( 16722, this.GetDiamondCardFreeRewardBack.bind( this ) ); }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ this.data.config,//付費活動 ] this.loadConfigs( cfgs, ( _ret, _data ) =>{ // this.reqBaseData( _cb ); nx.dt.fnInvoke( _cb, true ); this.reqDiamondCardData(); } ) }, getConfig: function(){ return this.data.config; }, // 请求每日首次充值數據 reqDiamondCardData: function( _cb ) { this.SendProtocal( 16720, {}, _cb ); }, GetDiamondCardInfo: function( _data ){ let count = 0; let list = _data.list; if( nx.dt.arrNEmpty( list ) ){ list.forEach( _award =>{ if( _award.status == 1 ){ count ++; } } ) } if( nx.dt.arrNEmpty( _data.list1 ) ){ _data.list1.forEach( _award =>{ if( _award.status == 0 ){ count ++; } } ) } this.openTip( "reward", count > 0 ); this.vset( "DiamondCard", _data ); // {"list":[],"list1":[{"week_id":11016,"status":0}] }, reqGetAward: function( _id ) { this.SendProtocal( 16721, { week_id : _id } ); }, GetDiamondCardRewardBack: function( _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( _data ){ }, reqGetFreeAward: function( _id ) { this.SendProtocal( 16722, { week_id : _id } ); }, GetDiamondCardFreeRewardBack: function( _data ){ }, } ); // 模块导出 module.exports = DiamondCardMod;