mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-19 20:26:26 +08:00
fix 139yun
This commit is contained in:
@ -286,10 +286,8 @@ type PersonalUploadUrlResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type QueryRoutePolicyResp struct {
|
type QueryRoutePolicyResp struct {
|
||||||
Success bool `json:"success"`
|
BaseResp
|
||||||
Code string `json:"code"`
|
Data struct {
|
||||||
Message string `json:"message"`
|
|
||||||
Data struct {
|
|
||||||
RoutePolicyList []struct {
|
RoutePolicyList []struct {
|
||||||
SiteID string `json:"siteID"`
|
SiteID string `json:"siteID"`
|
||||||
SiteCode string `json:"siteCode"`
|
SiteCode string `json:"siteCode"`
|
||||||
|
@ -159,20 +159,15 @@ func (d *Yun139) request(pathname string, method string, callback base.ReqCallba
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Yun139) requestRoute(data interface{}, resp interface{}) ([]byte, error) {
|
func (d *Yun139) requestRoute(data interface{}, resp interface{}) ([]byte, error) {
|
||||||
|
body, err := utils.Json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
url := "https://user-njs.yun.139.com/user/route/qryRoutePolicy"
|
url := "https://user-njs.yun.139.com/user/route/qryRoutePolicy"
|
||||||
req := base.RestyClient.R()
|
req := base.RestyClient.R()
|
||||||
randStr := random.String(16)
|
randStr := random.String(16)
|
||||||
ts := time.Now().Format("2006-01-02 15:04:05")
|
ts := time.Now().Format("2006-01-02 15:04:05")
|
||||||
callback := func(req *resty.Request) {
|
req.SetBody(data)
|
||||||
req.SetBody(data)
|
|
||||||
}
|
|
||||||
if callback != nil {
|
|
||||||
callback(req)
|
|
||||||
}
|
|
||||||
body, err := utils.Json.Marshal(req.Body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
sign := calSign(string(body), ts, randStr)
|
sign := calSign(string(body), ts, randStr)
|
||||||
svcType := "1"
|
svcType := "1"
|
||||||
if d.isFamily() {
|
if d.isFamily() {
|
||||||
@ -199,20 +194,24 @@ func (d *Yun139) requestRoute(data interface{}, resp interface{}) ([]byte, error
|
|||||||
"Inner-Hcy-Router-Https": "1",
|
"Inner-Hcy-Router-Https": "1",
|
||||||
})
|
})
|
||||||
|
|
||||||
var e BaseResp
|
|
||||||
req.SetResult(&e)
|
|
||||||
res, err := req.Execute(http.MethodPost, url)
|
res, err := req.Execute(http.MethodPost, url)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
log.Debugln(res.String())
|
log.Debugln(res.String())
|
||||||
|
var e BaseResp
|
||||||
|
err = utils.Json.Unmarshal(res.Bytes(), &e)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if !e.Success {
|
if !e.Success {
|
||||||
return nil, errors.New(e.Message)
|
return nil, errors.New(e.Message)
|
||||||
}
|
}
|
||||||
if resp != nil {
|
err = utils.Json.Unmarshal(res.Bytes(), resp)
|
||||||
err = utils.Json.Unmarshal(res.Bytes(), resp)
|
if err != nil {
|
||||||
if err != nil {
|
return nil, err
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return res.Bytes(), nil
|
return res.Bytes(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Yun139) post(pathname string, data interface{}, resp interface{}) ([]byte, error) {
|
func (d *Yun139) post(pathname string, data interface{}, resp interface{}) ([]byte, error) {
|
||||||
|
Reference in New Issue
Block a user