refactor: 移除不必要的上下文调用,简化服务方法参数
This commit is contained in:
@@ -22,7 +22,7 @@ type auth struct{}
|
||||
// @Success 200 {object} dto.LoginResponse
|
||||
// @Bind form body
|
||||
func (c *auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, error) {
|
||||
return services.Super.Login(ctx.Context(), form)
|
||||
return services.Super.Login(ctx, form)
|
||||
}
|
||||
|
||||
// Check Token
|
||||
@@ -35,5 +35,5 @@ func (c *auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, er
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.LoginResponse
|
||||
func (c *auth) CheckToken(ctx fiber.Ctx) (*dto.LoginResponse, error) {
|
||||
return services.Super.CheckToken(ctx.Context())
|
||||
return services.Super.CheckToken(ctx)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type contents struct{}
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.AdminContentItem}
|
||||
// @Bind filter query
|
||||
func (c *contents) List(ctx fiber.Ctx, filter *dto.SuperContentListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListContents(ctx.Context(), filter)
|
||||
return services.Super.ListContents(ctx, filter)
|
||||
}
|
||||
|
||||
// Update content status
|
||||
@@ -43,5 +43,5 @@ func (c *contents) List(ctx fiber.Ctx, filter *dto.SuperContentListFilter) (*req
|
||||
// @Bind contentID path
|
||||
// @Bind form body
|
||||
func (c *contents) UpdateStatus(ctx fiber.Ctx, tenantID, contentID int64, form *dto.SuperTenantContentStatusUpdateForm) error {
|
||||
return services.Super.UpdateContentStatus(ctx.Context(), tenantID, contentID, form)
|
||||
return services.Super.UpdateContentStatus(ctx, tenantID, contentID, form)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type orders struct{}
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.SuperOrderItem}
|
||||
// @Bind filter query
|
||||
func (c *orders) List(ctx fiber.Ctx, filter *dto.SuperOrderListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListOrders(ctx.Context(), filter)
|
||||
return services.Super.ListOrders(ctx, filter)
|
||||
}
|
||||
|
||||
// Get order
|
||||
@@ -39,7 +39,7 @@ func (c *orders) List(ctx fiber.Ctx, filter *dto.SuperOrderListFilter) (*request
|
||||
// @Success 200 {object} dto.SuperOrderDetail
|
||||
// @Bind id path
|
||||
func (c *orders) Get(ctx fiber.Ctx, id int64) (*dto.SuperOrderDetail, error) {
|
||||
return services.Super.GetOrder(ctx.Context(), id)
|
||||
return services.Super.GetOrder(ctx, id)
|
||||
}
|
||||
|
||||
// Refund order
|
||||
@@ -56,7 +56,7 @@ func (c *orders) Get(ctx fiber.Ctx, id int64) (*dto.SuperOrderDetail, error) {
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *orders) Refund(ctx fiber.Ctx, id int64, form *dto.SuperOrderRefundForm) error {
|
||||
return services.Super.RefundOrder(ctx.Context(), id, form)
|
||||
return services.Super.RefundOrder(ctx, id, form)
|
||||
}
|
||||
|
||||
// Order statistics
|
||||
@@ -69,5 +69,5 @@ func (c *orders) Refund(ctx fiber.Ctx, id int64, form *dto.SuperOrderRefundForm)
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.OrderStatisticsResponse
|
||||
func (c *orders) Statistics(ctx fiber.Ctx) (*dto.OrderStatisticsResponse, error) {
|
||||
return services.Super.OrderStatistics(ctx.Context())
|
||||
return services.Super.OrderStatistics(ctx)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type tenants struct{}
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.TenantItem}
|
||||
// @Bind filter query
|
||||
func (c *tenants) List(ctx fiber.Ctx, filter *dto.TenantListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListTenants(ctx.Context(), filter)
|
||||
return services.Super.ListTenants(ctx, filter)
|
||||
}
|
||||
|
||||
// Create tenant
|
||||
@@ -40,7 +40,7 @@ func (c *tenants) List(ctx fiber.Ctx, filter *dto.TenantListFilter) (*requests.P
|
||||
// @Success 200 {string} string "Created"
|
||||
// @Bind form body
|
||||
func (c *tenants) Create(ctx fiber.Ctx, form *dto.TenantCreateForm) error {
|
||||
return services.Super.CreateTenant(ctx.Context(), form)
|
||||
return services.Super.CreateTenant(ctx, form)
|
||||
}
|
||||
|
||||
// Get tenant
|
||||
@@ -55,7 +55,7 @@ func (c *tenants) Create(ctx fiber.Ctx, form *dto.TenantCreateForm) error {
|
||||
// @Success 200 {object} dto.TenantItem
|
||||
// @Bind id path
|
||||
func (c *tenants) Get(ctx fiber.Ctx, id int64) (*dto.TenantItem, error) {
|
||||
return services.Super.GetTenant(ctx.Context(), id)
|
||||
return services.Super.GetTenant(ctx, id)
|
||||
}
|
||||
|
||||
// Update tenant status
|
||||
@@ -72,7 +72,7 @@ func (c *tenants) Get(ctx fiber.Ctx, id int64) (*dto.TenantItem, error) {
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *tenants) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.TenantStatusUpdateForm) error {
|
||||
return services.Super.UpdateTenantStatus(ctx.Context(), id, form)
|
||||
return services.Super.UpdateTenantStatus(ctx, id, form)
|
||||
}
|
||||
|
||||
// Update tenant expire
|
||||
@@ -89,7 +89,7 @@ func (c *tenants) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.TenantStatusUp
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *tenants) UpdateExpire(ctx fiber.Ctx, id int64, form *dto.TenantExpireUpdateForm) error {
|
||||
return services.Super.UpdateTenantExpire(ctx.Context(), id, form)
|
||||
return services.Super.UpdateTenantExpire(ctx, id, form)
|
||||
}
|
||||
|
||||
// Tenant statuses
|
||||
@@ -102,5 +102,5 @@ func (c *tenants) UpdateExpire(ctx fiber.Ctx, id int64, form *dto.TenantExpireUp
|
||||
// @Produce json
|
||||
// @Success 200 {array} requests.KV
|
||||
func (c *tenants) Statuses(ctx fiber.Ctx) ([]requests.KV, error) {
|
||||
return services.Super.TenantStatuses(ctx.Context())
|
||||
return services.Super.TenantStatuses(ctx)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type users struct{}
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.UserItem}
|
||||
// @Bind filter query
|
||||
func (c *users) List(ctx fiber.Ctx, filter *dto.UserListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListUsers(ctx.Context(), filter)
|
||||
return services.Super.ListUsers(ctx, filter)
|
||||
}
|
||||
|
||||
// Get user
|
||||
@@ -40,7 +40,7 @@ func (c *users) List(ctx fiber.Ctx, filter *dto.UserListFilter) (*requests.Pager
|
||||
// @Success 200 {object} dto.UserItem
|
||||
// @Bind id path
|
||||
func (c *users) Get(ctx fiber.Ctx, id int64) (*dto.UserItem, error) {
|
||||
return services.Super.GetUser(ctx.Context(), id)
|
||||
return services.Super.GetUser(ctx, id)
|
||||
}
|
||||
|
||||
// Update user status
|
||||
@@ -57,7 +57,7 @@ func (c *users) Get(ctx fiber.Ctx, id int64) (*dto.UserItem, error) {
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *users) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.UserStatusUpdateForm) error {
|
||||
return services.Super.UpdateUserStatus(ctx.Context(), id, form)
|
||||
return services.Super.UpdateUserStatus(ctx, id, form)
|
||||
}
|
||||
|
||||
// Update user roles
|
||||
@@ -74,7 +74,7 @@ func (c *users) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.UserStatusUpdate
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *users) UpdateRoles(ctx fiber.Ctx, id int64, form *dto.UserRolesUpdateForm) error {
|
||||
return services.Super.UpdateUserRoles(ctx.Context(), id, form)
|
||||
return services.Super.UpdateUserRoles(ctx, id, form)
|
||||
}
|
||||
|
||||
// User statistics
|
||||
@@ -87,7 +87,7 @@ func (c *users) UpdateRoles(ctx fiber.Ctx, id int64, form *dto.UserRolesUpdateFo
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.UserStatistics
|
||||
func (c *users) Statistics(ctx fiber.Ctx) ([]dto.UserStatistics, error) {
|
||||
return services.Super.UserStatistics(ctx.Context())
|
||||
return services.Super.UserStatistics(ctx)
|
||||
}
|
||||
|
||||
// User statuses
|
||||
@@ -100,5 +100,5 @@ func (c *users) Statistics(ctx fiber.Ctx) ([]dto.UserStatistics, error) {
|
||||
// @Produce json
|
||||
// @Success 200 {array} requests.KV
|
||||
func (c *users) Statuses(ctx fiber.Ctx) ([]requests.KV, error) {
|
||||
return services.Super.UserStatuses(ctx.Context())
|
||||
return services.Super.UserStatuses(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user