2025-12-31 16:20:01 +08:00
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
// TokenResponse 用来解析第一次请求返回的 JSON
|
|
|
|
|
type TokenResponse struct {
|
|
|
|
|
Token string `json:"token"`
|
|
|
|
|
UserID int `json:"userId"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UserResponse 最外层响应
|
|
|
|
|
type UserResponse struct {
|
|
|
|
|
Data UserData `json:"data"`
|
|
|
|
|
Included []Group `json:"included"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UserData 用户数据
|
|
|
|
|
type UserData struct {
|
|
|
|
|
Type string `json:"type"`
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
Attributes UserAttributes `json:"attributes"`
|
|
|
|
|
Relationships Relationships `json:"relationships"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UserAttributes 用户详细属性
|
|
|
|
|
type UserAttributes struct {
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
DisplayName string `json:"displayName"`
|
|
|
|
|
AvatarUrl string `json:"avatarUrl"`
|
|
|
|
|
Slug string `json:"slug"`
|
|
|
|
|
JoinTime string `json:"joinTime"`
|
|
|
|
|
DiscussionCount int `json:"discussionCount"`
|
|
|
|
|
CommentCount int `json:"commentCount"`
|
|
|
|
|
CanEdit bool `json:"canEdit"`
|
|
|
|
|
CanEditCredentials bool `json:"canEditCredentials"`
|
|
|
|
|
CanEditGroups bool `json:"canEditGroups"`
|
|
|
|
|
CanDelete bool `json:"canDelete"`
|
|
|
|
|
LastSeenAt string `json:"lastSeenAt"`
|
|
|
|
|
Achievements []string `json:"achievements"`
|
|
|
|
|
Followed *bool `json:"followed"` // 可能为 null
|
|
|
|
|
FollowerCount int `json:"followerCount"`
|
|
|
|
|
FollowingCount int `json:"followingCount"`
|
|
|
|
|
Money float64 `json:"money"`
|
|
|
|
|
CanEditMoney bool `json:"canEditMoney"`
|
|
|
|
|
CanSuspend bool `json:"canSuspend"`
|
|
|
|
|
LastCheckinTime string `json:"lastCheckinTime"`
|
|
|
|
|
TotalContinuousCheckIn int `json:"totalContinuousCheckIn"`
|
|
|
|
|
CheckInCompatibleExtensions []string `json:"checkInCompatibleExtensions"`
|
|
|
|
|
CanCheckin bool `json:"canCheckin"`
|
|
|
|
|
CanCheckinContinuous bool `json:"canCheckinContinuous"`
|
|
|
|
|
CanBeFollowed bool `json:"canBeFollowed"`
|
|
|
|
|
FofUploadUploadCountCurrent int `json:"fof-upload-uploadCountCurrent"`
|
|
|
|
|
FofUploadUploadCountAll int `json:"fof-upload-uploadCountAll"`
|
|
|
|
|
BestAnswerCount int `json:"bestAnswerCount"`
|
|
|
|
|
IsBanned bool `json:"isBanned"`
|
|
|
|
|
CanBanIP bool `json:"canBanIP"`
|
|
|
|
|
CanEditNickname bool `json:"canEditNickname"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Relationships 用户关系
|
|
|
|
|
type Relationships struct {
|
|
|
|
|
Groups RelationshipData `json:"groups"`
|
|
|
|
|
Achievements RelationshipData `json:"achievements"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RelationshipData 关系数据
|
|
|
|
|
type RelationshipData struct {
|
|
|
|
|
Data []RelationshipItem `json:"data"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RelationshipItem 关系项
|
|
|
|
|
type RelationshipItem struct {
|
|
|
|
|
Type string `json:"type"`
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Group 组信息
|
|
|
|
|
type Group struct {
|
|
|
|
|
Type string `json:"type"`
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
Attributes GroupAttributes `json:"attributes"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GroupAttributes 组属性
|
|
|
|
|
type GroupAttributes struct {
|
|
|
|
|
NameSingular string `json:"nameSingular"`
|
|
|
|
|
NamePlural string `json:"namePlural"`
|
|
|
|
|
Color string `json:"color"`
|
|
|
|
|
Icon string `json:"icon"`
|
|
|
|
|
IsHidden int `json:"isHidden"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-25 23:17:46 +08:00
|
|
|
var bbsurl = "http://43.248.3.21:45632"
|
|
|
|
|
|
2025-12-31 16:20:01 +08:00
|
|
|
// GetUserInfo 输入用户名和密码,返回用户信息结构体
|