chore: release server-v1.0.72
Deploy Server / release-deploy-server (push) Successful in 56s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
This commit is contained in:
wangjia
2026-06-21 19:09:30 +08:00
parent fcc0fd988b
commit 7a78448a25
6 changed files with 82 additions and 0 deletions
+15
View File
@@ -255,3 +255,18 @@ func (h *StockInHandler) Reject(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"message": "rejected"})
}
// Withdraw PUT /api/v1/stock-in/orders/:id/withdraw
// 审核中(pending)撤回为草稿(draft),供管理员修改后重新提交。仅 pending 可撤回;
// 已审核(approved)单据只读、库存已变动,不可撤回。
func (h *StockInHandler) Withdraw(c *gin.Context) {
shopID := middleware.GetShopID(c)
result := h.db.Model(&model.StockInOrder{}).
Where("id = ? AND shop_id = ? AND status = 'pending'", c.Param("id"), shopID).
Update("status", "draft")
if result.RowsAffected == 0 {
c.JSON(http.StatusBadRequest, gin.H{"error": "order not found or not in pending status"})
return
}
c.JSON(http.StatusOK, gin.H{"message": "withdrawn"})
}