feat: remove wechat bot, replace with api callback for receive wechat payment transactions

This commit is contained in:
RockYang
2023-08-10 17:24:23 +08:00
parent 2107c13b3d
commit b0e02b43fc
12 changed files with 76 additions and 204 deletions

View File

@@ -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)
}