This commit is contained in:
苏尹岚
2020-06-27 11:51:02 +08:00
parent 4af8248432
commit 55a381d214
5 changed files with 21 additions and 7 deletions

View File

@@ -2,12 +2,14 @@ package jdshopapi
import (
"crypto/aes"
"crypto/md5"
"encoding/base64"
"fmt"
"io/ioutil"
"math"
"net/http"
"strings"
"testing"
"time"
"git.rosy.net.cn/baseapi/utils"
)
@@ -103,8 +105,19 @@ func TestTryGetCookie(t *testing.T) {
}
func TestAAADS(t *testing.T) {
str := "16:00-17:00"
fmt.Println(str[strings.LastIndex(str, "-")+1:])
const prefix = 80
const randPartNum = 100
orderNoBeginTimestamp := utils.Str2Time("2010-01-01 00:00:00").Unix()
orderNo := time.Now().Unix() - orderNoBeginTimestamp
orderNo = orderNo * randPartNum
md5Bytes := md5.Sum([]byte(utils.GetUUID()))
randPart := 0
for k, v := range md5Bytes {
randPart += int(v) << ((k % 3) * 8)
}
orderNo += int64(randPart % randPartNum)
orderNo += int64(math.Pow10(int(math.Log10(float64(orderNo)))+1)) * prefix
fmt.Println(orderNo)
}
func DecryptDESECB(d, key []byte) string {