/******************************************************************************* * * 活动: 每日首次充值 * * ******************************************************************************/ const ActBase = require( "act.base" ); const ActDayCharge = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { // // 前端准备完毕 this.RegisterProtocal( 21010, this.GetDailyChargeStatus.bind( this ) ); this.RegisterProtocal( 21011, this.GetDailyChargeBack.bind( this ) ); }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ this.data.config,//付費活動 ] this.loadConfigs( cfgs, ( _ret, _data ) =>{ this.reqDailyFChargeData( _cb ); // nx.dt.fnInvoke( _cb, true ); } ) }, // 请求每日首次充值數據 reqDailyFChargeData: function( _cb ) { this.SendProtocal( 21010, {}, _cb ); }, GetDailyChargeStatus: function( _data ){ nx.bridge.acts.vset( "dailyfirstCharge", _data ); this.openTip( "reward", _data.status == 1 ); }, GetDailyChargeBack: 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(); }, reqGetDailyFirstc: function( ){ let protocal = {}; this.SendProtocal( 21011, protocal ); }, } ); // 模块导出 module.exports = ActDayCharge;