models

package
v0.0.0-...-824d9a1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HistoryTableName = "history"

HistoryTableName 数据库表名

View Source
const WithdrawTableName = "withdraw"

WithdrawTableName 数据库表名

Variables

This section is empty.

Functions

func Connect

func Connect(settings db.ConnectionURL, conns int) error

Connect 连接到MySQL

func InsertHistory

func InsertHistory(userID int64, describe string) error

InsertHistory 插入历史

func InsertWithdraw

func InsertWithdraw(userID int64, to, assetID string, amount, fee uint32) (int64, error)

InsertWithdraw 插入提现记录

func UpdateWithdraw

func UpdateWithdraw(orderID int64, status WithdrawStatus, reason *string) error

UpdateWithdraw 更新提现记录

func UpdateWithdrawFee

func UpdateWithdrawFee(orderID int64, fee uint32) error

UpdateWithdrawFee 更新手续费

Types

type History

type History struct {
	UserID     int64     `db:"user_id"`     // 用户ID
	Describe   string    `db:"describe"`    // 描述信息
	InsertedAt time.Time `db:"inserted_at"` // 插入日期
}

History 历史记录

func GetUserHistory

func GetUserHistory(userID int64, page int, number int) ([]History, uint, error)

GetUserHistory 获取用户历史记录

type Withdraw

type Withdraw struct {
	OrderID    int64          `db:"id"`               // 订单ID
	UserID     int64          `db:"user_id"`          // 用户ID
	To         string         `db:"to"`               // 帐户名
	AssetID    string         `db:"asset_id"`         // 资产ID
	Amount     uint32         `db:"amount"`           // 资产金额(分)
	Fee        uint32         `db:"fee"`              // 手续费用(分)
	Real       uint32         `db:"real"`             // 真实手续费(分)
	Status     WithdrawStatus `db:"status"`           // 提现状态
	Reason     *string        `db:"reason,omitempty"` // 错误原因
	InsertedAt time.Time      `db:"inserted_at"`      // 插入日期
}

Withdraw 提现记录

func GetWithdrawOrder

func GetWithdrawOrder(orderID int64) (*Withdraw, error)

GetWithdrawOrder 获取提现订单

type WithdrawStatus

type WithdrawStatus int

WithdrawStatus 提现状态

const (

	// WithdrawStatusWaiting 等待提现
	WithdrawStatusWaiting WithdrawStatus
	// WithdrawStatusProcessing 正在提现
	WithdrawStatusProcessing
	// WithdrawStatusSuccessful 提现成功
	WithdrawStatusSuccessful
	// WithdrawStatusFailure 提现失败
	WithdrawStatusFailure
)

Jump to

Keyboard shortcuts

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