116 lines
2.7 KiB
Go
116 lines
2.7 KiB
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
)
|
||
|
|
||
|
|
||
|
|
||
|
//go:generate goqueryset -in config.go
|
||
|
// gen:qs
|
||
|
type Config struct {
|
||
|
Model
|
||
|
|
||
|
Name string `gorm:"unique_index;not null"`
|
||
|
Value string // `gorm:"size:65535;not null"`
|
||
|
}
|
||
|
|
||
|
func (m *Config) TableName() string {
|
||
|
return "config"
|
||
|
}
|
||
|
|
||
|
type ConfigInterface interface {
|
||
|
Encode() string
|
||
|
}
|
||
|
|
||
|
type CheckConfig struct {
|
||
|
Check uint8 `json:"check"`
|
||
|
}
|
||
|
|
||
|
func (c *CheckConfig) Encode() string {
|
||
|
configBytes, err := json.Marshal(c)
|
||
|
if err != nil {
|
||
|
return ""
|
||
|
}
|
||
|
return string(configBytes)
|
||
|
}
|
||
|
|
||
|
type AutoChargeMobileConfig struct {
|
||
|
IsOpen uint8 `json:"is_open"`
|
||
|
}
|
||
|
|
||
|
func (c *AutoChargeMobileConfig) Encode() string {
|
||
|
configBytes, err := json.Marshal(c)
|
||
|
if err != nil {
|
||
|
return ""
|
||
|
}
|
||
|
return string(configBytes)
|
||
|
}
|
||
|
|
||
|
type StepConfig struct {
|
||
|
InitStep uint32 `json:"init_step"`
|
||
|
InviteStepAward uint32 `json:"invite_step_award"`
|
||
|
StepDayLimit uint32 `json:"step_day_limit"`
|
||
|
StepToVmRate float64 `json:"step_to_vm_rate"`
|
||
|
InviteAwardRate float64 `json:"invite_award_rate"`
|
||
|
InviteAwardRateLimit float64 `json:"invite_award_rate_limit"`
|
||
|
SuperMemberRm uint32 `json:"super_member_rm"`
|
||
|
}
|
||
|
|
||
|
func (c *StepConfig) Encode() string {
|
||
|
configBytes, err := json.Marshal(c)
|
||
|
if err != nil {
|
||
|
return ""
|
||
|
}
|
||
|
return string(configBytes)
|
||
|
}
|
||
|
|
||
|
//type FBConfig struct {
|
||
|
// AssistanceValidityTerm uint32 `json:"assistance_validity_term"` // 邀请倒计时
|
||
|
// Postage uint32 `json:"postage"` // 邮费
|
||
|
// AssistanceFee uint32 `json:"assistance_fee"` // 每人拆红包
|
||
|
// OrderAssistanceFee uint32 `json:"order_assistance_fee"` // 订单邀请拆红包
|
||
|
// ActivityExpire string `json:"activity_expire"` // 活动过期时间
|
||
|
//}
|
||
|
//
|
||
|
//type FOConfig struct {
|
||
|
// ActivityExpire string `json:"activity_expire"` // 活动过期时间
|
||
|
//}
|
||
|
//
|
||
|
//func (c *FBConfig) Encode() string {
|
||
|
// configBytes, err := json.Marshal(c)
|
||
|
// if err != nil {
|
||
|
// return ""
|
||
|
// }
|
||
|
// return string(configBytes)
|
||
|
//}
|
||
|
|
||
|
type InviteLotteryConfig struct {
|
||
|
Name string `json:"name"` // 名字
|
||
|
Image string `json:"image"` // 图片
|
||
|
DrawTime uint32 `json:"draw_time"` // 开奖的分钟数
|
||
|
SponsorId uint32 `json:"sponsor_id"` // 赞助商ID
|
||
|
NeedNum uint32 `json:"need_num"` // 需要的邀请数
|
||
|
IsShow uint8 `json:"is_show"` // 上下架
|
||
|
}
|
||
|
|
||
|
func (c *InviteLotteryConfig) Encode() string {
|
||
|
configBytes, err := json.Marshal(c)
|
||
|
if err != nil {
|
||
|
return ""
|
||
|
}
|
||
|
return string(configBytes)
|
||
|
}
|
||
|
|
||
|
//type TargetUserConfig struct {
|
||
|
// List map[uint32]bool `json:"list"`
|
||
|
//}
|
||
|
//
|
||
|
//func (c *TargetUserConfig) Encode() string {
|
||
|
// configBytes, err := json.Marshal(c)
|
||
|
// if err != nil {
|
||
|
// return ""
|
||
|
// }
|
||
|
// return string(configBytes)
|
||
|
//}
|