mirror of
https://github.com/songquanpeng/message-pusher.git
synced 2025-10-06 00:26:51 +08:00
feat: create email channel for user after binding email
This commit is contained in:
@@ -93,6 +93,13 @@ func AddChannel(c *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
if channel_.Name == "email" {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": false,
|
||||
"message": "不能使用系统保留名称",
|
||||
})
|
||||
return
|
||||
}
|
||||
cleanChannel := model.Channel{
|
||||
Type: channel_.Type,
|
||||
UserId: c.GetInt("id"),
|
||||
|
@@ -118,7 +118,7 @@ func pushMessageHelper(c *gin.Context, message *model.Message) {
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": false,
|
||||
"message": "无效的渠道的名称",
|
||||
"message": "无效的渠道名称:" + message.Channel,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@@ -699,6 +699,16 @@ func EmailBind(c *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
// create email channel for this user
|
||||
emailChannel := model.Channel{
|
||||
Type: model.TypeEmail,
|
||||
UserId: user.Id,
|
||||
Name: "email",
|
||||
Description: "系统自动创建",
|
||||
Status: common.ChannelStatusEnabled,
|
||||
CreatedTime: common.GetTimestamp(),
|
||||
}
|
||||
_ = emailChannel.Insert()
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"message": "",
|
||||
|
Reference in New Issue
Block a user