You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
517 B
22 lines
517 B
2 years ago
|
package leshuazf
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
2 years ago
|
"go.dtapp.net/library/gobase64"
|
||
|
"go.dtapp.net/library/gomd5"
|
||
2 years ago
|
"sort"
|
||
|
)
|
||
|
|
||
|
// 数据签名
|
||
|
// https://www.yuque.com/leshuazf/doc/dbmxyi#Nr9Ps
|
||
|
func (app *App) getSign(params map[string]interface{}) string {
|
||
|
// 参数按照参数名的字典升序排列
|
||
|
var keys []string
|
||
|
for k := range params {
|
||
|
keys = append(keys, k)
|
||
|
}
|
||
|
sort.Strings(keys)
|
||
|
str, _ := json.Marshal(keys) // data字符串值
|
||
|
return gobase64.Encode(gomd5.ToLower("lepos" + app.KeyAgent + string(str)))
|
||
|
}
|