增加品牌
This commit is contained in:
parent
209d2033c1
commit
01a7c60d45
|
@ -24,6 +24,7 @@ func CreateOrder(c *gin.Context) {
|
||||||
controllers.HandCodeRes(c, nil, errorcode.NotLogin)
|
controllers.HandCodeRes(c, nil, errorcode.NotLogin)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
code, data := services.CreateOrderService(userId, request.ProductId)
|
code, data := services.CreateOrderService(userId, request.ProductId)
|
||||||
controllers.HandCodeRes(c, data, code)
|
controllers.HandCodeRes(c, data, code)
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,8 @@ type OrderQuery struct {
|
||||||
type InsertOrderResponse struct {
|
type InsertOrderResponse struct {
|
||||||
OrderNo string `json:"order_no"`
|
OrderNo string `json:"order_no"`
|
||||||
NotifyUrl string `json:"notify_url"`
|
NotifyUrl string `json:"notify_url"`
|
||||||
|
Sign string `json:"sign"`
|
||||||
|
PlainText string `json:"plain_text"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type YouChuOrderQueryResponse struct {
|
type YouChuOrderQueryResponse struct {
|
||||||
|
|
|
@ -90,6 +90,8 @@ func CreateOrderService(userId int, productId int) (code int, data front.InsertO
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
data.PlainText = config.GetConf().YouChu.MchtNo + order.OrderNo + order.Price
|
||||||
|
data.Sign = utils.HmacSha256To16(config.GetConf().YouChu.MchtNo, data.PlainText)
|
||||||
data.OrderNo = order.OrderNo
|
data.OrderNo = order.OrderNo
|
||||||
data.NotifyUrl = config.GetConf().YouChu.NotifyUrl
|
data.NotifyUrl = config.GetConf().YouChu.NotifyUrl
|
||||||
return errorcode.Success, data
|
return errorcode.Success, data
|
||||||
|
|
|
@ -2,6 +2,7 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/hmac"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
@ -508,3 +509,11 @@ func DownloadBill(xmlString string, key int) {
|
||||||
}
|
}
|
||||||
w.Flush()
|
w.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HmacSha256To16(key string, data string) string {
|
||||||
|
mac := hmac.New(sha256.New, []byte(key))
|
||||||
|
_, _ = mac.Write([]byte(data))
|
||||||
|
encode := mac.Sum(nil)
|
||||||
|
|
||||||
|
return hex.EncodeToString(encode)
|
||||||
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ type YouChuConfig struct {
|
||||||
SopPublicKey string //服开公钥
|
SopPublicKey string //服开公钥
|
||||||
SopPrivateKey string //服开私钥
|
SopPrivateKey string //服开私钥
|
||||||
FileHost string
|
FileHost string
|
||||||
|
Sha string
|
||||||
}
|
}
|
||||||
|
|
||||||
type YouChuCallBack struct {
|
type YouChuCallBack struct {
|
||||||
|
|
Loading…
Reference in New Issue