Browse Source

fix: fix IsShared check

JustSong 2 years ago
parent
commit
00a9f02974
2 changed files with 4 additions and 2 deletions
  1. 2 1
      channel/wechat-corp-account.go
  2. 2 1
      channel/wechat-test-account.go

+ 2 - 1
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
 }
 

+ 2 - 1
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
 }