fix(backend): 补全多处 Scan/Count 错误未检查,私钥缺失改为 Fatal

- stock.go: ApproveStockIn 入库前库存 Scan 加错误检查
- license.go: Activate 阶段 Count 设备数加错误检查;createTrialLicense
  私钥未配置由静默跳过改为 log.Fatalf,防止生产环境新注册门店无 license
- inventory.go: List 接口两处 Raw Scan 加错误检查并返回 500
- finance.go: ArBalance 汇总 Raw Scan 加错误检查并返回 500
This commit is contained in:
wangjia
2026-06-14 08:12:57 +08:00
parent f251953dbc
commit 2ed0010c67
4 changed files with 23 additions and 11 deletions
+5 -2
View File
@@ -173,7 +173,7 @@ func (h *FinanceHandler) Summary(c *gin.Context) {
TotalAmount float64 `json:"total_amount"`
}
var rows []row
h.db.Raw(`
if err := h.db.Raw(`
SELECT f.partner_id,
COALESCE(p.name, '') AS partner_name,
f.type,
@@ -186,7 +186,10 @@ func (h *FinanceHandler) Summary(c *gin.Context) {
AND f.status = 'open'
GROUP BY f.partner_id, f.type
ORDER BY total_amount DESC
`, shopID).Scan(&rows)
`, shopID).Scan(&rows).Error; err != nil {
util.RespondError(c, http.StatusInternalServerError, "QUERY_ERROR", "查询失败")
return
}
util.RespondSuccess(c, rows)
}