存客宝应用接口初始化

This commit is contained in:
Ghost
2026-01-05 10:25:32 +08:00
parent fa37227954
commit 02797ba50a
414 changed files with 85530 additions and 75 deletions

146
config/app.php Normal file
View File

@@ -0,0 +1,146 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 应用设置
// +----------------------------------------------------------------------
use think\facade\Env;
return [
// 应用名称
'app_name' => '',
// 应用地址
'app_host' => '',
// 应用调试模式
'app_debug' => Env::get('app.debug', false),
// 应用Trace
'app_trace' => Env::get('app.trace', false),
// 是否支持多模块
'app_multi_module' => true,
// 入口自动绑定模块
'auto_bind_module' => false,
// 注册的根命名空间
'root_namespace' => [],
// 默认输出类型
'default_return_type' => 'html',
// 默认AJAX 数据返回格式,可选json xml ...
'default_ajax_return' => 'json',
// 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法
'var_jsonp_handler' => 'callback',
// 默认时区
'default_timezone' => 'Asia/Shanghai',
// 是否开启多语言
'lang_switch_on' => false,
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => '',
// 默认语言
'default_lang' => 'zh-cn',
// 应用类库后缀
'class_suffix' => false,
// 控制器类后缀
'controller_suffix' => false,
// +----------------------------------------------------------------------
// | 模块设置
// +----------------------------------------------------------------------
// 默认模块名
'default_module' => 'index',
// 禁止访问模块
'deny_module_list' => [],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
'default_action' => 'index',
// 默认验证器
'default_validate' => '',
// 默认的空模块名
'empty_module' => '',
// 默认的空控制器名
'empty_controller' => 'Error',
// 操作方法前缀
'use_action_prefix' => false,
// 操作方法后缀
'action_suffix' => '',
// 自动搜索控制器
'controller_auto_search' => false,
// +----------------------------------------------------------------------
// | URL设置
// +----------------------------------------------------------------------
// PATHINFO变量名 用于兼容模式
'var_pathinfo' => 's',
// 兼容PATH_INFO获取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// pathinfo分隔符
'pathinfo_depr' => '/',
// HTTPS代理标识
'https_agent_name' => '',
// IP代理获取标识
'http_agent_ip' => 'X-REAL-IP',
// URL伪静态后缀
'url_html_suffix' => 'html',
// URL普通方式参数 用于自动生成
'url_common_param' => false,
// URL参数方式 0 按名称成对解析 1 按顺序解析
'url_param_type' => 0,
// 是否开启路由延迟解析
'url_lazy_route' => false,
// 是否强制使用路由
'url_route_must' => false,
// 合并路由规则
'route_rule_merge' => false,
// 路由是否完全匹配
'route_complete_match' => true,
// 使用注解路由
'route_annotation' => false,
// 域名根如thinkphp.cn
'url_domain_root' => '',
// 是否自动转换URL中的控制器和操作名
'url_convert' => true,
// 默认的访问控制器层
'url_controller_layer' => 'controller',
// 表单请求类型伪装变量
'var_method' => '_method',
// 表单ajax伪装变量
'var_ajax' => '_ajax',
// 表单pjax伪装变量
'var_pjax' => '_pjax',
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
'request_cache' => false,
// 请求缓存有效期
'request_cache_expire' => null,
// 全局请求缓存排除规则
'request_cache_except' => [],
// 是否开启路由缓存
'route_check_cache' => false,
// 路由缓存的Key自定义设置闭包默认为当前URL和请求类型的md5
'route_check_cache_key' => '',
// 路由缓存类型及参数
'route_cache_option' => [],
// 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
// 异常页面的模板文件
'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl',
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',
// 显示错误信息
'show_error_msg' => false,
// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle' => '',
];

25
config/cache.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
return [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => '',
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
];

5
config/config.php Normal file
View File

@@ -0,0 +1,5 @@
<?php
return [
'domain' => 'http://192.168.3.75:8081'
];

20
config/console.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 控制台配置
// +----------------------------------------------------------------------
return [
'name' => 'Think Console',
'version' => '0.1',
'user' => null,
'auto_path' => env('app_path') . 'command' . DIRECTORY_SEPARATOR,
];

32
config/cookie.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | Cookie设置
// +----------------------------------------------------------------------
return [
// cookie 名称前缀
'prefix' => '',
// cookie 保存时间
'expire' => 0,
// cookie 保存路径
'path' => '/',
// cookie 有效域名
'domain' => '',
// cookie 启用安全传输
'secure' => false,
// httponly设置
'httponly' => '',
// 是否使用 setcookie
'setcookie' => true,
// 跨站需要
'SameSite' => 'None',
];

13
config/cookies.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
return [
'xianyu' => [
'cna=bjINIOOLP2QBASQOA6MRoWqz',
'xlly_s=1',
'_samesite_flag_=true',
't=9aa5a7ca9fc23837b5f62366fb0e3c57',
'_tb_token_=e834030feb9b3',
'mtop_partitioned_detect=1',
'tfstk=g0cKNh9DFFQLM2KvYXJgruGcYcYMId0e-DufZuqhFcntlqS3FXVn2Tnnz02WYWc-XD0jKJc-z_USP08UqeJi82PzNnxDoI0E8l7Ra4tgNUg_ZzQ98mhK82PP7NjWnAgF2BFTQWNSV5w_zrP5F76BWla4f6a5Ozs6Wlz7Nyw7FR6_orW7PkiS5FUzfuN7d0NswMOzfMZ5wxUi5afPUl15NfULCd0Qfs4K6yeac2GdN_6zJJEjRlK42WH4eDeKsBI4JAgxSynyg6PQeYG31Xt6N5gqIDatVnB8fxhEw-cpDtrITuoTnvKA9mnUP4USvI7YfX3-6JkGos3THfG3TAKAioMZPbes8nB4SYgmtYnHb_ZnHViTnfjGiSMqXbebGgJKijQhNiqYr9T9WTWzdPRiFilYSSQ0zPEDJ3WPURxaWoY9cTWzdPzTmFVNUTyMb'
],
];

64
config/database.php Normal file
View File

@@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Env;
return [
// 数据库类型
'type' => Env::get('database.type', 'mysql'),
// 服务器地址
'hostname' => Env::get('database.hostname', '127.0.0.1'),
// 数据库名
'database' => Env::get('database.database', 'database'),
// 用户名
'username' => Env::get('database.username', 'root'),
// 密码
'password' => Env::get('database.password', 'root'),
// 端口
'hostport' => Env::get('database.hostport', '3306'),
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => env('database.charset', 'utf8mb4'),
// 数据库表前缀
'prefix' => Env::get('database.prefix', ''),
// 数据库调试模式
'debug' => env('database.debug', true),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 自动读取主库数据
'read_master' => false,
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 是否需要进行SQL性能分析
'sql_explain' => false,
// Builder类
'builder' => '',
// Query类
'query' => '\\think\\db\\Query',
// 是否需要断线重连
'break_reconnect' => true,
// 断线标识字符串
'break_match_str' => [],
];

46
config/gateway_worker.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | Workerman设置 仅对 php think worker:gateway 指令有效
// +----------------------------------------------------------------------
return [
// 扩展自身需要的配置
'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
'host' => '0.0.0.0', // 监听地址
'port' => 2348, // 监听端口
'socket' => '', // 完整监听地址
'context' => [], // socket 上下文选项
'register_deploy' => true, // 是否需要部署register
'businessWorker_deploy' => true, // 是否需要部署businessWorker
'gateway_deploy' => true, // 是否需要部署gateway
// Register配置
'registerAddress' => '127.0.0.1:1236',
// Gateway配置
'name' => 'thinkphp',
'count' => 1,
'lanIp' => '127.0.0.1',
'startPort' => 2000,
'daemonize' => false,
'pingInterval' => 30,
'pingNotResponseLimit' => 0,
'pingData' => '{"type":"ping"}',
// BusinsessWorker配置
'businessWorker' => [
'name' => 'BusinessWorker',
'count' => 1,
'eventHandler' => '\app\common\socket\Events',
],
'qdKey' => 'N2WhAkJ1pgDBM$Bq',
];

30
config/log.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
return [
// 日志记录方式,内置 file socket 支持扩展
'type' => 'File',
// 日志保存目录
'path' => '',
// 日志记录级别
'level' => [],
// 单文件日志写入
'single' => false,
// 独立日志级别
'apart_level' => [],
// 最大日志文件数量
'max_files' => 0,
// 是否关闭日志写入
'close' => false,
];

34
config/middleware.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 中间件配置
// +----------------------------------------------------------------------
return [
// 默认中间件命名空间
'default_namespace' => 'app\\common\\middleware\\',
// 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
'priority' => [
'app\\common\\middleware\\AllowCrossDomain'
],
// 全局中间件
'alias' => [
'cors' => 'app\\common\\middleware\\AllowCrossDomain',
'jwt' => 'app\\http\\middleware\\Jwt'
],
// 应用中间件
'app' => [
'cors'
],
];

33
config/queue.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | 队列设置
// +----------------------------------------------------------------------
return [
'default' => 'redis',
'connections' => [
'sync' => [
'type' => 'sync',
],
'database' => [
'type' => 'database',
'queue' => 'default',
'table' => 'jobs',
],
'redis' => [
'type' => 'redis',
'queue' => 'default',
'host' => '127.0.0.1',
'port' => 6379,
'password' => '',
'select' => 0,
'timeout' => 0,
'persistent' => false,
],
],
'failed' => [
'type' => 'redis',
'table' => 'failed_jobs',
],
'failed_delay' => 30, // 失败重试延迟时间(秒)
];

7
config/robot.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
return [
'keyId' => 'AKLTNzNiMzU2ZWMwMDYwNDNiZWJkMjFjOTFhYzFjY2JlZGU',
'secretKey' => 'TXpjeVlqSTJNRFpoTUdZd05EY3lPRGsxWTJFMk0yRmpaalkyTWpFd05tUQ==',
'model' => 'ep-20240522132057-rp6t4',
];

26
config/session.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 会话设置
// +----------------------------------------------------------------------
return [
'id' => '',
// SESSION_ID的提交变量,解决flash上传跨域
'var_session_id' => '',
// SESSION 前缀
'prefix' => 'think',
// 驱动方式 支持redis memcache memcached
'type' => '',
// 是否自动开启 SESSION
'auto_start' => true,
];

301
config/task_scheduler.php Normal file
View File

@@ -0,0 +1,301 @@
<?php
// +----------------------------------------------------------------------
// | 任务调度器配置文件
// +----------------------------------------------------------------------
// | 定义所有需要定时执行的任务及其执行频率
// +----------------------------------------------------------------------
return [
// 任务配置格式:
// '任务标识' => [
// 'command' => '命令名称', // 必填:执行的 ThinkPHP 命令(见 application/command.php
// 'schedule' => 'cron表达式', // 必填cron 表达式,如 '*/5 * * * *' 表示每5分钟
// 'options' => ['--option=value'], // 可选:命令参数(原来 crontab 里的 --xxx=yyy
// 'enabled' => true, // 可选:是否启用,默认 true
// 'max_concurrent'=> 1, // 可选:单任务最大并发数(目前由调度器统一控制,可预留)
// 'timeout' => 3600, // 可选:超时时间(秒),默认 3600
// 'log_file' => 'custom.log', // 可选:日志文件名,默认使用任务标识
// ]
// ===========================
// 高频任务(每分钟或更频繁)
// ===========================
// 同步微信好友列表(未删除好友),用于保持系统中好友数据实时更新
'wechat_friends_active' => [
'command' => 'wechatFriends:list',
'schedule' => '*/1 * * * *', // 每1分钟
'options' => ['--isDel=0'],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_wechatFriends_active.log',
],
// 拉取“添加好友任务”列表,驱动自动加好友的任务队列
'friend_task' => [
'command' => 'friendTask:list',
'schedule' => '*/1 * * * *', // 每1分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_friendTask.log',
],
// 同步微信好友私聊消息列表,写入消息表,供客服工作台使用
'message_friends' => [
'command' => 'message:friendsList',
'schedule' => '*/1 * * * *', // 每1分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_messageFriends.log',
],
// 同步微信群聊消息列表,写入消息表,供群聊记录与风控分析
'message_chatroom' => [
'command' => 'message:chatroomList',
'schedule' => '*/1 * * * *', // 每1分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_messageChatroom.log',
],
// 客服端消息提醒任务,负责给在线客服推送新消息通知
'kf_notice' => [
'command' => 'kf:notice',
'schedule' => '*/1 * * * *', // 每1分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'kf_notice.log',
],
// ===========================
// 中频任务(每 2-5 分钟)
// ===========================
// 同步微信设备列表(未删除设备),用于设备管理与监控
'device_active' => [
'command' => 'device:list',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => ['--isDel=0'],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_device_active.log',
],
// 同步微信群聊列表(未删除群),用于群管理与后续任务分配
'wechat_chatroom_active' => [
'command' => 'wechatChatroom:list',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => ['--isDel=0'],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_wechatChatroom_active.log',
],
// 同步微信群成员列表(群好友),维持群成员明细数据
'group_friends' => [
'command' => 'groupFriends:list',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_groupFriends.log',
],
// 同步“微信客服列表”,获取绑定到公司的微信号,用于工作台与分配规则
'wechat_list' => [
'command' => 'wechatList:list',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_wechatList.log',
],
// 同步公司账号列表(企业/租户账号),供后台管理与统计
'account_list' => [
'command' => 'account:list',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_account.log',
],
// 内容采集任务,将外部或设备内容同步到系统内容库
'content_collect' => [
'command' => 'content:collect',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_contentCollect.log',
],
// 工作台:自动点赞好友/客户朋友圈,提高账号活跃度
'workbench_auto_like' => [
'command' => 'workbench:autoLike',
'schedule' => '*/6 * * * *', // 每6分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_workbench_autoLike.log',
],
// 工作台:自动建群任务,按规则批量创建微信群
'workbench_group_create' => [
'command' => 'workbench:groupCreate',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'workbench_groupCreate.log',
],
// 工作台:自动导入通讯录到系统,生成加粉/建群等任务
'workbench_import_contact' => [
'command' => 'workbench:import-contact',
'schedule' => '*/5 * * * *', // 每5分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'import_contact.log',
],
// ===========================
// 低频任务(每 2 分钟)
// ===========================
// 清洗并同步微信原始数据到存客宝业务表(数据治理任务)
'sync_wechat_data' => [
'command' => 'sync:wechatData',
'schedule' => '*/2 * * * *', // 每2分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'sync_wechat_data.log',
],
// 工作台:流量分发任务,把流量池中的线索按规则分配给微信号或员工
'workbench_traffic_distribute' => [
'command' => 'workbench:trafficDistribute',
'schedule' => '*/2 * * * *', // 每2分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'traffic_distribute.log',
],
// 工作台:朋友圈同步任务,拉取并落库朋友圈内容
'workbench_moments' => [
'command' => 'workbench:moments',
'schedule' => '*/2 * * * *', // 每2分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'workbench_moments.log',
],
// 预防性切换好友任务,监控频繁/风控风险,自动切换加人对象,保护微信号
'switch_friends' => [
'command' => 'switch:friends',
'schedule' => '*/2 * * * *', // 每2分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'switch_friends.log',
],
// ===========================
// 低频任务(每 30 分钟)
// ===========================
// 拉取设备通话记录(语音/电话),用于质检、统计或标签打分
'call_recording' => [
'command' => 'call-recording:list',
'schedule' => '*/30 * * * *', // 每30分钟
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'call_recording.log',
],
// ===========================
// 每日 / 每几天任务
// ===========================
// 每日 1:00 同步“已删除设备”列表,补齐历史状态
'device_deleted' => [
'command' => 'device:list',
'schedule' => '0 1 * * *', // 每天1点
'options' => ['--isDel=1'],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_device_deleted.log',
],
// 每日 1:10 同步“已停用设备”列表,更新停用状态
'device_stopped' => [
'command' => 'device:list',
'schedule' => '10 1 * * *', // 每天1:10
'options' => ['--isDel=2'],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_device_stopped.log',
],
// 每日 1:30 同步“已删除微信好友”,用于历史恢复与报表
'wechat_friends_deleted' => [
'command' => 'wechatFriends:list',
'schedule' => '30 1 * * *', // 每天1:30
'options' => ['--isDel=1'],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_wechatFriends_deleted.log',
],
// 每日 1:30 同步“已删除微信群聊”,用于统计与留痕
'wechat_chatroom_deleted' => [
'command' => 'wechatChatroom:list',
'schedule' => '30 1 * * *', // 每天1:30
'options' => ['--isDel=1'],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'crontab_wechatChatroom_deleted.log',
],
// 每日 2:00 统一计算所有微信账号健康分(基础分 + 动态分)
'wechat_calculate_score' => [
'command' => 'wechat:calculate-score',
'schedule' => '0 2 * * *', // 每天2点
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'calculate_score.log',
],
// 每 3 天执行的全量任务
// 每 3 天 3:00 全量同步所有在线好友,做一次大规模校准
'sync_all_friends' => [
'command' => 'sync:allFriends',
'schedule' => '0 3 */3 * *', // 每3天的3点
'options' => [],
'enabled' => true,
'max_concurrent' => 1,
'log_file' => 'all_friends.log',
],
// 已禁用的任务(注释掉的任务)
// 'workbench_group_push' => [
// 'command' => 'workbench:groupPush',
// 'schedule' => '*/2 * * * *',
// 'options' => [],
// 'enabled' => false,
// 'log_file' => 'workbench_groupPush.log',
// ],
];

38
config/template.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 模板设置
// +----------------------------------------------------------------------
return [
// 模板引擎类型 支持 php think 支持扩展
'type' => 'php',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
'auto_rule' => 1,
// 模板路径
'view_path' => '',
// 模板后缀
'view_suffix' => 'php',
// 模板文件名分隔符
'view_depr' => DIRECTORY_SEPARATOR,
// 模板引擎普通标签开始标记
'tpl_begin' => '{{',
// 模板引擎普通标签结束标记
'tpl_end' => '}}',
// 标签库标签开始标记
'taglib_begin' => '{{',
// 标签库标签结束标记
'taglib_end' => '}}',
'layout_on' => true,
'layout_name' => 'layout',
];

18
config/trace.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | Trace设置 开启 app_trace 后 有效
// +----------------------------------------------------------------------
return [
// 内置Html Console 支持扩展
'type' => 'Html',
];

View File

@@ -0,0 +1,19 @@
<?php
return [
// 默认使用的供应商适配器标识
'default_adapter' => 'ChuKeBao',
// 各个供应商适配器的配置
'adapters' => [
'ChuKeBao' => [
'driver' => \WeChatDeviceApi\Adapters\ChuKebao\Adapter::class,
// 'api_key' => env('ChuKebao_API_KEY', ''),
// 'api_secret' => env('ChuKebao_API_SECRET', ''),
'base_url' => env('api.wechat_url'),
'username' => env('api.username', ''),
'password' => env('api.password', ''),
],
// ... 更多供应商
],
];

31
config/worker.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Env;
// +----------------------------------------------------------------------
// | Workerman设置 仅对 php think worker 指令有效
// +----------------------------------------------------------------------
return [
// 扩展自身需要的配置
'host' => '0.0.0.0', // 监听地址
'port' => 2346, // 监听端口
'root' => '', // WEB 根目录 默认会定位public目录
'app_path' => '', // 应用目录 守护进程模式必须设置(绝对路径)
'file_monitor' => false, // 是否开启PHP文件更改监控调试模式下自动开启
'file_monitor_interval' => 2, // 文件监控检测时间间隔(秒)
'file_monitor_path' => [], // 文件监控目录 默认监控application和config目录
// 支持workerman的所有配置参数
'name' => 'thinkphp',
'count' => 4,
'daemonize' => false,
'pidFile' => Env::get('runtime_path') . 'worker.pid',
];

59
config/worker_server.php Normal file
View File

@@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Env;
// +----------------------------------------------------------------------
// | Workerman设置 仅对 php think worker:server 指令有效
// +----------------------------------------------------------------------
return [
// 扩展自身需要的配置
'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
'host' => '0.0.0.0', // 监听地址
'port' => 2345, // 监听端口
'socket' => '', // 完整监听地址
'context' => [], // socket 上下文选项
'worker_class' => 'app\common\TaskServer', // 自定义Workerman服务类名 支持数组定义多个服务
// 支持workerman的所有配置参数
'name' => 'thinkphp',
'count' => 4,
'daemonize' => false,
'pidFile' => __DIR__ . '/../runtime/worker.pid',
'logFile' => __DIR__ . '/../runtime/workerman.log',
'stdoutFile' => __DIR__ . '/../runtime/stdout.log',
'daemonize' => true, // 你用 -d 时会自动变 true
// 支持事件回调
// onWorkerStart
'onWorkerStart' => function ($worker) {
//\app\common\socket\MessageHandler::onWorkerStart($worker);
},
// onWorkerReload
'onWorkerReload' => function ($worker) {
//\app\common\socket\MessageHandler::onWorkerReload($worker);
},
// onConnect
'onConnect' => function ($connection) {
//\app\common\socket\MessageHandler::onConnect($connection);
},
// onMessage
'onMessage' => function ($connection, $data) {
//\app\common\socket\MessageHandler::onMessage($connection, $data);
},
// onClose
'onClose' => function ($connection) {
//\app\common\socket\MessageHandler::onClose($connection);
},
// onError
'onError' => function ($connection, $code, $msg) {
//\app\common\socket\MessageHandler::onError($connection);
},
];