94 lines
2.3 KiB
JavaScript
94 lines
2.3 KiB
JavaScript
|
|
/*******************************************************************************
|
||
|
|
*
|
||
|
|
* 活动: 開服百抽
|
||
|
|
*
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
const ActBase = require( "act.base" );
|
||
|
|
const FID = require( "bridge.function.ids" );
|
||
|
|
|
||
|
|
|
||
|
|
const ActHundredDraw = cc.Class( {
|
||
|
|
|
||
|
|
extends: ActBase,
|
||
|
|
|
||
|
|
// 初始化配置数据
|
||
|
|
initConfig: function() {
|
||
|
|
|
||
|
|
// 视图附着
|
||
|
|
nx.plugin.add( this, [ "view" ] );
|
||
|
|
this.vattach( "Acts" );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 注册协议接受事件
|
||
|
|
registerProtocals: function() {
|
||
|
|
this.RegisterProtocal( 21110, this.getBaseInfo.bind( this ) ); // 百抽活動信息
|
||
|
|
this.RegisterProtocal( 21111, this.getRewardBack.bind( this ) ); // 領取對應天數的首充禮包
|
||
|
|
},
|
||
|
|
|
||
|
|
// 从服务器初始化数据
|
||
|
|
reqBaseFromServer: function( _cb ) {
|
||
|
|
|
||
|
|
let cfgs = [
|
||
|
|
this.data.config, //付費活動
|
||
|
|
]
|
||
|
|
this.loadConfigs( cfgs, ( _ret, _data ) =>{
|
||
|
|
this.reqBaseData( _cb );
|
||
|
|
// nx.dt.fnInvoke( _cb, true );
|
||
|
|
} )
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
// ============================================================
|
||
|
|
// 百抽操作 以及相關紅點處理
|
||
|
|
// ============================================================
|
||
|
|
|
||
|
|
// 请求百抽相關 基本數據
|
||
|
|
reqBaseData: function( _cb ) {
|
||
|
|
this.SendProtocal( 21110, {}, _cb );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 请求首充信息返回
|
||
|
|
getBaseInfo: function( _data ) {
|
||
|
|
|
||
|
|
let list = _data.status_list;
|
||
|
|
let count = 0;
|
||
|
|
if( nx.dt.arrNEmpty( list ) ){
|
||
|
|
list.sort( (a, b)=>{
|
||
|
|
return a.day - b.day;
|
||
|
|
} )
|
||
|
|
|
||
|
|
list.forEach( _item=>{
|
||
|
|
if( _item.status2 == 1 || _item.status1 == 1 ){
|
||
|
|
count++;
|
||
|
|
}
|
||
|
|
} )
|
||
|
|
|
||
|
|
}
|
||
|
|
this.vset( "HundredDraw", _data );
|
||
|
|
this.openTip( "reward", count > 0 );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 领取 每日簽到獎勵
|
||
|
|
reqGetDailyReward: function( _data, _cb ) {
|
||
|
|
|
||
|
|
let data = {
|
||
|
|
day : _data.day,
|
||
|
|
type : _data.type,
|
||
|
|
}
|
||
|
|
this.SendProtocal( 21111, data, _cb );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 领取奖励返回
|
||
|
|
getRewardBack: function( _data ) {
|
||
|
|
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
} );
|
||
|
|
|
||
|
|
// 模块导出
|
||
|
|
module.exports = ActHundredDraw;
|