Files
cunkebao_v3/Server/script/fix_website_acquisition_scene.php
Manus AI 2753265edb sync(本地→GitHub): 2026-06-03 21:17 全量单向同步
## GitHub 同步说明

| 项 | 内容 |
|:---|:---|
| 仓库 | https://github.com/fnvtk/cunkebao_v3 |
| 分支 | develop |
| 方向 | 本地 → GitHub(单向 push) |
| 是否拉取远程 | 否(未 fetch / pull / merge) |
| 是否改本地源文件 | 否(仅 git add/commit,未编辑业务/文档正文) |
| 远程基准 | origin/develop @ b5b40e8b |
| 本批工作区变更 | 999 files, +47622 / -4007 lines |

## 一并推送的本地已有 commit(此前未 push)

1. 3aa7ecf8 deploy: 官网 ckb.quwanzhi.com 宝塔上线 DNS+SSL+验收文档
2. 16a70045 fix(官网): 桌面导航仅保留一个留资 CTA 并重新上线
3. dbe7b7aa fix(官网): Hero 改为主 CTA 按钮并去掉重复 1200+ 数据条
4. ac82726e chore(部署): 五端上线验收46项并统一留资与缓存版本

## 本 commit 目录统计

| 目录 | 文件数 | 说明 |
|:---|---:|:---|
| 开发文档/ | 639 | 10、项目管理、未完成项跨仓汇总、五端需求/部署/接口 |
| Server/ | 129 | 后端 API、迁移、部署相关 |
| Touchkebao/ | 80 | PC 工作台、获客、算力 |
| 官网/ | 61 | ckb.quwanzhi.com 静态站与 CTA 迭代 |
| Cunkebao/ | 49 | 移动端场景/设置/流量池 |
| SuperAdmin/ | 26 | 超管后台 |
| .cursor/ | 11 | 规则与 Skill |
| 其他 | 14 | docker-compose、.obsidian、.codegraph 等 |

## 重点文件(本地为准)

- 开发文档/1、需求/修改/未完成项与跨仓验收汇总.md
- 开发文档/10、项目管理/账号密码与登录环境一览.md
- 开发文档/10、项目管理/(新建项目管理目录与截图)
- 官网/ 全站 + 宝塔上线文档
- 五端上线验收 46 项(见 ac82726e)

## 刻意未上传

- node_modules/、.DS_Store、.smart-env/
- .开发文档_nested_git_backup/
- **/__pycache__/

## 验收

- 提交页(含本说明): https://github.com/fnvtk/cunkebao_v3/commit/HEAD
- 分支树: https://github.com/fnvtk/cunkebao_v3/tree/develop

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 21:17:41 +08:00

120 lines
3.6 KiB
PHP
Raw Permalink 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
/**
* 官网获客场景修复 · 场景 id=12 + 计划归属卡若私域(2778)
*
* 根因:计划 779 等挂在 companyId=914 且 sceneId=3(抖音)/9(扫码)
* 15880802661 登录主体为 companyId=2778场景获客列表按公司隔离故不可见。
*
* 用法:
* docker compose exec -T server php /var/www/html/script/fix_website_acquisition_scene.php
* docker compose exec -T server php /var/www/html/script/fix_website_acquisition_scene.php apply=1
* docker compose exec -T server php /var/www/html/script/fix_website_acquisition_scene.php phone=15880802661 apply=1
*/
declare(strict_types=1);
require __DIR__ . '/../thinkphp/base.php';
use think\App;
use think\Db;
$app = new App(realpath(__DIR__ . '/../application'));
$app->initialize();
$args = [];
foreach ($argv as $arg) {
if (strpos($arg, '=') !== false) {
[$k, $v] = explode('=', $arg, 2);
$args[trim($k)] = trim($v);
}
}
$phone = $args['phone'] ?? '15880802661';
$apply = !empty($args['apply']);
$mode = $apply ? '【APPLY】' : '【DRY-RUN】';
$user = Db::name('users')
->where('phone', $phone)
->whereOr('account', $phone)
->find();
if (!$user) {
fwrite(STDERR, "未找到手机号 {$phone}\n");
exit(1);
}
$targetCompanyId = (int)$user['companyId'];
$userId = (int)$user['id'];
echo "{$mode} phone={$phone} userId={$userId} targetCompanyId={$targetCompanyId}\n";
$sceneExists = Db::name('plan_scene')->where('id', 12)->where('deleteTime', 0)->find();
if (!$sceneExists) {
echo " · 将插入 ck_plan_scene id=12 网站获客\n";
if ($apply) {
Db::name('plan_scene')->insert([
'id' => 12,
'name' => '网站获客',
'description' => '存客宝官网/落地页 POST /v1/api/scenarios 留资',
'image' => '',
'status' => 1,
'sort' => 72,
'scenarioTags' => '[]',
'createTime' => time(),
'updateTime' => time(),
'deleteTime' => 0,
]);
}
} else {
echo " · ck_plan_scene id=12 已存在: {$sceneExists['name']}\n";
if ($apply && ($sceneExists['name'] ?? '') !== '网站获客') {
Db::name('plan_scene')->where('id', 12)->update([
'name' => '网站获客',
'updateTime' => time(),
]);
echo " · 已更名 scene 12 → 网站获客\n";
}
if ($apply && (int)$sceneExists['status'] !== 1) {
Db::name('plan_scene')->where('id', 12)->update(['status' => 1, 'updateTime' => time()]);
echo " · 已开启 scene 12 status=1\n";
}
}
$planQuery = Db::name('customer_acquisition_task')
->where('deleteTime', 0)
->where(function ($q) {
$q->where('id', 779)
->whereOr('name', 'like', '存客宝官网%')
->whereOr('name', 'like', '%试用咨询留资%');
});
$plans = $planQuery->field('id,name,companyId,sceneId,status,userId')->select();
echo ' · 命中计划 ' . count($plans) . "\n";
foreach ($plans as $p) {
$p = is_array($p) ? $p : $p->toArray();
echo sprintf(
" #%d %s | company %d→%d scene %d→12\n",
(int)$p['id'],
$p['name'],
(int)$p['companyId'],
$targetCompanyId,
(int)$p['sceneId']
);
}
if ($apply && count($plans) > 0) {
$ids = array_column($plans, 'id');
Db::name('customer_acquisition_task')
->whereIn('id', $ids)
->update([
'sceneId' => 12,
'companyId' => $targetCompanyId,
'userId' => $userId,
'updateTime' => time(),
]);
echo " · 已更新 " . count($ids) . " 条计划\n";
}
echo "完成。\n";