🆕 修改群组页面为卡片

This commit is contained in:
李寻欢
2024-06-18 16:23:09 +08:00
parent bc2893fad1
commit b024600ef0
6 changed files with 180 additions and 97 deletions

View File

@@ -23,6 +23,13 @@ type changeUseAiModelParam struct {
Model string `json:"model" binding:"required"` // 模型代码
}
// autoClearMembers
// @description: 自动清理群成员
type autoClearMembers struct {
WxId string `json:"wxid" binding:"required"` // 群Id
Days int `json:"days"` // 多少天未发言
}
// ChangeEnableAiStatus
// @description: 修改是否开启AI
// @param ctx
@@ -227,3 +234,26 @@ func ChangeEnableNewsStatus(ctx *gin.Context) {
ctx.String(http.StatusOK, "操作成功")
}
// AutoClearMembers
// @description: 自动清理群成员
// @param ctx
func AutoClearMembers(ctx *gin.Context) {
var p autoClearMembers
if err := ctx.ShouldBindJSON(&p); err != nil {
ctx.String(http.StatusBadRequest, "参数错误")
return
}
log.Printf("待修改的Id%s", p.WxId)
err := client.MySQL.Model(&entity.Friend{}).
Where("wxid = ?", p.WxId).
Update("`clear_member`", p.Days).Error
if err != nil {
log.Printf("修改自动清理群成员阈值失败:%s", err)
ctx.String(http.StatusInternalServerError, "操作失败: %s", err)
return
}
ctx.String(http.StatusOK, "操作成功")
}