feat: 产品/客户/订单批量删除;接入 GeoLite2 城市库(地理分布/激活记录/审计日志显示归属地);仪表盘趋势图美化
This commit is contained in:
1 parent
252ae14aef
commit
473dcd0aab
24 files changed
+431
-34
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"backend/internal/dto"
|
||||
customerservice "backend/internal/service/customer"
|
||||
"backend/utils"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -120,3 +121,22 @@ func (ctrl *CustomerController) UpdateStatus(c *gin.Context) {
|
||||
utils.LogAction(ctrl.db, c, "update_status", "customer", uint(id), "", "", "", "切换客户状态")
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "message": "状态更新成功"})
|
||||
}
|
||||
|
||||
// BatchDelete 批量删除客户(名下有 License 的自动跳过) // Logan.Li
|
||||
func (ctrl *CustomerController) BatchDelete(c *gin.Context) {
|
||||
var req struct {
|
||||
IDs []uint `json:"ids" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"code": 400, "message": "参数错误"})
|
||||
return
|
||||
}
|
||||
result, err := ctrl.svc.BatchDelete(req.IDs)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{"code": 1, "message": err.Error()})
|
||||
return
|
||||
}
|
||||
utils.LogAction(ctrl.db, c, "batch_delete", "customer", 0, "", "", "",
|
||||
fmt.Sprintf("批量删除客户 %d 条,跳过 %d 条", result.Deleted, result.Skipped))
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "message": "批量删除完成", "data": result})
|
||||
}
|
||||
Reference in new issue
Block a user