feat:完善项目信息
This commit is contained in:
42
app/api/enterprise/model/user_withdrawal.go
Normal file
42
app/api/enterprise/model/user_withdrawal.go
Normal file
@ -0,0 +1,42 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
)
|
||||
|
||||
// UserWithdrawal 用户提现模型
|
||||
type UserWithdrawal struct {
|
||||
*model.UserWithdrawal
|
||||
}
|
||||
|
||||
// Withdrawal 提现记录
|
||||
func (m *UserWithdrawal) Withdrawal(page, pageSize int, count *int64, amount, actualAmount *float64, where ...*model.ModelWhere) ([]*model.UserWithdrawal, error) {
|
||||
db := orm.GetDB().Table(m.TableName()).
|
||||
Where("is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*model.UserWithdrawal, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Pluck("SUM(amount)", amount).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Pluck("SUM(actual_amount)", actualAmount).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewUserWithdrawal() *UserWithdrawal {
|
||||
return &UserWithdrawal{model.NewUserWithdrawal()}
|
||||
}
|
11
app/api/enterprise/model/user_withdrawal_transfer.go
Normal file
11
app/api/enterprise/model/user_withdrawal_transfer.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type UserWithdrawalTransfer struct {
|
||||
*model.UserWithdrawalTransfer
|
||||
}
|
||||
|
||||
func NewUserWithdrawalTransfer() *UserWithdrawalTransfer {
|
||||
return &UserWithdrawalTransfer{model.NewUserWithdrawalTransfer()}
|
||||
}
|
Reference in New Issue
Block a user