feat: add format utility function and improve loader method
This commit is contained in:
50
go/query_online.go
Normal file
50
go/query_online.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package query_youcao
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
youdao = "https://openapi.youdao.com/api"
|
||||
appKey = "1858465a8708c121"
|
||||
appPasswd = "fG0sitfk16nJOlIlycnLPYZn1optxUxL"
|
||||
)
|
||||
|
||||
type data struct {
|
||||
q string
|
||||
from string
|
||||
to string
|
||||
// appKey string
|
||||
salt string
|
||||
sign string
|
||||
signType string
|
||||
curtime string
|
||||
}
|
||||
|
||||
|
||||
func input(word string) string {
|
||||
var input string
|
||||
len := len(word)
|
||||
if len > 20 {
|
||||
input = word[:10] + string(rune(len)) + word[len-10:]
|
||||
} else {
|
||||
input = word
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func salt(_ string) string {
|
||||
// TODO : hash salt
|
||||
var salt string
|
||||
|
||||
return salt
|
||||
}
|
||||
|
||||
func to_value(d data) url.Values {
|
||||
// return value
|
||||
}
|
||||
|
||||
func Query(word string) {
|
||||
|
||||
}
|
Reference in New Issue
Block a user