ConfigSave.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. namespace App\Http\Requests\Admin;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class ConfigSave extends FormRequest
  5. {
  6. /**
  7. * Get the validation rules that apply to the request.
  8. *
  9. * @return array
  10. */
  11. public function rules()
  12. {
  13. return [
  14. // invite & commission
  15. 'safe_mode_enable' => 'in:0,1',
  16. 'invite_force' => 'in:0,1',
  17. 'invite_commission' => 'integer',
  18. 'invite_gen_limit' => 'integer',
  19. 'invite_never_expire' => 'in:0,1',
  20. 'commission_first_time_enable' => 'in:0,1',
  21. 'commission_auto_check_enable' => 'in:0,1',
  22. 'commission_withdraw_limit' => 'nullable|numeric',
  23. 'commission_withdraw_method' => 'nullable|array',
  24. 'withdraw_close_enable' => 'in:0,1',
  25. 'commission_distribution_enable' => 'in:0,1',
  26. 'commission_distribution_l1' => 'nullable|numeric',
  27. 'commission_distribution_l2' => 'nullable|numeric',
  28. 'commission_distribution_l3' => 'nullable|numeric',
  29. // site
  30. 'stop_register' => 'in:0,1',
  31. 'email_verify' => 'in:0,1',
  32. 'app_name' => '',
  33. 'app_description' => '',
  34. 'app_url' => 'nullable|url',
  35. 'subscribe_url' => 'nullable',
  36. 'try_out_enable' => 'in:0,1',
  37. 'try_out_plan_id' => 'integer',
  38. 'try_out_hour' => 'numeric',
  39. 'email_whitelist_enable' => 'in:0,1',
  40. 'email_whitelist_suffix' => 'nullable|array',
  41. 'email_gmail_limit_enable' => 'in:0,1',
  42. 'recaptcha_enable' => 'in:0,1',
  43. 'recaptcha_key' => '',
  44. 'recaptcha_site_key' => '',
  45. 'tos_url' => 'nullable|url',
  46. // subscribe
  47. 'plan_change_enable' => 'in:0,1',
  48. 'reset_traffic_method' => 'in:0,1,2',
  49. 'surplus_enable' => 'in:0,1',
  50. 'new_order_event_id' => 'in:0,1',
  51. 'renew_order_event_id' => 'in:0,1',
  52. 'change_order_event_id' => 'in:0,1',
  53. // server
  54. 'server_token' => 'nullable|min:16',
  55. 'server_license' => 'nullable',
  56. 'server_log_enable' => 'in:0,1',
  57. 'server_v2ray_domain' => '',
  58. 'server_v2ray_protocol' => '',
  59. // alipay
  60. 'alipay_enable' => 'in:0,1',
  61. 'alipay_appid' => 'nullable|integer|min:16',
  62. 'alipay_pubkey' => 'max:2048',
  63. 'alipay_privkey' => 'max:2048',
  64. // stripe
  65. 'stripe_alipay_enable' => 'in:0,1',
  66. 'stripe_wepay_enable' => 'in:0,1',
  67. 'stripe_card_enable' => 'in:0,1',
  68. 'stripe_sk_live' => '',
  69. 'stripe_pk_live' => '',
  70. 'stripe_webhook_key' => '',
  71. 'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp,jpy,cad',
  72. // bitpayx
  73. 'bitpayx_name' => '',
  74. 'bitpayx_enable' => 'in:0,1',
  75. 'bitpayx_appsecret' => '',
  76. // mGate
  77. 'mgate_name' => '',
  78. 'mgate_enable' => 'in:0,1',
  79. 'mgate_url' => 'nullable|url',
  80. 'mgate_app_id' => '',
  81. 'mgate_app_secret' => '',
  82. // Epay
  83. 'epay_name' => '',
  84. 'epay_enable' => 'in:0,1',
  85. 'epay_url' => 'nullable|url',
  86. 'epay_pid' => '',
  87. 'epay_key' => '',
  88. // frontend
  89. 'frontend_theme' => '',
  90. 'frontend_theme_sidebar' => 'in:dark,light',
  91. 'frontend_theme_header' => 'in:dark,light',
  92. 'frontend_theme_color' => 'in:default,darkblue,black,green',
  93. 'frontend_background_url' => 'nullable|url',
  94. 'frontend_admin_path' => '',
  95. 'frontend_customer_service_method' => '',
  96. 'frontend_customer_service_id' => '',
  97. // email
  98. 'email_template' => '',
  99. 'email_host' => '',
  100. 'email_port' => '',
  101. 'email_username' => '',
  102. 'email_password' => '',
  103. 'email_encryption' => '',
  104. 'email_from_address' => '',
  105. // telegram
  106. 'telegram_bot_enable' => 'in:0,1',
  107. 'telegram_bot_token' => '',
  108. 'telegram_discuss_id' => '',
  109. 'telegram_channel_id' => '',
  110. // app
  111. 'windows_version' => '',
  112. 'windows_download_url' => '',
  113. 'macos_version' => '',
  114. 'macos_download_url' => '',
  115. 'android_version' => '',
  116. 'android_download_url' => ''
  117. ];
  118. }
  119. public function messages()
  120. {
  121. // illiteracy prompt
  122. return [
  123. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  124. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://',
  125. 'server_token.min' => '通讯密钥长度必须大于16位',
  126. 'tos_url.url' => '服务条款URL格式不正确'
  127. ];
  128. }
  129. }