ConfigSave.php 4.7 KB

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