mirror of
https://github.com/AynaLivePlayer/miaosic.git
synced 2025-12-14 00:38:14 +08:00
fix session cmd: save session every in every command add qq init fix init sequence update gitignore fix miaosic cmd add kugou album info in search update qq music api.
41 lines
915 B
Go
41 lines
915 B
Go
package qq
|
|
|
|
import "strings"
|
|
|
|
type Credential struct {
|
|
OpenID string `json:"openid"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
AccessToken string `json:"access_token"`
|
|
ExpiredAt int64 `json:"expired_at"`
|
|
MusicID int64 `json:"musicid"`
|
|
MusicKey string `json:"musickey"`
|
|
UnionID string `json:"unionid"`
|
|
StrMusicID string `json:"str_musicid"`
|
|
RefreshKey string `json:"refresh_key"`
|
|
EncryptUin string `json:"encryptUin"`
|
|
LoginType int `json:"loginType"`
|
|
}
|
|
|
|
func NewCredential() *Credential {
|
|
return &Credential{}
|
|
}
|
|
|
|
func (c *Credential) GetFormatedLoginType() int {
|
|
if c.LoginType == 0 {
|
|
if c.MusicKey != "" && strings.HasPrefix(c.MusicKey, "W_X") {
|
|
c.LoginType = 1
|
|
} else {
|
|
c.LoginType = 2
|
|
}
|
|
}
|
|
return c.LoginType
|
|
}
|
|
|
|
func (c *Credential) HasMusicID() bool {
|
|
return c.MusicID != 0
|
|
}
|
|
|
|
func (c *Credential) HasMusicKey() bool {
|
|
return c.MusicKey != ""
|
|
}
|