上传支付接口调增
This commit is contained in:
parent
b84b75ce8f
commit
a61b865d6d
@ -2,9 +2,10 @@ package web
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/gin"
|
||||
"go_dreamfactory/lego/sys/gin/engine"
|
||||
"go_dreamfactory/lego/utils/crypto/md5"
|
||||
"go_dreamfactory/pb"
|
||||
"net/http"
|
||||
)
|
||||
@ -21,16 +22,16 @@ type PayDelivery struct {
|
||||
|
||||
//充值发货
|
||||
func (this *Api_Comp) PayDelivery(c *engine.Context) {
|
||||
req := &PayDelivery{}
|
||||
req := make([]interface{}, 0)
|
||||
err := c.BindJSON(&req)
|
||||
this.module.Debugf("PayDelivery:%+v err:%v", req, err)
|
||||
var (
|
||||
payreq *pb.PayDeliveryReq = &pb.PayDeliveryReq{
|
||||
Uid: req.Uid,
|
||||
Orderid: req.Order,
|
||||
Productid: req.ProductID,
|
||||
Price: req.Price,
|
||||
Amount: req.Amount,
|
||||
Uid: req[0].(string),
|
||||
Productid: req[1].(string),
|
||||
Orderid: req[2].(string),
|
||||
Price: req[3].(float32),
|
||||
Amount: 1,
|
||||
}
|
||||
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{
|
||||
Code: 0,
|
||||
@ -41,11 +42,10 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) {
|
||||
defer func() {
|
||||
c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: ""})
|
||||
}()
|
||||
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"orderid": req.Order, "productid": req.ProductID, "price": req.Price, "amount": req.Amount, "uid": req.Uid}); sign != req.Sign {
|
||||
this.module.Errorf("PayDelivery SignError sgin:%s", sign)
|
||||
sign := md5.MD5EncToLower(fmt.Sprintf("%s%s%s%d%s%s", req[0], req[1], req[2], req[3], req[4], this.options.Key))
|
||||
if sign != req[4] {
|
||||
payresp.Code = pb.ErrorCode_SignError
|
||||
payresp.Msg = pb.GetErrorCodeMsg(pb.ErrorCode_SignError)
|
||||
return
|
||||
}
|
||||
if err = this.module.service.RpcCall(
|
||||
context.Background(),
|
||||
|
Loading…
Reference in New Issue
Block a user