Skip to content

Commit 596c75e

Browse files
committed
✏️ make lint happy
1 parent 67a493e commit 596c75e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

plugin_novel/qianbi.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/wdvxdr1123/ZeroBot/utils/helper"
2020

2121
"github.com/FloatTech/ZeroBot-Plugin/control"
22-
"github.com/FloatTech/ZeroBot-Plugin/utils/encode"
22+
ub "github.com/FloatTech/ZeroBot-Plugin/utils/binary"
2323
)
2424

2525
const (
@@ -130,12 +130,12 @@ func login(username, password string) {
130130
client := &http.Client{
131131
Jar: gCurCookieJar,
132132
}
133-
usernameData, err := encode.Utf8ToGbk(helper.StringToBytes(username))
133+
usernameData, err := ub.UTF82GBK(helper.StringToBytes(username))
134134
if err != nil {
135135
log.Errorln("[novel]", err)
136136
}
137137
usernameGbk := helper.BytesToString(usernameData)
138-
passwordData, err := encode.Utf8ToGbk(helper.StringToBytes(password))
138+
passwordData, err := ub.UTF82GBK(helper.StringToBytes(password))
139139
if err != nil {
140140
log.Errorln("[novel]", err)
141141
}
@@ -154,7 +154,7 @@ func login(username, password string) {
154154
}
155155

156156
func search(searchKey string) (searchHtml string) {
157-
searchKeyData, err := encode.Utf8ToGbk(helper.StringToBytes(searchKey))
157+
searchKeyData, err := ub.UTF82GBK(helper.StringToBytes(searchKey))
158158
if err != nil {
159159
log.Errorln("[novel]", err)
160160
}
@@ -177,7 +177,7 @@ func search(searchKey string) (searchHtml string) {
177177
if err != nil {
178178
log.Errorf("[novel] get response for url=%s got error=%s\n", searchURL, err.Error())
179179
}
180-
searchData, err = encode.GbkToUtf8(searchData)
180+
searchData, err = ub.GBK2UTF8(searchData)
181181
if err != nil {
182182
log.Errorln("[novel]", err)
183183
}

utils/encode/encode.go renamed to utils/binary/encode.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package encode
1+
package binary
22

33
import (
44
"bytes"
@@ -8,8 +8,8 @@ import (
88
"golang.org/x/text/transform"
99
)
1010

11-
// GBK 转 UTF-8
12-
func GbkToUtf8(s []byte) ([]byte, error) {
11+
// GBK2UTF8 GBK 转 UTF-8
12+
func GBK2UTF8(s []byte) ([]byte, error) {
1313
reader := transform.NewReader(bytes.NewReader(s), simplifiedchinese.GBK.NewDecoder())
1414
d, e := ioutil.ReadAll(reader)
1515
if e != nil {
@@ -18,8 +18,8 @@ func GbkToUtf8(s []byte) ([]byte, error) {
1818
return d, nil
1919
}
2020

21-
// UTF-8 转 GBK
22-
func Utf8ToGbk(s []byte) ([]byte, error) {
21+
// UTF82GBK UTF-8 转 GBK
22+
func UTF82GBK(s []byte) ([]byte, error) {
2323
reader := transform.NewReader(bytes.NewReader(s), simplifiedchinese.GBK.NewEncoder())
2424
d, e := ioutil.ReadAll(reader)
2525
if e != nil {

0 commit comments

Comments
 (0)