package service import ( "github.com/go-kratos/kratos/v2/transport/http" v1 "voucher/api/v1" "voucher/internal/biz/bo" "voucher/internal/biz/vo" ) func (s *VoucherService) CmbOrder(ctx http.Context) error { var req v1.CmbOrderReply if err := ctx.BindForm(&req); err != nil { return err } reply := &v1.CmbReply{ //RespCode: "1000", //RespMsg: "成功", //Date: "", //KeyAlias: "", //CmbKeyAlias: "", //EncryptBody: "", //Sign: "", } return ctx.JSON(200, reply) } func (s *VoucherService) cmbOrder(ctx http.Context) (string, error) { var req v1.CmbRequest if err := ctx.BindForm(&req); err != nil { return "", err } if err := req.Validate(); err != nil { return "", err } // todo 签名验证 boReq := &bo.OrderCreateReqBo{ //OutBizNo: req.TransactionId, //ProductNo: req.ActivityId, //Account: req.CmbUid, AccountType: vo.OrderAccountTypeOpenId, } orderNo, err := s.VoucherBiz.CmbOrder(ctx, boReq) if err != nil { return "", err } return orderNo, nil } func (s *VoucherService) CmbProductQuery(ctx http.Context) error { var req v1.CmbQueryProductRequest if err := ctx.BindForm(&req); err != nil { return err } if err := req.Validate(); err != nil { return err } q, err := s.VoucherBiz.CmbProductQuery(ctx, req.ActivityId) if err != nil { return err } // 数据构造 加签 返回 rep := &v1.CmbQueryProductReply{ //RespCode: "", //RespMsg: "", //Date: "", //KeyAlias: "", //CmbKeyAlias: "", //EncryptBody: "", //Sign: "", ActivityName: "", ActivityId: *q.StockId, Amount: "", MinAmount: "", AvailableType: "", AvailableDays: "", StartTime: "", EndTime: "", AvailableStock: "", Detail: "", } return ctx.JSON(200, rep) }