package app import ( "net/http" "bindbox-game/internal/code" "bindbox-game/internal/pkg/core" ) type cancelShippingRequest struct { InventoryID int64 `json:"inventory_id"` } type cancelShippingResponse struct{} // CancelShipping 取消发货申请 // @Summary 取消发货申请 // @Description 取消已提交但未发货的申请;恢复库存状态 // @Tags APP端.用户 // @Accept json // @Produce json // @Security LoginVerifyToken // @Param user_id path integer true "用户ID" // @Param RequestBody body cancelShippingRequest true "请求参数:资产ID" // @Success 200 {object} cancelShippingResponse "成功" // @Failure 400 {object} code.Failure "参数错误/记录不存在/已处理" // @Router /api/app/users/{user_id}/inventory/cancel-shipping [post] func (h *handler) CancelShipping() core.HandlerFunc { return func(ctx core.Context) { req := new(cancelShippingRequest) if err := ctx.ShouldBindJSON(req); err != nil || req.InventoryID == 0 { ctx.AbortWithError(core.Error(http.StatusBadRequest, code.ParamBindError, "参数错误")) return } userID := int64(ctx.SessionUserInfo().Id) err := h.user.CancelShipping(ctx.RequestContext(), userID, req.InventoryID) if err != nil { ctx.AbortWithError(core.Error(http.StatusBadRequest, 10024, err.Error())) return } ctx.Payload(nil) } }