客户基本信息支持快速编辑,新增微信与QQ字段
工作台侧栏可点击编辑手机/邮箱/微信/QQ;客户资料同步展示,自动识别仅在主字段为空时回填。
This commit is contained in:
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"kefu-cloud/server/internal/middleware"
|
||||
@@ -135,12 +136,23 @@ func (h *CustomerHandler) Update(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
allowed := map[string]bool{"name": true, "phone": true, "email": true, "tags": true, "source": true, "status": true}
|
||||
allowed := map[string]bool{
|
||||
"name": true, "phone": true, "email": true, "wechat": true, "qq": true,
|
||||
"tags": true, "source": true, "status": true,
|
||||
}
|
||||
for key := range updates {
|
||||
if !allowed[key] {
|
||||
delete(updates, key)
|
||||
}
|
||||
}
|
||||
// 字符串字段统一 trim
|
||||
for _, k := range []string{"name", "phone", "email", "wechat", "qq", "source", "status"} {
|
||||
if v, ok := updates[k]; ok {
|
||||
if s, ok := v.(string); ok {
|
||||
updates[k] = strings.TrimSpace(s)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(updates) == 0 {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"code": 400, "message": "没有可更新字段"})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user