feat: add payout account review flow
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package dto
|
||||
|
||||
import "quyun/v2/app/requests"
|
||||
import (
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/pkg/consts"
|
||||
)
|
||||
|
||||
// SuperPayoutAccountListFilter 超管结算账户列表过滤条件。
|
||||
type SuperPayoutAccountListFilter struct {
|
||||
@@ -17,6 +20,8 @@ type SuperPayoutAccountListFilter struct {
|
||||
Username *string `query:"username"`
|
||||
// Type 账户类型过滤(bank/alipay)。
|
||||
Type *string `query:"type"`
|
||||
// Status 审核状态过滤(pending/approved/rejected)。
|
||||
Status *consts.PayoutAccountStatus `query:"status"`
|
||||
// CreatedAtFrom 创建时间起始(RFC3339)。
|
||||
CreatedAtFrom *string `query:"created_at_from"`
|
||||
// CreatedAtTo 创建时间结束(RFC3339)。
|
||||
@@ -45,8 +50,25 @@ type SuperPayoutAccountItem struct {
|
||||
Account string `json:"account"`
|
||||
// Realname 收款人姓名。
|
||||
Realname string `json:"realname"`
|
||||
// Status 审核状态。
|
||||
Status consts.PayoutAccountStatus `json:"status"`
|
||||
// StatusDescription 审核状态描述(用于展示)。
|
||||
StatusDescription string `json:"status_description"`
|
||||
// ReviewedBy 审核操作者ID。
|
||||
ReviewedBy int64 `json:"reviewed_by"`
|
||||
// ReviewedAt 审核时间(RFC3339)。
|
||||
ReviewedAt string `json:"reviewed_at"`
|
||||
// ReviewReason 审核说明/驳回原因。
|
||||
ReviewReason string `json:"review_reason"`
|
||||
// CreatedAt 创建时间(RFC3339)。
|
||||
CreatedAt string `json:"created_at"`
|
||||
// UpdatedAt 更新时间(RFC3339)。
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
type SuperPayoutAccountReviewForm struct {
|
||||
// Action 审核动作(approve/reject)。
|
||||
Action string `json:"action" validate:"required,oneof=approve reject"`
|
||||
// Reason 审核说明(驳回时必填)。
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
@@ -43,3 +43,21 @@ func (c *payoutAccounts) List(ctx fiber.Ctx, filter *dto.SuperPayoutAccountListF
|
||||
func (c *payoutAccounts) Remove(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Super.RemovePayoutAccount(ctx, user.ID, id)
|
||||
}
|
||||
|
||||
// Review payout account
|
||||
//
|
||||
// @Router /super/v1/payout-accounts/:id<int>/review [post]
|
||||
// @Summary Review payout account
|
||||
// @Description Review payout account across tenants
|
||||
// @Tags Finance
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "Payout account ID"
|
||||
// @Param form body dto.SuperPayoutAccountReviewForm true "Review form"
|
||||
// @Success 200 {string} string "Reviewed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *payoutAccounts) Review(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperPayoutAccountReviewForm) error {
|
||||
return services.Super.ReviewPayoutAccount(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
@@ -305,6 +305,13 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
r.payoutAccounts.List,
|
||||
Query[dto.SuperPayoutAccountListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/payout-accounts/:id<int>/review -> payoutAccounts.Review")
|
||||
router.Post("/super/v1/payout-accounts/:id<int>/review"[len(r.Path()):], Func3(
|
||||
r.payoutAccounts.Review,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.SuperPayoutAccountReviewForm]("form"),
|
||||
))
|
||||
// Register routes for controller: reports
|
||||
r.log.Debugf("Registering route: Get /super/v1/reports/overview -> reports.Overview")
|
||||
router.Get("/super/v1/reports/overview"[len(r.Path()):], DataFunc1(
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package dto
|
||||
|
||||
import "quyun/v2/app/requests"
|
||||
import (
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/pkg/consts"
|
||||
)
|
||||
|
||||
type ApplyForm struct {
|
||||
// Name 频道/创作者名称。
|
||||
@@ -206,6 +209,14 @@ type PayoutAccount struct {
|
||||
Account string `json:"account"`
|
||||
// Realname 收款人姓名。
|
||||
Realname string `json:"realname"`
|
||||
// Status 审核状态(pending/approved/rejected)。
|
||||
Status consts.PayoutAccountStatus `json:"status"`
|
||||
// StatusDescription 审核状态描述(用于展示)。
|
||||
StatusDescription string `json:"status_description"`
|
||||
// ReviewedAt 审核时间(RFC3339)。
|
||||
ReviewedAt string `json:"reviewed_at"`
|
||||
// ReviewReason 审核说明/驳回原因。
|
||||
ReviewReason string `json:"review_reason"`
|
||||
}
|
||||
|
||||
type WithdrawForm struct {
|
||||
|
||||
Reference in New Issue
Block a user