first commit
This commit is contained in:
33
config/__autocomplete.php
Normal file
33
config/__autocomplete.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This class only exists here for IDE (PHPStorm/Netbeans/...) autocompletion.
|
||||
* This file is never included anywhere.
|
||||
* Adjust this file to match classes configured in your application config, to enable IDE autocompletion for custom components.
|
||||
* Example: A property phpdoc can be added in `__Application` class as `@property \vendor\package\Rollbar|__Rollbar $rollbar` and adding a class in this file
|
||||
* ```php
|
||||
* // @property of \vendor\package\Rollbar goes here
|
||||
* class __Rollbar {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Yii {
|
||||
/**
|
||||
* @var \yii\web\Application|\yii\console\Application|__Application
|
||||
*/
|
||||
public static $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* @property yii\rbac\DbManager $authManager
|
||||
* @property \yii\web\User|__WebUser $user
|
||||
*
|
||||
*/
|
||||
class __Application {
|
||||
}
|
||||
|
||||
/**
|
||||
* @property app\models\User $identity
|
||||
*/
|
||||
class __WebUser {
|
||||
}
|
||||
72
config/console.php
Normal file
72
config/console.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
$params = require __DIR__ . '/params.php';
|
||||
$db = require __DIR__ . '/db.php';
|
||||
|
||||
$config = [
|
||||
'id' => 'basic-console',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'bootstrap' => ['log', 'queue'],
|
||||
'controllerNamespace' => 'app\commands',
|
||||
'timeZone' => 'Asia/Shanghai',
|
||||
'aliases' => [
|
||||
'@bower' => '@vendor/bower-asset',
|
||||
'@npm' => '@vendor/npm-asset',
|
||||
'@tests' => '@app/tests',
|
||||
],
|
||||
'components' => [
|
||||
'queue' => [
|
||||
'class' => \yii\queue\redis\Queue::class,
|
||||
'redis' => 'redis', // Redis 连接组件或其配置
|
||||
'channel' => 'queue', // 队列通道键
|
||||
'as log' => \yii\queue\LogBehavior::class, // 日志行为
|
||||
],
|
||||
'oceanengine' => [
|
||||
'class' => 'app\components\Oceanengine',
|
||||
],
|
||||
'redis' => [
|
||||
'class' => 'yii\redis\Connection',
|
||||
'hostname' => 'localhost',
|
||||
'port' => 6379,
|
||||
'database' => 0,
|
||||
],
|
||||
'cache' => [
|
||||
'class' => 'yii\caching\FileCache',
|
||||
],
|
||||
'log' => [
|
||||
'targets' => [
|
||||
[
|
||||
'class' => 'yii\log\FileTarget',
|
||||
'levels' => ['error', 'warning'],
|
||||
],
|
||||
],
|
||||
],
|
||||
'db' => $db,
|
||||
],
|
||||
'params' => $params,
|
||||
/*
|
||||
'controllerMap' => [
|
||||
'fixture' => [ // Fixture generation command line.
|
||||
'class' => 'yii\faker\FixtureController',
|
||||
],
|
||||
],
|
||||
*/
|
||||
];
|
||||
|
||||
if (YII_ENV_DEV) {
|
||||
// configuration adjustments for 'dev' environment
|
||||
// $config['bootstrap'][] = 'gii';
|
||||
// $config['modules']['gii'] = [
|
||||
// 'class' => 'yii\gii\Module',
|
||||
// ];
|
||||
// configuration adjustments for 'dev' environment
|
||||
// requires version `2.1.21` of yii2-debug module
|
||||
$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'],
|
||||
];
|
||||
}
|
||||
|
||||
return $config;
|
||||
15
config/db.php
Normal file
15
config/db.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=localhost;dbname=23cm',
|
||||
'username' => 'root',
|
||||
'password' => '123456',
|
||||
'charset' => 'utf8',
|
||||
|
||||
// mysql_77BFSX
|
||||
// Schema cache options (for production environment)
|
||||
//'enableSchemaCache' => true,
|
||||
//'schemaCacheDuration' => 60,
|
||||
//'schemaCache' => 'cache',
|
||||
];
|
||||
14
config/params.php
Normal file
14
config/params.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
'senderEmail' => 'noreply@example.com',
|
||||
'senderName' => 'Example.com mailer',
|
||||
|
||||
'app_id' => '1852484891502756',
|
||||
'secret' => '06b3ab42e212f4824fa19d958512d025eb477fea',
|
||||
|
||||
'salt' => 'toom1996',
|
||||
|
||||
'cdnAddress' => 'http://static.23cm.cn/'
|
||||
];
|
||||
18
config/schedule.php
Normal file
18
config/schedule.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \omnilight\scheduling\Schedule $schedule
|
||||
*/
|
||||
|
||||
// /Users/toom/Documents/yii2/xiansuo_admin
|
||||
// php /www/wwwroot/sites/clue/index/clue/yii schedule/run --scheduleFile=/Users/toom/Documents/yii2/xiansuo_admin/config/schedule.php 1>> /dev/null 2>&1
|
||||
$path = Yii::getAlias('@runtime') . '/logs/' . date('Ym') . '/' . date('d') . '/';
|
||||
$h = date('H');
|
||||
$hi = date('H-i');
|
||||
\app\common\FileHelper::mkdirs($path);
|
||||
// php /www/wwwroot/sites/clue/index/clue/yii schedule/run --scheduleFile=/www/wwwroot/sites/clue/index/clue/config/schedule.php 1>> /dev/null 2>&1
|
||||
/** 8-22/每2小时执行一次 / 获取【小红书定制】文章信息 */
|
||||
$filePath = $path . 'clue_chain.log';
|
||||
$schedule->command('sync/pull-clue-chain')->cron('*/5 * * * * *')->appendOutputTo($filePath);
|
||||
|
||||
$filePath = $path . 'refresh_token.log';
|
||||
$schedule->command('sync/refresh-token')->cron('0 */12 * * * *')->appendOutputTo($filePath);
|
||||
46
config/test.php
Normal file
46
config/test.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
$params = require __DIR__ . '/params.php';
|
||||
$db = require __DIR__ . '/test_db.php';
|
||||
|
||||
/**
|
||||
* Application configuration shared by all test types
|
||||
*/
|
||||
return [
|
||||
'id' => 'basic-tests',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'aliases' => [
|
||||
'@bower' => '@vendor/bower-asset',
|
||||
'@npm' => '@vendor/npm-asset',
|
||||
],
|
||||
'language' => 'en-US',
|
||||
'components' => [
|
||||
'db' => $db,
|
||||
'mailer' => [
|
||||
'class' => \yii\symfonymailer\Mailer::class,
|
||||
'viewPath' => '@app/mail',
|
||||
// send all mails to a file by default.
|
||||
'useFileTransport' => true,
|
||||
'messageClass' => 'yii\symfonymailer\Message'
|
||||
],
|
||||
'assetManager' => [
|
||||
'basePath' => __DIR__ . '/../web/assets',
|
||||
],
|
||||
'urlManager' => [
|
||||
'showScriptName' => true,
|
||||
],
|
||||
'user' => [
|
||||
'identityClass' => 'app\models\User',
|
||||
],
|
||||
'request' => [
|
||||
'cookieValidationKey' => 'test',
|
||||
'enableCsrfValidation' => false,
|
||||
// but if you absolutely need it set cookie domain to localhost
|
||||
/*
|
||||
'csrfCookie' => [
|
||||
'domain' => 'localhost',
|
||||
],
|
||||
*/
|
||||
],
|
||||
],
|
||||
'params' => $params,
|
||||
];
|
||||
6
config/test_db.php
Normal file
6
config/test_db.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$db = require __DIR__ . '/db.php';
|
||||
// test database! Important not to run tests on production or development databases
|
||||
$db['dsn'] = 'mysql:host=localhost;dbname=yii2basic_test';
|
||||
|
||||
return $db;
|
||||
96
config/web.php
Normal file
96
config/web.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
$params = require __DIR__ . '/params.php';
|
||||
$db = require __DIR__ . '/db.php';
|
||||
|
||||
$config = [
|
||||
'id' => 'basic',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'bootstrap' => ['log'],
|
||||
'aliases' => [
|
||||
'@bower' => '@vendor/yidas/yii2-bower-asset/bower',
|
||||
'@npm' => '@vendor/npm-asset',
|
||||
],
|
||||
'timeZone' => 'Asia/Shanghai',
|
||||
'components' => [
|
||||
'assetManager' => [
|
||||
// 'bundles' => [
|
||||
// 'yii\web\JqueryAsset' => [
|
||||
// 'basePath' => '@webroot',
|
||||
// 'baseUrl' => '@web',
|
||||
// 'js' => [
|
||||
// 'js/jquery.js', // 你的 jQuery
|
||||
// ],
|
||||
// ],
|
||||
// ],
|
||||
],
|
||||
'request' => [
|
||||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
||||
'cookieValidationKey' => '0VfdiVtgFI4CJ4PNusreE5khkMp8fna2',
|
||||
],
|
||||
'cache' => [
|
||||
'class' => 'yii\caching\FileCache',
|
||||
],
|
||||
'oceanengine' => [
|
||||
'class' => 'app\components\Oceanengine',
|
||||
],
|
||||
'user' => [
|
||||
'identityClass' => 'app\models\User',
|
||||
'enableAutoLogin' => true,
|
||||
],
|
||||
'redis' => [
|
||||
'class' => 'yii\redis\Connection',
|
||||
'hostname' => 'localhost',
|
||||
'port' => 6379,
|
||||
'database' => 0,
|
||||
],
|
||||
'errorHandler' => [
|
||||
'errorAction' => 'site/error',
|
||||
],
|
||||
'mailer' => [
|
||||
'class' => \yii\symfonymailer\Mailer::class,
|
||||
'viewPath' => '@app/mail',
|
||||
// send all mails to a file by default.
|
||||
'useFileTransport' => true,
|
||||
],
|
||||
'log' => [
|
||||
'traceLevel' => YII_DEBUG ? 3 : 0,
|
||||
'targets' => [
|
||||
[
|
||||
'class' => 'yii\log\FileTarget',
|
||||
'levels' => ['error', 'warning'],
|
||||
],
|
||||
],
|
||||
],
|
||||
'db' => $db,
|
||||
'urlManager' => [
|
||||
'enablePrettyUrl' => true,
|
||||
'showScriptName' => false,
|
||||
'rules' => [
|
||||
// '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', // 带 ID
|
||||
'<action:\w+>' => 'site/<action>', // site 控制器下的简单 action,例如 login, logout, console
|
||||
'' => 'site/index', // 首页
|
||||
],
|
||||
],
|
||||
],
|
||||
'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'],
|
||||
];
|
||||
}
|
||||
|
||||
return $config;
|
||||
Reference in New Issue
Block a user