You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.2 KiB
55 lines
2.2 KiB
package user
|
|
|
|
import (
|
|
"recook/internal/v2/lib/db"
|
|
|
|
"github.com/golangkit/formatime"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
const (
|
|
RecookUserWalletBalanceListIncomeTypePay = 1 // 订单支付
|
|
RecookUserWalletBalanceListIncomeTypeRefund = 2 // 订单退款
|
|
RecookUserWalletBalanceListIncomeTypeWithdraw = 3 // 提现
|
|
RecookUserWalletBalanceListIncomeTypeWithdrawFail = 4 // 提现失败
|
|
RecookUserWalletBalanceListIncomeTypeTransfer = 5 // 瑞币转入
|
|
)
|
|
|
|
type RecookUserWalletBalanceListModel struct {
|
|
db.BaseModel
|
|
Id uint `gorm:"column:id;primary_key" json:"id,omitempty"`
|
|
UserId uint `gorm:"column:user_id" json:"-"`
|
|
IncomeType uint `gorm:"column:income_type" json:"-"`
|
|
Amount decimal.Decimal `gorm:"column:amount" json:"amount"`
|
|
Title string `gorm:"column:title" json:"title,omitempty"`
|
|
Comment string `gorm:"column:comment" json:"comment,omitempty"`
|
|
OrderId uint `gorm:"column:order_id" json:"-"`
|
|
OrderGoodsId uint `gorm:"column:order_goods_id" json:"-"`
|
|
OrderTime formatime.Second `gorm:"column:order_time" json:"orderTime,omitempty"`
|
|
CreatedAt formatime.Second `gorm:"column:created_at" json:"createdAt,omitempty"`
|
|
ProfitID uint `json:"profit_id"`
|
|
Status int `json:"status"`
|
|
}
|
|
|
|
// TableName sets the insert table name for this struct type
|
|
func (r *RecookUserWalletBalanceListModel) TableName() string {
|
|
return "recook_user_wallet_balance_list"
|
|
}
|
|
|
|
// @Style 添加
|
|
func (r *RecookUserWalletBalanceListModel) Create(data *RecookUserWalletBalanceListModel) {
|
|
r.GetDb().Create(data)
|
|
}
|
|
|
|
// @Style 获取列表
|
|
func (r *RecookUserWalletBalanceListModel) List(start, limit int, order string, query interface{}, args ...interface{}) (result []RecookUserWalletBalanceListModel) {
|
|
r.GetDb().Model(&RecookUserWalletBalanceListModel{}).Where(query, args...).Offset(start).Limit(limit).Order(order).Find(&result)
|
|
return
|
|
}
|
|
|
|
// @Style 获取列表数量
|
|
func (r *RecookUserWalletBalanceListModel) ListCount(query interface{}, args ...interface{}) (count int) {
|
|
r.GetDb().Model(&RecookUserWalletBalanceListModel{}).Where(query, args...).Count(&count)
|
|
return
|
|
}
|