SystemConfigValidate.php 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\validate\admin;
  12. use think\Validate;
  13. /**
  14. * Class SystemConfigValidate
  15. * @package app\validate\admin\setting
  16. */
  17. class SystemConfigValidate extends Validate
  18. {
  19. protected $regex = [
  20. 'float_two' => '/^[0-9]+(.[0-9]{1,2})?$/',
  21. 'tel' => '/^((\d{3,4}-)?[0-9]{7,8}$)|(^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])[0-9]{8}$)$/'
  22. ];
  23. /**
  24. * 定义验证规则
  25. * 格式:'字段名' => ['规则1','规则2'...]
  26. *
  27. * @var array
  28. */
  29. protected $rule = [
  30. 'site_url' => 'url',
  31. 'user_extract_min_price' => 'float|gt:0',
  32. 'store_brokerage_price' => 'float|gt:0',
  33. 'thumb_big_height' => 'number|egt:0',
  34. 'thumb_big_width' => 'number|egt:0',
  35. 'thumb_mid_height' => 'number|egt:0',
  36. 'thumb_mid_width' => 'number|egt:0',
  37. 'thumb_small_height' => 'number|egt:0',
  38. 'thumb_small_width' => 'number|egt:0',
  39. 'watermark_opacity' => 'number|between:0,100',
  40. 'watermark_text' => 'chsAlphaNum|length:1,10',
  41. 'watermark_text_size' => 'number|egt:0',
  42. 'watermark_x' => 'integer',
  43. 'watermark_y' => 'integer',
  44. 'store_extract_max_price' => 'float',
  45. 'store_extract_min_price' => 'float|egt:1',
  46. 'site_phone' => 'regex:tel',
  47. 'withdraw_fee' => 'float|egt:0|elt:100|regex:float_two',
  48. ];
  49. /**
  50. * 定义错误信息
  51. * 格式:'字段名.规则名' => '错误信息'
  52. *
  53. * @var array
  54. */
  55. protected $message = [
  56. 'site_url.url' => '请输入有效的网址',
  57. 'user_extract_min_price.float' => '提现最小金额只能为数字',
  58. 'user_extract_min_price.gt' => '提现最小金额必须大于0',
  59. 'store_brokerage_price.float' => '满额分销金额金额必须为数字',
  60. 'store_brokerage_price.gt' => '满额分销金额金额必须大于0',
  61. 'thumb_big_height.number' => '缩略图大图尺寸(高)必须为整数',
  62. 'thumb_big_height.egt' => '缩略图大图尺寸(高)必须大于等于0',
  63. 'thumb_big_width.number' => '缩略图大图尺寸(宽)必须为整数',
  64. 'thumb_big_width.egt' => '缩略图大图尺寸(宽)必须大于等于0',
  65. 'thumb_mid_height.number' => '缩略图中图尺寸(高)必须为整数',
  66. 'thumb_mid_height.egt' => '缩略图中图尺寸(高)必须大于等于0',
  67. 'thumb_mid_width.number' => '缩略图中图尺寸(宽)必须为整数',
  68. 'thumb_mid_width.egt' => '缩略图中图尺寸(宽)必须大于等于0',
  69. 'thumb_small_height.number' => '缩略图小图尺寸(高)必须为整数',
  70. 'thumb_small_height.egt' => '缩略图小图尺寸(高)必须大于等于0',
  71. 'thumb_small_width.number' => '缩略图小图尺寸(宽)必须为整数',
  72. 'thumb_small_width.egt' => '缩略图小图尺寸(宽)必须大于等于0',
  73. 'watermark_text.chsAlphaNum' => '水印文字只能是汉字、字母、数字',
  74. 'watermark_text.length' => '水印文字长度为1-10位',
  75. 'watermark_text_size.number' => '水印文字大小必须为整数',
  76. 'watermark_text_size.egt' => '水印文字大小必须大于等于0',
  77. 'watermark_x.integer' => '水印横坐标偏移量必须为整数',
  78. 'watermark_y.integer' => '水印纵坐标偏移量必须为整数',
  79. 'store_extract_max_price.float' => '门店提现最高金额必须为数字',
  80. 'store_extract_min_price.float' => '门店提现最低金额必须为数字',
  81. 'store_extract_min_price.egt' => '门店提现最低金额为1元',
  82. 'site_phone.regex' => '请填写有效的联系电话',
  83. 'withdraw_fee.float' => '提现手续费必须为数字',
  84. 'withdraw_fee.egt' => '提现手续费为0-100数字',
  85. 'withdraw_fee.elt' => '提现手续费为0-100数字',
  86. 'withdraw_fee.regex' => '提现手续费最多两位小数',
  87. ];
  88. protected $scene = [
  89. ];
  90. }