Skip to content

Commit

Permalink
Merge pull request #94 from decert-me/fix/discord-bind
Browse files Browse the repository at this point in the history
fix: Discord绑定失败
  • Loading branch information
0xdwong authored Dec 18, 2023
2 parents 9f09060 + f3eaf9f commit 84c21f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/app/service/social.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (s *Service) DiscordCallback(address string, discordCallback interface{}) (
}
// 发送请求获取 Discord 用户信息
client := req.C().SetCommonHeader("x-api-key", s.c.Social.Wechat.APIKey)
r, err := client.R().SetBodyJsonMarshal(discordCallback).Post(s.c.Social.Wechat.CallURL + "/v1/callback/discord")
r, err := client.R().SetBodyJsonMarshal(discordCallback).Post(s.c.Social.Discord.CallURL + "/v1/callback/discord")
if err != nil {
return errors.New("FailedObtainDiscordInfo")
}
Expand All @@ -94,6 +94,9 @@ func (s *Service) DiscordCallback(address string, discordCallback interface{}) (
}
discordID := gjson.Get(r.String(), "data.id").String()
username := gjson.Get(r.String(), "data.username").String()
if discordID == "" || username == "" {
return errors.New("FailedObtainDiscordInfo")
}
// 跳过已绑定 Discord
Binding, err := s.dao.DiscordIsBinding(discordID)
if err != nil {
Expand Down

0 comments on commit 84c21f4

Please sign in to comment.