完善通道管理机制 & 增强 otel 记录字段
This commit is contained in:
@@ -257,7 +257,7 @@ func RemoveChannels(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 删除通道
|
||||
err = s.Channel.RemoveChannels(req.Batch)
|
||||
err = s.Channel.RemoveChannels(req.Batch, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -341,3 +341,32 @@ type PageChannelOfUserByAdminReq struct {
|
||||
ExpiredAtStart *time.Time `json:"expired_at_start"`
|
||||
ExpiredAtEnd *time.Time `json:"expired_at_end"`
|
||||
}
|
||||
|
||||
// SyncChannelClearExpiredByAdmin 清理过期通道
|
||||
func SyncChannelClearExpiredByAdmin(c *fiber.Ctx) error {
|
||||
if _, err := auth.GetAuthCtx(c).PermitAdmin(core.ScopeChannelWriteClearExpired); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var req SyncChannelClearExpiredByAdminReq
|
||||
if err := g.Validator.ParseBody(c, &req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
count, err := s.Channel.ClearExpiredChannels(req.ProxyID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(SyncChannelClearExpiredByAdminResp{
|
||||
Count: count,
|
||||
})
|
||||
}
|
||||
|
||||
type SyncChannelClearExpiredByAdminReq struct {
|
||||
ProxyID int32 `json:"proxy_id" validate:"required"`
|
||||
}
|
||||
|
||||
type SyncChannelClearExpiredByAdminResp struct {
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user