Invoice.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 验证器
  10. */
  11. class Invoice extends Validate
  12. {
  13. protected $rule = [
  14. 'invoice_state' => 'require|in:1,2',
  15. 'invoice_title' => 'require|max:50',
  16. 'invoice_content' => 'require|max:10',
  17. 'invoice_code' => 'require|max:50',
  18. 'invoice_company' => 'require|max:50',
  19. 'invoice_company_code' => 'require|max:50',
  20. 'invoice_reg_addr' => 'require|max:50',
  21. 'invoice_reg_phone' => 'require|max:30',
  22. 'invoice_reg_bname' => 'require|max:30',
  23. 'invoice_reg_baccount' => 'require|max:30',
  24. ];
  25. protected $message = [
  26. 'invoice_state.require' => '发票类型必填',
  27. 'invoice_state.in' => '发票类型错误',
  28. 'invoice_title.require' => '发票抬头必填',
  29. 'invoice_title.max' => '发票抬头长度必须小于50',
  30. 'invoice_content.require' => '发票内容必填',
  31. 'invoice_content.max' => '发票内容长度必须小于10',
  32. 'invoice_code.require' => '纳税人识别号必填',
  33. 'invoice_code.max' => '纳税人识别号长度必须小于50',
  34. 'invoice_company.require' => '单位名称必填',
  35. 'invoice_company.max' => '单位名称长度必须小于50',
  36. 'invoice_company_code.require' => '纳税人识别号必填',
  37. 'invoice_company_code.max' => '纳税人识别号长度必须小于50',
  38. 'invoice_reg_addr.require' => '注册地址必填',
  39. 'invoice_reg_addr.max' => '注册地址长度必须小于50',
  40. 'invoice_reg_phone.require' => '注册电话必填',
  41. 'invoice_reg_phone.max' => '注册电话长度必须小于30',
  42. 'invoice_reg_bname.require' => '开户银行必填',
  43. 'invoice_reg_bname.max' => '开户银行长度必须小于30',
  44. 'invoice_reg_baccount.require' => '银行帐户必填',
  45. 'invoice_reg_baccount.max' => '银行帐户长度必须小于30',
  46. ];
  47. protected $scene = [
  48. 'invoice_1_update' => ['invoice_state', 'invoice_title', 'invoice_content', 'invoice_code'],
  49. 'invoice_2_update' => ['invoice_company', 'invoice_company_code', 'invoice_reg_addr', 'invoice_reg_phone', 'invoice_reg_bname', 'invoice_reg_baccount'],
  50. ];
  51. }