新增客户标签库:管理员维护、员工选择
租户级标签 CRUD 与颜色预设;客户打标仅能从库中选择,设置页提供管理入口,列表筛选随标签库动态生成。
This commit is contained in:
@@ -635,6 +635,16 @@ func TestCustomerAndKnowledgeCRUD(t *testing.T) {
|
||||
tenant := createTenant(t, "业务CRUD租户", "normal")
|
||||
admin := createUser(t, tenant.ID, "biz-admin", "admin")
|
||||
|
||||
// 先建标签库,客户打标只能从库中选
|
||||
for _, name := range []string{"新客户", "VIP客户", "活跃"} {
|
||||
tagRec := httptest.NewRecorder()
|
||||
body := fmt.Sprintf(`{"name":%q,"color":"blue"}`, name)
|
||||
router.ServeHTTP(tagRec, bearerRequest(t, http.MethodPost, "/api/customer-tags", []byte(body), admin))
|
||||
if tagRec.Code != http.StatusOK {
|
||||
t.Fatalf("创建标签 %s 失败: %s", name, tagRec.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
createCustomerRec := httptest.NewRecorder()
|
||||
router.ServeHTTP(createCustomerRec, bearerRequest(t, http.MethodPost, "/api/customers", []byte(`{"name":"测试客户甲","phone":"13900001111","tags":"[\"新客户\"]","status":"offline","source":"手动"}`), admin))
|
||||
if createCustomerRec.Code != http.StatusOK {
|
||||
|
||||
Reference in New Issue
Block a user