first commit
This commit is contained in:
12
pkg/common/messages/active_message.go
Normal file
12
pkg/common/messages/active_message.go
Normal file
@ -0,0 +1,12 @@
|
||||
package messages
|
||||
|
||||
// 活跃消息
|
||||
type Active struct {
|
||||
MessageId string
|
||||
UserId string //用户ID
|
||||
DeviceId string //设备ID
|
||||
ActiveTime string //活跃的平台
|
||||
ActivePlatform string //活跃的平台
|
||||
ActiveDeviceModel string //活跃的设备型号
|
||||
ActiveIp string //活跃的IP
|
||||
}
|
||||
26
pkg/common/messages/error_message.go
Normal file
26
pkg/common/messages/error_message.go
Normal file
@ -0,0 +1,26 @@
|
||||
package messages
|
||||
|
||||
// 错误消息(补偿)
|
||||
type Error struct {
|
||||
MessageId string
|
||||
Code string // 错误代码
|
||||
Content string // 错误内容(json)
|
||||
Tag ErrorTag // 消息标签:auto=自动处理 manual=手动处理 auto_to_manual=自动转手动
|
||||
}
|
||||
|
||||
type ErrorTag string
|
||||
|
||||
const (
|
||||
Auto ErrorTag = "AUTO"
|
||||
Manual ErrorTag = "MANUAL"
|
||||
AutoToManual ErrorTag = "AUTO_TO_MANUAL"
|
||||
)
|
||||
|
||||
type ErrorState string
|
||||
|
||||
const (
|
||||
ErrorCreate ErrorState = "CREATED"
|
||||
ErrorSuccess ErrorState = "SUCCESS"
|
||||
ErrorFailed ErrorState = "FAILED"
|
||||
ErrorReSuccess ErrorState = "RE_SUCCESS"
|
||||
)
|
||||
49
pkg/common/messages/event_message.go
Normal file
49
pkg/common/messages/event_message.go
Normal file
@ -0,0 +1,49 @@
|
||||
package messages
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// 事件
|
||||
type Event struct {
|
||||
MessageId string
|
||||
Tag EventTag // 消息标签:EventTagUser=用户
|
||||
Flag EventFlag // 消息标签:EventFlagCreate=创建 EventFlagUpdate=更新
|
||||
EventId string // 事件ID
|
||||
EventContent interface{} // 事件内容
|
||||
}
|
||||
|
||||
type EventTag string
|
||||
|
||||
const (
|
||||
EventTagUser EventTag = "user"
|
||||
EventTagRoomInto EventTag = "into_room"
|
||||
EventTagMessage EventTag = "message"
|
||||
)
|
||||
|
||||
func TagIndex(key string) string {
|
||||
switch key {
|
||||
case string(EventTagUser):
|
||||
return viper.GetString("es.default.indexUser")
|
||||
case string(EventTagMessage):
|
||||
return viper.GetString("es.default.indexMessage")
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
type EventFlag string
|
||||
|
||||
const (
|
||||
EventFlagSave EventFlag = "save"
|
||||
EventFlagCreate EventFlag = "create"
|
||||
EventFlagUpdate EventFlag = "update"
|
||||
EventFlagDelete EventFlag = "delete"
|
||||
)
|
||||
|
||||
func (message *Event) ToJson() string {
|
||||
b, _ := json.Marshal(message)
|
||||
return string(b)
|
||||
}
|
||||
12
pkg/common/messages/register_message.go
Normal file
12
pkg/common/messages/register_message.go
Normal file
@ -0,0 +1,12 @@
|
||||
package messages
|
||||
|
||||
// 注册消息
|
||||
type Register struct {
|
||||
MessageId string
|
||||
UserId string //用户ID
|
||||
DeviceId string //设备ID
|
||||
RegisterTime string //注册时间
|
||||
ChannelCode string //渠道代码
|
||||
Ip string //ip
|
||||
Platform string //平台
|
||||
}
|
||||
98
pkg/common/messages/transaction_message.go
Normal file
98
pkg/common/messages/transaction_message.go
Normal file
@ -0,0 +1,98 @@
|
||||
package messages
|
||||
|
||||
// 交易消息
|
||||
type Transaction struct {
|
||||
MessageId string
|
||||
FromUserId string //发起用户ID
|
||||
FromCurrency TransactionCurrencyEnum //扣款类型
|
||||
FromAmount string //扣款数量
|
||||
FromPlatform string //扣款所在平台
|
||||
ToUserId string //接收用户
|
||||
ToCurrency TransactionCurrencyEnum //接收类型
|
||||
ToAmount string //接收数量
|
||||
TransactionRate string //交易抽成
|
||||
TransactionState TransactionStateEnum //交易状态
|
||||
TransactionType TransactionTypeEnum //充值、打赏、购买表情、购买守护、兑换、砸蛋、提现、订单等
|
||||
TransactionId string //充值ID、打赏ID、购买表情ID、购买守护ID、兑换ID、砸蛋ID、提现ID、订单ID等
|
||||
TransactionCreateTime string //交易创建时间
|
||||
TransactionCompleteTime string //交易完成时间
|
||||
TransactionSubjectId string //充值为产品ID、打赏为房间ID、购买表情为表情ID、购买守护为房间ID、兑换为配置ID、砸蛋为配置ID、提现为配置ID、订单为品类ID
|
||||
TransactionCode TransactionCodeEnum //充值为充值渠道(支付宝H5、支付宝App、微信、运营赠送等)、打赏为打赏类型(单个、批量)、购买表情为空、购买守护为守护类型、兑换为空、砸蛋为中奖等级、提现为银行名称、订单为空
|
||||
TransactionAmount string //交易金额(单位为扣款类型)
|
||||
TransactionAmountCoupon string //交易优惠金额(单位为扣款类型)
|
||||
TransactionAmountCouponId string //交易优惠凭证ID
|
||||
TransactionAmountPay string //交易实际支付金额(单位为扣款类型)
|
||||
GuildId string //俱乐部ID
|
||||
}
|
||||
|
||||
// 交易更新消息
|
||||
type TransactionUpdate struct {
|
||||
MessageId string
|
||||
TransactionState TransactionStateEnum //交易状态
|
||||
TransactionId string //充值ID、打赏ID、购买表情ID、购买守护ID、兑换ID、砸蛋ID、提现ID、订单ID等
|
||||
TransactionCompleteTime string //交易完成时间
|
||||
}
|
||||
|
||||
type TransactionCodeEnum string
|
||||
|
||||
const (
|
||||
RewardSimple TransactionCodeEnum = "SIMPLE" //单个打赏
|
||||
RewardMulti TransactionCodeEnum = "MULTI" //批量打赏
|
||||
RewardBagSimple TransactionCodeEnum = "BAG_SIMPLE" //背包礼物单个打赏
|
||||
RewardBagMulti TransactionCodeEnum = "BAG_MULTI" //背包礼物批量打赏
|
||||
|
||||
GuardLevel01 TransactionCodeEnum = "1" //青铜守护
|
||||
GuardLevel02 TransactionCodeEnum = "2" //白银守护
|
||||
GuardLevel03 TransactionCodeEnum = "3" //黄金守护
|
||||
|
||||
Hunting1 TransactionCodeEnum = "1" //单砸
|
||||
Hunting10 TransactionCodeEnum = "10" //十砸
|
||||
Hunting100 TransactionCodeEnum = "100" //百砸
|
||||
|
||||
RechargeAppAlipay TransactionCodeEnum = "AppAlipay" //app支付宝
|
||||
RechargeAppWeChat TransactionCodeEnum = "AppWeChat" //app微信
|
||||
RechargeAppIap TransactionCodeEnum = "AppIap" //appIap
|
||||
RechargeH5Alipay TransactionCodeEnum = "H5Alipay" //H5支付宝
|
||||
RechargeH5WeChatClub TransactionCodeEnum = "H5WeChatClub" //H5微信公众号
|
||||
RechargeOperation TransactionCodeEnum = "Operation" //Operation
|
||||
)
|
||||
|
||||
type TransactionStateEnum string
|
||||
|
||||
const (
|
||||
CREATED TransactionStateEnum = "CREATED" //已创建
|
||||
SUCCESS TransactionStateEnum = "SUCCESS" //成功
|
||||
FAILED TransactionStateEnum = "FAILED" //失败
|
||||
)
|
||||
|
||||
type TransactionCurrencyEnum string
|
||||
|
||||
const (
|
||||
DIAMOND TransactionCurrencyEnum = "DIAMOND" //钻石
|
||||
CRYSTAL TransactionCurrencyEnum = "CRYSTAL" //晶石
|
||||
MONEY TransactionCurrencyEnum = "MONEY" //钱
|
||||
FRAGMENT TransactionCurrencyEnum = "FRAGMENT" //碎片
|
||||
)
|
||||
|
||||
type TransactionTypeEnum string
|
||||
|
||||
const (
|
||||
RECHARGE TransactionTypeEnum = "RECHARGE" //充值
|
||||
RechargeNCoin TransactionTypeEnum = "RECHARGE_N_COIN" //充值N币
|
||||
REWARD TransactionTypeEnum = "REWARD" //打赏
|
||||
REWARDNCoin TransactionTypeEnum = "REWARD_N_COIN" //打赏
|
||||
GUARD TransactionTypeEnum = "GUARD" //购买守护
|
||||
EMOJI TransactionTypeEnum = "EMOJI" //购买表情
|
||||
OperationDiamond TransactionTypeEnum = "OPERATION_DIAMOND" //手工加钻石
|
||||
OperationCrystal TransactionTypeEnum = "OPERATION_CRYSTAL" //手工加晶石
|
||||
OperationCrystalReduce TransactionTypeEnum = "OPERATION_CRYSTAL_REDUCE" //手工扣除晶石
|
||||
EXCHANGE TransactionTypeEnum = "EXCHANGE" //兑换
|
||||
HUNTING TransactionTypeEnum = "HUNTING" //星空寻宝
|
||||
WithdrawNCoin TransactionTypeEnum = "WITHDRAW_N_COIN" //提现 N币
|
||||
ORDER TransactionTypeEnum = "ORDER" //订单
|
||||
ORDERNCoin TransactionTypeEnum = "ORDER_N_COIN" //订单
|
||||
ORDER_H5 TransactionTypeEnum = "ORDER_H5" //订单
|
||||
ORDER_H5_NCoin TransactionTypeEnum = "ORDER_H5_N_COIN" //订单
|
||||
LUCK_GIFT TransactionTypeEnum = "LUCK_GIFT" //幸运礼物
|
||||
LuckGiftNCoin TransactionTypeEnum = "LUCK_GIFT_N_COIN" //幸运礼物
|
||||
)
|
||||
Reference in New Issue
Block a user