From 00a9f0297431e2b4abaa506d0c3ff96424bec9dd Mon Sep 17 00:00:00 2001 From: JustSong Date: Mon, 8 May 2023 09:22:40 +0800 Subject: [PATCH] fix: fix IsShared check --- channel/wechat-corp-account.go | 3 ++- channel/wechat-test-account.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/channel/wechat-corp-account.go b/channel/wechat-corp-account.go index 7f2802a..0bd3313 100644 --- a/channel/wechat-corp-account.go +++ b/channel/wechat-corp-account.go @@ -33,7 +33,8 @@ func (i *WeChatCorpAccountTokenStoreItem) Key() string { func (i *WeChatCorpAccountTokenStoreItem) IsShared() bool { appId := fmt.Sprintf("%s|%s", i.CorpId, i.AgentId) var count int64 = 0 - model.DB.Model(&model.Channel{}).Where("secret = ? and app_id = ? and type = ?", model.TypeWeChatCorpAccount, appId, i.AgentSecret).Count(&count) + model.DB.Model(&model.Channel{}).Where("secret = ? and app_id = ? and type = ?", + i.AgentSecret, appId, model.TypeWeChatCorpAccount).Count(&count) return count > 1 } diff --git a/channel/wechat-test-account.go b/channel/wechat-test-account.go index 57a030c..2bdd59a 100644 --- a/channel/wechat-test-account.go +++ b/channel/wechat-test-account.go @@ -30,7 +30,8 @@ func (i *WeChatTestAccountTokenStoreItem) Key() string { func (i *WeChatTestAccountTokenStoreItem) IsShared() bool { var count int64 = 0 - model.DB.Model(&model.Channel{}).Where("secret = ? and app_id = ? and type = ?", model.TypeWeChatTestAccount, i.AppID, i.AppSecret).Count(&count) + model.DB.Model(&model.Channel{}).Where("secret = ? and app_id = ? and type = ?", + i.AppSecret, i.AppID, model.TypeWeChatTestAccount).Count(&count) return count > 1 }