fix: wrong memory address when updating channel (#67)

* fix: wrong memory address when updating channel

Fix the address issue when updating the Wecom channel detail

* refactor: change method signature

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
Edward
2023-05-06 15:36:41 +08:00
committed by GitHub
co-authored by JustSong
parent 2fd800b0a3
commit 7b2180565f
+4 -3
View File
@@ -1,12 +1,13 @@
package controller
import (
"github.com/gin-gonic/gin"
"message-pusher/channel"
"message-pusher/common"
"message-pusher/model"
"net/http"
"strconv"
"github.com/gin-gonic/gin"
)
func GetAllChannels(c *gin.Context) {
@@ -168,7 +169,7 @@ func UpdateChannel(c *gin.Context) {
})
return
}
cleanChannel := oldChannel
cleanChannel := *oldChannel
if statusOnly != "" {
cleanChannel.Status = channel_.Status
} else {
@@ -190,7 +191,7 @@ func UpdateChannel(c *gin.Context) {
})
return
}
channel.TokenStoreUpdateChannel(cleanChannel, oldChannel)
channel.TokenStoreUpdateChannel(&cleanChannel, oldChannel)
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",