feat: expand superadmin edits and minio docs
This commit is contained in:
@@ -2,8 +2,10 @@ package v1
|
||||
|
||||
import (
|
||||
dto "quyun/v2/app/http/super/v1/dto"
|
||||
v1_dto "quyun/v2/app/http/v1/dto"
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/app/services"
|
||||
"quyun/v2/database/models"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
@@ -26,3 +28,36 @@ type creators struct{}
|
||||
func (c *creators) List(ctx fiber.Ctx, filter *dto.TenantListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListTenants(ctx, filter)
|
||||
}
|
||||
|
||||
// Get creator settings
|
||||
//
|
||||
// @Router /super/v1/creators/:tenantID<int>/settings [get]
|
||||
// @Summary Get creator settings
|
||||
// @Description Get creator settings by tenant ID
|
||||
// @Tags Creator
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param tenantID path int64 true "Tenant ID"
|
||||
// @Success 200 {object} v1_dto.Settings
|
||||
// @Bind tenantID path
|
||||
func (c *creators) GetSettings(ctx fiber.Ctx, tenantID int64) (*v1_dto.Settings, error) {
|
||||
return services.Super.GetCreatorSettings(ctx, tenantID)
|
||||
}
|
||||
|
||||
// Update creator settings
|
||||
//
|
||||
// @Router /super/v1/creators/:tenantID<int>/settings [put]
|
||||
// @Summary Update creator settings
|
||||
// @Description Update creator settings by tenant ID
|
||||
// @Tags Creator
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param tenantID path int64 true "Tenant ID"
|
||||
// @Param form body v1_dto.Settings true "Settings form"
|
||||
// @Success 200 {string} string "Updated"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind tenantID path
|
||||
// @Bind form body
|
||||
func (c *creators) UpdateSettings(ctx fiber.Ctx, user *models.User, tenantID int64, form *v1_dto.Settings) error {
|
||||
return services.Super.UpdateCreatorSettings(ctx, user.ID, tenantID, form)
|
||||
}
|
||||
|
||||
@@ -213,6 +213,16 @@ type UserItem struct {
|
||||
Balance int64 `json:"balance"`
|
||||
// BalanceFrozen 账户冻结余额(分)。
|
||||
BalanceFrozen int64 `json:"balance_frozen"`
|
||||
// Nickname 用户昵称(资料展示)。
|
||||
Nickname string `json:"nickname"`
|
||||
// Avatar 用户头像URL(资料展示)。
|
||||
Avatar string `json:"avatar"`
|
||||
// Gender 用户性别(male/female/secret)。
|
||||
Gender consts.Gender `json:"gender"`
|
||||
// Bio 用户个人简介。
|
||||
Bio string `json:"bio"`
|
||||
// IsRealNameVerified 是否已实名认证。
|
||||
IsRealNameVerified bool `json:"is_real_name_verified"`
|
||||
// OwnedTenantCount 拥有的租户数量。
|
||||
OwnedTenantCount int64 `json:"owned_tenant_count"`
|
||||
// JoinedTenantCount 加入的租户数量。
|
||||
|
||||
@@ -113,6 +113,22 @@ type SuperNotificationTemplateCreateForm struct {
|
||||
IsActive *bool `json:"is_active"`
|
||||
}
|
||||
|
||||
// SuperNotificationTemplateUpdateForm 超管通知模板更新参数。
|
||||
type SuperNotificationTemplateUpdateForm struct {
|
||||
// TenantID 租户ID(不传代表不修改租户归属)。
|
||||
TenantID *int64 `json:"tenant_id"`
|
||||
// Name 模板名称(可选)。
|
||||
Name *string `json:"name"`
|
||||
// Type 通知类型(system/order/audit/interaction,可选)。
|
||||
Type *consts.NotificationType `json:"type"`
|
||||
// Title 通知标题(可选)。
|
||||
Title *string `json:"title"`
|
||||
// Content 通知内容(可选)。
|
||||
Content *string `json:"content"`
|
||||
// IsActive 是否启用(可选)。
|
||||
IsActive *bool `json:"is_active"`
|
||||
}
|
||||
|
||||
// SuperNotificationTemplateItem 超管通知模板条目。
|
||||
type SuperNotificationTemplateItem struct {
|
||||
// ID 模板ID。
|
||||
|
||||
@@ -72,3 +72,29 @@ type SuperPayoutAccountReviewForm struct {
|
||||
// Reason 审核说明(驳回时必填)。
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// SuperPayoutAccountCreateForm 超管创建结算账户参数。
|
||||
type SuperPayoutAccountCreateForm struct {
|
||||
// UserID 收款账户归属用户ID。
|
||||
UserID int64 `json:"user_id" validate:"required"`
|
||||
// Type 账户类型(bank/alipay)。
|
||||
Type string `json:"type" validate:"required,oneof=bank alipay"`
|
||||
// Name 账户名称/开户行。
|
||||
Name string `json:"name" validate:"required,max=128"`
|
||||
// Account 收款账号。
|
||||
Account string `json:"account" validate:"required,max=128"`
|
||||
// Realname 收款人姓名。
|
||||
Realname string `json:"realname" validate:"required,max=128"`
|
||||
}
|
||||
|
||||
// SuperPayoutAccountUpdateForm 超管更新结算账户参数。
|
||||
type SuperPayoutAccountUpdateForm struct {
|
||||
// Type 账户类型(bank/alipay,可选)。
|
||||
Type *string `json:"type" validate:"omitempty,oneof=bank alipay"`
|
||||
// Name 账户名称/开户行(可选)。
|
||||
Name *string `json:"name" validate:"omitempty,max=128"`
|
||||
// Account 收款账号(可选)。
|
||||
Account *string `json:"account" validate:"omitempty,max=128"`
|
||||
// Realname 收款人姓名(可选)。
|
||||
Realname *string `json:"realname" validate:"omitempty,max=128"`
|
||||
}
|
||||
|
||||
@@ -117,6 +117,24 @@ type SuperUserRealNameResponse struct {
|
||||
IDCardMasked string `json:"id_card_masked"`
|
||||
}
|
||||
|
||||
// SuperUserProfileUpdateForm 超管用户资料更新表单。
|
||||
type SuperUserProfileUpdateForm struct {
|
||||
// Nickname 昵称(可选,空字符串表示清空)。
|
||||
Nickname *string `json:"nickname"`
|
||||
// Avatar 头像URL(可选,空字符串表示清空)。
|
||||
Avatar *string `json:"avatar"`
|
||||
// Gender 性别(可选)。
|
||||
Gender *consts.Gender `json:"gender"`
|
||||
// Bio 个人简介(可选,空字符串表示清空)。
|
||||
Bio *string `json:"bio"`
|
||||
// IsRealNameVerified 是否已实名认证(可选)。
|
||||
IsRealNameVerified *bool `json:"is_real_name_verified"`
|
||||
// RealName 真实姓名(可选,用于更新实名认证信息)。
|
||||
RealName *string `json:"real_name"`
|
||||
// IDCard 身份证号(可选,用于更新实名认证信息)。
|
||||
IDCard *string `json:"id_card"`
|
||||
}
|
||||
|
||||
// SuperUserContentActionListFilter 超管用户互动内容列表过滤条件。
|
||||
type SuperUserContentActionListFilter struct {
|
||||
requests.Pagination
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
dto "quyun/v2/app/http/super/v1/dto"
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/app/services"
|
||||
"quyun/v2/database/models"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
@@ -70,3 +71,21 @@ func (c *notifications) ListTemplates(ctx fiber.Ctx, filter *dto.SuperNotificati
|
||||
func (c *notifications) CreateTemplate(ctx fiber.Ctx, form *dto.SuperNotificationTemplateCreateForm) (*dto.SuperNotificationTemplateItem, error) {
|
||||
return services.Super.CreateNotificationTemplate(ctx, form)
|
||||
}
|
||||
|
||||
// Update notification template
|
||||
//
|
||||
// @Router /super/v1/notifications/templates/:id<int> [patch]
|
||||
// @Summary Update notification template
|
||||
// @Description Update notification template
|
||||
// @Tags Notification
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "Template ID"
|
||||
// @Param form body dto.SuperNotificationTemplateUpdateForm true "Update form"
|
||||
// @Success 200 {object} dto.SuperNotificationTemplateItem
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *notifications) UpdateTemplate(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperNotificationTemplateUpdateForm) (*dto.SuperNotificationTemplateItem, error) {
|
||||
return services.Super.UpdateNotificationTemplate(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,24 @@ func (c *payoutAccounts) List(ctx fiber.Ctx, filter *dto.SuperPayoutAccountListF
|
||||
return services.Super.ListPayoutAccounts(ctx, filter)
|
||||
}
|
||||
|
||||
// Create payout account
|
||||
//
|
||||
// @Router /super/v1/creators/:tenantID<int>/payout-accounts [post]
|
||||
// @Summary Create payout account
|
||||
// @Description Create payout account for tenant
|
||||
// @Tags Finance
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param tenantID path int64 true "Tenant ID"
|
||||
// @Param form body dto.SuperPayoutAccountCreateForm true "Create form"
|
||||
// @Success 200 {string} string "Created"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind tenantID path
|
||||
// @Bind form body
|
||||
func (c *payoutAccounts) Create(ctx fiber.Ctx, user *models.User, tenantID int64, form *dto.SuperPayoutAccountCreateForm) error {
|
||||
return services.Super.CreatePayoutAccount(ctx, user.ID, tenantID, form)
|
||||
}
|
||||
|
||||
// Remove payout account
|
||||
//
|
||||
// @Router /super/v1/payout-accounts/:id<int> [delete]
|
||||
@@ -61,3 +79,21 @@ func (c *payoutAccounts) Remove(ctx fiber.Ctx, user *models.User, id int64) erro
|
||||
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)
|
||||
}
|
||||
|
||||
// Update payout account
|
||||
//
|
||||
// @Router /super/v1/payout-accounts/:id<int> [patch]
|
||||
// @Summary Update payout account
|
||||
// @Description Update payout account across tenants
|
||||
// @Tags Finance
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "Payout account ID"
|
||||
// @Param form body dto.SuperPayoutAccountUpdateForm true "Update form"
|
||||
// @Success 200 {string} string "Updated"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *payoutAccounts) Update(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperPayoutAccountUpdateForm) error {
|
||||
return services.Super.UpdatePayoutAccount(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
@@ -228,6 +228,18 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
r.creators.List,
|
||||
Query[dto.TenantListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /super/v1/creators/:tenantID<int>/settings -> creators.GetSettings")
|
||||
router.Get("/super/v1/creators/:tenantID<int>/settings"[len(r.Path()):], DataFunc1(
|
||||
r.creators.GetSettings,
|
||||
PathParam[int64]("tenantID"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Put /super/v1/creators/:tenantID<int>/settings -> creators.UpdateSettings")
|
||||
router.Put("/super/v1/creators/:tenantID<int>/settings"[len(r.Path()):], Func3(
|
||||
r.creators.UpdateSettings,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("tenantID"),
|
||||
Body[v1_dto.Settings]("form"),
|
||||
))
|
||||
// Register routes for controller: finance
|
||||
r.log.Debugf("Registering route: Get /super/v1/finance/anomalies/balances -> finance.ListBalanceAnomalies")
|
||||
router.Get("/super/v1/finance/anomalies/balances"[len(r.Path()):], DataFunc1(
|
||||
@@ -261,6 +273,13 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
r.notifications.ListTemplates,
|
||||
Query[dto.SuperNotificationTemplateListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Patch /super/v1/notifications/templates/:id<int> -> notifications.UpdateTemplate")
|
||||
router.Patch("/super/v1/notifications/templates/:id<int>"[len(r.Path()):], DataFunc3(
|
||||
r.notifications.UpdateTemplate,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.SuperNotificationTemplateUpdateForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/notifications/broadcast -> notifications.Broadcast")
|
||||
router.Post("/super/v1/notifications/broadcast"[len(r.Path()):], Func1(
|
||||
r.notifications.Broadcast,
|
||||
@@ -318,6 +337,20 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
r.payoutAccounts.List,
|
||||
Query[dto.SuperPayoutAccountListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Patch /super/v1/payout-accounts/:id<int> -> payoutAccounts.Update")
|
||||
router.Patch("/super/v1/payout-accounts/:id<int>"[len(r.Path()):], Func3(
|
||||
r.payoutAccounts.Update,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.SuperPayoutAccountUpdateForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/creators/:tenantID<int>/payout-accounts -> payoutAccounts.Create")
|
||||
router.Post("/super/v1/creators/:tenantID<int>/payout-accounts"[len(r.Path()):], Func3(
|
||||
r.payoutAccounts.Create,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("tenantID"),
|
||||
Body[dto.SuperPayoutAccountCreateForm]("form"),
|
||||
))
|
||||
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,
|
||||
@@ -487,6 +520,13 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
router.Get("/super/v1/users/statuses"[len(r.Path()):], DataFunc0(
|
||||
r.users.Statuses,
|
||||
))
|
||||
r.log.Debugf("Registering route: Patch /super/v1/users/:id<int> -> users.UpdateProfile")
|
||||
router.Patch("/super/v1/users/:id<int>"[len(r.Path()):], Func3(
|
||||
r.users.UpdateProfile,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.SuperUserProfileUpdateForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Patch /super/v1/users/:id<int>/roles -> users.UpdateRoles")
|
||||
router.Patch("/super/v1/users/:id<int>/roles"[len(r.Path()):], Func2(
|
||||
r.users.UpdateRoles,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
dto "quyun/v2/app/http/super/v1/dto"
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/app/services"
|
||||
"quyun/v2/database/models"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
@@ -233,6 +234,24 @@ func (c *users) UpdateRoles(ctx fiber.Ctx, id int64, form *dto.UserRolesUpdateFo
|
||||
return services.Super.UpdateUserRoles(ctx, id, form)
|
||||
}
|
||||
|
||||
// Update user profile
|
||||
//
|
||||
// @Router /super/v1/users/:id<int> [patch]
|
||||
// @Summary Update user profile
|
||||
// @Description Update user profile fields
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "User ID"
|
||||
// @Param form body dto.SuperUserProfileUpdateForm true "Update form"
|
||||
// @Success 200 {string} string "Updated"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *users) UpdateProfile(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperUserProfileUpdateForm) error {
|
||||
return services.Super.UpdateUserProfile(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
// User statistics
|
||||
//
|
||||
// @Router /super/v1/users/statistics [get]
|
||||
|
||||
Reference in New Issue
Block a user