Invoice.php 2.6 KB

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