fix: fix IsShared check

This commit is contained in:
JustSong
2023-05-08 09:22:40 +08:00
parent 99bf0ca127
commit 00a9f02974
2 changed files with 4 additions and 2 deletions

View File

@@ -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
}

View File

@@ -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
}