web

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelOrderReq

type CancelOrderReq struct {
	OrderSN string `json:"sn"`
}

CancelOrderReq 取消订单

type CloseTimeoutOrdersReq

type CloseTimeoutOrdersReq struct {
	Limit  int   `json:"limit,omitempty"`
	Minute int64 `json:"minute"`
}

CloseTimeoutOrdersReq 关闭超时订单

type CompleteOrderReq

type CompleteOrderReq struct {
	OrderSN string `json:"sn"`
	BuyerID int64  `json:"buyerId"`
}

CompleteOrderReq 完成订单

type CreateOrderReq

type CreateOrderReq struct {
	RequestID          string    `json:"requestID"`       // 请求去重,防止订单重复提交
	Products           []Product `json:"products"`        // 商品信息
	Payments           []Payment `json:"paymentChannels"` // 支付通道
	OriginalTotalPrice int64     `json:"originalTotalPrice"`
	RealTotalPrice     int64     `json:"realTotalPrice"`
}

CreateOrderReq 创建订单请求

type CreateOrderResp

type CreateOrderResp struct {
	OrderSN       string `json:"orderSN"` // 前端用于轮训订单状态,然后根据状态/时间限制来跳转
	WechatCodeURL string `json:"wechatCodeURL,omitempty"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(svc service.Service, paymentSvc payment.Service, productSvc product.Service, creditSvc credit.Service, snGenerator *sequencenumber.Generator, cache ecache.Cache) *Handler

func (*Handler) CancelOrder

func (h *Handler) CancelOrder(ctx *ginx.Context, req CancelOrderReq, sess session.Session) (ginx.Result, error)

CancelOrder 取消订单

func (*Handler) CloseTimeoutOrders

func (h *Handler) CloseTimeoutOrders(ctx *ginx.Context, req CloseTimeoutOrdersReq) (ginx.Result, error)

CloseTimeoutOrders 关闭超时订单

func (*Handler) CompleteOrder

func (h *Handler) CompleteOrder(ctx *ginx.Context, req CompleteOrderReq) (ginx.Result, error)

CompleteOrder 完成订单

func (*Handler) CreateOrderAndPayment

func (h *Handler) CreateOrderAndPayment(ctx *ginx.Context, req CreateOrderReq, sess session.Session) (ginx.Result, error)

CreateOrderAndPayment 创建订单和支付

func (*Handler) ListOrders

func (h *Handler) ListOrders(ctx *ginx.Context, req ListOrdersReq, sess session.Session) (ginx.Result, error)

ListOrders 分页查询用户订单

func (*Handler) PrivateRoutes

func (h *Handler) PrivateRoutes(server *gin.Engine)

func (*Handler) RetrieveOrderDetail

func (h *Handler) RetrieveOrderDetail(ctx *ginx.Context, req RetrieveOrderDetailReq, sess session.Session) (ginx.Result, error)

RetrieveOrderDetail 查看订单详情

func (*Handler) RetrieveOrderStatus

func (h *Handler) RetrieveOrderStatus(ctx *ginx.Context, req RetrieveOrderStatusReq, sess session.Session) (ginx.Result, error)

RetrieveOrderStatus 获取订单状态

func (*Handler) RetrievePreviewOrder

func (h *Handler) RetrievePreviewOrder(ctx *ginx.Context, req PreviewOrderReq, sess session.Session) (ginx.Result, error)

RetrievePreviewOrder 获取订单预览信息, 此时订单尚未创建

type ListOrdersReq

type ListOrdersReq struct {
	Offset int `json:"offset,omitempty"`
	Limit  int `json:"limit,omitempty"`
}

ListOrdersReq 分页查询用户所有订单

type ListOrdersResp

type ListOrdersResp struct {
	Total  int64   `json:"total,omitempty"`
	Orders []Order `json:"orders,omitempty"`
}

type Order

type Order struct {
	SN                 string      `json:"sn"`
	PaymentSN          string      `json:"paymentSn"`
	OriginalTotalPrice int64       `json:"originalPrice"`
	RealTotalPrice     int64       `json:"realPrice"`
	Status             int64       `json:"status"`
	Items              []OrderItem `json:"items"`
	Payments           []Payment   `json:"payments"`
	Ctime              int64       `json:"ctime"`
	Utime              int64       `json:"utime"`
}

type OrderItem

type OrderItem struct {
	SPUID            int64  `json:"spuId"`
	SKUID            int64  `json:"skuId"`
	SKUName          string `json:"skuName"`
	SKUDescription   string `json:"skuDescription"`
	SKUOriginalPrice int64  `json:"skuOriginalPrice"`
	SKURealPrice     int64  `json:"skuRealPrice"`
	Quantity         int64  `json:"quantity"`
}

type Payment

type Payment struct {
	Type   int64 `json:"type"` // 1 积分, 2微信
	Amount int64 `json:"amount,omitempty"`
}

type PreviewOrderReq

type PreviewOrderReq struct {
	ProductSKUSN string `json:"sn"`
	Quantity     int64  `json:"quantity"`
}

PreviewOrderReq 预览订单请求

type PreviewOrderResp

type PreviewOrderResp struct {
	Credits  int64     `json:"credits"`  // 积分总数
	Payments []Payment `json:"payments"` // 支付通道
	Products []Product `json:"products"` // 商品信息
	Policy   string    `json:"policy"`   // 政策信息
}

type Product

type Product struct {
	SPUSN         string `json:"spuSN"`
	SKUSN         string `json:"skuSN"`
	Name          string `json:"name"`
	Desc          string `json:"desc"`
	OriginalPrice int64  `json:"originalPrice"`
	RealPrice     int64  `json:"realPrice"`
	Quantity      int64  `json:"quantity"`
}

type RetrieveOrderDetailReq

type RetrieveOrderDetailReq struct {
	OrderSN string `json:"sn"`
}

RetrieveOrderDetailReq 获取订单详情

type RetrieveOrderDetailResp

type RetrieveOrderDetailResp struct {
	Order Order `json:"order"`
}

type RetrieveOrderStatusReq

type RetrieveOrderStatusReq struct {
	OrderSN string `json:"sn"`
}

RetrieveOrderStatusReq 获取订单状态

type RetrieveOrderStatusResp

type RetrieveOrderStatusResp struct {
	OrderStatus int64 `json:"status"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL