京东商城订单,商品审核暂停一下

This commit is contained in:
苏尹岚
2020-06-04 15:15:12 +08:00
parent a04c1595bc
commit 66bdac9c2c
5 changed files with 126 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ package jxutils
import (
"bytes"
"context"
"crypto/aes"
"encoding/base64"
"fmt"
"io/ioutil"
"math"
@@ -882,3 +884,35 @@ func TranslateSoundSize(vendorID, soundPercentage int) (soundSize string) {
}
return soundSize
}
//ECB,AES模式解密
//目前就京东商城订单手机号解密用
func DecryptDESECB(d, key []byte) string {
data, err := base64.StdEncoding.DecodeString(string(d))
if err != nil {
return ""
}
block, err := aes.NewCipher(key)
if err != nil {
return ""
}
bs := block.BlockSize()
if len(data)%bs != 0 {
return ""
}
out := make([]byte, len(data))
dst := out
for len(data) > 0 {
block.Decrypt(dst, data[:bs])
data = data[bs:]
dst = dst[bs:]
}
out = PKCS5UnPadding(out)
return string(out)
}
func PKCS5UnPadding(origData []byte) []byte {
length := len(origData)
unpadding := int(origData[length-1])
return origData[:(length - unpadding)]
}