From c5c63d0b646d80c9e709905442c308dbb2ef648a Mon Sep 17 00:00:00 2001 From: GenesisAN Date: Wed, 12 Apr 2023 14:02:49 +0800 Subject: [PATCH] =?UTF-8?q?wfapi=20=E9=94=81=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=8C=E8=AE=BE=E7=BD=AETLS=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E4=B8=BA1.2=20(#663)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: GenesisAN <501946815@qq.com> --- plugin/warframeapi/api.go | 13 +++++++++++-- plugin/warframeapi/world.go | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/plugin/warframeapi/api.go b/plugin/warframeapi/api.go index d4a3de28..fd4d43df 100644 --- a/plugin/warframeapi/api.go +++ b/plugin/warframeapi/api.go @@ -1,6 +1,7 @@ package warframeapi import ( + "crypto/tls" "encoding/json" "errors" "fmt" @@ -30,7 +31,11 @@ func newwfapi() (w wfapi, err error) { // 获取Warframe市场的售价表,并进行排序,cn_name为物品中文名称,onlyMaxRank表示只取最高等级的物品,返回物品售价表,物品信息,物品英文 func getitemsorder(cnName string, onlyMaxRank bool) (od orders, it *itemsInSet, n string, err error) { var wfapiio wfAPIItemsOrders - data, err := web.RequestDataWithHeaders(&http.Client{}, fmt.Sprintf("https://api.warframe.market/v1/items/%s/orders?include=item", cnName), "GET", func(request *http.Request) error { + data, err := web.RequestDataWithHeaders(&http.Client{Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + MinVersion: tls.VersionTLS12, + }, + }}, fmt.Sprintf("https://api.warframe.market/v1/items/%s/orders?include=item", cnName), "GET", func(request *http.Request) error { request.Header.Add("Accept", "application/json") request.Header.Add("Platform", "pc") return nil @@ -87,7 +92,11 @@ var ( func newwm() (*wmdata, error) { var itemapi wfAPIItem // WarFrame市场的数据实例 var wd wmdata - data, err := web.RequestDataWithHeaders(&http.Client{}, wfitemurl, "GET", func(request *http.Request) error { + data, err := web.RequestDataWithHeaders(&http.Client{Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + MinVersion: tls.VersionTLS12, + }, + }}, wfitemurl, "GET", func(request *http.Request) error { request.Header.Add("Accept", "application/json") request.Header.Add("Language", "zh-hans") return nil diff --git a/plugin/warframeapi/world.go b/plugin/warframeapi/world.go index 814abdd4..cef0d15d 100644 --- a/plugin/warframeapi/world.go +++ b/plugin/warframeapi/world.go @@ -81,6 +81,9 @@ func (w *world) refresh(api *wfapi) { w.w[2].NextTime = api.CambionCycle.Expiry.Local() w.w[2].IsDay = api.CambionCycle.Active == "fass" + for _, t := range w.w { + t.Unlock() + } } // 游戏时间更新