ConfigSave.php 5.0 KB

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