assets

package
v0.0.0-...-0a93553 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FreezeStatusNew  FreezeStatus = 0
	FreezeStatusDone FreezeStatus = 1

	Behavior_Trade        OpBehavior = "trade"
	Behavior_Recharge     OpBehavior = "recharge"
	Behavior_Withdraw     OpBehavior = "withdraw"
	Behavior_Transfer     OpBehavior = "transfer"
	Behavior_DemoRecharge OpBehavior = "demo_recharge"
)
View Source
const (
	//根账户,所有的进出账都从这个账户开始,所有列的资产求和为0 系统金额才算对应的上
	ROOTUSERID = 0
	//系统收取手续费用放在该用户ID下
	SystemFeeUserID = 1
)

Variables

This section is empty.

Functions

func FreezeAssets

func FreezeAssets(db *xorm.Session, enable_transaction bool, user_id int64, symbol_id int, freeze_amount, business_id string, behavior OpBehavior) (success bool, err error)

func FreezeTotalAssets

func FreezeTotalAssets(db *xorm.Session, enable_transaction bool, user_id int64, symbol_id int, business_id string, behavior OpBehavior) (success bool, err error)

func Init

func Init(db *xorm.Engine, rdc *redis.Client)

func InitAssetsForDemo

func InitAssetsForDemo(uid int64, sid int, amount string, busid string)

func QueryFreeze

func QueryFreeze(db *xorm.Session, bid string) (*assetFreezeRecord, error)

func Transfer

func Transfer(db *xorm.Session, enable_transaction bool, from, to int64, symbol_id int, amount string, business_id string, behavior OpBehavior) (success bool, err error)

func UnfreezeAllAssets

func UnfreezeAllAssets(db *xorm.Session, enable_transaction bool, user_id int64, business_id string) (success bool, err error)

func UnfreezeAssets

func UnfreezeAssets(db *xorm.Session, enable_transaction bool, user_id int64, business_id, unfreeze_amount string) (success bool, err error)

解除资产冻结,unfreeze_amount="0" 则解除当前business_id全部冻结的资产

Types

type Assets

type Assets struct {
	Id         int64     `xorm:"pk autoincr bigint" json:"-"`
	UserId     int64     `xorm:"notnull unique(userid_symbol)" json:"-"`
	SymbolId   int       `xorm:"notnull unique(userid_symbol)" json:"-"`
	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:"available"`
	CreateTime time.Time `xorm:"timestamp created" json:"-"`
	UpdateTime time.Time `xorm:"timestamp updated" json:"update_time"`
}

用户资产余额表

func UserAssets

func UserAssets(user_id int64, symbol_id int) Assets

type FreezeStatus

type FreezeStatus int

用户资产冻结记录

type OpBehavior

type OpBehavior string

Jump to

Keyboard shortcuts

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