InstallCheck.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2021 勾股工作室
  4. * @license https://opensource.org/licenses/Apache-2.0
  5. * @link https://www.gougucms.com
  6. */
  7. namespace app\install\validate;
  8. use think\Validate;
  9. class InstallCheck extends Validate
  10. {
  11. protected $rule = [
  12. 'DB_TYPE' => 'require|eq:mysql',
  13. 'DB_HOST' => 'require',
  14. 'DB_PORT' => 'require',
  15. 'DB_USER' => 'require',
  16. 'DB_PWD' => 'require',
  17. 'DB_NAME' => 'require',
  18. 'DB_PREFIX' => 'require',
  19. 'username' => 'require',
  20. 'password' => 'require|confirm',
  21. ];
  22. protected $message = [
  23. 'DB_TYPE.require' => '数据库类型不能为空',
  24. 'DB_TYPE.eq' => '数据库类型固定为mysql',
  25. 'DB_HOST.require' => '数据库地址不能为空',
  26. 'DB_PORT.require' => '数据库端口不能为空',
  27. 'DB_USER.require' => '数据库用户名不能为空',
  28. 'DB_PWD.require' => '数据库密码不能为空',
  29. 'DB_NAME.require' => '数据库名字不能为空',
  30. 'DB_PREFIX.require' => '表前缀不能为空',
  31. 'username.require' => '管理员账户不能为空',
  32. 'password.require' => '密码不能为空',
  33. 'password.confirm' => '两次密码不一致',
  34. ];
  35. protected $scene = [
  36. ];
  37. }