diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..981c3fa --- /dev/null +++ b/.env.example @@ -0,0 +1,16 @@ +DB_HOST = 1Panel-mysql-sLiG +DB_PORT = 3306 +DB_NAME = xyh_crm +DB_USER = xyh_crm +DB_PASSWORD = GxpZByzJ5Y7PrQ5m + +# redis +REDIS_HOST = 1Panel-redis-uDAx +REDIS_PASSWORD = redis_QTihHi +REDIS_PORT = 6379 +REDIS_DATABASE = 0 + +# jwt +JWT_SECRET_KEY = Hj3$kLm8NpQrStUvXwZ1y2C4D6E8G +JWT_ALGORITHM = HS256 +JWT_EXPIRATION = 2592000 \ No newline at end of file diff --git a/config/database.php b/config/database.php index 15c3a1c..d3b3e6c 100644 --- a/config/database.php +++ b/config/database.php @@ -7,11 +7,11 @@ return [ 'mysql' => [ 'driver' => 'mysql', - 'host' => '127.0.0.1', - 'port' => 3306, - 'database' => 'xyh_crm', - 'username' => 'root', - 'password' => 'root', + 'host' => getenv('DB_HOST'), + 'port' => getenv('DB_PORT'), + 'database' => getenv('DB_NAME'), + 'username' => getenv('DB_USER'), + 'password' => getenv('DB_PASSWORD'), 'unix_socket' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', diff --git a/config/jwt.php b/config/jwt.php index 7c5ff73..6caa560 100644 --- a/config/jwt.php +++ b/config/jwt.php @@ -1,6 +1,6 @@ 'Hj3$kLm8NpQrStUvXwZ1y2C4D6E8G', // 替换为高强度的密钥 - 'algorithm' => 'HS256', // 加密算法 - 'expire' => 3600 * 24 * 7, // 过期时间(7天) + 'secret' => getenv('JWT_SECRET_KEY'), // 替换为高强度的密钥 + 'algorithm' => getenv('JWT_ALGORITHM'), // 加密算法 + 'expire' => getenv('JWT_EXPIRATION'), // 过期时间 ]; \ No newline at end of file diff --git a/config/redis.php b/config/redis.php index 37c5f12..742b518 100644 --- a/config/redis.php +++ b/config/redis.php @@ -14,10 +14,10 @@ return [ 'default' => [ - 'password' => '', - 'host' => '127.0.0.1', - 'port' => 6379, - 'database' => 0, + 'password' => getenv('REDIS_PASSWORD'), + 'host' => getenv('REDIS_HOST'), + 'port' => getenv('REDIS_PORT'), + 'database' => getenv('REDIS_DATABASE'), // Connection pool, supports only Swoole or Swow drivers. 'pool' => [ 'max_connections' => 5, diff --git a/resource/translations/en/messages.php b/resource/translations/en/messages.php new file mode 100644 index 0000000..cf6e2f3 --- /dev/null +++ b/resource/translations/en/messages.php @@ -0,0 +1,17 @@ + 'success', + 'fail' => 'fail', + 'login_success' => 'login success', + 'password_error' => 'password error', + 'user_none' => 'user none', + 'not_null' => 'not null', + 'code_error' => 'code error', + 'format_error' => 'format error', + 'email_repeat' => 'email repeat', + 'save_success' => 'save success', + 'save_fail' => 'save fail', + 'register_success' => 'register success', + 'register_fail' => 'register fail', +]; \ No newline at end of file diff --git a/resource/translations/zh_CN/messages.php b/resource/translations/zh_CN/messages.php index 8350cef..821a680 100644 --- a/resource/translations/zh_CN/messages.php +++ b/resource/translations/zh_CN/messages.php @@ -10,9 +10,8 @@ return [ 'code_error' => '验证码错误', 'format_error' => '格式错误', 'email_repeat' => '邮箱重复', - 'save_success' => '添加成功', - 'save_fail' => '添加失败', + 'save_success' => '保存成功', + 'save_fail' => '保存失败', 'register_success' => '注册成功', 'register_fail' => '注册失败', - ]; \ No newline at end of file