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 package controller
import ( import (
"github.com/gin-gonic/gin"
"message-pusher/channel" "message-pusher/channel"
"message-pusher/common" "message-pusher/common"
"message-pusher/model" "message-pusher/model"
"net/http" "net/http"
"strconv" "strconv"
"github.com/gin-gonic/gin"
) )
func GetAllChannels(c *gin.Context) { func GetAllChannels(c *gin.Context) {
@@ -168,7 +169,7 @@ func UpdateChannel(c *gin.Context) {
}) })
return return
} }
cleanChannel := oldChannel cleanChannel := *oldChannel
if statusOnly != "" { if statusOnly != "" {
cleanChannel.Status = channel_.Status cleanChannel.Status = channel_.Status
} else { } else {
@@ -190,7 +191,7 @@ func UpdateChannel(c *gin.Context) {
}) })
return return
} }
channel.TokenStoreUpdateChannel(cleanChannel, oldChannel) channel.TokenStoreUpdateChannel(&cleanChannel, oldChannel)
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"success": true, "success": true,
"message": "", "message": "",