package web import ( "context" "go_dreamfactory/comm" "go_dreamfactory/lego/sys/gin" "go_dreamfactory/lego/sys/gin/engine" "go_dreamfactory/pb" "net/http" ) type PayDelivery struct { pb.DBSystemNotify Order string `json:"orderid"` ProductID string `json:"productid"` Uid string `json:"uid"` Sign string `json:"sign"` } //充值发货 func (this *Api_Comp) PayDelivery(c *engine.Context) { req := &PayDelivery{} err := c.BindJSON(&req) this.module.Debugf("PayDelivery:%+v err:%v", req, err) var ( payreq *pb.PayDeliveryReq = &pb.PayDeliveryReq{} 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 { this.module.Errorf("PayDelivery SignError sgin:%s", sign) payresp.Code = pb.ErrorCode_SignError return } if err = this.module.service.RpcCall( context.Background(), comm.Service_Worker, string(comm.Rpc_ModulePayDelivery), payreq, payresp); err != nil { this.module.Errorln(err) payresp.Code = pb.ErrorCode_RpcFuncExecutionError } }