From: qydysky Date: Wed, 1 Sep 2021 18:09:36 +0000 (+0800) Subject: 银瓜子兑换接口更新 X-Git-Tag: v0.5.10~41^2~92 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=432de3ae661be9b455be49150f3e84d8f35052d1;p=bili_danmu%2F.git 银瓜子兑换接口更新 tts初始化错误修复 --- diff --git a/F/api.go b/F/api.go index f2baae3..ef0bd2c 100644 --- a/F/api.go +++ b/F/api.go @@ -2127,7 +2127,7 @@ func Silver_2_coin() (missKey []string) { req := reqf.New() if err := req.Reqf(reqf.Rval{ - Url:`https://api.live.bilibili.com/pay/v1/Exchange/getStatus`, + Url:`https://api.live.bilibili.com/xlive/revenue/v1/wallet/getStatus`, Header:map[string]string{ `Host`: `api.live.bilibili.com`, `User-Agent`: `Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0`, @@ -2149,33 +2149,23 @@ func Silver_2_coin() (missKey []string) { return } - var res struct{ - Code int `json:"code"` - Msg string `json:"msg"` - Message string `json:"message"` - Data struct{ - Silver int `json:"silver"` - Silver_2_coin_left int `json:"silver_2_coin_left"` - } `json:"data"` - } - - if e := json.Unmarshal(req.Respon, &res);e != nil{ + var j J.ApiXliveRevenueV1WalletGetStatus + + if e := json.Unmarshal([]byte(req.Respon),&j);e != nil{ apilog.L(`E: `, e) return - } - - if res.Code != 0{ - apilog.L(`E: `, res.Message) + } else if j.Code != 0 { + apilog.L(`E: `, j.Message) return } - if res.Data.Silver_2_coin_left == 0{ + if j.Data.Silver2CoinLeft == 0 { apilog.L(`I: `, `今天次数已用完`) return } - apilog.L(`T: `, `现在有银瓜子`, res.Data.Silver, `个`) - Silver = res.Data.Silver + apilog.L(`T: `, `现在有银瓜子`, j.Data.Silver, `个`) + Silver = j.Data.Silver } {//获取交换规则,验证数量足够 @@ -2187,7 +2177,7 @@ func Silver_2_coin() (missKey []string) { req := reqf.New() if err := req.Reqf(reqf.Rval{ - Url:`https://api.live.bilibili.com/pay/v1/Exchange/getRule`, + Url:`https://api.live.bilibili.com/xlive/revenue/v1/wallet/getRule`, Header:map[string]string{ `Host`: `api.live.bilibili.com`, `User-Agent`: `Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0`, @@ -2209,26 +2199,17 @@ func Silver_2_coin() (missKey []string) { return } - var res struct{ - Code int `json:"code"` - Msg string `json:"msg"` - Message string `json:"message"` - Data struct{ - Silver_2_coin_price int `json:"silver_2_coin_price"` - } `json:"data"` - } + var j J.ApixliveRevenueV1WalletGetRule - if e := json.Unmarshal(req.Respon, &res);e != nil{ + if e := json.Unmarshal([]byte(req.Respon),&j);e != nil{ apilog.L(`E: `, e) return - } - - if res.Code != 0{ - apilog.L(`E: `, res.Message) + } else if j.Code != 0 { + apilog.L(`E: `, j.Message) return } - if Silver < res.Data.Silver_2_coin_price{ + if Silver < j.Data.Silver2CoinPrice { apilog.L(`W: `, `当前银瓜子数量不足`) return } @@ -2248,7 +2229,7 @@ func Silver_2_coin() (missKey []string) { req := reqf.New() if err := req.Reqf(reqf.Rval{ - Url:`https://api.live.bilibili.com/pay/v1/Exchange/silver2coin`, + Url:`https://api.live.bilibili.com/xlive/revenue/v1/wallet/silver2coin`, PostStr:url.PathEscape(post_str), Header:map[string]string{ `Host`: `api.live.bilibili.com`, diff --git a/Json/apiXliveRevenueV1WalletGetStatus.go b/Json/apiXliveRevenueV1WalletGetStatus.go new file mode 100644 index 0000000..a476896 --- /dev/null +++ b/Json/apiXliveRevenueV1WalletGetStatus.go @@ -0,0 +1,18 @@ +package part + +type ApiXliveRevenueV1WalletGetStatus struct { + Code int `json:"code"` + Message string `json:"message"` + TTL int `json:"ttl"` + Data struct { + Silver int `json:"silver"` + Gold int `json:"gold"` + Coin int `json:"coin"` + Bp int `json:"bp"` + Coin2SilverLeft int `json:"coin_2_silver_left"` + Silver2CoinLeft int `json:"silver_2_coin_left"` + Num int `json:"num"` + Status int `json:"status"` + Vip int `json:"vip"` + } `json:"data"` +} \ No newline at end of file diff --git a/Json/apixliveRevenueV1WalletGetRule.go b/Json/apixliveRevenueV1WalletGetRule.go new file mode 100644 index 0000000..0f9dabd --- /dev/null +++ b/Json/apixliveRevenueV1WalletGetRule.go @@ -0,0 +1,23 @@ +package part + +type ApixliveRevenueV1WalletGetRule struct { + Code int `json:"code"` + Message string `json:"message"` + TTL int `json:"ttl"` + Data struct { + Coin2SilverRateNormal int `json:"coin_2_silver_rate_normal"` + Coin2SilverRateVip int `json:"coin_2_silver_rate_vip"` + Coin2SilverRate int `json:"coin_2_silver_rate"` + Coin2SilverFee float64 `json:"coin_2_silver_fee"` + Coin2SilverLimit int `json:"coin_2_silver_limit"` + Coin2SilverLimitVip int `json:"coin_2_silver_limit_vip"` + Silver2CoinPrice int `json:"silver_2_coin_price"` + Silver2CoinLimit int `json:"silver_2_coin_limit"` + Coin2SilverRealRate int `json:"coin_2_silver_real_rate"` + Gold2SilverBonus struct { + Num10000 float64 `json:"10000"` + Num100000 float64 `json:"100000"` + Num500000 float64 `json:"500000"` + } `json:"gold_2_silver_bonus"` + } `json:"data"` +} \ No newline at end of file diff --git a/Reply/tts.go b/Reply/tts.go index 5d8781a..4498bb2 100644 --- a/Reply/tts.go +++ b/Reply/tts.go @@ -273,9 +273,14 @@ func init(){ tts_log.L(`I: `,`未支持设定发音,使用随机`) } } - if tts_ser == `xf` && (xfId == `` || xfKey == `` || xfSecret == ``) { + + // 设置了非讯飞tts + if tts_ser != `xf` {return} + + if xfId == `` || xfKey == `` || xfSecret == `` { tts_log.L(`W: `, `未提供讯飞Id、Key、Secret,使用baidu`) tts_ser = `baidu` + return } //@hosturl : like wss://tts-api.xfyun.cn/v2/tts