fixed
This commit is contained in:
307
front/config/app.php
Normal file
307
front/config/app.php
Normal file
@@ -0,0 +1,307 @@
|
||||
<?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;
|
||||
use think\facade\Request;
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
//定位到项目根目录 E:\wh\projects\boom_im
|
||||
$root_path = str_replace('config','',__DIR__);
|
||||
|
||||
|
||||
list($debug,$trace,$sys_env) = [false,false,'DEV'];
|
||||
|
||||
if (!function_exists('is_main_domain')) {
|
||||
function is_main_domain($domain, $main_domain)
|
||||
{
|
||||
$exp_arr = explode('.', $domain);
|
||||
$str = $exp_arr[count($exp_arr) - 2] . '.' . $exp_arr[count($exp_arr) - 1];
|
||||
return in_array($str, $main_domain);//$str == $main_domain;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('auto_choose_app_conf')) {
|
||||
function auto_choose_app_conf(&$debug,&$trace,&$sys_env){
|
||||
$domain = Request::host(); //获取当前域名
|
||||
if(in_array($domain, ['aaa.excn.top'])){
|
||||
//正式 - 全域名
|
||||
$debug = false;
|
||||
$trace = false;
|
||||
$sys_env = 'PROD';
|
||||
}
|
||||
//测试
|
||||
else if(in_array($domain, ['ybx_prediagnosis.excn.top'])) {
|
||||
$debug = true;
|
||||
$trace = false;
|
||||
$sys_env = 'DEV';
|
||||
}
|
||||
else {
|
||||
//本地
|
||||
$debug = true;
|
||||
$trace = false;
|
||||
$sys_env = 'LOCAL';
|
||||
}
|
||||
}
|
||||
}
|
||||
auto_choose_app_conf($debug,$trace,$sys_env);
|
||||
|
||||
return [
|
||||
// 应用名称
|
||||
'app_name' => '',
|
||||
// 应用地址
|
||||
'app_host' => '',
|
||||
// 应用调试模式
|
||||
'app_debug' => $debug,
|
||||
// 应用Trace
|
||||
'app_trace' => $trace,
|
||||
// 是否支持多模块
|
||||
'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' => ['common'],
|
||||
// 默认控制器名
|
||||
'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' => false,
|
||||
// 使用注解路由
|
||||
'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' => '\\app\\common\\exception\\SystemException',
|
||||
|
||||
'pay_config'=>[
|
||||
'wechat' => [
|
||||
//小白菜商城
|
||||
],
|
||||
|
||||
],
|
||||
//数字人-报告生成接口(预问诊)(h5,固定问答,自由问答这几个在前端翔宇处配置key)
|
||||
'ai_num_report_config'=>[
|
||||
'base_url'=>'https://ue-ai.excn.top/api/v1/chat/completions',
|
||||
//'APIKey'=>'fastgpt-jrmdlpu4ijKDl8dvh0zkHmk7m2smjXpM4stas9UnNQJOyjkNmGKM',
|
||||
'APIKey'=>'fastgpt-wgZVEbXVl2egotIcTdDOmhhrbfyrtmWMyjz8Fqa1L581OegT9gMpvb',
|
||||
],
|
||||
//听译-报告生成接口(问诊)
|
||||
'ai_listen_report_config'=>[
|
||||
'base_url'=>'https://ue-ai.excn.top/api/v1/chat/completions',
|
||||
'APIKey'=>'fastgpt-aA4mHjZZ3IVGX8mnwUHW8Ip9qdXfp8cWok26l0fRKQHa01hfsZCPF9',
|
||||
],
|
||||
//听译-健康小洞察
|
||||
'ai_health_insight_config'=>[
|
||||
'base_url'=>'https://serverfastgpt.excn.top/api/v1/chat/completions',
|
||||
'APIKey'=>'fastgpt-slpyh4HgrcmxeKFKHK58OXwOUAqPvz5aa6kfyAhmGA8tK0cQef6WUhNDZ8nPDaZ',
|
||||
],
|
||||
//医生提示,问诊提示
|
||||
'ai_doctor_tips_config'=>[
|
||||
'base_url'=> 'https://ue-ai.excn.top/api/v1/chat/completions',
|
||||
'APIKey'=>'fastgpt-b5JYnBaeESH2ExiwEg95PE3qP4SZNxUflCqZTLINslzefLQ9W2JJmXwfMyS',
|
||||
],
|
||||
//听译-讯飞录音接口
|
||||
'xunfei_record_config'=>[
|
||||
//优一
|
||||
'appid'=>'de02dasd',
|
||||
'APIKey'=>'31ce3f96c062958df3c426da4903540c',
|
||||
'secretKey'=>'MjcyOGE5ODg3ODM2ZWU5MTNiODc0M2Zl',
|
||||
|
||||
//测试
|
||||
//'appid'=>'d482af59',
|
||||
//'APIKey'=>'0d20dab630904ad8676d9075375a1914',
|
||||
//'secretKey'=>'Yjg0YTAyNmE5OGUwNDE3YjU4NWE4NmZh',
|
||||
],
|
||||
//azure文本转语音服务
|
||||
'voice_to_text_service'=>[
|
||||
'base_url'=> 'https://eastasia.tts.speech.microsoft.com/cognitiveservices/v1',
|
||||
'APIKey'=>'090287baa7b14fcfb060a70bd1863f2f',
|
||||
],
|
||||
//量表处理ai
|
||||
'scale_processing_ai_config'=>[
|
||||
'base_url'=>'https://ue-ai.excn.vip/api/v1/chat/completions',
|
||||
'APIKey'=>'fastgpt-fBwUxCwO4AE6aBEa6kmPl6BfCVr8vqKOe8F80nZG6zRgjQ9kNnD9',
|
||||
],
|
||||
//基本信息读取接口(传图片地址)【一张图片一个chatid】
|
||||
'basic_information_read_config'=>[
|
||||
'base_url'=>'https://ue-ai.excn.vip/api/v1/chat/completions',
|
||||
'APIKey'=>'fastgpt-xQfBX6pAIFsEBlssRsPOo2kHJ80STZxkTahbThzVVY8fU0n5fomUd7YuLr',
|
||||
],
|
||||
//药品、影像、病历上传AI分析
|
||||
'medicine_image_report_config'=>[
|
||||
'base_url'=>'https://ue-ai.excn.vip/api/v1/chat/completions',
|
||||
'APIKey'=>'fastgpt-cTEwcjNHtYLNa0ockBMGZmJJMS2XIvHQGjfg8AlPlnyNzg58555gKDtPz',
|
||||
'notify_url'=>'https://ybx_prediagnosis.excn.top/api/Drugsimagesmedicaltasknotify/notify'
|
||||
],
|
||||
//听译优医AI助手
|
||||
'ai_medical_assistant_config'=>[
|
||||
'base_url'=>'https://ue-ai.excn.vip/api/v1/chat/completions',
|
||||
'APIKey'=>'fastgpt-qglbpakk93NM7tLmhBxAIMk0AcyItx3RaLzifNgNAXRcc1sfd42Z',
|
||||
],
|
||||
//阿里云oss配置
|
||||
'aliyun_oss_config' => [
|
||||
//项目应用名称
|
||||
'bucket'=>'wanlliuyinli-adm',//每创建一个bucket必须标明前缀,代表这个bucket属于哪个项目
|
||||
'UserPrincipalName'=>'wanghua@1113242774600735.onaliyun.com',
|
||||
'Password'=>'(BgvEvL#7FQ%ZXRVc0kYCrOa2kd9ace!',
|
||||
'AccessKeyId'=>'LTAI5tPqn1n7jugviVoGqFfa',
|
||||
'AccessKeySecret'=>'BRoB5TdcUAFEuIR11BbN3R47Cm4Yep',
|
||||
|
||||
//https://help.aliyun.com/zh/oss/user-guide/regions-and-endpoints?spm=a2c4g.11186623.0.0.41ae2effA6oZar
|
||||
'region_id'=>'cn-chengdu',//这里配置不能包含oss-前缀,否则提示:Invalid signing region in Authorization header
|
||||
//西南1(成都)
|
||||
//oss-cn-chengdu
|
||||
//oss-cn-chengdu.aliyuncs.com
|
||||
//oss-cn-chengdu-internal.aliyuncs.com
|
||||
'endpoint'=>'oss-cn-chengdu.aliyuncs.com',//成都节点
|
||||
'sts_endpoint'=>'sts.cn-chengdu.aliyuncs.com',//sts服务节点
|
||||
|
||||
//邮件配置
|
||||
'accountName'=>'libin@mail.excn.vip',//发信服务地址
|
||||
'fromAlias'=>'优一科技',//发信人昵称
|
||||
|
||||
],
|
||||
//短信配置
|
||||
'sms_config'=>[
|
||||
//短信配置 start
|
||||
//主号
|
||||
//'AccessKeyId'=>'LTAI5tSEhubcsKbZsNM1GGZQ',
|
||||
//'AccessKeySecret'=>'JgjBrCDYXMNsiLmoaE2bjMZFw7F9fu',
|
||||
//副号
|
||||
'AccessKeyId'=>'LTAI5tPqn1n7jugviVoGqFfa',
|
||||
'AccessKeySecret'=>'BRoB5TdcUAFEuIR11BbN3R47Cm4Yep',
|
||||
|
||||
//优一科技 验证码配置
|
||||
'sms_sign_name'=>'优一科技',//关联签名
|
||||
'sms_template_code'=>'SMS_471455330',//模板CODE
|
||||
'sms_template_name'=>'智语医助',//模板名称
|
||||
//短信配置 end
|
||||
],
|
||||
//业务基础架构配置
|
||||
'service_framework_config'=>[
|
||||
//内网访问架构中放行的端口
|
||||
'inner_allow_ports'=>[8080],
|
||||
//错误重定向URL
|
||||
'auth_err_redirect_url'=>'/index/err/checkfailed',
|
||||
'sign_token'=>'ASbn56&1^%_qsdcvb',
|
||||
//业务架构调试模式 false 关闭, true开启
|
||||
'debug'=>false,
|
||||
],
|
||||
//当前系统环境类型
|
||||
'sys_env'=>$sys_env,
|
||||
//系统日志驱动
|
||||
'sys_log_type'=>'file',//file mysql email
|
||||
];
|
||||
25
front/config/cache.php
Normal file
25
front/config/cache.php
Normal 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,
|
||||
];
|
||||
20
front/config/console.php
Normal file
20
front/config/console.php
Normal 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,
|
||||
];
|
||||
30
front/config/cookie.php
Normal file
30
front/config/cookie.php
Normal 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>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Cookie设置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// cookie 名称前缀
|
||||
'prefix' => '',
|
||||
// cookie 保存时间
|
||||
'expire' => 0,
|
||||
// cookie 保存路径
|
||||
'path' => '/',
|
||||
// cookie 有效域名
|
||||
'domain' => '',
|
||||
// cookie 启用安全传输
|
||||
'secure' => false,
|
||||
// httponly设置
|
||||
'httponly' => '',
|
||||
// 是否使用 setcookie
|
||||
'setcookie' => true,
|
||||
];
|
||||
118
front/config/database.php
Normal file
118
front/config/database.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?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;
|
||||
use think\facade\Request;
|
||||
|
||||
list($hostname,$database,$username,$password,$hostport) = ['','','','',''];
|
||||
|
||||
if (!function_exists('is_main_domain')) {
|
||||
function is_main_domain($domain, $main_domain)
|
||||
{
|
||||
$exp_arr = explode('.', $domain);
|
||||
$str = $exp_arr[count($exp_arr) - 2] . '.' . $exp_arr[count($exp_arr) - 1];
|
||||
return in_array($str, $main_domain);//$str == $main_domain;
|
||||
}
|
||||
}
|
||||
if (!function_exists('auto_choose_db_conf')) {
|
||||
function auto_choose_db_conf(&$hostname,&$database,&$username,&$password,&$hostport){
|
||||
$domain = Request::host(); //获取当前域名
|
||||
//正式
|
||||
if(in_array($domain, [
|
||||
'sdsdsd.ss.cn'
|
||||
])){
|
||||
$hostname = 'mysql57.excn.top';
|
||||
$database = 'digital_doctor';
|
||||
$username = 'sss';
|
||||
$password = 'sss';
|
||||
$hostport = '3307';
|
||||
}
|
||||
|
||||
//测试 socket请求这里$domain=null,【上线正式环境之后把null移动到正式环境配置】
|
||||
else if(in_array($domain, [null,'ybx_prediagnosis.excn.top'])) {
|
||||
$hostname = '8.130.29.83';
|
||||
$database = 'digital_doctor';
|
||||
$username = 'wanghua';
|
||||
$password = '1m2s3456';
|
||||
$hostport = '3308';
|
||||
|
||||
//$hostname = 'mysql57.excn.top';
|
||||
//$database = 'digital_doctor';
|
||||
//$username = 'root';
|
||||
//$password = '8m9s6843';
|
||||
//$hostport = '3307';
|
||||
}
|
||||
|
||||
//本地
|
||||
else{
|
||||
$hostname = '127.0.0.1';
|
||||
$database = 'digital_doctor';
|
||||
$username = 'root';
|
||||
$password = 'root';//root or 123456
|
||||
$hostport = '3306';
|
||||
}
|
||||
}
|
||||
}
|
||||
auto_choose_db_conf($hostname,$database,$username,$password,$hostport);
|
||||
return [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
// 服务器地址
|
||||
'hostname' => $hostname,
|
||||
// 数据库名
|
||||
'database' => $database,
|
||||
// 用户名
|
||||
'username' => $username,//正式:root,测试:zc_game_admin,本地root
|
||||
// 密码.
|
||||
'password' => $password,//正式:hbDB8SRa3Ix3poVi,测试:KZK4cGd4XYsbNG5w,本地root
|
||||
// 端口
|
||||
'hostport' => $hostport,
|
||||
// 连接dsn
|
||||
'dsn' => '',
|
||||
// 数据库连接参数
|
||||
'params' => [],
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8',
|
||||
// 数据库表前缀
|
||||
'prefix' => '',
|
||||
// 默认时区
|
||||
'default_timezone' => 'PRC',
|
||||
// 数据库调试模式
|
||||
'debug' => false,
|
||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||
'deploy' => 0,
|
||||
// 数据库读写是否分离 主从式有效
|
||||
'rw_separate' => false,
|
||||
// 读写分离后 主服务器数量
|
||||
'master_num' => 1,
|
||||
// 指定从服务器序号
|
||||
'slave_no' => '',
|
||||
// 自动读取主库数据
|
||||
'read_master' => false,
|
||||
// 是否严格检查字段是否存在
|
||||
'fields_strict' => true,
|
||||
// 数据集返回类型
|
||||
'resultset_type' => 'array',
|
||||
// 自动写入时间戳字段
|
||||
'auto_timestamp' => false,
|
||||
// 时间字段取出后的默认时间格式
|
||||
'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' => [],
|
||||
];
|
||||
52
front/config/gateway_worker.php
Normal file
52
front/config/gateway_worker.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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 [
|
||||
/**
|
||||
* https://blog.csdn.net/qq_15941409/article/details/135760559?spm=1001.2014.3001.5502
|
||||
* 【长连接使用此配置,启动命令: php think worker:gateway 】
|
||||
*/
|
||||
// 扩展自身需要的配置
|
||||
'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
|
||||
'host' => '0.0.0.0', // 监听地址
|
||||
'port' => 2000, // 监听端口
|
||||
'socket' => '', // 完整监听地址
|
||||
'context' => [], // socket 上下文选项
|
||||
'register_deploy' => true, // 是否需要部署register
|
||||
'businessWorker_deploy' => true, // 是否需要部署businessWorker
|
||||
'gateway_deploy' => true, // 是否需要部署gateway
|
||||
|
||||
// Register配置
|
||||
'registerAddress' => '127.0.0.1:1256',
|
||||
|
||||
// Gateway配置
|
||||
'name' => 'thinkphp',
|
||||
'count' => 1,
|
||||
'lanIp' => '127.0.0.1',
|
||||
'startPort' => 1370,
|
||||
'daemonize' => false,
|
||||
'pingInterval' => 30,
|
||||
'pingNotResponseLimit' => 0,
|
||||
'pingData' => '{"action":"ping"}',
|
||||
|
||||
// BusinsessWorker配置
|
||||
'businessWorker' => [
|
||||
'name' => 'BusinessWorker',
|
||||
'count' => 1,
|
||||
// 'eventHandler' => '\think\worker\Events',
|
||||
|
||||
'eventHandler' => 'app\index\logic\events\Events',
|
||||
],
|
||||
'sendToWorkerBufferSize' => 262144, // 设置为 128KB
|
||||
|
||||
];
|
||||
30
front/config/log.php
Normal file
30
front/config/log.php
Normal 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,
|
||||
];
|
||||
18
front/config/middleware.php
Normal file
18
front/config/middleware.php
Normal 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>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 中间件配置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 默认中间件命名空间
|
||||
'default_namespace' => 'app\\http\\middleware\\',
|
||||
];
|
||||
26
front/config/session.php
Normal file
26
front/config/session.php
Normal 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,
|
||||
];
|
||||
35
front/config/template.php
Normal file
35
front/config/template.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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' => 'Think',
|
||||
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
|
||||
'auto_rule' => 1,
|
||||
// 模板路径
|
||||
'view_path' => '',
|
||||
// 模板后缀
|
||||
'view_suffix' => 'html',
|
||||
// 模板文件名分隔符
|
||||
'view_depr' => DIRECTORY_SEPARATOR,
|
||||
// 模板引擎普通标签开始标记
|
||||
'tpl_begin' => '{',
|
||||
// 模板引擎普通标签结束标记
|
||||
'tpl_end' => '}',
|
||||
// 标签库标签开始标记
|
||||
'taglib_begin' => '{',
|
||||
// 标签库标签结束标记
|
||||
'taglib_end' => '}',
|
||||
];
|
||||
18
front/config/trace.php
Normal file
18
front/config/trace.php
Normal 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',
|
||||
];
|
||||
34
front/config/worker.php
Normal file
34
front/config/worker.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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 指令有效
|
||||
// +----------------------------------------------------------------------
|
||||
$app_path = explode('config',__FILE__)[0];
|
||||
//dump($app_path);die;
|
||||
return [
|
||||
/** 【php think worker 命令默认启动的此文件 】 */
|
||||
// 扩展自身需要的配置
|
||||
'host' => '0.0.0.0', // 监听地址
|
||||
'port' => 2006, // 监听端口
|
||||
'root' => Env::get('root_path') . 'public', // WEB 根目录 默认会定位public目录
|
||||
'app_path' => $app_path.'application', // 应用目录 守护进程模式必须设置(绝对路径)
|
||||
'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',
|
||||
];
|
||||
85
front/config/worker_server.php
Normal file
85
front/config/worker_server.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?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 [
|
||||
/**
|
||||
* 2024-1-21日测试通过,可以发信息
|
||||
* php think worker:server
|
||||
* 【php think worker:server start命令对应的是此文件】
|
||||
*/
|
||||
// 扩展自身需要的配置
|
||||
'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
|
||||
'host' => '0.0.0.0', // 监听地址
|
||||
'port' => 2001, // 监听端口
|
||||
'socket' => '', // 完整监听地址
|
||||
'context' => [], // socket 上下文选项
|
||||
'worker_class' => '', // 自定义Workerman服务类名 支持数组定义多个服务
|
||||
|
||||
// 支持workerman的所有配置参数
|
||||
'name' => 'thinkphp',
|
||||
'count' => 4,
|
||||
'daemonize' => false,
|
||||
'pidFile' => Env::get('runtime_path') . 'worker.pid',
|
||||
|
||||
// 支持事件回调
|
||||
// onWorkerStart
|
||||
'onWorkerStart' => function ($worker) {
|
||||
|
||||
\wanghua\general_utility_tools_php\tool\Tools::log_to_write_txt([
|
||||
'onWorkerStart'=>$worker
|
||||
]);
|
||||
},
|
||||
// onWorkerReload
|
||||
'onWorkerReload' => function ($worker) {
|
||||
|
||||
\wanghua\general_utility_tools_php\tool\Tools::log_to_write_txt([
|
||||
'onWorkerReload'=>$worker
|
||||
]);
|
||||
},
|
||||
// onConnect
|
||||
'onConnect' => function ($connection) {
|
||||
|
||||
\wanghua\general_utility_tools_php\tool\Tools::log_to_write_txt([
|
||||
'onConnect'=>'onConnect'
|
||||
]);
|
||||
$connection->send(json_encode(['msg_type'=>'onConnect']));
|
||||
//$connection->send(json_encode(['test'=>'test','conn'=>$connection],JSON_UNESCAPED_UNICODE));
|
||||
},
|
||||
// onMessage
|
||||
'onMessage' => function ($connection, $data) {
|
||||
\wanghua\general_utility_tools_php\tool\Tools::log_to_write_txt([
|
||||
'onMessage'=>$data
|
||||
]);
|
||||
$connection->send(json_encode(['msg_type'=>'onMessage']));
|
||||
//$connection->send($connection.' === receive ,,,success');
|
||||
},
|
||||
// onClose
|
||||
'onClose' => function ($connection) {
|
||||
\wanghua\general_utility_tools_php\tool\Tools::log_to_write_txt([
|
||||
'onClose'=>'onClose'
|
||||
]);
|
||||
$connection->send(json_encode(['msg_type'=>'onClose']));
|
||||
|
||||
},
|
||||
// onError
|
||||
'onError' => function ($connection, $code, $msg) {
|
||||
\wanghua\general_utility_tools_php\tool\Tools::log_to_write_txt([
|
||||
'onError'=>[$code=>$msg]
|
||||
]);
|
||||
$connection->send(json_encode(['msg_type'=>'onError']));
|
||||
//echo "error [ $code ] $msg\n";
|
||||
},
|
||||
|
||||
];
|
||||
Reference in New Issue
Block a user