From 7b2180565fabcc4faeaa974d725b05a25ef6ae4f Mon Sep 17 00:00:00 2001 From: Edward <73746306+WangEdward@users.noreply.github.com> Date: Sat, 6 May 2023 15:36:41 +0800 Subject: [PATCH] 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 --- controller/channel.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/controller/channel.go b/controller/channel.go index 7405ade..b49f4d0 100644 --- a/controller/channel.go +++ b/controller/channel.go @@ -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": "",