fix: fix push setting page (#68)

* fix: unknown channel on message page

* feat: add get all chanels short api

* style: temporaryly change label color

* fix: update query for new api

* fix: fix PushSetting page

* fix: fix PushSetting page

---------

Co-authored-by: JustSong <quanpengsong@gmail.com>
This commit is contained in:
Edward
2023-05-06 21:19:49 +08:00
committed by GitHub
co-authored by JustSong
parent 01c6af0005
commit c70cc3a793
3 changed files with 64 additions and 21 deletions
+22
View File
@@ -11,6 +11,10 @@ import (
)
func GetAllChannels(c *gin.Context) {
if c.Query("brief") != "" {
GetBriefChannels(c)
return
}
userId := c.GetInt("id")
p, _ := strconv.Atoi(c.Query("p"))
if p < 0 {
@@ -32,6 +36,24 @@ func GetAllChannels(c *gin.Context) {
return
}
func GetBriefChannels(c *gin.Context) {
userId := c.GetInt("id")
channels, err := model.GetBriefChannelsByUserId(userId)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
"data": channels,
})
return
}
func SearchChannels(c *gin.Context) {
userId := c.GetInt("id")
keyword := c.Query("keyword")