first commit

This commit is contained in:
Yangtao
2025-11-18 17:48:20 +08:00
commit 6e56cab848
196 changed files with 65809 additions and 0 deletions

View File

@ -0,0 +1,5 @@
package message
type Message struct {
MessageId string
}

View File

@ -0,0 +1,12 @@
package message
// 活跃消息
type ActiveMessage struct {
Message
UserId string // 用户ID
DeviceId string // 设备ID
ActiveTime string // 活跃的平台
ActivePlatform string // 活跃的平台
ActiveDeviceModel string // 活跃的设备型号
ActiveIp string // 活跃的IP
}

View File

@ -0,0 +1,16 @@
package message
// 激活消息
type ActiveNewMessage struct {
Message
ClientIp string // 用户Ip
ClientVersion string // 用户ID
DeviceId string // 设备ID
Platform string // 活跃的平台
MarketChannel string // 活跃的平台
DeviceModel string // 活跃的设备型号
TimeStamp string // 活跃的IP
BundleId string // 活跃的IP
OsVersion string // 活跃的IP
ApiVersionNum string // 活跃的IP
}

View File

@ -0,0 +1,34 @@
package message
// 错误消息(补偿)
type ErrorMessage struct {
Message
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"
)
// CMQ异常消息code
const (
// 注册云信失败 需要自动补偿注册
CMQ_ERROR_CODE_SIGNUP_TO_YUNXIN_FAIL = "CMQ_E001"
// 抽奖更新总奖池失败
CMQ_ERROR_CODE_OPEN_BOX_UPDATE_DATA_FAIL = "CMQ_E002"
// 系统警告
CMQ_ERROR_CODE_SYSTEM_WARN = "CMQ_E003"
)
// 系统警告
type SystemWarnBody struct {
ServiceName string
ApiName string
ErrMsg string
}

View File

@ -0,0 +1,35 @@
package message
import (
"encoding/json"
)
// 事件
type EventMessage struct {
Message
Tag EventTag // 消息标签EventTagUser=用户
Flag EventFlag // 消息标签EventFlagCreate=创建 EventFlagUpdate=更新 EventFlagSave=创建或更新 EventFlagDelete=删除
EventId string // 事件ID
EventContent interface{} // 事件内容
}
type EventTag string
const (
EventTagUser = "user"
EventTagRoomInto EventTag = "into_room"
)
type EventFlag string
const (
EventFlagSave EventFlag = "save"
EventFlagCreate EventFlag = "create"
EventFlagUpdate EventFlag = "update"
EventFlagDelete EventFlag = "delete"
)
func (message *EventMessage) ToJson() string {
b, _ := json.Marshal(message)
return string(b)
}

View File

@ -0,0 +1,12 @@
package message
// 注册消息
type RegisterMessage struct {
Message
Platform string // 设备平台
UserId string // 用户ID
DeviceId string // 设备ID
RegisterTime string // 注册时间
ChannelCode string // 渠道代码
Ip string //ip
}

View File

@ -0,0 +1,104 @@
package message
// 交易消息
type TransactionMessage struct {
Message
FromUserId string // 发起用户ID
FromCurrency TransactionCurrencyEnum // 扣款类型
FromAmount 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 // 交易实际支付金额(单位为扣款类型)
FromPlatform string // 操作用户的平台
GuildId string // 俱乐部ID
}
// TransactionUpdateMessage 交易更新消息
type TransactionUpdateMessage struct {
Message
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后台充值
RechargeH5WeChatWap TransactionCodeEnum = "H5WeChatWap" //H5网页支付
)
type TransactionStateEnum string
const (
CREATED TransactionStateEnum = "CREATED" // 已创建
SUCCESS TransactionStateEnum = "SUCCESS" // 成功
FAILED TransactionStateEnum = "FAILED" // 失败
)
type TransactionCurrencyEnum string
const (
DIAMOND TransactionCurrencyEnum = "DIAMOND" // 钻石
NCoin TransactionCurrencyEnum = "GOLD" //N币
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" // 手工加钻石
OperationDiamondRetrieve TransactionTypeEnum = "OPERATION_DIAMOND_RETRIEVE" // 手工扣除钻石
OperationCrystal TransactionTypeEnum = "OPERATION_CRYSTAL" // 手工加晶石
OperationCrystalReduce TransactionTypeEnum = "OPERATION_CRYSTAL_REDUCE" // 手工扣除晶石
EXCHANGE TransactionTypeEnum = "EXCHANGE" // 兑换
EXCHANGENCoin TransactionTypeEnum = "EXCHANGE_N_COIN" // 兑换
HUNTING TransactionTypeEnum = "HUNTING" // 星空寻宝
WITHDRAW TransactionTypeEnum = "WITHDRAW" // 提现
WithdrawNCoin TransactionTypeEnum = "WITHDRAW_N_COIN" // 提现 N币
WithdrawTimely TransactionTypeEnum = "WITHDRAW_TIMELY" // 提现
ORDER TransactionTypeEnum = "ORDER" // 订单
ORDERNCoin TransactionTypeEnum = "ORDER_N_COIN" // 订单
OrderH5 TransactionTypeEnum = "ORDER_H5" // 订单-H5
OrderH5NCoin TransactionTypeEnum = "ORDER_H5_N_COIN" // 订单-H5
LuckGift TransactionTypeEnum = "LUCK_GIFT" // 幸运礼物
LuckGiftNCoin TransactionTypeEnum = "LUCK_GIFT_N_COIN" // 幸运礼物
)