cxgj/config/web.php
2023-11-27 09:45:13 +08:00

217 lines
7.8 KiB
PHP

<?php
$params = require __DIR__ . '/params.php';
$db = require __DIR__ . '/db.php';
$config = [
'id' => 'basic',
'language' => 'zh-CN',
'timeZone' => 'Asia/Shanghai',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
'@Cqrcode' => '@app/cxe/cqrcode/src/Cqrcode',
'@Dten' => '@app/cxe/dten/src/Dten',
'@Utoken' => '@app/cxe/utoken/src/Utoken',
'@Wechat' => '@app/cxe/wechat/src/Wechat',
'@Geocoder' => '@app/cxe/geocoder/src/Geocoder',
'@RedisCache' => '@app/cxe/rediscache/src/RedisCache',
'@TxIm' => '@app/cxe/txim/src/TxIm',
'@UniLbs' => '@app/cxe/unilbs/src/UniLbs',
'@Updc' => '@app/cxe/updc/src/Updc',
],
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'U^##vz$xQ$m$A3%4^P33%8*r!^2%!7i#', //@CX INIT PARAM
],
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
'cache' => [
'class' => 'yii\redis\Cache',
'keyPrefix' => 'cxaibc', //@CX INIT PARAM
],
'session' => [
'class' => 'yii\web\CacheSession',
'cache' => 'cache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'admin' => [
'class' => 'yii\web\User',
'identityClass' => 'app\models\Admin',
'enableAutoLogin' => true,
'idParam' => '__admin_id',
'identityCookie' => [
'name' => '_admin_identity',
'httpOnly' => true,
],
],
'shop' => [
'class' => 'yii\web\User',
'identityClass' => 'app\models\Company',
'enableAutoLogin' => true,
'idParam' => '__shop_id',
'identityCookie' => [
'name' => '_shop_identity',
'httpOnly' => true,
],
],
'store' => [
'class' => 'yii\web\User',
'identityClass' => 'app\models\StoreUser',
'enableAutoLogin' => true,
'idParam' => '__store_id',
'identityCookie' => [
'name' => '_store_identity',
'httpOnly' => true,
],
],
// 'errorHandler' => [
// 'errorAction' => 'site/error',
// ],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['PaymentUpdc'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/payment/updc/' . date('Ymd', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['electronic'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/electronic/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['union_pay'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/union_pay/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['earnings'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/earnings/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['union_select'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/union_select/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['ball_sms'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/ball_sms/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['wx_applet_msg'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/wx_applet_msg/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['wxpay'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/wxpay/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['refund'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/refund/' . date('Y-m-d', time()) . '.log',
],
[
'class' => 'yii\log\FileTarget',
'categories' => ['NotifyPayment'],
'levels' => ['error', 'info'],
'logVars' => ['*'],
'logFile' => '@runtime/logs/NotifyPayment/' . date('Y-m-d', time()) . '.log',
],
],
],
'db' => $db,
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>',
'<controller:\\w+>/<action:\\w+>' => '<controller>/<action>',
],
],
],
'modules' => [
'api' => [
'class' => 'app\modules\api\Module',
],
'admin' => [
'class' => 'app\modules\admin\Module',
],
'file' => [
'class' => 'app\modules\file\Module',
],
'shop' => [
'class' => 'app\modules\shop\Module',
],
'store' => [
'class' => 'app\modules\store\Module',
],
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
// uncomment the following to add your IP if you are not connecting from localhost.
//'allowedIPs' => ['127.0.0.1', '::1'],
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
// uncomment the following to add your IP if you are not connecting from localhost.
'allowedIPs' => ['127.0.0.1', '::1', '192.168.*.*', '120.36.253.9'],
];
}
return $config;