You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-fly/controller/notice.go

33 lines
776 B

package controller
import (
"github.com/gin-gonic/gin"
"github.com/taoshihan1991/imaptool/models"
)
func GetNotice(c *gin.Context) {
kefuId := c.Query("kefu_id")
user := models.FindUser(kefuId)
if user.ID == 0 {
c.JSON(200, gin.H{
"code": 400,
"msg": "user not found",
})
return
}
welcomeMessage := models.FindConfigByUserId(user.Name, "WelcomeMessage")
offlineMessage := models.FindConfigByUserId(user.Name, "OfflineMessage")
allNotice := models.FindConfigByUserId(user.Name, "AllNotice")
c.JSON(200, gin.H{
"code": 200,
"msg": "ok",
"result": gin.H{
"welcome": welcomeMessage.ConfValue,
"offline": offlineMessage.ConfValue,
"avatar": user.Avator,
"nickname": user.Nickname,
"allNotice": allNotice.ConfValue,
},
})
}