Documentation ¶
Index ¶
- Constants
- func BalanceOfAvailable(user_id, symbol string) decimal.Decimal
- func BalanceOfFreeze(user_id, symbol string) decimal.Decimal
- func BalanceOfTotal(user_id, symbol string) decimal.Decimal
- func DemoData()
- func FreezeAssets(db *xorm.Session, user_id string, symbol string, ...) (success bool, err error)
- func FreezeTotalAssets(db *xorm.Session, user_id string, symbol string, business_id string, ...) (success bool, err error)
- func QueryAssetsLogBusIdIsExist(symbol string, user_id string, business_id string) bool
- func SysDeposit(to string, symbol string, amount string, business_id string) (success bool, err error)
- func SysWithdraw(user_id string, symbol string, amount string, business_id string) (success bool, err error)
- func Transfer(db *xorm.Session, from, to string, symbol string, amount string, ...) (success bool, err error)
- func UnfreezeAllAssets(db *xorm.Session, symbol string, user_id string, business_id string) (success bool, err error)
- func UnfreezeAssets(db *xorm.Session, symbol string, user_id string, ...) (success bool, err error)
- type Assets
- type AssetsFreeze
- type AssetsHealthStatus
- type AssetsLog
- type FreezeStatus
- type OpBehavior
Constants ¶
View Source
const ( FreezeStatusNew FreezeStatus = 0 FreezeStatusDone FreezeStatus = 1 Behavior_Trade OpBehavior = "trade" Behavior_Recharge OpBehavior = "deposit" Behavior_Withdraw OpBehavior = "withdraw" Behavior_Transfer OpBehavior = "transfer" )
View Source
const ( //根账户,所有的进出账都从这个账户开始,所有列的资产求和应该为0 UserRoot string = "root" //系统收取手续费用放在该用户ID下 UserSystemFee string = "fee" )
Variables ¶
This section is empty.
Functions ¶
func BalanceOfAvailable ¶
func BalanceOfFreeze ¶
func BalanceOfTotal ¶
func FreezeAssets ¶
func FreezeTotalAssets ¶
func SysDeposit ¶
func SysDeposit(to string, symbol string, amount string, business_id string) (success bool, err error)
充值
func SysWithdraw ¶
func SysWithdraw(user_id string, symbol string, amount string, business_id string) (success bool, err error)
提现
func UnfreezeAllAssets ¶
Types ¶
type Assets ¶
type Assets struct { Id int64 `xorm:"pk autoincr bigint" json:"id"` UserId string `xorm:"varchar(30) notnull unique(userid_symbol)" json:"user_id"` Symbol string `xorm:"varchar(30) notnull unique(userid_symbol)" json:"symbol"` Total string `xorm:"decimal(40,20) default(0) notnull" json:"total"` Freeze string `xorm:"decimal(40,20) default(0) notnull" json:"freeze"` Available string `xorm:"decimal(40,20) default(0) notnull" json:"avail"` CreateTime utils.Time `xorm:"timestamp created" json:"create_time"` UpdateTime utils.Time `xorm:"timestamp updated" json:"update_time"` }
用户资产余额表
func FindSymbol ¶
func UserAssets ¶
type AssetsFreeze ¶
type AssetsFreeze struct { Id int64 `xorm:"pk autoincr bigint" json:"id"` UserId string `xorm:"varchar(30) index notnull" json:"user_id"` Symbol string `xorm:"varchar(30) index notnull" json:"symbol"` Amount string `xorm:"decimal(40,20) default(0) notnull" json:"amount"` // 冻结总量 FreezeAmount string `xorm:"decimal(40,20) default(0) notnull" json:"freeze_amount"` // 冻结着的量 Status FreezeStatus `xorm:"tinyint(1)" json:"status"` // 状态 冻结中, 已解冻 BusinessId string `xorm:"varchar(100) unique(business_id) notnull" json:"business_id"` //业务相关的id OpType OpBehavior `xorm:"varchar(15)" json:"op_type"` Info string `xorm:"varchar(64)" json:"info"` CreateTime utils.Time `xorm:"timestamp created" json:"create_time"` UpdateTime utils.Time `xorm:"timestamp updated" json:"update_time"` }
func QueryFreeze ¶
func (*AssetsFreeze) TableName ¶ added in v0.1.7
func (a *AssetsFreeze) TableName() string
type AssetsHealthStatus ¶
type AssetsHealthStatus struct { GlobalTotal string `json:"global_total"` UserTotal string `json:"user_total"` Health bool `json:"health"` }
func AssetsCheck ¶
func AssetsCheck() AssetsHealthStatus
type AssetsLog ¶
type AssetsLog struct { Id int64 `xorm:"pk autoincr bigint" json:"id"` UserId string `xorm:"varchar(30) index notnull" json:"user_id"` Symbol string `xorm:"varchar(30) index notnull" json:"symbol"` Before string `xorm:"decimal(40,20) default(0)" json:"before"` // 变动前 Amount string `xorm:"decimal(40,20) default(0)" json:"amount"` // 变动数 After string `xorm:"decimal(40,20) default(0)" json:"after"` // 变动后 BusinessId string `xorm:"varchar(100) index(business_id) notnull" json:"business_id"` //业务相关的id OpType OpBehavior `xorm:"varchar(15)" json:"op_type"` Info string `xorm:"varchar(150)" json:"info"` CreateTime utils.Time `xorm:"timestamp created" json:"create_time"` UpdateTime utils.Time `xorm:"timestamp updated" json:"update_time"` }
用户资产变动记录
type OpBehavior ¶
type OpBehavior string
Click to show internal directories.
Click to hide internal directories.