ActivityModel.lua
1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
cc.exports.ActivityModel = {}
ActivityModel.fightLotteryInfo = {};
function ActivityModel.init()
cmsg.on("gateway_msg.show_btl_cnt_reward_msg_res",ActivityModel.onFightLotteryFun);
cmsg.on("gateway_msg.get_btl_cnt_reward_msg_res",ActivityModel.onGetLotteryFun);
end
function ActivityModel.getFightLotteryInfo()
SocketClient:getInstance():send("gateway_msg.show_btl_cnt_reward_msg",
{
});
end
function ActivityModel.onFightLotteryFun(params)
if params.errcode == EnumErrorCode.EC_SUCCESS then
ActivityModel.fightLotteryInfo = {};
ActivityModel.fightLotteryInfo.btl_cnt = params.data.btl_cnt;
ActivityModel.fightLotteryInfo.get_sec = params.data.get_sec;
EventListener.dispatchEvent(EnumEvent.ACT_SHOW_FIGHT_LOTTERY);
end
end
function ActivityModel.getLottery()
SocketClient:getInstance():send("gateway_msg.get_btl_cnt_reward_msg",
{
});
end
function ActivityModel.onGetLotteryFun(params)
if params.errcode == EnumErrorCode.EC_SUCCESS then
ActivityModel.fightLotteryInfo.get_sec = UserModel.time_second;
EventListener.dispatchEvent(EnumEvent.ACT_GET_LOTTERY,{id=params.data.id});
EventListener.dispatchEvent(EnumEvent.UPDATE_ACTIVITY);
end
end
function ActivityModel.getCurrentFirstPayInfo()
local firstPayList = ShopInfo.getFirstPayList();
local firstInfo = nil;
for i,v in ipairs(firstPayList) do
if not TableUtil.IsInTable(UserModel.first_pay_id,v.id) then
firstInfo = v;
break;
end
end
return firstInfo;
end
--ȡÿ׳
function ActivityModel.getCurrentFirstPayDailyInfo()
local dailyPayList = ShopInfo.getDailyPayList();
local payInfo = nil;
for i,v in ipairs(dailyPayList) do
if not TableUtil.IsInTable(UserModel.first_pay_daily_id,v.id) then
payInfo = v;
break;
end
end
return payInfo;
end
return ActivityModel