mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-06 09:13:47 +08:00
feat: remove wechat bot, replace with api callback for receive wechat payment transactions
This commit is contained in:
@@ -4,8 +4,11 @@ import (
|
||||
"bytes"
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
// AesEncrypt 加密
|
||||
@@ -68,3 +71,14 @@ func pkcs7UnPadding(data []byte) ([]byte, error) {
|
||||
unPadding := int(data[length-1])
|
||||
return data[:(length - unPadding)], nil
|
||||
}
|
||||
|
||||
func Sha256(data string) string {
|
||||
hash := sha256.New()
|
||||
_, err := io.WriteString(hash, data)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
hashValue := hash.Sum(nil)
|
||||
return fmt.Sprintf("%x", hashValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user