feat: now client part supports multiple channels for the same type (#50)

This commit is contained in:
JustSong
2023-05-06 10:15:18 +08:00
parent 3a8d625201
commit 91725aeba7
16 changed files with 1070 additions and 131 deletions
+4
View File
@@ -2,6 +2,7 @@ package controller
import (
"encoding/json"
"errors"
"fmt"
"github.com/gin-gonic/gin"
"message-pusher/channel"
@@ -136,6 +137,9 @@ func pushMessageHelper(c *gin.Context, message *model.Message) {
}
func saveAndSendMessage(user *model.User, message *model.Message, channel_ *model.Channel) error {
if channel_.Status != common.ChannelStatusEnabled {
return errors.New("该渠道已被禁用")
}
message.Link = common.GetUUID()
if message.URL == "" {
message.URL = fmt.Sprintf("%s/message/%s", common.ServerAddress, message.Link)