From b22ff23c4db1c414e2aac301b5765cfbd4eee6a7 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 20 Dec 2022 14:30:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=94=AF=E4=BB=98=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/梦工厂后台AIP文档.md | 26 ++++++++++++++++++++++++++ modules/web/api_paydelivery.go | 20 ++++++++++++++------ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/bin/梦工厂后台AIP文档.md b/bin/梦工厂后台AIP文档.md index ff605bb11..c111c2e49 100644 --- a/bin/梦工厂后台AIP文档.md +++ b/bin/梦工厂后台AIP文档.md @@ -93,4 +93,30 @@ "msg":"成功", "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":"", +} ``` \ No newline at end of file diff --git a/modules/web/api_paydelivery.go b/modules/web/api_paydelivery.go index 07fd1af51..56be413e6 100644 --- a/modules/web/api_paydelivery.go +++ b/modules/web/api_paydelivery.go @@ -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