update
This commit is contained in:
1 parent
0690285147
commit
5618cd2738
154 files changed
+5021
-3161
No files matched your search
@@ -60,11 +60,21 @@ func (h *AlertHandler) UpdateContact(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
updates := map[string]interface{}{}
|
||||
if req.Name != "" { updates["name"] = req.Name }
|
||||
if req.Phone != "" { updates["phone"] = req.Phone }
|
||||
if req.Email != "" { updates["email"] = req.Email }
|
||||
if req.ChannelType != "" { updates["channel_type"] = req.ChannelType }
|
||||
if req.WebhookURL != "" { updates["webhook_url"] = req.WebhookURL }
|
||||
if req.Name != "" {
|
||||
updates["name"] = req.Name
|
||||
}
|
||||
if req.Phone != "" {
|
||||
updates["phone"] = req.Phone
|
||||
}
|
||||
if req.Email != "" {
|
||||
updates["email"] = req.Email
|
||||
}
|
||||
if req.ChannelType != "" {
|
||||
updates["channel_type"] = req.ChannelType
|
||||
}
|
||||
if req.WebhookURL != "" {
|
||||
updates["webhook_url"] = req.WebhookURL
|
||||
}
|
||||
h.db.Model(&contact).Updates(updates)
|
||||
h.db.First(&contact, id)
|
||||
c.JSON(http.StatusOK, model.Response{Code: 200, Message: "更新成功", Data: contact})
|
||||
@@ -127,8 +137,12 @@ func (h *AlertHandler) UpdateContactGroup(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
updates := map[string]interface{}{}
|
||||
if req.GroupName != "" { updates["group_name"] = req.GroupName }
|
||||
if req.Notes != "" { updates["notes"] = req.Notes }
|
||||
if req.GroupName != "" {
|
||||
updates["group_name"] = req.GroupName
|
||||
}
|
||||
if req.Notes != "" {
|
||||
updates["notes"] = req.Notes
|
||||
}
|
||||
if len(req.ContactIDs) > 0 {
|
||||
idsJSON, _ := json.Marshal(req.ContactIDs)
|
||||
updates["contact_ids"] = string(idsJSON)
|
||||
|
||||
Reference in new issue
Block a user