accounts

package
v0.0.0-...-90f78ec Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccountDomain

func NewAccountDomain() *accountDomain

用于发红包时红包支付环节

Types

type Account

type Account struct {
	Id           int64           `db:"id,omitempty"`         //账户ID
	AccountNo    string          `db:"account_no,uni"`       //账户编号,账户唯一标识
	AccountName  string          `db:"account_name"`         //账户名称,用来说明账户的简短描述,账户对应的名称或者命名,比如xxx积分、xxx零钱
	AccountType  int             `db:"account_type"`         //账户类型,用来区分不同类型的账户:积分账户、会员卡账户、钱包账户、红包账户
	CurrencyCode string          `db:"currency_code"`        //货币类型编码:CNY人民币,EUR欧元,USD美元 。。。
	UserId       string          `db:"user_id"`              //用户编号, 账户所属用户
	Username     sql.NullString  `db:"username"`             //用户名称
	Balance      decimal.Decimal `db:"balance"`              //账户可用余额
	Status       int             `db:"status"`               //账户状态,账户状态:0账户初始化,1启用,2停用
	CreatedAt    time.Time       `db:"created_at,omitempty"` //创建时间
	UpdatedAt    time.Time       `db:"updated_at,omitempty"` //更新时间
}

账户持久化对象

func (*Account) FromDTO

func (po *Account) FromDTO(dto *services.AccountDTO)

func (*Account) ToDTO

func (po *Account) ToDTO() *services.AccountDTO

,omitempty

type AccountDao

type AccountDao struct {
	// contains filtered or unexported fields
}

func (*AccountDao) GetByUserId

func (dao *AccountDao) GetByUserId(userId string, accountType int) *Account

通过用户 id 和账户类型来查询账户信息

func (*AccountDao) GetOne

func (dao *AccountDao) GetOne(accountNo string) *Account

查询数据库持久化对象的单实例,获取一行数据

func (*AccountDao) Insert

func (dao *AccountDao) Insert(a *Account) (id int64, err error)

账户数据的插入

func (*AccountDao) UpdateBalance

func (dao *AccountDao) UpdateBalance(accountNo string, amount decimal.Decimal) (rows int64, err error)

账户余额的更新,返回更新影响行数和错误信息

func (*AccountDao) UpdateStatus

func (dao *AccountDao) UpdateStatus(accountNo string, status int) (rows int64, err error)

账户状态更新,返回影响行数和错误信息

type AccountLog

type AccountLog struct {
	Id              int64               `db:"id,omitempty"`         //
	LogNo           string              `db:"log_no,uni"`           //流水编号 全局不重复字符或数字,唯一性标识
	TradeNo         string              `db:"trade_no"`             //交易单号 全局不重复字符或数字,唯一性标识
	AccountNo       string              `db:"account_no"`           //账户编号 账户ID
	UserId          string              `db:"user_id"`              //用户编号
	Username        string              `db:"username"`             //用户名称
	TargetAccountNo string              `db:"target_account_no"`    //账户编号 账户ID
	TargetUserId    string              `db:"target_user_id"`       //目标用户编号
	TargetUsername  string              `db:"target_username"`      //目标用户名称
	Amount          decimal.Decimal     `db:"amount"`               //交易金额,该交易涉及的金额
	Balance         decimal.Decimal     `db:"balance"`              //交易后余额,该交易后的余额
	ChangeType      services.ChangeType `db:"change_type"`          //流水交易类型,0 创建账户,>0 为收入类型,<0 为支出类型,自定义
	ChangeFlag      services.ChangeFlag `db:"change_flag"`          //交易变化标识:-1 出账 1为进账,枚举
	Status          int                 `db:"status"`               //交易状态:
	Decs            string              `db:"decs"`                 //交易描述
	CreatedAt       time.Time           `db:"created_at,omitempty"` //创建时间
}

func (*AccountLog) FromDTO

func (po *AccountLog) FromDTO(dto *services.AccountLogDTO)

func (*AccountLog) FromTransferDTO

func (po *AccountLog) FromTransferDTO(dto *services.AccountTransferDTO)

func (*AccountLog) ToDTO

func (po *AccountLog) ToDTO() *services.AccountLogDTO

type AccountLogDao

type AccountLogDao struct {
	// contains filtered or unexported fields
}

func (*AccountLogDao) GetByTradeNo

func (dao *AccountLogDao) GetByTradeNo(tradeNo string) *AccountLog

通过交易编号查询流水记录

func (*AccountLogDao) GetOne

func (dao *AccountLogDao) GetOne(logNo string) *AccountLog

通过流水编号查询流水记录

func (*AccountLogDao) Insert

func (dao *AccountLogDao) Insert(l *AccountLog) (id int64, err error)

流水记录的写入

Jump to

Keyboard shortcuts

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