lcrm-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese场景1:检索
Scenario 1: Retrieval
目标
Goal
支持销售快速检索:
- 自己(当前登录身份)
- 客户(包括公海客户)
- 商务记录(按客户、线索、机会、记录人查询)
- 客户机会
- 客户联系人
- 线索(包括公海线索)
- 机会
- 标签
- 用户
- 通知(激活的通知、历史通知)
- 售前行程(按时间段筛选)
Enable sales to quickly retrieve:
- Yourself (current logged-in identity)
- Customers (including public pool customers)
- Business records (query by customer, lead, opportunity, recorder)
- Customer opportunities
- Customer contacts
- Leads (including public pool leads)
- Opportunities
- Tags
- Users
- Notifications (active notifications, historical notifications)
- Presales itineraries (filtered by time period)
脚本入口
Script Entry
- 主脚本:
node scripts/search.mjs <action> [options] - 通用脚本:
node scripts/request.mjs ... - 环境变量:
- 必填:
LCRM_API_KEY - 可选:(默认
LCRM_BASE_URL)https://crm.langcore.net
- 必填:
- Main script:
node scripts/search.mjs <action> [options] - General script:
node scripts/request.mjs ... - Environment variables:
- Required:
LCRM_API_KEY - Optional: (default
LCRM_BASE_URL)https://crm.langcore.net
- Required:
执行流程
Execution Flow
- 判断用户要查的对象(自己/客户/线索/机会/标签/用户/客户关联数据)。
- 若对象是自己,使用 action。
me - 若对象是用户,优先使用 或
usersaction。sales-presales-users - 若对象是标签,使用 action。
tags - 优先调用 对应 action 发起检索。
search.mjs - 若命中多条且无法确定唯一对象,先让用户选择再继续。
- 返回结果时,先给核心字段,再给可继续缩小范围的建议参数。
- Determine the object the user wants to retrieve (yourself/customers/leads/opportunities/tags/users/customer-related data).
- If the object is yourself, use the action.
me - If the object is a user, prefer using the or
usersaction.sales-presales-users - If the object is a tag, use the action.
tags - Prioritize invoking the corresponding action in to initiate retrieval.
search.mjs - If multiple results are hit and the unique object cannot be determined, let the user select first before proceeding.
- When returning results, provide core fields first, then suggest parameters for further narrowing down the scope.
检索枚举字典
Retrieval Enumeration Dictionary
客户筛选枚举():
GET /api/customers- :
customerType[]、直接客户合作伙伴 - :
customerSource[]、自拓线索公司分配 - :
customerStatus[]、潜在客户、跟进客户、商机客户、合作客户无效客户 - :
region[]、上海、北京、华南、华东、海外其他
机会筛选枚举():
GET /api/opportunities/list- :
status、需求引导、客户立项、客户选定、客户成交机会失败
线索筛选枚举():
GET /api/leads- :
status[]、待处理、已跟进已转化 - :
classification[]、公司、市场销售 - 或
source[]:source、官方渠道、自办活动、三方活动、市场名单、熟人推荐、生态伙伴销售自拓 - :线索标签名称(支持多值,按“包含全部标签”匹配)
tags[] - 说明:当前仅用于线索检索,不适用于客户与机会检索
tags[]
商务记录字段枚举(用于结果解读与关联查询):
- :
followUpType、微信、电话、线上会议、邮件、现场拜访、商务活动其他
标签筛选枚举():
GET /api/tags- :当前系统主要使用
categoryLEAD - 说明:当前业务上仅线索使用 tag 字段;客户、机会暂无 tag 字段
Customer filtering enumeration ():
GET /api/customers- :
customerType[],Direct CustomerPartner - :
customerSource[],Self-developed LeadCompany-assigned - :
customerStatus[],Potential Customer,Follow-up Customer,Business Opportunity Customer,Cooperative CustomerInvalid Customer - :
region[],Shanghai,Beijing,South China,East China,OverseasOther
Opportunity filtering enumeration ():
GET /api/opportunities/list- :
status,Demand Guidance,Customer Project Initiation,Customer Selection,Customer ClosedOpportunity Failed
Lead filtering enumeration ():
GET /api/leads- :
status[],Pending Processing,Followed UpConverted - :
classification[],Company,MarketingSales - or
source[]:source,Official Channel,Self-hosted Event,Third-party Event,Marketing List,Acquaintance Referral,Ecosystem PartnerSales Self-developed - : Lead tag names (supports multiple values, matches by "contains all tags")
tags[] - Note: is currently only used for lead retrieval, not applicable to customer and opportunity retrieval
tags[]
Business record field enumeration (for result interpretation and associated queries):
- :
followUpType,WeChat,Phone Call,Online Meeting,Email,On-site Visit,Business EventOther
Tag filtering enumeration ():
GET /api/tags- : The current system mainly uses
categoryLEAD - Note: Currently, only leads use the tag field in business; customers and opportunities have no tag field yet
API 映射
API Mapping
1) 搜索自己(当前身份)
1) Search Yourself (Current Identity)
- 脚本:
node scripts/search.mjs me
- API:
GET /api/auth/me
- Script:
node scripts/search.mjs me
- API:
GET /api/auth/me
2) 检索客户
2) Retrieve Customers
- 脚本:
node scripts/search.mjs customers --company-name "<客户名>" --limit 5- 复杂筛选:
node scripts/search.mjs customers --query 'customerStatus[]=跟进客户' --query 'region[]=华东' - 查询公海客户:先获取公海用户ID,再查询
node scripts/search.mjs customers --query 'followUpSalesId[]=<公海用户ID>' - 查询我的客户:
node scripts/search.mjs customers --query 'followUpSalesId[]=<我的用户ID>'
- Script:
node scripts/search.mjs customers --company-name "<customer name>" --limit 5- Complex filtering:
node scripts/search.mjs customers --query 'customerStatus[]=Follow-up Customer' --query 'region[]=East China' - Query public pool customers: First get the public pool user ID, then query
node scripts/search.mjs customers --query 'followUpSalesId[]=<public pool user ID>' - Query my customers:
node scripts/search.mjs customers --query 'followUpSalesId[]=<my user ID>'
3) 检索商务记录
3) Retrieve Business Records
支持多种查询方式:
- 按客户查询:
node scripts/search.mjs customer-business-records --customer-id "<customerId>" - 按记录人查询:
node scripts/search.mjs business-records --recorder-id "<userId>" - 按记录人和时间查询:
node scripts/search.mjs business-records --recorder-id "<userId>" --start-date 2026-02-12 --end-date 2026-02-12 - 按线索查询:
node scripts/search.mjs business-records --lead-id "<leadId>" - 按机会查询:
node scripts/search.mjs business-records --opportunity-id "<opportunityId>" - 组合查询:
node scripts/search.mjs business-records --customer-id "<id>" --query limit=10 - 时间范围查询:
node scripts/search.mjs business-records --start-date 2026-02-01 --end-date 2026-02-28
注意:如需先找客户再查记录,使用:
node scripts/search.mjs customers --company-name "<客户名>" --limit 5Supports multiple query methods:
- Query by customer:
node scripts/search.mjs customer-business-records --customer-id "<customerId>" - Query by recorder:
node scripts/search.mjs business-records --recorder-id "<userId>" - Query by recorder and time:
node scripts/search.mjs business-records --recorder-id "<userId>" --start-date 2026-02-12 --end-date 2026-02-12 - Query by lead:
node scripts/search.mjs business-records --lead-id "<leadId>" - Query by opportunity:
node scripts/search.mjs business-records --opportunity-id "<opportunityId>" - Combined query:
node scripts/search.mjs business-records --customer-id "<id>" --query limit=10 - Time range query:
node scripts/search.mjs business-records --start-date 2026-02-01 --end-date 2026-02-28
Note: If you need to find the customer first before querying records, use:
node scripts/search.mjs customers --company-name "<customer name>" --limit 54) 检索客户机会
4) Retrieve Customer Opportunities
二选一:
node scripts/search.mjs customer-opportunities --customer-id "<customerId>"node scripts/search.mjs customer-opportunities --customer-name "<客户名>"
Choose one of the two:
node scripts/search.mjs customer-opportunities --customer-id "<customerId>"node scripts/search.mjs customer-opportunities --customer-name "<customer name>"
5) 检索客户联系人
5) Retrieve Customer Contacts
node scripts/search.mjs customer-contacts --customer-id "<customerId>"
node scripts/search.mjs customer-contacts --customer-id "<customerId>"
6) 检索线索
6) Retrieve Leads
node scripts/search.mjs leads --query keyword="<关键词>" --query limit=20- 复杂筛选示例:
node scripts/search.mjs leads --query 'status[]=已跟进' --query 'classification[]=销售' --query mine=truenode scripts/search.mjs leads --query 'tags[]=重点客户' --query 'tags[]=AI'
- 查询公海线索:
node scripts/search.mjs leads --query publicOnly=true - 查询我的线索:
node scripts/search.mjs leads --query mine=true
node scripts/search.mjs leads --query keyword="<keyword>" --query limit=20- Complex filtering examples:
node scripts/search.mjs leads --query 'status[]=Followed Up' --query 'classification[]=Sales' --query mine=truenode scripts/search.mjs leads --query 'tags[]=Key Customer' --query 'tags[]=AI'
- Query public pool leads:
node scripts/search.mjs leads --query publicOnly=true - Query my leads:
node scripts/search.mjs leads --query mine=true
7) 检索机会
7) Retrieve Opportunities
node scripts/search.mjs opportunities --query customerName="<客户名>" --query status=需求引导,客户立项- 金额和日期筛选示例:
node scripts/search.mjs opportunities --query minAmount=100000 --query maxAmount=500000 --query startDate=2026-02-01 --query endDate=2026-03-31
node scripts/search.mjs opportunities --query customerName="<customer name>" --query status=Demand Guidance,Customer Project Initiation- Amount and date filtering examples:
node scripts/search.mjs opportunities --query minAmount=100000 --query maxAmount=500000 --query startDate=2026-02-01 --query endDate=2026-03-31
8) 检索用户
8) Retrieve Users
- 用户检索(所有认证用户可访问,支持关键词):
node scripts/search.mjs users --search "<姓名或邮箱关键词>" --limit 20
- 直接查销售/售前用户:
node scripts/search.mjs sales-presales-users --search "<姓名或邮箱关键词>"
- User retrieval (accessible to all authenticated users, supports keywords):
node scripts/search.mjs users --search "<name or email keyword>" --limit 20
- Directly query sales/presales users:
node scripts/search.mjs sales-presales-users --search "<name or email keyword>"
9) 检索标签
9) Retrieve Tags
- 查全部标签:
node scripts/search.mjs tags
- 按分类查标签:
node scripts/search.mjs tags --category LEAD
- 按关键词过滤标签(名称/描述/分类):
node scripts/search.mjs tags --category LEAD --search "<关键词>"
- 注意:标签检索主要用于辅助线索检索/录入,当前不用于客户或机会字段过滤
- Query all tags:
node scripts/search.mjs tags
- Query tags by category:
node scripts/search.mjs tags --category LEAD
- Filter tags by keyword (name/description/category):
node scripts/search.mjs tags --category LEAD --search "<keyword>"
- Note: Tag retrieval is mainly used to assist lead retrieval/entry, and is not currently used for customer or opportunity field filtering
10) 检索通知
10) Retrieve Notifications
- 查询激活的通知(ACTIVE/OVERDUE):
node scripts/search.mjs notifications --status active
- 查询历史通知(DONE/OVERDUE):
node scripts/search.mjs notifications --status history
- 按分类筛选:
node scripts/search.mjs notifications --category LEAD_TIMEOUT --status active
- 分页查询:
node scripts/search.mjs notifications --page 2 --limit 20
- Query active notifications (ACTIVE/OVERDUE):
node scripts/search.mjs notifications --status active
- Query historical notifications (DONE/OVERDUE):
node scripts/search.mjs notifications --status history
- Filter by category:
node scripts/search.mjs notifications --category LEAD_TIMEOUT --status active
- Pagination query:
node scripts/search.mjs notifications --page 2 --limit 20
11) 检索售前行程
11) Retrieve Presales Itineraries
- 查询指定时间段的行程:
node scripts/search.mjs presales-itineraries --start-date 2026-02-10 --end-date 2026-02-16
- 查询某个售前的行程:
node scripts/search.mjs presales-itineraries --user-id <userId> --start-date 2026-02-10 --end-date 2026-02-16
- 查询某个机会的行程:
node scripts/search.mjs presales-itineraries --opportunity-id <opportunityId>
- Query itineraries for a specified time period:
node scripts/search.mjs presales-itineraries --start-date 2026-02-10 --end-date 2026-02-16
- Query itineraries for a specific presales person:
node scripts/search.mjs presales-itineraries --user-id <userId> --start-date 2026-02-10 --end-date 2026-02-16
- Query itineraries for a specific opportunity:
node scripts/search.mjs presales-itineraries --opportunity-id <opportunityId>
公海概念说明
Public Pool Concept Explanation
公海是指未分配给具体销售的线索和客户池,由系统中的特殊"公海用户"持有。
Public Pool refers to the pool of leads and customers not assigned to specific salespeople, held by a special "public pool user" in the system.
公海线索
Public Pool Leads
- 线索的 等于公海用户ID时,该线索属于公海
ownerId - 查询公海线索:
node scripts/search.mjs leads --query publicOnly=true - 查询我的线索:
node scripts/search.mjs leads --query mine=true - 公海用户配置:环境变量
PUBLIC_POOL_USER_EMAIL
- When a lead's equals the public pool user ID, the lead belongs to the public pool
ownerId - Query public pool leads:
node scripts/search.mjs leads --query publicOnly=true - Query my leads:
node scripts/search.mjs leads --query mine=true - Public pool user configuration: Environment variable
PUBLIC_POOL_USER_EMAIL
公海客户
Public Pool Customers
- 客户的 等于公海用户ID时,该客户属于公海
followUpSalesId - 查询公海客户:
node scripts/search.mjs customers --query 'followUpSalesId[]=<公海用户ID>' - 查询我的客户:
node scripts/search.mjs customers --query 'followUpSalesId[]=<我的用户ID>'
- When a customer's equals the public pool user ID, the customer belongs to the public pool
followUpSalesId - Query public pool customers:
node scripts/search.mjs customers --query 'followUpSalesId[]=<public pool user ID>' - Query my customers:
node scripts/search.mjs customers --query 'followUpSalesId[]=<my user ID>'
获取公海用户ID
Get Public Pool User ID
先查询当前用户信息获取公海用户邮箱,再查询用户列表获取公海用户ID:
bash
undefinedFirst query current user information to get the public pool user email, then query the user list to get the public pool user ID:
bash
undefined1. 查询自己,获取系统配置
1. Query yourself to get system configuration
node scripts/search.mjs me
node scripts/search.mjs me
2. 使用公海用户邮箱查询用户ID
2. Use the public pool user email to query the user ID
node scripts/search.mjs users --search "<公海用户邮箱>"
undefinednode scripts/search.mjs users --search "<public pool user email>"
undefined输出建议
Output Suggestions
- 自己:
id/name/email/roles - 客户:
id/companyName/customerStatus/followUpSales/_count - 商务记录:
recordTime/followUpType/contactedPerson/description - 机会:
id/name/status/amount/estimatedCloseDate/customer - 联系人:
name/phone/position/roles - 线索:
id/companyName/status/classification/owner/importedAt - 标签:
id/name/category/description/sortOrder/isActive - 用户:
id/name/email/roles/createdAt - 通知:
id/category/title/message/status/isRead/createdAt - 售前行程:
id/title/startTime/endTime/tripType/deliveryMode/status/opportunity/customer
- Yourself:
id/name/email/roles - Customers:
id/companyName/customerStatus/followUpSales/_count - Business records:
recordTime/followUpType/contactedPerson/description - Opportunities:
id/name/status/amount/estimatedCloseDate/customer - Contacts:
name/phone/position/roles - Leads:
id/companyName/status/classification/owner/importedAt - Tags:
id/name/category/description/sortOrder/isActive - Users:
id/name/email/roles/createdAt - Notifications:
id/category/title/message/status/isRead/createdAt - Presales itineraries:
id/title/startTime/endTime/tripType/deliveryMode/status/opportunity/customer