chore: stabilize lint and verify builds
This commit is contained in:
@@ -59,5 +59,6 @@ func (c *assets) Delete(ctx fiber.Ctx, id int64, query *dto.SuperAssetDeleteQuer
|
||||
if query != nil && query.Force != nil {
|
||||
force = *query.Force
|
||||
}
|
||||
|
||||
return services.Super.DeleteAsset(ctx, id, force)
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ func (c *contents) ListTenantContents(ctx fiber.Ctx, tenantID int64, filter *dto
|
||||
filter = &dto.SuperContentListFilter{}
|
||||
}
|
||||
filter.TenantID = &tenantID
|
||||
|
||||
return services.Super.ListContents(ctx, filter)
|
||||
}
|
||||
|
||||
|
||||
@@ -154,5 +154,6 @@ func (c *coupons) Grant(ctx fiber.Ctx, tenantID, id int64, form *v1_dto.CouponGr
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dto.SuperCouponGrantResponse{Granted: granted}, nil
|
||||
}
|
||||
|
||||
@@ -674,6 +674,54 @@ type SuperOrderReconcileForm struct {
|
||||
Note string `json:"note"`
|
||||
}
|
||||
|
||||
// RechargeCodeActivateForm 超管批量激活充值码表单。
|
||||
type RechargeCodeActivateForm struct {
|
||||
// Amount 充值码面额(单位元,必填且需大于 0)。
|
||||
Amount float64 `json:"amount" validate:"required,gt=0"`
|
||||
// Quantity 生成数量(可选,默认 1,单次上限 500)。
|
||||
Quantity int `json:"quantity" validate:"omitempty,gt=0"`
|
||||
// Remark 激活备注(可选,用于审计记录)。
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// RechargeCodeItem 充值码明细。
|
||||
type RechargeCodeItem struct {
|
||||
// ID 充值码ID。
|
||||
ID int64 `json:"id"`
|
||||
// Code 充值码字符串(兑换时输入)。
|
||||
Code string `json:"code"`
|
||||
// Amount 充值码面额(单位元)。
|
||||
Amount float64 `json:"amount"`
|
||||
// Status 充值码状态(active 已激活 / redeemed 已兑换)。
|
||||
Status string `json:"status"`
|
||||
// ActivatedAt 激活时间(RFC3339)。
|
||||
ActivatedAt string `json:"activated_at"`
|
||||
// ActivatedBy 激活操作者用户ID。
|
||||
ActivatedBy int64 `json:"activated_by"`
|
||||
// RedeemedAt 兑换时间(RFC3339,未兑换为空)。
|
||||
RedeemedAt string `json:"redeemed_at"`
|
||||
// RedeemedBy 兑换用户ID(未兑换为 0)。
|
||||
RedeemedBy int64 `json:"redeemed_by"`
|
||||
// RedeemedOrderID 兑换产生的充值订单ID(未兑换为 0)。
|
||||
RedeemedOrderID int64 `json:"redeemed_order_id"`
|
||||
// Remark 激活备注(可选)。
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// RechargeCodeActivateResponse 充值码激活返回结果。
|
||||
type RechargeCodeActivateResponse struct {
|
||||
// Items 本次生成的充值码列表。
|
||||
Items []RechargeCodeItem `json:"items"`
|
||||
}
|
||||
|
||||
// SuperWalletCreditForm 超管为用户充值表单。
|
||||
type SuperWalletCreditForm struct {
|
||||
// Amount 充值金额(单位元,必填且需大于 0)。
|
||||
Amount float64 `json:"amount" validate:"required,gt=0"`
|
||||
// Remark 充值备注(可选,用于审计记录)。
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// AdminContentItem for super admin view
|
||||
type AdminContentItem struct {
|
||||
// Content 内容摘要信息。
|
||||
|
||||
@@ -146,7 +146,8 @@ type SuperCouponGrantItem struct {
|
||||
// SuperCouponRiskListFilter 超管优惠券异常核查过滤条件。
|
||||
type SuperCouponRiskListFilter struct {
|
||||
requests.Pagination
|
||||
// RiskType 异常类型过滤(used_without_order/order_status_mismatch/used_outside_window/unused_has_order_or_used_at/duplicate_grant)。
|
||||
// RiskType 异常类型过滤:used_without_order/order_status_mismatch/
|
||||
// used_outside_window/unused_has_order_or_used_at/duplicate_grant。
|
||||
RiskType *string `query:"risk_type"`
|
||||
// CouponID 优惠券ID过滤(精确匹配)。
|
||||
CouponID *int64 `query:"coupon_id"`
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
@@ -58,3 +59,17 @@ func (c *finance) ListBalanceAnomalies(ctx fiber.Ctx, filter *dto.SuperBalanceAn
|
||||
func (c *finance) ListOrderAnomalies(ctx fiber.Ctx, filter *dto.SuperOrderAnomalyFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListOrderAnomalies(ctx, filter)
|
||||
}
|
||||
|
||||
// @Router /super/v1/finance/recharge-codes/activate [post]
|
||||
// @Summary Activate recharge codes
|
||||
// @Description Batch activate recharge codes
|
||||
// @Tags Finance
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param form body dto.RechargeCodeActivateForm true "Activate form"
|
||||
// @Success 200 {object} dto.RechargeCodeActivateResponse
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *finance) ActivateRechargeCodes(ctx fiber.Ctx, user *models.User, form *dto.RechargeCodeActivateForm) (*dto.RechargeCodeActivateResponse, error) {
|
||||
return services.Recharge.ActivateCodes(ctx, user.ID, form)
|
||||
}
|
||||
|
||||
@@ -256,6 +256,12 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
r.finance.ListLedgers,
|
||||
Query[dto.SuperLedgerListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/finance/recharge-codes/activate -> finance.ActivateRechargeCodes")
|
||||
router.Post("/super/v1/finance/recharge-codes/activate"[len(r.Path()):], DataFunc2(
|
||||
r.finance.ActivateRechargeCodes,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.RechargeCodeActivateForm]("form"),
|
||||
))
|
||||
// Register routes for controller: healths
|
||||
r.log.Debugf("Registering route: Get /super/v1/health/overview -> healths.Overview")
|
||||
router.Get("/super/v1/health/overview"[len(r.Path()):], DataFunc1(
|
||||
@@ -539,6 +545,13 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.UserStatusUpdateForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/users/:id<int>/wallet/credit -> users.CreditWallet")
|
||||
router.Post("/super/v1/users/:id<int>/wallet/credit"[len(r.Path()):], Func3(
|
||||
r.users.CreditWallet,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.SuperWalletCreditForm]("form"),
|
||||
))
|
||||
// Register routes for controller: withdrawals
|
||||
r.log.Debugf("Registering route: Get /super/v1/withdrawals -> withdrawals.List")
|
||||
router.Get("/super/v1/withdrawals"[len(r.Path()):], DataFunc1(
|
||||
|
||||
@@ -59,6 +59,22 @@ func (c *users) Wallet(ctx fiber.Ctx, id int64) (*dto.SuperWalletResponse, error
|
||||
return services.Super.GetUserWallet(ctx, id)
|
||||
}
|
||||
|
||||
// @Router /super/v1/users/:id<int>/wallet/credit [post]
|
||||
// @Summary Credit user wallet
|
||||
// @Description Credit user wallet balance
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "User ID"
|
||||
// @Param form body dto.SuperWalletCreditForm true "Credit form"
|
||||
// @Success 200 {string} string "OK"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *users) CreditWallet(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperWalletCreditForm) error {
|
||||
return services.Super.CreditUserWallet(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
// List user notifications
|
||||
//
|
||||
// @Router /super/v1/users/:id<int>/notifications [get]
|
||||
|
||||
Reference in New Issue
Block a user