feat:完善项目信息

This commit is contained in:
henry
2021-12-29 16:12:25 +08:00
parent 43dd770336
commit c3da1ebc51
8 changed files with 121 additions and 19 deletions

View File

@ -2,6 +2,7 @@ package user
import (
"SciencesServer/app/api/enterprise/model"
"SciencesServer/app/basic/controller"
model2 "SciencesServer/app/common/model"
"SciencesServer/app/session"
"SciencesServer/config"
@ -16,12 +17,16 @@ type Withdrawal struct {
type WithdrawalHandle func(session *session.Enterprise) *Withdrawal
type (
// WithdrawalBasic 基本信息
WithdrawalBasic struct {
ID string `json:"id"`
*model.UserWithdrawalInfo
}
// WithdrawalInfo 提现数据信息
WithdrawalInfo struct {
Data []*model2.UserWithdrawal `json:"data"`
Amount float64 `json:"amount"`
ActualAmount float64 `json:"actual_amount"`
Count int64 `json:"count"`
controller.ReturnPages
TotalAmount float64 `json:"total_amount"`
TotalActualAmount float64 `json:"total_actual_amount"`
}
// WithdrawalTransferInfo 提现转账信息
WithdrawalTransferInfo struct {
@ -36,16 +41,23 @@ func (c *Withdrawal) Instance(status int, createdAt string, page, pageSize int)
out := new(WithdrawalInfo)
where := []*model2.ModelWhere{model2.NewWhere("uid", c.UID), model2.NewWhere("status", status)}
where := []*model2.ModelWhere{model2.NewWhere("w.uid", c.UID), model2.NewWhere("w.status", status)}
if createdAt != "" {
where = append(where, model2.NewWhereSectionAt("created_at", strings.Split(createdAt, " ~ "))...)
where = append(where, model2.NewWhereSectionAt("w.created_at", strings.Split(createdAt, " ~ "))...)
}
var err error
ret, err := mUserWithdrawal.Withdrawal(page, pageSize, &out.Count, &out.TotalAmount, &out.TotalActualAmount, where...)
if out.Data, err = mUserWithdrawal.Withdrawal(page, pageSize, &out.Count, &out.Amount, &out.ActualAmount, where...); err != nil {
if err != nil {
return nil, err
}
list := make([]*WithdrawalBasic, 0)
for _, v := range ret {
list = append(list, &WithdrawalBasic{ID: v.GetEncodeID(), UserWithdrawalInfo: v})
}
out.Data = list
return out, nil
}