Files

167 lines
5.2 KiB
JavaScript
Raw Permalink Normal View History

2026-05-23 22:10:14 +08:00
/*******************************************************************************
*
* 活动: 每日活跃
*
*
******************************************************************************/
const ActBase = require( "act.base" );
const ActDailyTreasure = cc.Class( {
extends: ActBase,
// 初始化配置数据
initConfig: function() {
// 视图附着
nx.plugin.add( this, [ "view" ] );
this.vattach( "Acts" );
this.period = 0;
},
// 注册协议接受事件
registerProtocals: function() {
this.RegisterProtocal( 31150, this.getCardCollectData.bind( this ) ); // 炫卡集基本信息
this.RegisterProtocal( 31151, this.getCardReward.bind( this ) ); // 抽獎/卡
this.RegisterProtocal( 31152, this.getCollectReachTimesRewardBack.bind( this ) ); // 領取達成獎勵
this.RegisterProtocal( 31153, this.getCollectLineReward.bind( this ) ); // 領取連綫達成獎勵
// this.RegisterProtocal( 31122, this.getTreasureTaskR.bind( this ) ); // 當前活躍活動任務相關
// this.RegisterProtocal( 31123, this.getStarPrayData.bind( this ) ); // 活躍度抽獎相關
// this.RegisterProtocal( 31124, this.getStarPrayBackData.bind( this ) ); // 請求轉盤獎勵
// this.RegisterProtocal( 31125, this.getStarPrayRewardData.bind( this ) ); // 領取轉盤獎勵
// this.RegisterProtocal( 31126, this.getDailyReachData.bind( this ) ); // 領取轉盤活躍達成獎勵
// // // // // 前端准备完毕
// this.RegisterProtocal( 31127, this.getStarPrayJump.bind( this ) ); // 跳過 返回
// // this.RegisterProtocal( 31106, this.getBuyDiaBack.bind( this ) ); // 今日充值次数
// this.RegisterProtocal( 31128, this.getStarPrayRecords.bind( this ) ); // 活躍度 獎勵記錄
// this.RegisterProtocal(14100, this.GetSignStatus.bind( this ) );
// this.RegisterProtocal(14101, this.GetSignBack.bind( this ) );
},
// 从服务器初始化数据
reqBaseFromServer: function( _cb ) {
let cfgs = [
this.data.config,//付費活動
]
this.loadConfigs( cfgs, ( _ret, _data ) =>{
nx.dt.fnInvoke( _cb, true );
this.reqBaseInfo();
} )
},
reqBaseInfo: function(){
this.SendProtocal( 31150, {} );
},
/***
* [31150]:{"ids":[{"id":5},{"id":9},{"id":6},{"id":10},{"id":18},{"id":17},{"id":7},{"id":25},{"id":22},{"id":14},{"id":16},{"id":8},{"id":4},{"id":24},{"id":11},{"id":20},{"id":19},{"id":2},{"id":3},{"id":23}],
* "reach_reward":[{"id":6,"status":0},{"id":5,"status":0},{"id":4,"status":0},{"id":3,"status":1},{"id":2,"status":1},{"id":1,"status":1}],
* "rewards":[{"id":12,"status":0},{"id":11,"status":0},{"id":10,"status":1},{"id":9,"status":0},{"id":8,"status":0},{"id":7,"status":0},{"id":6,"status":0},{"id":5,"status":0},{"id":4,"status":1},{"id":3,"status":0},{"id":2,"status":1},{"id":1,"status":0}],"draw_times":121}
*/
// 獲取當前的 集卡活動 數據
getCardCollectData: function( _data ){
//
this.vset( "ActsCollectCard", _data );
this.period = _data.group;
let count = 0;
let reach_reward = _data.reach_reward;
let rewards = _data.rewards;
if( nx.dt.arrNEmpty( reach_reward ) ){
for (let i = 0; i < reach_reward.length; i++) {
let reach = reach_reward[i];
if( reach.status == 1 ){
count++;
break;
}
}
}
if( nx.dt.arrNEmpty( rewards ) ){
for (let r = 0; r < rewards.length; r++) {
let reach = rewards[r];
if( reach.status == 1 ){
count++;
break;
}
}
}
this.openTip( "reward", count > 0 );
},
// 獲取當前的 星空許願 數據
getStarPrayBackData: function( _data ){
//
// this.vset( "starPrayData", _data );
},
reqCollectCard: function( _times, _cb ){
let protocal = {};
protocal.times = _times;
this.SendProtocal( 31151, protocal, _cb );
},
getCardReward: function( _data ){
this.vset( "ActsCardInfo", _data );
},
reqGetCollectReachTimesReward: function( _id ){
let protocal = {};
protocal.id = _id;
this.SendProtocal( 31152, protocal );
},
getCollectReachTimesRewardBack: function( _id ){
},
reqGetLineCollectReward: function( _id ){
let protocal = {};
protocal.id = _id;
this.SendProtocal( 31153, protocal );
},
getCollectLineReward : function( _data ){
},
// 領取當前的 星空許願獎勵
reqGetStarPrayRewardData: function( _data ){
let protocal = {};
protocal.group_id = _data.group_id;
protocal.type = _data.type;
protocal.id = _data.id;
this.SendProtocal( 31125, protocal );
},
} );
// 模块导出
module.exports = ActDailyTreasure;