You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kashangwl/api.buy.notify.gin.go

37 lines
2.6 KiB

2 years ago
package kashangwl
import (
"context"
"github.com/gin-gonic/gin"
)
type ResponseApiBuyNotifyGin struct {
OrderNo int64 `form:"order_no" json:"order_no" xml:"order_no" uri:"order_no" binding:"required"` // 订单编号
OuterOrderId string `form:"outer_order_id" json:"outer_order_id" xml:"outer_order_id" uri:"outer_order_id" binding:"omitempty"` // 商户订单号
ProductId int `form:"product_id" json:"product_id" xml:"product_id" uri:"product_id" binding:"omitempty"` // 商品编号
Quantity int `form:"quantity" json:"quantity" xml:"quantity" uri:"quantity" binding:"required"` // 购买数量
State int `form:"state" json:"state" xml:"state" uri:"state" binding:"required"` // 订单状态100等待发货101正在充值200交易成功500交易失败501未知状态
StateInfo string `form:"state_info" json:"state_info" xml:"state_info" uri:"state_info" binding:"omitempty"` // 状态信息
CreatedAt string `form:"created_at" json:"created_at" xml:"created_at" uri:"created_at" binding:"required"` // 购买数量
}
// ApiBuyNotifyGin 购买商品 - 回调通知
// http://doc.cqmeihu.cn/sales/order-status-notify.html
func (c *Client) ApiBuyNotifyGin(ctx context.Context, ginCtx *gin.Context) (ResponseApiBuyNotifyGin, error) {
// 声明接收的变量
var validateJson struct {
OrderNo int64 `form:"order_no" json:"order_no" xml:"order_no" uri:"order_no" binding:"required"` // 订单编号
OuterOrderId string `form:"outer_order_id" json:"outer_order_id" xml:"outer_order_id" uri:"outer_order_id" binding:"omitempty"` // 商户订单号
ProductId int `form:"product_id" json:"product_id" xml:"product_id" uri:"product_id" binding:"omitempty"` // 商品编号
Quantity int `form:"quantity" json:"quantity" xml:"quantity" uri:"quantity" binding:"required"` // 购买数量
State int `form:"state" json:"state" xml:"state" uri:"state" binding:"required"` // 订单状态100等待发货101正在充值200交易成功500交易失败501未知状态
StateInfo string `form:"state_info" json:"state_info" xml:"state_info" uri:"state_info" binding:"omitempty"` // 状态信息
CreatedAt string `form:"created_at" json:"created_at" xml:"created_at" uri:"created_at" binding:"required"` // 购买数量
}
err := ginCtx.ShouldBind(&validateJson)
return validateJson, err
}