This commit is contained in:
苏尹岚
2020-06-23 18:01:36 +08:00
parent 4120717078
commit 961e4378ee
3 changed files with 70 additions and 0 deletions

View File

@@ -385,6 +385,21 @@ func GenOrderNo(ctx *jxcontext.Context) (orderNo int64) {
return orderNo
}
func GenAfsOrderNo(ctx *jxcontext.Context) (orderNo int64) {
const prefix = 80
const randPartNum = 100
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
return orderNo
}
func GenPayOrderID(order *model.GoodsOrder) (payOrderID int64) {
return utils.Str2Int64(order.VendorOrderID)
}