Files
cunkebao_v3/Server/script/configure_wz02_ai_lead.php
Manus AI 5182529a58 sync(本地→GitHub): 2026-05-30 21:41 全量单向同步
## GitHub 同步说明

| 项 | 内容 |
|:---|:---|
| 仓库 | https://github.com/fnvtk/cunkebao_v3 |
| 分支 | develop |
| 方向 | 本地 → GitHub(单向 push) |
| 是否拉取远程 | 否(未 fetch / pull / merge) |
| 是否改本地文件 | 否(仅 git add/commit,未编辑任何源文件正文) |
| 基准 commit | 0643e78a |
| 变更规模 | 709 files, +26436 / -3407 lines |

## 目录变更统计

| 目录 | 文件数 | 说明 |
|:---|---:|:---|
| 开发文档/ | 404 | 四端进行中/已完成需求、接口文档、官网需求、部署脚本 |
| Server/ | 95 | 后端 API、迁移脚本、触客宝/超管/存客宝服务 |
| Cunkebao/ | 85 | 移动端 H5、设备绑定、客服、转号审批等 |
| Touchkebao/ | 68 | PC 工作台、AI 获客、算力中心、Glass UI |
| SuperAdmin/ | 33 | 超管项目中心、算力计费、内容库 |
| 官网/ | 19 | 新增存客宝官网静态页(index/pricing/solutions 等) |
| .cursor/ | 3 | Cursor 规则与 Skill |
| .obsidian/ | 2 | Obsidian 工作区配置 |

## 重点新增/更新(本地为准)

- 官网/: 完整静态站点(index、pricing、manual、solutions、api)
- 开发文档/1、需求/修改/*_进行中_20260530.md(存客宝/触客宝/AI数智员工)
- 开发文档/1、需求/官网需求.md
- 开发文档/5、接口/开发进度_接口文档.md 等接口文档迭代
- Touchkebao Glass UI 与 P0 收尾、通道获客算力
- SuperAdmin 算力计费规则、项目工作台

## 刻意未上传(本地保留)

- node_modules/
- .DS_Store、.smart-env/
- .开发文档_nested_git_backup/(旧嵌套 git 备份)
- **/__pycache__/

## 验收

GitHub 浏览: https://github.com/fnvtk/cunkebao_v3/tree/develop

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:41:40 +08:00

87 lines
2.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* 为 wz_02 配置场景获客 → 触客宝 AI 获客推送,并灌入演示客资
* 用法docker compose exec server php script/configure_wz02_ai_lead.php [companyId]
*/
require __DIR__ . '/../thinkphp/base.php';
$app = new think\App();
$app->initialize();
use app\cunkebao\service\PlanLeadWebhookService;
use think\Db;
$companyId = isset($argv[1]) ? (int)$argv[1] : 2130;
$user = Db::name('users')
->where('companyId', $companyId)
->where('account', 'wz_02')
->find();
if (!$user) {
$user = Db::name('users')->where('account', 'wz_02')->find();
}
if (!$user) {
echo "ERR: ck_users wz_02 not found\n";
exit(1);
}
$kefuId = (int)$user['id'];
$companyId = (int)($user['companyId'] ?: $companyId);
$plan = Db::name('customer_acquisition_task')
->where('companyId', $companyId)
->where('deleteTime', 0)
->order('id desc')
->find();
if (!$plan) {
echo "ERR: no customer_acquisition_task for companyId={$companyId}\n";
exit(1);
}
PlanLeadWebhookService::saveConfig((int)$plan['id'], [
'touchkebaoEnabled' => true,
'touchkebaoKefuId' => $kefuId,
]);
$now = time();
$samples = [
[
'nickname' => '张先生·魔兽一键宏',
'phone' => '13800138001',
'unionId' => 'wz02_lead_' . $now . '_1',
'planName' => (string)($plan['name'] ?? '场景获客'),
'tags' => ['高意向', '魔兽玩家'],
'rfmLevel' => 'A',
'rfmScore' => 78,
'behaviorTimeline' => [
['time' => date('Y-m-d H:i', $now - 300), 'action' => '场景获客推送', 'summary' => '最近触达'],
],
],
[
'nickname' => '李女士·暗黑代练',
'phone' => '13900139002',
'unionId' => 'wz02_lead_' . $now . '_2',
'planName' => (string)($plan['name'] ?? '场景获客'),
'tags' => ['暗黑3', '比价'],
'rfmLevel' => 'S',
'rfmScore' => 92,
'behaviorTimeline' => [
['time' => date('Y-m-d H:i', $now - 60), 'action' => 'Webhook', 'summary' => '高 RFM'],
],
],
];
foreach ($samples as $body) {
\app\chukebao\controller\AiLeadController::ingest(array_merge($body, [
'companyId' => $companyId,
'kefuId' => $kefuId,
]));
}
$count = Db::name('ai_lead')
->where('companyId', $companyId)
->where(function ($q) use ($kefuId) {
$q->where('kefuId', $kefuId)->whereOr('kefuId', 0);
})
->count();
echo "OK planId={$plan['id']} planName={$plan['name']} kefuId={$kefuId} touchkebao=1 ai_lead_visible={$count}\n";