爱优五金配置文件说明
生成时间:2026年5月15日
项目路径:/www/wwwroot/lingshou/
一、核心配置文件
1.1 Application/Common/Conf/config.php(主配置)
路径: /www/wwwroot/lingshou/Application/Common/Conf/config.php
return array(
// ES配置
'ES_CONFIG' => array(
'host' => '127.0.0.1',
'port' => 9200,
'use_https' => false,
'username' => 'elastic',
'password' => 'Wofengle00',
'ca_fingerprint' => '447CAFF9EE37003CB...',
'index_prefix' => 'goods_',
),
// URL配置
'URL_CASE_INSENSITIVE' => false,
'URL_HTML_SUFFIX' => '.html',
'HTT_UL' => 'http://ls.hnjiuheng.cn',
'URL_ROUTER_ON' => true,
'URL_ROUTE_RULES' => array(...),
// 允许的模块
'MODULE_ALLOW_LIST' => array(
'Terminalapi','Retail','Admin','Vip','Sellapi','Pay',
'Xcxapi','WxApi','Super','Agent','Wxkabao','Main','Retails',
'CashierApi','SmallProgramApi','NotifyApi','Credit',
'Distribution','Shelves','Command','Supplier','AgentApi','Merchant'
),
// 数据库配置(内网)
'DB_TYPE' => 'mysql',
'DB_HOST' => '172.30.0.6',
'DB_PORT' => '3306',
'DB_NAME' => 'ls_hnjiuheng_cn',
'DB_USER' => 'OnlineProjectRetailAccount',
'DB_PWD' => 'Wofengle@eu456987',
'DB_PREFIX' => 'ls_',
// Redis配置
'IS_SET_REDIS' => true,
'REDIS_LOCAL' => '127.0.0.1',
'REDIS_PORT' => '6379',
'REDIS_PASS' => '',
'REDIS_NUMBER' => 0,
// Session配置
'SESSION_OPTIONS' => array(
'expire' => 7*86400, // 7天
),
// 操作日志配置
'OPERATE_LOG_ENABLED' => true,
'OPERATE_LOG_DRIVER' => 'Fastcgi',
'LOG_DB' => array(
'DB_HOST' => '172.30.0.6',
'DB_NAME' => 'ls_store_log',
...
),
);
二、入口文件
| 文件 | 说明 |
|---|---|
index.php |
Web 入口,APP_DEBUG=true 开启调试 |
cli.php |
CLI 入口,APP_DEBUG=false 生产模式 |
install.php |
安装引导 |
关键配置:
// index.php
define('APP_DEBUG', true); // 开发环境
define('APP_PATH', './Application/');
// cli.php
define('APP_DEBUG', false); // 生产环境
define('APP_MODE', 'cli');
三、各模块独立配置
| 模块 | 路径 | 状态 |
|---|---|---|
| Retail | Application/Retail/Conf/config.php |
Zend加密 |
| Admin | Application/Admin/Conf/config.php |
Zend加密 |
| Vip | Application/Vip/Conf/config.php |
Zend加密 |
| Pay | Application/Pay/Conf/config.php |
Zend加密 |
| Sellapi | Application/Sellapi/Conf/config.php |
Zend加密 |
| Terminalapi | Application/Terminalapi/Conf/config.php |
可读 |
| Xcxapi | Application/Xcxapi/Conf/config.php |
Zend加密 |
| WxApi | Application/WxApi/Conf/config.php |
可读 |
| Wxkabao | Application/Wxkabao/Conf/config.php |
Zend加密 |
| AgentApi | Application/AgentApi/Conf/config.php |
Zend加密 |
| Addons | Application/Addons/Conf/config.php |
Zend加密 |
| Retails | Application/Retails/Conf/config.php |
Zend加密 |
| Android | Application/Android/Conf/config.php |
可读 |
四、公共行为配置
4.1 tags.php
路径: Application/Common/Conf/tags.php
return array(
'app_begin' => array(
'Behavior\CronRunBehavior', // 定时任务行为
),
'get_commission' => array('Distribution\Behavior\commissionBehavior'),
'refund_commission' => array('Distribution\Behavior\refundBehavior'),
'user_distributor' => array('Distribution\Behavior\distributorBehavior'),
'calculate_commission' => array('Distribution\Behavior\calculateBehavior'),
'open_distribution' => array('Distribution\Behavior\isOpenBehavior'),
'store_settled_distribution' => array('Distribution\Behavior\storeSettledBehavior'),
);
4.2 crons.php
路径: Application/Common/Conf/crons.php
状态: Zend 加密
4.3 debug.php
路径: Application/Common/Conf/debug.php
return array(
'LOG_RECORD' => false,
'LOG_LEVEL' => 'EMERG,ALERT,CRIT,ERR,WARN',
'DB_FIELDS_CACHE' => false,
'DB_DEBUG' => false,
'TMPL_CACHE_ON' => false,
'SHOW_ERROR_MSG' => false,
'URL_CASE_INSENSITIVE' => false,
);
五、业务专项配置
5.1 打印配置
路径: Application/Retail/Conf/brother_cloud_print_config.php
// 兄弟云打印配置
5.2 合同配置
路径: Application/Retail/Conf/contract_config.php
// 合同模板相关配置
六、第三方依赖
6.1 composer.json
{
"require": {
"guzzlehttp/guzzle": "^7.9",
"phpoffice/phpexcel": "^1.8"
}
}
6.2 package.json
{
"dependencies": {
"@microsoft/fetch-event-source": "^2.0.1",
"easy-print": "^1.0.16",
"element-ui": "^2.15.14",
"qrcode": "^1.5.3",
"qrcodejs2": "^0.0.2",
"uqrcodejs": "^4.0.7"
}
}
七、其他配置文件
| 文件 | 说明 |
|---|---|
.user.ini |
PHP-FPM 配置 |
.htaccess |
Apache 重写规则 |
SignatureHelper.php |
签名辅助类 |
sync_goods_to_es.php |
ES 同步脚本 |
test_search_performance.php |
搜索性能测试 |
Worker/start.php |
Workerman 进程 |
sse-server/AllocationSseServer.php |
SSE 服务 |
sse-server/config_loader.php |
SSE 配置加载器 |
八、数据库配置
| 环境 | Host | Port | 用户 | 库 |
|---|---|---|---|---|
| 内网 | 172.30.0.6 | 3306 | OnlineProjectRetailAccount | ls_hnjiuheng_cn |
| 日志库 | 172.30.0.6 | 3306 | OnlineProjectRetailAccount | ls_store_log |
九、安全配置
// CORS 配置(全开)
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
header('Access-Control-Allow-Credentials: true');
// ⚠️ 注意:生产环境应限制来源
十、配置优先级
命令行 > 模块配置 > 公共配置 > 默认配置
ThinkPHP 加载顺序:
1. ThinkPHP/Conf/convention.php(框架默认)
2. Application/Common/Conf/config.php(公共配置)
3. Application/模块/Conf/config.php(模块配置)
4. Application/Common/Conf/debug.php(调试配置)