model

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Copyright 2019 Axetroy. All rights reserved. MIT license.

Index

Constants

View Source
const (
	HelpStatusInActive HelpStatus = -1        // 未启用的状态
	HelpStatusActive   HelpStatus = 1         // 启用的状态
	HelpTypeArticle    HelpType   = "article" // 普通文章
	HelpTypeClass      HelpType   = "class"   // 分类
)
View Source
const (
	LoginLogTypeUserName         LoginLogType    = 0 // 用户名登陆
	LoginLogTypeTel                                  // 手机登陆
	LoginLogTypeEmail                                // 邮箱登陆
	LoginLogTypeThird                                // 第三方登陆
	LoginLogCommandLoginSuccess  LoginLogCommand = 0 // 登陆成功
	LoginLogCommandLogoutSuccess                     // 登出成功
	LoginLogCommandLoginFail                         // 登陆失败
	LoginLogCommandLogoutFail                        // 登出失败
)
View Source
const (
	NewsTypeNews         NewsType = "news"         // 新闻资讯
	NewsTypeAnnouncement NewsType = "announcement" // 官方公告

	NewsStatusInActive NewsStatus = -1 // 未启用的状态
	NewsStatusActive                   // 启用的状态
)
View Source
const (
	// 用户状态
	UserStatusBanned      UserStatus = -100 // 账号被禁用
	UserStatusInactivated UserStatus = -1   // 账号未激活
	UserStatusInit        UserStatus = 0    // 初始化状态

	// 用户性别
	GenderUnknown Gender = 0 // 未知性别
	GenderMale               // 男
	GenderFemmale            // 女
)

Variables

View Source
var (
	ReportTypeBug        ReportType = "bug"        // BUG 反馈
	ReportTypeFeature    ReportType = "feature"    // 新功能请求
	ReportTypeSuggestion ReportType = "suggestion" // 建议
	ReportTypeOther      ReportType = "other"      // 其他

	ReportStatusPending ReportStatus = 0 // 初始状态
	ReportStatusResolve ReportStatus = 1 // 已解决

	ReportTypes = []ReportType{ReportTypeBug, ReportTypeFeature, ReportTypeSuggestion, ReportTypeOther}
)
View Source
var (
	TransferStatusReject         TransferStatus = -1 // 收款方拒接接受
	TransferStatusWaitForConfirm TransferStatus = 0  // 等待收款方确认
	TransferStatusConfirmed      TransferStatus = 1  // 收款方已确认

	TransferLogCnyTableName  = transferLogTablePrefix + strings.ToLower(WalletCNY)  // 人民币表名
	TransferLogUsdTableName  = transferLogTablePrefix + strings.ToLower(WalletUSD)  // 美元表名
	TransferLogCoinTableName = transferLogTablePrefix + strings.ToLower(WalletCOIN) // 积分表名

	TransferTableNames = []string{
		TransferLogCnyTableName,
		TransferLogUsdTableName,
		TransferLogCoinTableName,
	}

	TransferLogMap = map[string]interface{}{
		WalletCNY:  TransferLogCny{},
		WalletUSD:  TransferLogUsd{},
		WalletCOIN: TransferLogCoin{},
	}
)
View Source
var (
	WalletCNY  = "CNY"
	WalletUSD  = "USD"
	WalletCOIN = "COIN"
	Wallets    = []string{WalletCNY, WalletUSD, WalletCOIN}

	WalletCnyTableName  = walletTablePrefix + strings.ToLower(WalletCNY)  // 人民币表名
	WalletUsdTableName  = walletTablePrefix + strings.ToLower(WalletUSD)  // 美元表名
	WalletCoinTableName = walletTablePrefix + strings.ToLower(WalletCOIN) // 积分表名

	WalletTableNames = []string{
		WalletCnyTableName,
		WalletUsdTableName,
		WalletCoinTableName,
	}
)

Functions

func IsValidNewsType

func IsValidNewsType(t NewsType) bool

func IsValidReportType

func IsValidReportType(t ReportType) bool

检验是否是有效的报错类型

Types

type Address

type Address struct {
	Id           string `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // 地址ID
	Uid          string `gorm:"not null;index;type:varchar(32)" json:"uid"`                   // 用户ID, 与默认地址联合唯一,用户只能有一个唯一的收货地址
	Name         string `gorm:"not null;index;type:varchar(32)" json:"name"`                  // 收货人
	Phone        string `gorm:"not null;index;type:varchar(32)" json:"phone"`                 // 收货人电话
	ProvinceCode string `gorm:"not null;index;type:varchar(6)" json:"province_code"`          // 省份代码
	CityCode     string `gorm:"not null;index;type:varchar(6)" json:"city_code"`              // 城市代码
	AreaCode     string `gorm:"not null;index;type:varchar(6)" json:"area_code"`              // 地区代码
	Address      string `gorm:"not null;index;type:varchar(32)" json:"address"`               // 详细地址
	IsDefault    bool   `gorm:"not null;index;" json:"is_default"`                            // 是否为默认地址, 跟 UID 联合唯一
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    *time.Time `sql:"index"`
}

func (*Address) BeforeCreate

func (news *Address) BeforeCreate(scope *gorm.Scope) error

func (*Address) TableName

func (news *Address) TableName() string

type Admin

type Admin struct {
	Id        string         `gorm:"primary_key;not null;unique;index" json:"id"`            // 用户ID
	Username  string         `gorm:"not null;unique;index;type:varchar(36)" json:"username"` // 用户名, 用于登陆
	Name      string         `gorm:"not null;index;type:varchar(36)" json:"Name"`            // 管理员名
	Password  string         `gorm:"not null;type:varchar(36)" json:"password"`              // 登陆密码
	Accession pq.StringArray `gorm:"not null;type:varchar(64)[]" json:"accession"`           // 管理员的权限, 超级管理员不依赖于这个字段
	IsSuper   bool           `gorm:"not null;" json:"is_super"`                              // 是否是超级管理员, 超级管理员全站应该只有一个
	Status    AdminStatus    `gorm:"not null;" json:"status"`                                // 状态
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Admin) BeforeCreate

func (news *Admin) BeforeCreate(scope *gorm.Scope) error

func (*Admin) TableName

func (news *Admin) TableName() string

type AdminStatus

type AdminStatus int32
const (
	AdminStatusBanned      AdminStatus = -100 // 账号被禁用
	AdminStatusInactivated AdminStatus = -1   // 账号未激活
	AdminStatusInit        AdminStatus = 0    // 初始化状态
)
type Banner struct {
	Id          string         `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // ID
	Image       string         `gorm:"not null;index;type:varchar(255)" json:"image"`                // 图片
	Href        string         `gorm:"not null;index;type:varchar(255)" json:"href"`                 // 图片连接
	Platform    BannerPlatform `gorm:"not null;index;type:varchar(32)" json:"platform"`              // 用于哪个平台
	Description *string        `gorm:"null;index;type:varchar(255)" json:"description"`              // Banner 描述
	Priority    *int           `gorm:"null;index;" json:"priority"`                                  // 优先级,主要用于排序
	Identifier  *string        `gorm:"null;index;type:varchar(32)" json:"identifier"`                // 标识符, 用于 APP 跳转页面的标识符
	FallbackUrl *string        `gorm:"null;index;type:varchar(255)" json:"fallback_url"`             // fallback 的 url, 当 APP 没有 `Identifier` 对应的页面时,这个就是 fallback 的页面
	Active      bool           `gorm:"not null;default:true;index;" json:"active"`                   // 是否激活
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time `sql:"index"`
}

func (*Banner) BeforeCreate

func (news *Banner) BeforeCreate(scope *gorm.Scope) (err error)

func (*Banner) TableName

func (news *Banner) TableName() string

type BannerPlatform

type BannerPlatform string
const (
	BannerPlatformPc  BannerPlatform = "pc"  // PC 端的 Banner
	BannerPlatformApp BannerPlatform = "app" // APP 端的 Banner
)

type FinanceLog

type FinanceLog struct {
	Id              string      `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // 流水ID
	Currency        string      `gorm:"not null;index;type:varchar(16)" json:"currency"`              // 对应的币种流水
	OrderId         string      `gorm:"null;index;type:varchar(32)" json:"order_id"`                  // 对应的订单id, 系统产生的流水可能不会存在orderId
	Uid             string      `gorm:"not null;index;type:varchar(32)" json:"uid"`                   // 对应的用户
	BeforeBalance   float64     `gorm:"not null;" json:"before_balance"`                              // 这条流水前的余额
	BalanceMutation float64     `gorm:"not null;" json:"balance_mutation"`                            // 可用余额的变动,正数则为加,负数为减
	AfterBalance    float64     `gorm:"not null" json:"after_balance"`                                // 这条流水后的余额
	BeforeFrozen    float64     `gorm:"not null" json:"before_frozen"`                                // 这条流水前的冻结余额
	FrozenMutation  float64     `gorm:"not null" json:"frozen_mutation"`                              // 冻结余额的变动,正数则为加,负数为减
	AfterFrozen     float64     `gorm:"not null" json:"after_frozen"`                                 // 这条流水后的冻结余额
	Type            FinanceType `gorm:"not null" json:"status"`                                       // 流水类型
	Note            *string     `gorm:"null;type:varchar(128)" json:"note"`                           // 流水备注
	CreatedAt       time.Time
	UpdatedAt       time.Time
	DeletedAt       *time.Time `sql:"index" json:"-"`
}

func (*FinanceLog) BeforeCreate

func (news *FinanceLog) BeforeCreate(scope *gorm.Scope) error

type FinanceLogCny

type FinanceLogCny struct {
	FinanceLog
}

func (*FinanceLogCny) BeforeCreate

func (news *FinanceLogCny) BeforeCreate(scope *gorm.Scope) error

func (*FinanceLogCny) TableName

func (news *FinanceLogCny) TableName() string

type FinanceLogCoin

type FinanceLogCoin struct {
	FinanceLog
}

func (*FinanceLogCoin) BeforeCreate

func (news *FinanceLogCoin) BeforeCreate(scope *gorm.Scope) error

func (*FinanceLogCoin) TableName

func (news *FinanceLogCoin) TableName() string

type FinanceLogUsd

type FinanceLogUsd struct {
	FinanceLog
}

func (*FinanceLogUsd) BeforeCreate

func (news *FinanceLogUsd) BeforeCreate(scope *gorm.Scope) error

func (*FinanceLogUsd) TableName

func (news *FinanceLogUsd) TableName() string

type FinanceType

type FinanceType string
var (
	FinanceTypeTransferIn  FinanceType = "transfer_in"  // 转入
	FinanceTypeTransferOut FinanceType = "transfer_out" // 转出

	FinanceLogMap = map[string]interface{}{
		"cny":  FinanceLogCny{},
		"usd":  FinanceLogUsd{},
		"coin": FinanceLogCoin{},
	}
)

type Gender

type Gender int

type Help added in v0.1.1

type Help struct {
	Id        string         `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // 帮助文章ID
	Title     string         `gorm:"not null;index;type:varchar(32)" json:"title"`                 // 帮助文章标题
	Content   string         `gorm:"not null;type:text" json:"content"`                            // 帮助文章内容
	Tags      pq.StringArray `gorm:"type:varchar(32)[]" json:"tags"`                               // 帮助文章的标签
	Status    HelpStatus     `gorm:"not null;type:integer" json:"status"`                          // 帮助文章状态
	Type      HelpType       `gorm:"not null;type:varchar(32)" json:"type"`                        // 帮助文章的类型
	ParentId  *string        `gorm:"null;index;type:varchar(32)" json:"parent_id"`                 // 父级 ID,如果有的话                                    // 父级 ID
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Help) BeforeCreate added in v0.1.1

func (news *Help) BeforeCreate(scope *gorm.Scope) error

func (*Help) TableName added in v0.1.1

func (news *Help) TableName() string

type HelpStatus added in v0.1.1

type HelpStatus int

type HelpType added in v0.1.1

type HelpType string

type InviteHistory

type InviteHistory struct {
	Id            string       `gorm:"primary_key;notnull;unique;index" json:"id"`
	Inviter       string       `gorm:"not null;index;type:varchar(32)" json:"inviter"`        // 邀请人
	Invitee       string       `gorm:"not null;unique;index;type:varchar(32)" json:"invitee"` // 受邀请人, 只有唯一的一个
	Status        InviteStatus `gorm:"not null;" json:"status"`                               // 受邀请人的激活状态
	RewardSettled bool         `gorm:"not null;" json:"reward_settled"`                       // 是否已发放奖励, 包括邀请人和收邀请人的奖励
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     *time.Time `sql:"index"`
}

func (*InviteHistory) BeforeCreate

func (news *InviteHistory) BeforeCreate(scope *gorm.Scope) error

func (*InviteHistory) TableName

func (news *InviteHistory) TableName() string

type InviteStatus

type InviteStatus int
const (
	StatusInviteRegistered InviteStatus = 0  // 被邀请人刚注册
	StatusInviteAuth       InviteStatus = 10 // 被邀请人进行了实名认证
	StatusInvitePay        InviteStatus = 50 // 被邀请人已进行了一笔支付
)

type LoginLog

type LoginLog struct {
	Id        string          `gorm:"primary_key;not null;index;type:varchar(32)" json:"id"` // 数据ID
	Uid       string          `gorm:"not null;index;type:varchar(32)" json:"uid"`            // 用户ID
	Type      LoginLogType    `gorm:"not null;type:int" json:"type"`                         // 登陆类型(用什么方式登陆)
	Command   LoginLogCommand `gorm:"not null;type:int" json:"command"`                      // 登陆的状态(成功, 失败)
	LastIp    string          `gorm:"not null;type:varchar(15)" json:"last_ip"`              // 本次登陆IP
	Client    string          `gorm:"not null;type:varchar(255)" json:"client"`              // 登陆的客户端
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*LoginLog) BeforeCreate

func (news *LoginLog) BeforeCreate(scope *gorm.Scope) error

func (*LoginLog) TableName

func (news *LoginLog) TableName() string

type LoginLogCommand

type LoginLogCommand int

type LoginLogType

type LoginLogType int
type Menu struct {
	Id        string         `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // 菜单 ID
	ParentId  string         `gorm:"not null;index;type:varchar(32)" json:"parent_id"`             // 该菜单的父级 ID
	Name      string         `gorm:"not null;index;type:varchar(32)" json:"name"`                  // 菜单名
	Url       string         `gorm:"not null;index;type:varchar(255)" json:"url"`                  // 菜单链接的 URL 地址
	Icon      string         `gorm:"not null;index;type:varchar(64)" json:"icon"`                  // 菜单的图标
	Accession pq.StringArray `gorm:"not null;index;type:varchar(64)[]" json:"accession"`           // 该菜单所需要的权限
	Sort      int            `gorm:"not null;index;" json:"sort"`                                  // 菜单排序, 越大的越靠前
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}
func (news *Menu) BeforeCreate(scope *gorm.Scope) error
func (news *Menu) TableName() string

type Message

type Message struct {
	Id        string        `gorm:"primary_key;not null;unique;index;type:varchar(32)" json:"id"` // 消息ID
	Uid       string        `gorm:"not null;index;type:varchar(32)" json:"uid"`                   // 这条消息的所有者
	Title     string        `gorm:"not null;index;type:varchar(32)" json:"title"`                 // 消息标题
	Content   string        `gorm:"not null;type:text" json:"content"`                            // 消息内容
	Read      bool          `gorm:"not null" json:"read"`                                         // 是否已读
	ReadAt    *time.Time    `json:"read_at"`                                                      // 已读时间
	Status    MessageStatus `gorm:"not null" json:"status"`                                       // 消息状态
	Note      *string       `gorm:"null;type:varchar(255)" json:"note"`                           // 这条通知的备注
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Message) BeforeCreate

func (news *Message) BeforeCreate(scope *gorm.Scope) error

func (*Message) TableName

func (news *Message) TableName() string

type MessageStatus

type MessageStatus int
const (
	MessageStatusActive MessageStatus = 0 // 默认状态
)

type News

type News struct {
	Id        string         `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // 新闻公告类ID
	Author    string         `gorm:"not null;index;type:varchar(32)" json:"author"`                // 公告的作者ID
	Title     string         `gorm:"not null;index;type:varchar(32)" json:"title"`                 // 公告标题
	Content   string         `gorm:"not null;type:text" json:"content"`                            // 公告内容
	Type      NewsType       `gorm:"not null;type:varchar(32)" json:"type"`                        // 公告类型
	Tags      pq.StringArray `gorm:"type:varchar(32)[]" json:"tags"`                               // 公告的标签
	Status    NewsStatus     `gorm:"not null;type:integer" json:"status"`                          // 公告状态
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*News) BeforeCreate

func (news *News) BeforeCreate(scope *gorm.Scope) error

func (*News) TableName

func (news *News) TableName() string

type NewsStatus

type NewsStatus int

type NewsType

type NewsType string

type Notification

type Notification struct {
	Id        string             `gorm:"primary_key;not null;unique;index;type:varchar(32)" json:"id"` // 通知ID
	Author    string             `gorm:"not null;index;type:varchar(32)" json:"Author"`                // 发布这则公告的作者
	Title     string             `gorm:"not null;index;type:varchar(32)" json:"title"`                 // 公告标题
	Content   string             `gorm:"not null;type:text" json:"content"`                            // 公告内容
	Status    NotificationStatus `gorm:"not null" json:"status"`                                       // 公告状态
	Note      *string            `gorm:"null;type:varchar(255)" json:"note"`                           // 这条通知的备注
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Notification) BeforeCreate

func (news *Notification) BeforeCreate(scope *gorm.Scope) error

func (*Notification) TableName

func (news *Notification) TableName() string

type NotificationMark

type NotificationMark struct {
	Id           string       `gorm:"primary_key;not null;unique(uid);index;type:varchar(32)" json:"id"` // 通知ID, 通知 ID 和 UID 为联合唯一
	Uid          string       `gorm:"not null;index;unique(id);type:varchar(32)" json:"uid"`             // 对应的用户ID, 联合通知ID唯一
	Read         bool         `gorm:"not null" json:"read"`                                              // 是否已读
	Notification Notification `gorm:"foreign_key:Id;association_foreign_key:Id" json:"notification"`     // 关联外键
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    *time.Time `sql:"index"`
}

func (*NotificationMark) BeforeCreate

func (news *NotificationMark) BeforeCreate(scope *gorm.Scope) error

func (*NotificationMark) TableName

func (news *NotificationMark) TableName() string

type NotificationStatus

type NotificationStatus int
const (
	NotificationStatusInActive NotificationStatus = -1 // 未启用的状态
	NotificationStatusActive   NotificationStatus = 0  // 启用的状态
)

type Report

type Report struct {
	Id          string         `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // 反馈ID
	Uid         string         `gorm:"not null;index;type:varchar(32)" json:"uid"`                   // 反馈的作者ID
	Title       string         `gorm:"not null;index;type:varchar(32)" json:"title"`                 // 反馈标题
	Content     string         `gorm:"not null;type:text" json:"content"`                            // 反馈内容
	Type        ReportType     `gorm:"not null;type:varchar(32)" json:"type"`                        // 反馈类型
	Status      ReportStatus   `gorm:"not null;" json:"status"`                                      // 当前报告的处理状态
	Screenshots pq.StringArray `gorm:"type:varchar(256)[]" json:"screenshots"`                       // 反馈的截图
	Locked      bool           `gorm:"not null;" json:"locked"`                                      // 是否已锁定,锁定之后用户不能再更改状态
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time `sql:"index"`
}

func (*Report) BeforeCreate

func (report *Report) BeforeCreate(scope *gorm.Scope) (err error)

func (*Report) TableName

func (report *Report) TableName() string

type ReportStatus

type ReportStatus int

type ReportType

type ReportType string

type Role

type Role struct {
	Name        string         `gorm:"primary_key;unique;not null;index;type:varchar(64)" json:"name"` // 角色名, 作为主建而且唯一
	Description string         `gorm:"not null;index;type:varchar(64)" json:"description"`             // 角色描述
	Accession   pq.StringArray `gorm:"not null;index;type:varchar(64)[]" json:"accession"`             // 改角色拥有的权限
	BuildIn     bool           `gorm:"not null;index;" json:"build_in"`                                // 是否是内建的角色,该角色通常是不可改的
	Note        *string        `gorm:"null;index;type:varchar(64)" json:"note"`                        // 备注
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time `sql:"index"`
}

func (*Role) TableName

func (news *Role) TableName() string

type TransferLog

type TransferLog struct {
	Id           string         `gorm:"primary_key;unique;not null;index;type:varchar(32)" json:"id"` // 转账ID
	Currency     string         `gorm:"not null;index;" json:"currency"`                              // 转账币种
	From         string         `gorm:"not null;index;type:varchar(32)" json:"from"`                  // 汇款人
	To           string         `gorm:"not null;index;type:varchar(32)" json:"to"`                    // 收款人
	Amount       string         `gorm:"not null;type:numeric" json:"amount"`                          // 转账数量
	Status       TransferStatus `gorm:"not null" json:"status"`                                       // 转账状态
	Note         *string        `gorm:"null;type:varchar(128)" json:"note"`                           // 转账备注
	SnapshotFrom *string        `gorm:"null" json:"-"`                                                // 转账者的钱包快照
	SnapshotTo   *string        `gorm:"null" json:"-"`                                                // 收款人的钱包快照
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    *time.Time `sql:"index" json:"-"`
}

func (*TransferLog) BeforeCreate

func (news *TransferLog) BeforeCreate(scope *gorm.Scope) error

type TransferLogCny

type TransferLogCny struct {
	TransferLog
}

func (*TransferLogCny) TableName

func (news *TransferLogCny) TableName() string

type TransferLogCoin

type TransferLogCoin struct {
	TransferLog
}

func (*TransferLogCoin) TableName

func (news *TransferLogCoin) TableName() string

type TransferLogUsd

type TransferLogUsd struct {
	TransferLog
}

func (*TransferLogUsd) TableName

func (news *TransferLogUsd) TableName() string

type TransferStatus

type TransferStatus int

type User

type User struct {
	Id            string         `gorm:"primary_key;not null;unique;index;type:varchar(32)" json:"id"` // 用户ID
	Username      string         `gorm:"not null;unique;index" json:"username"`                        // 用户名
	Password      string         `gorm:"not null;type:varchar(36);index" json:"password"`              // 登陆密码
	PayPassword   *string        `gorm:"null;type:varchar(36)" json:"pay_password"`                    // 支付密码
	Nickname      *string        `gorm:"null;type:varchar(36)" json:"nickname"`                        // 昵称
	Phone         *string        `gorm:"null;type:varchar(16);index" json:"phone"`                     // 手机号
	Email         *string        `gorm:"null;type:varchar(36);index" json:"email"`                     // 邮箱
	Status        UserStatus     `gorm:"not null" json:"status"`                                       // 状态
	Role          pq.StringArray `gorm:"not null;type:varchar(36)[]" json:"role"`                      // 角色, 用户可以拥有多个角色
	Avatar        string         `gorm:"not null;type:varchar(128)" json:"avatar"`                     // 头像
	Level         int32          `gorm:"default(1)" json:"level"`                                      // 用户等级
	Gender        Gender         `gorm:"default(0)" json:"gender"`                                     // 性别
	EnableTOTP    bool           `gorm:"not null;" json:"enable_totp"`                                 // 是否启用双重身份认证
	Secret        string         `gorm:"not null;type:varchar(32)" json:"secret"`                      // 用户自己的密钥
	InviteCode    string         `gorm:"not null;unique;type:varchar(8)" json:"invite_code"`           // 用户的邀请码,邀请码唯一
	OauthGoogleId *string        `gorm:"null;unique;type:varchar(255)" json:"oauth_google_id"`         // 用户的GoogleAuth唯一标识符
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     *time.Time `sql:"index"`
}

func (*User) BeforeCreate

func (news *User) BeforeCreate(scope *gorm.Scope) error

func (*User) TableName

func (news *User) TableName() string

type UserStatus

type UserStatus int32

type Wallet

type Wallet struct {
	Id        string  `gorm:"primary_key;unique;notnull;index;type:varchar(32)" json:"id"` // 用户ID
	Currency  string  `gorm:"not null;type:varchar(12)" json:"currency"`                   // 钱包币种
	Balance   float64 `gorm:"not null;type:numeric" json:"balance"`                        // 可用余额
	Frozen    float64 `gorm:"not null;type:numeric" json:"frozen"`                         // 冻结余额
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

type WalletCny

type WalletCny struct {
	Wallet
}

人民币

func (*WalletCny) TableName

func (news *WalletCny) TableName() string

type WalletCoin

type WalletCoin struct {
	Wallet
}

我们平台自己的币

func (*WalletCoin) TableName

func (news *WalletCoin) TableName() string

type WalletUsd

type WalletUsd struct {
	Wallet
}

美元

func (*WalletUsd) TableName

func (news *WalletUsd) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL