50 lines
1.9 KiB
Go
50 lines
1.9 KiB
Go
package model
|
||
|
||
import (
|
||
"strconv"
|
||
"time"
|
||
|
||
"mongo.games.com/game/mq"
|
||
)
|
||
|
||
// GenerateOnline 在线统计
|
||
func GenerateOnline(online map[string]map[string]int) *mq.RabbitMQData {
|
||
params := make(map[string]interface{})
|
||
params["Online"] = online
|
||
params["Time"] = time.Now().Unix()
|
||
return NewRabbitMQData(mq.BackOnline, params)
|
||
}
|
||
|
||
// GenerateLogin 玩家登陆事件
|
||
func GenerateLogin(o *PlayerLoginEvent) *mq.RabbitMQData {
|
||
return NewRabbitMQData(mq.BackLogin, o)
|
||
}
|
||
|
||
// GenerateSystemFreeGive 系统免费赠送
|
||
func GenerateSystemFreeGive(snid int32, name, platform, channel string, givetype, cointype int32, count int64) *mq.RabbitMQData {
|
||
params := make(map[string]string)
|
||
params["snid"] = strconv.Itoa(int(snid))
|
||
params["Channel"] = channel
|
||
params["name"] = name
|
||
params["platform"] = platform
|
||
params["givetype"] = strconv.Itoa(int(givetype)) //0创号赠送 1签到赠送(转盘、签到、累签) 2商城观看视频赠送 3破产补助 4vip领取
|
||
params["cointype"] = strconv.Itoa(int(cointype)) //货币类型 0金币 1钻石
|
||
params["count"] = strconv.Itoa(int(count))
|
||
params["ts"] = strconv.Itoa(int(time.Now().Unix()))
|
||
return NewRabbitMQData(mq.BackSystemFreeGive, params)
|
||
}
|
||
|
||
// GeneratePhoneLottery 手机抽奖统计
|
||
func GeneratePhoneLottery(snid int32, platform string, items string, lotteryType, count, countType, score int) *mq.RabbitMQData {
|
||
params := make(map[string]string)
|
||
params["Snid"] = strconv.Itoa(int(snid))
|
||
params["Platform"] = platform
|
||
params["LotteryType"] = strconv.Itoa(lotteryType) //1-抽奖获得 2-兑换 3-抽奖次数
|
||
params["Items"] = items
|
||
params["Score"] = strconv.Itoa(score) //兑换消耗积分
|
||
params["CountType"] = strconv.Itoa(countType) //1-首次登录 2-玩游戏 3-输赢送 4-充值送 5-初始送
|
||
params["Count"] = strconv.Itoa(count)
|
||
params["Ts"] = strconv.Itoa(int(time.Now().Unix()))
|
||
return NewRabbitMQData(mq.BackPhoneLottery, params)
|
||
}
|