mirror of
https://github.com/ctwj/urldb.git
synced 2025-11-25 03:15:04 +08:00
update: tg bot
This commit is contained in:
@@ -200,7 +200,7 @@ func (h *TelegramHandler) UpdateChannel(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var req dto.TelegramChannelRequest
|
||||
var req dto.TelegramChannelUpdateRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
ErrorResponse(c, "请求参数错误", http.StatusBadRequest)
|
||||
return
|
||||
@@ -213,6 +213,12 @@ func (h *TelegramHandler) UpdateChannel(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 如果前端传递了ChatID,验证它是否与现有频道匹配
|
||||
if req.ChatID != 0 && req.ChatID != channel.ChatID {
|
||||
ErrorResponse(c, "ChatID不匹配,无法更新此频道", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// 更新频道信息
|
||||
channel.ChatName = req.ChatName
|
||||
channel.ChatType = req.ChatType
|
||||
@@ -276,7 +282,7 @@ func (h *TelegramHandler) RegisterChannelByCommand(chatID int64, chatName, chatT
|
||||
ChatName: chatName,
|
||||
ChatType: chatType,
|
||||
PushEnabled: true,
|
||||
PushFrequency: 24, // 默认24小时
|
||||
PushFrequency: 5, // 默认5分钟
|
||||
IsActive: true,
|
||||
RegisteredBy: "bot_command",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user