update: pan

This commit is contained in:
Kerwin
2025-09-03 23:39:26 +08:00
parent 07cb6977e4
commit 074058ac5c
7 changed files with 35 additions and 42 deletions

View File

@@ -256,9 +256,9 @@ func (a *AlipanService) DeleteFiles(fileList []string) (*TransferResult, error)
}
// GetUserInfo 获取用户信息
func (a *AlipanService) GetUserInfo(cookie string) (*UserInfo, error) {
func (a *AlipanService) GetUserInfo(cookie *string) (*UserInfo, error) {
// 设置Cookie
a.SetHeader("Cookie", cookie)
a.SetHeader("Cookie", *cookie)
// 获取access token
accessToken, err := a.manageAccessToken()

View File

@@ -52,9 +52,9 @@ func (b *BaiduPanService) DeleteFiles(fileList []string) (*TransferResult, error
}
// GetUserInfo 获取用户信息
func (b *BaiduPanService) GetUserInfo(cookie string) (*UserInfo, error) {
func (b *BaiduPanService) GetUserInfo(cookie *string) (*UserInfo, error) {
// 设置Cookie
b.SetHeader("Cookie", cookie)
b.SetHeader("Cookie", *cookie)
// 调用百度网盘用户信息API
userInfoURL := "https://pan.baidu.com/api/gettemplatevariable"

View File

@@ -91,7 +91,7 @@ type PanService interface {
DeleteFiles(fileList []string) (*TransferResult, error)
// GetUserInfo 获取用户信息
GetUserInfo(ck string) (*UserInfo, error)
GetUserInfo(ck *string) (*UserInfo, error)
GetUserInfoByEntity(entity entity.Cks) (*UserInfo, error)

View File

@@ -943,10 +943,10 @@ type PasswordResult struct {
}
// GetUserInfo 获取用户信息
func (q *QuarkPanService) GetUserInfo(cookie string) (*UserInfo, error) {
func (q *QuarkPanService) GetUserInfo(cookie *string) (*UserInfo, error) {
// 临时设置cookie
originalCookie := q.GetHeader("Cookie")
q.SetHeader("Cookie", cookie)
q.SetHeader("Cookie", *cookie)
defer q.SetHeader("Cookie", originalCookie) // 恢复原始cookie
// 获取用户基本信息

View File

@@ -52,9 +52,9 @@ func (u *UCService) DeleteFiles(fileList []string) (*TransferResult, error) {
}
// GetUserInfo 获取用户信息
func (u *UCService) GetUserInfo(cookie string) (*UserInfo, error) {
func (u *UCService) GetUserInfo(cookie *string) (*UserInfo, error) {
// 设置Cookie
u.SetHeader("Cookie", cookie)
u.SetHeader("Cookie", *cookie)
// 调用UC网盘用户信息API
userInfoURL := "https://drive.uc.cn/api/user/info"

View File

@@ -708,11 +708,11 @@ func (x *XunleiPanService) DeleteFiles(fileList []string) (*TransferResult, erro
}
// GetUserInfo 获取用户信息 - 实现 PanService 接口cookie 参数为 refresh_token先获取 access_token 再访问 API
func (x *XunleiPanService) GetUserInfo(cookie string) (*UserInfo, error) {
func (x *XunleiPanService) GetUserInfo(cookie *string) (*UserInfo, error) {
log.Printf("开始获取迅雷网盘用户信息cookie 为 refresh_token")
// 使用 refresh_token 获取 access_token
accessTokenData, err := x.GetAccessTokenByRefreshToken(cookie)
accessTokenData, err := x.GetAccessTokenByRefreshToken(*cookie)
if err != nil {
return nil, fmt.Errorf("获取 access_token 失败: %v", err)
}