125 lines
4.4 KiB
Go
125 lines
4.4 KiB
Go
package awssqs
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type SqsMessage struct {
|
|
Action SqsAction `json:"action"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
type SqsAction int32
|
|
|
|
func (a SqsAction) GetId() int32 {
|
|
return int32(a)
|
|
}
|
|
|
|
func (a SqsAction) GetName() string {
|
|
return SqsActionMap[a].Name
|
|
}
|
|
|
|
const (
|
|
SqsActionCreateUser = SqsAction(10)
|
|
SqsActionIncreaseBetTotal = SqsAction(20)
|
|
SqsActionDecreaseBetTotal = SqsAction(21) // 结算后扣除稽核流水
|
|
SqsActionInviteCratesCheck = SqsAction(30)
|
|
SqsActionLoginIpCheck = SqsAction(40)
|
|
SqsActionExportData = SqsAction(50)
|
|
SqsActionSendEmailVerifyCode = SqsAction(60)
|
|
SqsActionDailyQuestProcess = SqsAction(70)
|
|
SqsActionDepositSuccess = SqsAction(80)
|
|
SqsActionVisit = SqsAction(90)
|
|
SqsActionSaveBonus = SqsAction(100)
|
|
SqsActionInviteBonusCheck = SqsAction(110)
|
|
SqsActionGenDepositDailyClaim = SqsAction(120)
|
|
SqsActionDeductWithdrawLimitAfterTransfer = SqsAction(130) // 回收后才结算,扣除稽核流水
|
|
)
|
|
|
|
var SqsActionMap = map[SqsAction]struct {
|
|
Id int32
|
|
Name string
|
|
}{
|
|
SqsActionCreateUser: {Id: 10, Name: "SqsActionCreateUser"},
|
|
SqsActionIncreaseBetTotal: {Id: 20, Name: "SqsActionIncreaseBetTotal"},
|
|
SqsActionDecreaseBetTotal: {Id: 21, Name: "SqsActionDecreaseBetTotal"},
|
|
SqsActionInviteCratesCheck: {Id: 30, Name: "SqsActionInviteCratesCheck"},
|
|
SqsActionLoginIpCheck: {Id: 40, Name: "SqsActionLoginIpCheck"},
|
|
SqsActionExportData: {Id: 50, Name: "SqsActionExportData"},
|
|
SqsActionSendEmailVerifyCode: {Id: 60, Name: "SqsActionSendEmailVerifyCode"},
|
|
SqsActionDailyQuestProcess: {Id: 70, Name: "SqsActionDailyQuestProcess"},
|
|
SqsActionDepositSuccess: {Id: 80, Name: "SqsActionDepositSuccess"},
|
|
SqsActionVisit: {Id: 90, Name: "SqsActionVisit"},
|
|
SqsActionSaveBonus: {Id: 100, Name: "SqsActionSaveBonus"},
|
|
SqsActionInviteBonusCheck: {Id: 110, Name: "SqsActionInviteBonus"},
|
|
SqsActionGenDepositDailyClaim: {Id: 120, Name: "SqsActionGenDepositDailyClaim"},
|
|
SqsActionDeductWithdrawLimitAfterTransfer: {Id: 130, Name: "SqsActionDeductWithdrawLimitAfterTransfer"},
|
|
}
|
|
|
|
type SqsActionRegisterContent struct {
|
|
Userno string `json:"userno"`
|
|
ClientIp string `json:"clientIp"`
|
|
}
|
|
type LoginIpCheck struct {
|
|
Userno string `json:"userno"`
|
|
Ip string `json:"ip"`
|
|
}
|
|
|
|
type SqsActionSendEmailVerifyCodeContent struct {
|
|
Email string `json:"email"`
|
|
Lang string `json:"lang"`
|
|
}
|
|
|
|
type SqsActionDailyQuestProcessContent struct {
|
|
Userno string `json:"userno"`
|
|
QuestType string `json:"questType"`
|
|
IncreaseProcess string `json:"increaseProcess"`
|
|
}
|
|
|
|
type SqsActionDepositSuccessContent struct {
|
|
Orderno string `json:"orderno"`
|
|
Userno string `json:"userno"`
|
|
DepositAmount decimal.Decimal `json:"depositAmount"`
|
|
SuccessTime int64 `json:"successTime"`
|
|
DepositTimes int32 `json:"depositTimes"`
|
|
BonusId string `json:"bonusId"`
|
|
}
|
|
|
|
type SqsActionWebSocketInitContent struct {
|
|
Userno string `json:"userno"`
|
|
ConnectId string `json:"userno"`
|
|
}
|
|
|
|
type SqsActionSaveBonusContent struct {
|
|
Userno string `json:"userno"`
|
|
BonusCategory int32 `json:"bonusCategory"`
|
|
BonusType int32 `json:"bonusType"`
|
|
BonusDetail string `json:"bonusDetail"`
|
|
SourceId string `json:"sourceId"`
|
|
DoneValue string `json:"doneValue"`
|
|
BonusAmount string `json:"bonusAmount"`
|
|
ClaimTime int64 `json:"claimTime"`
|
|
}
|
|
|
|
type SqsActionGenDepositDailyClaimContent struct {
|
|
UserPromotionId uint64 `json:"userPromotionId"`
|
|
}
|
|
|
|
type SqsActionDeductWithdrawLimitAfterTransferContent struct {
|
|
Userno string `json:"userno"`
|
|
BetOrderno string `json:"betOrderno"`
|
|
ValidBetAmount decimal.Decimal `json:"validBetAmount"`
|
|
ProviderId int32 `json:"providerId"`
|
|
SourceType int32 `json:"sourceType"` // WalletRecordSourceType
|
|
}
|
|
|
|
func (m SqsMessage) Json() (string, error) {
|
|
marshal, err := json.Marshal(m)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return string(marshal), nil
|
|
}
|