上传支付接口调整
This commit is contained in:
parent
1932877a11
commit
b22ff23c4d
@ -94,3 +94,29 @@
|
||||
"data":"",
|
||||
}
|
||||
```
|
||||
|
||||
### 支付发货API
|
||||
- 接口名:paydelivery
|
||||
- 接口说明:web 服务器给玩家发送邮件
|
||||
- 请求地址:{IP}:{port}/paydelivery
|
||||
- 请求参数:orderid(订单号|签名),productid(商品id|签名),price(总金额|签名),amount(购买数量|签名),uid(用户id|签名),sign(签名)
|
||||
- 请求样例
|
||||
```
|
||||
{
|
||||
"orderid":"orderid0001",
|
||||
"productid":"productid_1",
|
||||
"price":35.5,
|
||||
"amount": 1,
|
||||
"uid":"df01_123dasqwe123",
|
||||
"sign":"asjioqiowjeioqjweijqwejoi"
|
||||
}
|
||||
```
|
||||
- 返回参数 code(0:成功 -1 失败),msg(结果描述),data(返回的额外数据)
|
||||
- 返回样例
|
||||
```
|
||||
{
|
||||
"code":0,
|
||||
"msg":"成功",
|
||||
"data":"",
|
||||
}
|
||||
```
|
@ -11,10 +11,12 @@ import (
|
||||
|
||||
type PayDelivery struct {
|
||||
pb.DBSystemNotify
|
||||
Order string `json:"orderid"`
|
||||
ProductID string `json:"productid"`
|
||||
Uid string `json:"uid"`
|
||||
Sign string `json:"sign"`
|
||||
Order string `json:"orderid"`
|
||||
ProductID string `json:"productid"`
|
||||
Price float32 `json:"price"`
|
||||
Amount int32 `json:"amount"`
|
||||
Uid string `json:"uid"`
|
||||
Sign string `json:"sign"`
|
||||
}
|
||||
|
||||
//充值发货
|
||||
@ -23,11 +25,17 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) {
|
||||
err := c.BindJSON(&req)
|
||||
this.module.Debugf("PayDelivery:%+v err:%v", req, err)
|
||||
var (
|
||||
payreq *pb.PayDeliveryReq = &pb.PayDeliveryReq{}
|
||||
payreq *pb.PayDeliveryReq = &pb.PayDeliveryReq{
|
||||
Uid: req.Uid,
|
||||
Orderid: req.Order,
|
||||
Productid: req.ProductID,
|
||||
Price: req.Price,
|
||||
Amount: req.Amount,
|
||||
}
|
||||
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{}
|
||||
)
|
||||
defer c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: nil})
|
||||
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"orderid": req.Order, "productid": req.ProductID, "uid": req.Uid}); sign != req.Sign {
|
||||
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)
|
||||
payresp.Code = pb.ErrorCode_SignError
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user