初始化提交

This commit is contained in:
2023-02-17 17:10:16 +08:00
commit 4ca844f470
152 changed files with 20390 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'host' => env('AMQP_HOST', 'localhost'),
'port' => (int) env('AMQP_PORT', 5672),
'user' => env('AMQP_USER', 'guest'),
'password' => env('AMQP_PASSWORD', 'guest'),
'vhost' => env('AMQP_VHOST', '/'),
'concurrent' => [
'limit' => 1,
],
'pool' => [
'connections' => 2,
],
'params' => [
'insist' => false,
'login_method' => 'AMQPLAIN',
'login_response' => null,
'locale' => 'en_US',
'connection_timeout' => 3,
'read_write_timeout' => 6,
'context' => null,
'keepalive' => true,
'heartbeat' => 3,
'channel_rpc_timeout' => 0.0,
'close_on_destruct' => false,
'max_idle_channels' => 10,
],
],
];
+21
View File
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'scan' => [
'paths' => [
BASE_PATH . '/app',
],
'ignore_annotations' => [
'mixin',
],
],
];
+13
View File
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
];
+27
View File
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class,
'redis' => [
'pool' => 'default',
],
'channel' => '{queue}',
'timeout' => 2,
'retry_seconds' => 5,
'handle_timeout' => 10,
'processes' => 1,
'concurrent' => [
'limit' => 10,
],
],
];
+18
View File
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'driver' => Hyperf\Cache\Driver\RedisDriver::class,
'packer' => Hyperf\Utils\Packer\PhpSerializerPacker::class,
'prefix' => 'c:',
],
];
+13
View File
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
];
+56
View File
@@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
use Hyperf\Database\Commands\ModelOption;
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'driver' => env('DB_DRIVER', 'mysql'),
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'hyperf'),
'port' => env('DB_PORT', 3306),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'collation' => env('DB_COLLATION', 'utf8_unicode_ci'),
'prefix' => env('DB_PREFIX', ''),
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
],
'commands' => [
'gen:model' => [
'path' => 'app/Model', //模型路径
'force_casts' => true, //是否强制重置 casts 参数
'inheritance' => 'Model', //父类
'uses' => '', //配合 inheritance 使用
'refresh_fillable' => true, //是否刷新 fillable 参数
'table_mapping' => [], //为表名 -> 模型增加映射关系 比如 ['users:Account']
'with_comments' => true, //是否增加字段注释
'property_case' => ModelOption::PROPERTY_SNAKE_CASE,
],
],
'options' => [
// 框架默认配置
PDO::ATTR_CASE => PDO::CASE_NATURAL,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::ATTR_STRINGIFY_FETCHES => true,
// 如果使用的为非原生 MySQL 或云厂商提供的 DB 如从库/分析型实例等不支持 MySQL prepare 协议的, 将此项设置为 true
PDO::ATTR_EMULATE_PREPARES => false,
],
],
];
+14
View File
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
Hyperf\HttpServer\CoreMiddleware::class => App\Middleware\CoreMiddleware::class,
];
+44
View File
@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'generator' => [
'amqp' => [
'consumer' => [
'namespace' => 'App\\Amqp\\Consumer',
],
'producer' => [
'namespace' => 'App\\Amqp\\Producer',
],
],
'aspect' => [
'namespace' => 'App\\Aspect',
],
'command' => [
'namespace' => 'App\\Command',
],
'controller' => [
'namespace' => 'App\\Controller',
],
'job' => [
'namespace' => 'App\\Job',
],
'listener' => [
'namespace' => 'App\\Listener',
],
'middleware' => [
'namespace' => 'App\\Middleware',
],
'Process' => [
'namespace' => 'App\\Processes',
],
],
];
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Validation\ValidationExceptionHandler;
return [
'handler' => [
'http' => [
App\Exception\Handler\ValidationExceptionHandler::class, // 自定义验证器异常接管
App\Exception\Handler\BusinessExceptionHandler::class, // 自定义http异常接管
Hyperf\HttpServer\Exception\Handler\HttpExceptionHandler::class,
App\Exception\Handler\AppExceptionHandler::class,
],
],
];
+15
View File
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler::class,
Hyperf\Command\Listener\FailToHandleListener::class,
];
+41
View File
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
$appEnv = env('APP_ENV', 'dev');
if ($appEnv == 'dev') {
$formatter = [
'class' => Monolog\Formatter\LineFormatter::class,
'constructor' => [
'format' => null,
'dateFormat' => 'Y-m-d H:i:s',
'allowInlineLineBreaks' => true,
'includeStacktraces' => true,
],
];
}else{
$formatter = [
'class' => Monolog\Formatter\JsonFormatter::class,
'constructor' => [],
];
}
return [
'default' => [
'handler' => [
'class' => Monolog\Handler\StreamHandler::class,
'constructor' => [
'stream' => BASE_PATH . '/runtime/logs/hyperf.log',
'level' => Monolog\Logger::DEBUG,
],
],
'formatter' => $formatter,
]
];
+28
View File
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use App\Middleware\Auth\AuthMiddleware;
use App\Middleware\Corss\CorssMiddleware;
use Hyperf\Validation\Middleware\ValidationMiddleware;
return [
'http' => [
// 跨域
CorssMiddleware::class,
// token验证
AuthMiddleware::class,
// 数组内配置您的全局中间件,顺序根据该数组的顺序
ValidationMiddleware::class
],
];
+13
View File
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
];
+27
View File
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'auth' => env('REDIS_AUTH', null),
'port' => (int) env('REDIS_PORT', 6379),
'db' => (int) env('REDIS_DB', 0),
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
],
],
];
+46
View File
@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Server\Event;
use Hyperf\Server\Server;
use Swoole\Constant;
return [
'mode' => SWOOLE_PROCESS,
'servers' => [
[
'name' => 'http',
'type' => Server::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 9501,
'sock_type' => SWOOLE_SOCK_TCP,
'callbacks' => [
Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
],
],
],
'settings' => [
Constant::OPTION_ENABLE_COROUTINE => true,
Constant::OPTION_WORKER_NUM => swoole_cpu_num(),
Constant::OPTION_PID_FILE => BASE_PATH . '/runtime/hyperf.pid',
Constant::OPTION_OPEN_TCP_NODELAY => true,
Constant::OPTION_MAX_COROUTINE => 100000,
Constant::OPTION_OPEN_HTTP2_PROTOCOL => true,
Constant::OPTION_MAX_REQUEST => 100000,
Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024,
Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024,
],
'callbacks' => [
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
Event::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
Event::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
],
];
+30
View File
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Snowflake\MetaGenerator\RedisMetaGenerator;
use Hyperf\Snowflake\MetaGenerator\RedisMilliSecondMetaGenerator;
use Hyperf\Snowflake\MetaGenerator\RedisSecondMetaGenerator;
use Hyperf\Snowflake\MetaGeneratorInterface;
return [
'begin_second' => MetaGeneratorInterface::DEFAULT_BEGIN_SECOND,
RedisMilliSecondMetaGenerator::class => [
'pool' => 'default',
// 用于计算 WorkerId 的 Key 键
'key' => RedisMetaGenerator::DEFAULT_REDIS_KEY
],
RedisSecondMetaGenerator::class => [
'pool' => 'default',
// 用于计算 WorkerId 的 Key 键
'key' => RedisMetaGenerator::DEFAULT_REDIS_KEY
],
];
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Contract\StdoutLoggerInterface;
use Psr\Log\LogLevel;
return [
'app_name' => env('APP_NAME', 'gdxz'),
'app_env' => env('APP_ENV', 'dev'),
'scan_cacheable' => env('SCAN_CACHEABLE', false),
StdoutLoggerInterface::class => [
'log_level' => [
LogLevel::ALERT,
LogLevel::CRITICAL,
LogLevel::EMERGENCY,
LogLevel::ERROR,
LogLevel::INFO,
LogLevel::NOTICE,
LogLevel::WARNING,
],
],
'jwt' => [
"secret" => env('JWT_SECRET', ''),// 密钥
"ttl" => env('JWT_TTL', '3600 * 24 * 70'),// 过期时间
'algo' => env('JWT_ALGO', 'HS256'),
],
"easy_we_chat" => [ // 微信配置
// 测试
"app_id" => env('WE_CHAT_APP_ID', 'wxc83296720404aa7b'),
"secret" => env('WE_CHAT_APP_SECRET', '817665d3763637fe66d56548f8484622'),
'http' => [
'throw' => false, // 状态码非 200、300 时是否抛出异常,默认为开启
'timeout' => 5.0,
// 'base_uri' => 'https://api.weixin.qq.com/', // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
'retry' => true, // 使用默认重试配置
// 'retry' => [
// // 仅以下状态码重试
// 'http_codes' => [429, 500]
// // 最大重试次数
// 'max_retries' => 3,
// // 请求间隔 (毫秒)
// 'delay' => 1000,
// // 如果设置,每次重试的等待时间都会增加这个系数
// // (例如. 首次:1000ms; 第二次: 3 * 1000ms; etc.)
// 'multiplier' => 3
// ],
],
],
"alibaba" => [// 阿里
"dysms" => [// 阿里云大鱼短信
"accessKey" => "LTAI4GGygjsKhyBwvvC3CghV",
"accessKeySecret" => "rcx7lO9kQxG10m8NqNPEfEtT9IS8EI",
],
"oss" => [// 阿里云对象存储
"accessKey" => "LTAI5tKmFrVCghcxX7yHyGhm",
"accessKeySecret" => "q1aiIZCJJuf92YbKk2cSXnPES4zx26",
"bucket" => "gdxz-hospital",
"endpoint" => "oss-cn-chengdu.aliyuncs.com",
],
],
'verify_dun' =>[ // 网易易盾
"secretId" => "a0efb0a735ca5f833d9c50075d3bd673",
"secretKey" => "bc5fc333fec0f16973bb4600cebf8f32",
"busunessId" => "",
],
];
+21
View File
@@ -0,0 +1,21 @@
<?php
/**
* Initialize a dependency injection container that implemented PSR-11 and return the container.
*/
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Di\Container;
use Hyperf\Di\Definition\DefinitionSourceFactory;
use Hyperf\Utils\ApplicationContext;
$container = new Container((new DefinitionSourceFactory())());
return ApplicationContext::setContainer($container);
+203
View File
@@ -0,0 +1,203 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use App\Controller\AreaController;
use App\Controller\BasicDataController;
use App\Controller\DiseaseController;
use App\Controller\DoctorAuthController;
use App\Controller\IndexController;
use App\Controller\LoginController;
use App\Controller\CodeController;
use App\Controller\OrderInquiryController;
use App\Controller\PatientCaseController;
use App\Controller\PatientCenterController;
use App\Controller\PatientDoctorController;
use App\Controller\PatientFamilyController;
use App\Controller\SafeController;
use App\Controller\UserDoctorController;
use App\Services\SafeService;
use Hyperf\HttpServer\Router\Router;
/**
* ------------医生端api---------------------
*/
// 医生端api
Router::addGroup('/doctor', function () {
// 首页
Router::get('/index', [IndexController::class, 'doctorIndex']);
// 身份认证
Router::addGroup('/auth', function () {
// 获取实名认证信息
Router::get('/real', [DoctorAuthController::class, 'getAuthReal']);
// 新增实名认证
Router::post('/real', [DoctorAuthController::class, 'addAuthReal']);
// 获取身份认证信息
Router::get('/iden', [DoctorAuthController::class, 'getAuthIden']);
// 新增身份认证信息
Router::post('/iden', [DoctorAuthController::class, 'addAuthIden']);
// 获取多点执业认证信息
Router::get('/multi', [DoctorAuthController::class, 'getAuthMulti']);
// 新增多点执业认证信息
Router::post('/multi', [DoctorAuthController::class, 'addAuthMulti']);
});
// 专长
Router::addGroup('/expertise', function () {
// 获取医生专长列表-身份认证
Router::get('', [UserDoctorController::class, 'getAuthDoctorExpertise']);
});
// 问诊配置
Router::addGroup('/inquiry', function () {
// 获取医生问诊配置
Router::get('/config', [UserDoctorController::class, 'getInquiryConfig']);
// 医生问诊开关
Router::put('/open', [UserDoctorController::class, 'putInquiryOpen']);
// 修改医生问诊配置
Router::put('/config', [UserDoctorController::class, 'putInquiryConfig']);
});
});
/**
* ------------患者端api---------------------
*/
// 患者端api
Router::addGroup('/patient', function () {
// 首页
Router::get('/index', [IndexController::class, 'patientIndex']);
// 个人中心-我的医生
Router::addGroup('/my_doctor', function () {
// 删除我的医生
Router::delete('/{history_inquiry_id:\d+}', [PatientCenterController::class, 'deleteMyDoctor']);
});
// 问诊
Router::addGroup('/inquiry', function () {
// 医生数据
Router::addGroup('/doctor', function () {
// 获取问诊医生列表
Router::get('', [PatientDoctorController::class, 'getInquiryDoctorList']);
// 获取问诊医生详情
Router::get('/{doctor_id:\d+}', [PatientDoctorController::class, 'getInquiryDoctorInfo']);
});
// 订单
Router::addGroup('/order', function () {
// 创建订单
Router::post('', [OrderInquiryController::class, 'addInquiryOrder']);
});
});
// 医生数据
Router::addGroup('/doctor', function () {
// 获取医生评价
Router::get('/evaluation', [PatientDoctorController::class, 'getDoctorEvaluationList']);
// 医生详情简介-详情中的简介
Router::get('/profile/{doctor_id:\d+}', [PatientDoctorController::class, 'getDoctorProfile']);
});
// 家庭成员
Router::addGroup('/family', function () {
// 获取家庭成员列表
Router::get('', [PatientFamilyController::class, 'getFamilyList']);
// 新增家庭成员
Router::post('', [PatientFamilyController::class, 'addFamily']);
});
// 疾病分类
Router::addGroup('/disease', function () {
// 搜索疾病分类
Router::get('/search', [DiseaseController::class, 'getDiseaseSearch']);
// 获取常见疾病分类
Router::get('/hot', [DiseaseController::class, 'getDiseaseHot']);
});
// 病例
Router::addGroup('/case', function () {
// 获取患者最后一份问诊病例
Router::get('/last/{family_id:\d+}', [PatientCaseController::class, 'getLastCase']);
});
});
// 药师端api
Router::addGroup('/pharmacist', function () {
// 首页
Router::get('/index', [IndexController::class, 'pharmacistIndex']);
});
/**
* ------------公共api---------------------
*/
// 登陆api
Router::addGroup('/login', function () {
// 微信登陆
Router::post('/wechat_mobile_login', [LoginController::class, 'wechatMobileLogin']);
// 手机号登陆
Router::post('/mobile_login', [LoginController::class, 'mobileLogin']);
});
// 验证码api
Router::addGroup('/code', function () {
// 获取手机号验证码
Router::post('/phone', [CodeController::class, 'getPhoneCode']);
});
// 疾病分类api
Router::addGroup('/disease', function () {
// 疾病专长列表-搜索使用
Router::get('/expertise', [DiseaseController::class, 'getDiseaseExpertiseList']);
});
// 省市区
Router::addGroup('/area', function () {
// 获取省份信息
Router::get('/province', [AreaController::class, 'getProvince']);
// 获取城市信息
Router::get('/city', [AreaController::class, 'getCity']);
// 获取区县信息
Router::get('/county', [AreaController::class, 'getCounty']);
});
// oss
Router::addGroup('/oss', function () {
// 获取oss签名数据
Router::get('/sign', [SafeController::class, 'getOssSign']);
});
// 医院
Router::addGroup('/basic', function () {
// 获取医院数据
Router::get('/hospital', [BasicDataController::class, 'getHospital']);
// 获取自定义科室数据
Router::get('/department', [BasicDataController::class, 'getCustomDepartment']);
});