样机小程序
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\Request;
|
||||
|
||||
return [
|
||||
'debug' => true,
|
||||
'error_reporting' => E_ALL,
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
'request_class' => Request::class,
|
||||
'public_path' => base_path() . DIRECTORY_SEPARATOR . 'public',
|
||||
'runtime_path' => base_path(false) . DIRECTORY_SEPARATOR . 'runtime',
|
||||
'controller_suffix' => 'Controller',
|
||||
'controller_reuse' => false,
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'files' => [
|
||||
base_path() . '/app/functions.php',
|
||||
base_path() . '/support/Request.php',
|
||||
base_path() . '/support/Response.php',
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
support\bootstrap\Session::class,
|
||||
];
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => 'file',
|
||||
'stores' => [
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => runtime_path('cache')
|
||||
],
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default'
|
||||
],
|
||||
'array' => [
|
||||
'driver' => 'array'
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return new Webman\Container;
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
return [
|
||||
'default' => 'mysql',
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => getenv('DB_HOST'),
|
||||
'port' => getenv('DB_PORT'),
|
||||
'database' => getenv('DB_NAME'),
|
||||
'username' => getenv('DB_USER'),
|
||||
'password' => getenv('DB_PASSWORD'),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
'prefix' => getenv('DB_PREFIX'),
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => [
|
||||
PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
|
||||
],
|
||||
'pool' => [
|
||||
'max_connections' => 5,
|
||||
'min_connections' => 1,
|
||||
'wait_timeout' => 3,
|
||||
'idle_timeout' => 60,
|
||||
'heartbeat_interval' => 50,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => 'mysql',
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => getenv('DB_HOST'),
|
||||
'port' => getenv('DB_PORT'),
|
||||
'database' => getenv('DB_NAME'),
|
||||
'username' => getenv('DB_USER'),
|
||||
'password' => getenv('DB_PASSWORD'),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
'prefix' => getenv('DB_PREFIX'),
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => [
|
||||
PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
|
||||
],
|
||||
'pool' => [
|
||||
'max_connections' => 5,
|
||||
'min_connections' => 1,
|
||||
'wait_timeout' => 3,
|
||||
'idle_timeout' => 60,
|
||||
'heartbeat_interval' => 50,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'' => support\exception\Handler::class,
|
||||
];
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'jwt_secret_key' => getenv('JWT_SECRET_KEY') ?: 'default_secret_key',
|
||||
'jwt_algorithm' => getenv('JWT_ALGORITHM') ?: 'HS256',
|
||||
'jwt_issuer' => getenv('JWT_ISSUER') ?: 'domain.com',
|
||||
'jwt_expiration' => (int)(getenv('JWT_EXPIRATION') ?: 7200),
|
||||
'jwt_refresh_token_expiration' => (int)(getenv('JWT_REFRESH_TOKEN_EXPIRATION') ?: 2592000)
|
||||
];
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/webman.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'' => [
|
||||
\app\middleware\AccessControl::class,
|
||||
\app\middleware\BasicData::class,
|
||||
\app\middleware\AuthCheck::class,
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
*-------------------------------------------------------------------------p*
|
||||
* 配置文件
|
||||
*-------------------------------------------------------------------------h*
|
||||
* @copyright Copyright (c) 2015-2022 Shopwwi Inc. (http://www.shopwwi.com)
|
||||
*-------------------------------------------------------------------------c*
|
||||
* @license http://www.shopwwi.com s h o p w w i . c o m
|
||||
*-------------------------------------------------------------------------e*
|
||||
* @link http://www.shopwwi.com by 象讯科技 phcent.com
|
||||
*-------------------------------------------------------------------------n*
|
||||
* @since shopwwi象讯·PHP商城系统Pro
|
||||
*-------------------------------------------------------------------------t*
|
||||
*/
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
'default' => 'local',
|
||||
'max_size' => 1024 * 1024 * 10, //单个文件大小10M
|
||||
'ext_yes' => [], //允许上传文件类型 为空则为允许所有
|
||||
'ext_no' => [], // 不允许上传文件类型 为空则不限制
|
||||
'storage' => [
|
||||
'public' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\LocalAdapterFactory::class,
|
||||
'root' => public_path(),
|
||||
'url' => '//127.0.0.1:8787' // 静态文件访问域名
|
||||
],
|
||||
'local' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\LocalAdapterFactory::class,
|
||||
'root' => runtime_path(),
|
||||
'url' => '//127.0.0.1:8787' // 静态文件访问域名
|
||||
],
|
||||
'ftp' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\FtpAdapterFactory::class,
|
||||
'host' => 'ftp.example.com',
|
||||
'username' => 'username',
|
||||
'password' => 'password',
|
||||
'url' => '' // 静态文件访问域名
|
||||
// 'port' => 21,
|
||||
// 'root' => '/path/to/root',
|
||||
// 'passive' => true,
|
||||
// 'ssl' => true,
|
||||
// 'timeout' => 30,
|
||||
// 'ignorePassiveAddress' => false,
|
||||
// 'timestampsOnUnixListingsEnabled' => true,
|
||||
],
|
||||
'memory' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\MemoryAdapterFactory::class,
|
||||
],
|
||||
's3' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\S3AdapterFactory::class,
|
||||
'credentials' => [
|
||||
'key' => 'S3_KEY',
|
||||
'secret' => 'S3_SECRET',
|
||||
],
|
||||
'region' => 'S3_REGION',
|
||||
'version' => 'latest',
|
||||
'bucket_endpoint' => false,
|
||||
'use_path_style_endpoint' => false,
|
||||
'endpoint' => 'S3_ENDPOINT',
|
||||
'bucket_name' => 'S3_BUCKET',
|
||||
'url' => '' // 静态文件访问域名
|
||||
],
|
||||
'minio' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\S3AdapterFactory::class,
|
||||
'credentials' => [
|
||||
'key' => 'S3_KEY',
|
||||
'secret' => 'S3_SECRET',
|
||||
],
|
||||
'region' => 'S3_REGION',
|
||||
'version' => 'latest',
|
||||
'bucket_endpoint' => false,
|
||||
'use_path_style_endpoint' => true,
|
||||
'endpoint' => 'S3_ENDPOINT',
|
||||
'bucket_name' => 'S3_BUCKET',
|
||||
'url' => '' // 静态文件访问域名
|
||||
],
|
||||
'oss' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\AliyunOssAdapterFactory::class,
|
||||
'accessId' => getenv('OSS_ACCESSID'),
|
||||
'accessSecret' => getenv('OSS_ACCESSSECRET'),
|
||||
'bucket' => getenv('OSS_BUCKET'),
|
||||
'endpoint' => getenv('OSS_ENDPOINT'),
|
||||
'url' => getenv('OSS_STATIC_URL'), // 静态文件访问域名
|
||||
// 'timeout' => 3600,
|
||||
// 'connectTimeout' => 10,
|
||||
// 'isCName' => false,
|
||||
// 'token' => null,
|
||||
// 'proxy' => null,
|
||||
],
|
||||
'qiniu' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\QiniuAdapterFactory::class,
|
||||
'accessKey' => 'QINIU_ACCESS_KEY',
|
||||
'secretKey' => 'QINIU_SECRET_KEY',
|
||||
'bucket' => 'QINIU_BUCKET',
|
||||
'domain' => 'QINBIU_DOMAIN',
|
||||
'url' => '' // 静态文件访问域名
|
||||
],
|
||||
'cos' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\CosAdapterFactory::class,
|
||||
'region' => 'COS_REGION',
|
||||
'app_id' => 'COS_APPID',
|
||||
'secret_id' => 'COS_SECRET_ID',
|
||||
'secret_key' => 'COS_SECRET_KEY',
|
||||
// 可选,如果 bucket 为私有访问请打开此项
|
||||
// 'signed_url' => false,
|
||||
'bucket' => 'COS_BUCKET',
|
||||
'read_from_cdn' => false,
|
||||
'url' => '' // 静态文件访问域名
|
||||
// 'timeout' => 60,
|
||||
// 'connect_timeout' => 60,
|
||||
// 'cdn' => '',
|
||||
// 'scheme' => 'https',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
|
||||
'build_dir' => BASE_PATH . DIRECTORY_SEPARATOR . 'build',
|
||||
|
||||
'phar_filename' => 'webman.phar',
|
||||
|
||||
'bin_filename' => 'webman.bin',
|
||||
|
||||
'signature_algorithm'=> Phar::SHA256, //set the signature algorithm for a phar and apply it. The signature algorithm must be one of Phar::MD5, Phar::SHA1, Phar::SHA256, Phar::SHA512, or Phar::OPENSSL.
|
||||
|
||||
'private_key_file' => '', // The file path for certificate or OpenSSL private key file.
|
||||
|
||||
'exclude_pattern' => '#^(?!.*(composer.json|/.github/|/.idea/|/.git/|/.setting/|/runtime/|/vendor-bin/|/build/|/vendor/webman/admin/))(.*)$#',
|
||||
|
||||
'exclude_files' => [
|
||||
'.env', 'LICENSE', 'composer.json', 'composer.lock', 'start.php', 'webman.phar', 'webman.bin'
|
||||
],
|
||||
|
||||
'custom_ini' => '
|
||||
memory_limit = 256M
|
||||
',
|
||||
];
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\Log;
|
||||
use support\Request;
|
||||
use app\process\Http;
|
||||
|
||||
global $argv;
|
||||
|
||||
return [
|
||||
'webman' => [
|
||||
'handler' => Http::class,
|
||||
'listen' => 'http://0.0.0.0:'.getenv('PROCESS_LISTEN'),
|
||||
'count' => getenv('PROCESS_COUNT'),
|
||||
'user' => '',
|
||||
'group' => '',
|
||||
'reusePort' => false,
|
||||
'eventLoop' => '',
|
||||
'context' => [],
|
||||
'constructor' => [
|
||||
'requestClass' => Request::class,
|
||||
'logger' => Log::channel('default'),
|
||||
'appPath' => app_path(),
|
||||
'publicPath' => public_path()
|
||||
]
|
||||
],
|
||||
// File update detection and automatic reload
|
||||
'monitor' => [
|
||||
'handler' => app\process\Monitor::class,
|
||||
'reloadable' => false,
|
||||
'constructor' => [
|
||||
// Monitor these directories
|
||||
'monitorDir' => array_merge([
|
||||
app_path(),
|
||||
config_path(),
|
||||
base_path() . '/process',
|
||||
base_path() . '/support',
|
||||
base_path() . '/resource',
|
||||
base_path() . '/.env',
|
||||
], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
|
||||
// Files with these suffixes will be monitored
|
||||
'monitorExtensions' => [
|
||||
'php', 'html', 'htm', 'env'
|
||||
],
|
||||
'options' => [
|
||||
'enable_file_monitor' => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/',
|
||||
'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'password' => getenv('REDIS_PASSWORD'),
|
||||
'host' => getenv('REDIS_HOST'),
|
||||
'port' => getenv('REDIS_PORT'),
|
||||
'database' => getenv('REDIS_DATABASE'),
|
||||
'pool' => [
|
||||
'max_connections' => 5,
|
||||
'min_connections' => 1,
|
||||
'wait_timeout' => 3,
|
||||
'idle_timeout' => 60,
|
||||
'heartbeat_interval' => 50,
|
||||
],
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use Webman\Route;
|
||||
|
||||
|
||||
Route::any('/c', [app\controller\IndexController::class, 'createResource']);
|
||||
|
||||
Route::any('/qrcode/url', [app\common\controller\UserController::class, 'getQrUrl']);
|
||||
Route::any('/user/info', [app\common\controller\UserController::class, 'getUserInfo']);
|
||||
Route::any('/bind/user', [app\common\controller\UserController::class, 'bindUser']);
|
||||
|
||||
//Route::post('/wechat/login', [app\common\controller\UserController::class, 'wechatLogin']);
|
||||
// 登录
|
||||
Route::post('/miniapp/login', [app\common\controller\UserController::class, 'miniappLogin']);
|
||||
// 手机号
|
||||
Route::post('/miniapp/phone', [app\common\controller\UserController::class, 'miniappPhoneNumber']);
|
||||
|
||||
// 代理oss文件地址
|
||||
Route::any('/proxy/ossurl', [app\common\controller\UploadController::class, 'proxy']);
|
||||
Route::any('/upload', [app\common\controller\UploadController::class, 'uploadFile']);
|
||||
Route::any('/upload/image', [app\common\controller\UploadController::class, 'uploadImage']);
|
||||
Route::any('/upload/delete', [app\common\controller\UploadController::class, 'deleteFile']);
|
||||
|
||||
// 公共
|
||||
Route::group('/common', function () {
|
||||
Route::group('/auth', function () {
|
||||
Route::any('/login', [app\common\controller\AuthController::class, 'login']);
|
||||
Route::any('/refresh/token', [app\common\controller\AuthController::class, 'refresh']);
|
||||
});
|
||||
|
||||
Route::group('/user', function () {
|
||||
Route::any('/info', [app\common\controller\UserController::class, 'info']);
|
||||
Route::any('/update/password', [app\common\controller\UserController::class, 'savePassword']);
|
||||
Route::any('/update', [app\common\controller\UserController::class, 'save']);
|
||||
});
|
||||
|
||||
Route::group('/preset', function () {
|
||||
Route::any('/systems', [app\common\controller\PresetController::class, 'systems']);
|
||||
Route::any('/roles', [app\common\controller\PresetController::class, 'roles']);
|
||||
Route::any('/cache/clear', [app\common\controller\PresetController::class, 'cacheClear']);
|
||||
Route::any('/menus', [app\common\controller\PresetController::class, 'menus']);
|
||||
});
|
||||
|
||||
// 帖子
|
||||
Route::group('/post', function () {
|
||||
Route::any('/list', [app\common\controller\PostController::class, 'index']);
|
||||
Route::any('/show', [app\common\controller\PostController::class, 'show']);
|
||||
Route::any('/interaction', [app\common\controller\PostController::class, 'interaction']);
|
||||
Route::any('/store', [app\admin\controller\PostController::class, 'store']);
|
||||
|
||||
// 评论
|
||||
Route::group('/comment', function () {
|
||||
Route::any('/list', [app\common\controller\PostCommentController::class, 'index']);
|
||||
Route::any('/store', [app\common\controller\PostCommentController::class, 'store']);
|
||||
Route::any('/destroy', [app\common\controller\PostCommentController::class, 'delete']);
|
||||
});
|
||||
|
||||
// 点赞
|
||||
Route::group('/like', function () {
|
||||
Route::any('/list', [app\common\controller\PostLikeController::class, 'index']);
|
||||
Route::any('/store', [app\common\controller\PostLikeController::class, 'store']);
|
||||
Route::any('/destroy', [app\common\controller\PostLikeController::class, 'delete']);
|
||||
});
|
||||
|
||||
// 收藏
|
||||
Route::group('/favorite', function () {
|
||||
Route::any('/self', [app\common\controller\PostFavoriteController::class, 'self']);
|
||||
Route::any('/store', [app\common\controller\PostFavoriteController::class, 'store']);
|
||||
Route::any('/destroy', [app\common\controller\PostFavoriteController::class, 'delete']);
|
||||
});
|
||||
|
||||
// 消息
|
||||
Route::group('/messageNotice', function () {
|
||||
Route::any('/list', [app\common\controller\MessageNoticeController::class, 'index']);
|
||||
});
|
||||
|
||||
// 帖子分类
|
||||
Route::group('/category', function () {
|
||||
Route::any('/list', [app\admin\controller\PostCategoryController::class, 'index']);
|
||||
});
|
||||
});
|
||||
|
||||
//协议
|
||||
Route::any('/agreement', [app\admin\controller\AgreementController::class, 'show']);
|
||||
|
||||
// 轮播
|
||||
Route::group('/banner', function () {
|
||||
Route::any('/list', [app\common\controller\BannerController::class, 'getAll']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 后台管理
|
||||
Route::group('/admin', function () {
|
||||
// 角色
|
||||
Route::group('/role', function () {
|
||||
Route::any('/list', [app\admin\controller\RoleController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\RoleController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\RoleController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\RoleController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\RoleController::class, 'destroy']);
|
||||
Route::any('/menu/resource', [app\admin\controller\RoleController::class, 'menuResource']);
|
||||
});
|
||||
|
||||
// 系统
|
||||
Route::group('/systems', function () {
|
||||
Route::any('/list', [app\admin\controller\SystemsController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\SystemsController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\SystemsController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\SystemsController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\SystemsController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// 资源
|
||||
Route::group('/resources', function () {
|
||||
Route::any('/list/tree', [app\common\controller\ResourceController::class, 'listTree']);
|
||||
Route::any('/show', [app\common\controller\ResourceController::class, 'show']);
|
||||
Route::any('/store', [app\common\controller\ResourceController::class, 'store']);
|
||||
Route::any('/update', [app\common\controller\ResourceController::class, 'update']);
|
||||
Route::any('/destroy', [app\common\controller\ResourceController::class, 'destroy']);
|
||||
Route::any('/list/menu', [app\common\controller\ResourceController::class, 'menuList']);
|
||||
Route::any('/list/menu/tree', [app\common\controller\ResourceController::class, 'menuTreeList']);
|
||||
});
|
||||
|
||||
// 用户
|
||||
Route::group('/user', function () {
|
||||
Route::any('/list', [app\admin\controller\UserController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\UserController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\UserController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\UserController::class, 'update']);
|
||||
Route::any('/edit', [app\admin\controller\UserController::class, 'edit']);
|
||||
Route::any('/authorize', [app\admin\controller\UserController::class, 'authorize']);
|
||||
Route::any('/set/resources', [app\admin\controller\UserController::class, 'updateResources']);
|
||||
Route::any('/update/password', [app\admin\controller\UserController::class, 'savePassword']);
|
||||
});
|
||||
// 帖子
|
||||
Route::group('/post', function () {
|
||||
Route::any('/list', [app\admin\controller\PostController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\PostController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\PostController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\PostController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\PostController::class, 'destroy']);
|
||||
|
||||
// 评论
|
||||
Route::group('/comment', function () {
|
||||
Route::any('/list', [app\admin\controller\PostCommentController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\PostCommentController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\PostCommentController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\PostCommentController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\PostCommentController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// 帖子分类
|
||||
Route::group('/category', function () {
|
||||
Route::any('/list', [app\admin\controller\PostCategoryController::class, 'index']);
|
||||
Route::any('/tree', [app\admin\controller\PostCategoryController::class, 'tree']);
|
||||
Route::any('/show', [app\admin\controller\PostCategoryController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\PostCategoryController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\PostCategoryController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\PostCategoryController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// 点赞
|
||||
Route::group('/like', function () {
|
||||
Route::any('/list', [app\admin\controller\PostLikeController::class, 'index']);
|
||||
});
|
||||
|
||||
// 收藏
|
||||
Route::group('/favorite', function () {
|
||||
Route::any('/list', [app\admin\controller\PostFavoriteController::class, 'index']);
|
||||
});
|
||||
});
|
||||
|
||||
// // 分类下内容
|
||||
// Route::group('/nav/item', function () {
|
||||
// Route::any('/list', [app\admin\controller\NavItemsController::class, 'index']);
|
||||
// Route::any('/show', [app\admin\controller\NavItemsController::class, 'show']);
|
||||
// Route::any('/store', [app\admin\controller\NavItemsController::class, 'store']);
|
||||
// Route::any('/update', [app\admin\controller\NavItemsController::class, 'update']);
|
||||
// Route::any('/destroy', [app\admin\controller\NavItemsController::class, 'destroy']);
|
||||
// });
|
||||
|
||||
// 设置
|
||||
Route::group('/banner', function () {
|
||||
Route::any('/list', [app\admin\controller\BannerController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\BannerController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\BannerController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\BannerController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\BannerController::class, 'destroy']);
|
||||
Route::any('/module', [app\admin\controller\BannerController::class, 'getBannerModule']);
|
||||
});
|
||||
|
||||
// 设置
|
||||
Route::group('/agreement', function () {
|
||||
Route::any('/list', [app\admin\controller\AgreementController::class, 'index']);
|
||||
Route::any('/show', [app\admin\controller\AgreementController::class, 'show']);
|
||||
Route::any('/store', [app\admin\controller\AgreementController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\AgreementController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\AgreementController::class, 'destroy']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'event_loop' => '',
|
||||
'stop_timeout' => 2,
|
||||
'pid_file' => runtime_path() . '/webman.pid',
|
||||
'status_file' => runtime_path() . '/webman.status',
|
||||
'stdout_file' => runtime_path() . '/logs/stdout.log',
|
||||
'log_file' => runtime_path() . '/logs/workerman.log',
|
||||
'max_package_size' => 10 * 1024 * 1024
|
||||
];
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use Webman\Session\FileSessionHandler;
|
||||
use Webman\Session\RedisSessionHandler;
|
||||
use Webman\Session\RedisClusterSessionHandler;
|
||||
|
||||
return [
|
||||
|
||||
'type' => 'file', // or redis or redis_cluster
|
||||
|
||||
'handler' => FileSessionHandler::class,
|
||||
|
||||
'config' => [
|
||||
'file' => [
|
||||
'save_path' => runtime_path() . '/sessions',
|
||||
],
|
||||
'redis' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'auth' => '',
|
||||
'timeout' => 2,
|
||||
'database' => '',
|
||||
'prefix' => 'redis_session_',
|
||||
],
|
||||
'redis_cluster' => [
|
||||
'host' => ['127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7001'],
|
||||
'timeout' => 2,
|
||||
'auth' => '',
|
||||
'prefix' => 'redis_session_',
|
||||
]
|
||||
],
|
||||
|
||||
'session_name' => 'PHPSID',
|
||||
|
||||
'auto_update_timestamp' => false,
|
||||
|
||||
'lifetime' => 7*24*60*60,
|
||||
|
||||
'cookie_lifetime' => 365*24*60*60,
|
||||
|
||||
'cookie_path' => '/',
|
||||
|
||||
'domain' => '',
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
'secure' => false,
|
||||
|
||||
'same_site' => '',
|
||||
|
||||
'gc_probability' => [1, 1000],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Static file settings
|
||||
*/
|
||||
return [
|
||||
'enable' => true,
|
||||
'middleware' => [ // Static file Middleware
|
||||
//app\middleware\StaticFile::class,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Multilingual configuration
|
||||
*/
|
||||
return [
|
||||
// Default language
|
||||
'locale' => 'zh_CN',
|
||||
// Fallback language
|
||||
'fallback_locale' => ['zh_CN', 'en'],
|
||||
// Folder where language files are stored
|
||||
'path' => base_path() . '/resource/translations',
|
||||
];
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\view\Raw;
|
||||
use support\view\Twig;
|
||||
use support\view\Blade;
|
||||
use support\view\ThinkPHP;
|
||||
|
||||
return [
|
||||
'handler' => Raw::class
|
||||
];
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// config/wechat.php
|
||||
return [
|
||||
// 网站应用(开放平台)
|
||||
'web' => [
|
||||
'app_id' => getenv('WECHAT_WEB_APPID', ''),
|
||||
'app_secret' => getenv('WECHAT_WEB_SECRET', ''),
|
||||
'redirect' => getenv('WECHAT_WEB_REDIRECT', ''),
|
||||
],
|
||||
'mini' => [
|
||||
'app_id' => getenv('WECHAT_MINI_APPID', ''),
|
||||
'app_secret' => getenv('WECHAT_MINI_SECRET', ''),
|
||||
],
|
||||
|
||||
// 登录态、幂等等
|
||||
'login' => [
|
||||
'state_ttl' => 300, // state 有效期 5 分钟
|
||||
'result_ttl'=> 300, // 扫码结果缓存 5 分钟
|
||||
],
|
||||
];
|
||||
Reference in New Issue
Block a user