完善发货链接签名和作废恢复

This commit is contained in:
yml2213
2026-07-31 11:43:13 +08:00
parent 6ca226ce4b
commit e4c1306216
17 changed files with 527 additions and 109 deletions
+29 -1
View File
@@ -16,13 +16,15 @@ type MerchantHandler struct {
merchantSvc *service.MerchantService
fulfillmentSvc *service.FulfillmentService
callbackSvc *service.CallbackService
deliverySvc *service.DeliveryService
}
func NewMerchantHandler(merchantSvc *service.MerchantService, fulfillmentSvc *service.FulfillmentService, callbackSvc *service.CallbackService) *MerchantHandler {
func NewMerchantHandler(merchantSvc *service.MerchantService, fulfillmentSvc *service.FulfillmentService, callbackSvc *service.CallbackService, deliverySvc *service.DeliveryService) *MerchantHandler {
return &MerchantHandler{
merchantSvc: merchantSvc,
fulfillmentSvc: fulfillmentSvc,
callbackSvc: callbackSvc,
deliverySvc: deliverySvc,
}
}
@@ -165,6 +167,32 @@ func (h *MerchantHandler) CreateTestOrder(c *gin.Context) {
})
}
func (h *MerchantHandler) GetDeliveryLink(c *gin.Context) {
link, err := h.deliverySvc.GetOrCreateDeliveryLink(middleware.GetMerchantID(c), c.Param("order_no"))
if err != nil {
writeDeliveryError(c, err)
return
}
response.OK(c, link)
}
func (h *MerchantHandler) RevokeDeliveryLink(c *gin.Context) {
if err := h.deliverySvc.RevokeDeliveryLink(middleware.GetMerchantID(c), c.Param("order_no")); err != nil {
writeDeliveryError(c, err)
return
}
response.OK(c, nil)
}
func (h *MerchantHandler) RestoreDeliveryLink(c *gin.Context) {
link, err := h.deliverySvc.RestoreDeliveryLink(middleware.GetMerchantID(c), c.Param("order_no"))
if err != nil {
writeDeliveryError(c, err)
return
}
response.OK(c, link)
}
func (h *MerchantHandler) GetWallet(c *gin.Context) {
wallet, err := h.fulfillmentSvc.GetWallet(middleware.GetMerchantID(c))
if err != nil {