Company.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Http\Requests\Manager\External;
  3. use App\Http\Requests\BaseRequest;
  4. /**
  5. * 采集配置-商品信息验证
  6. * @author 唐远望
  7. * @version 1.0
  8. * @date 2026-02-02
  9. *
  10. */
  11. class Company extends BaseRequest
  12. {
  13. /**
  14. * 获取应用于请求的规则
  15. *
  16. * @return array
  17. */
  18. public function rules()
  19. {
  20. // 返回结果
  21. return [
  22. 'name' => 'required',
  23. 'id' => 'required|integer|gt:0',
  24. 'status' => 'required|integer|in:0,1',
  25. 'page' => 'integer|min:1',
  26. 'limit' => 'integer|min:1',
  27. 'sort' => 'required|integer|min:0',
  28. 'company_name' => 'required',
  29. 'social_credit_code' => 'required',
  30. ];
  31. }
  32. // 场景列表
  33. protected $scenes = [
  34. 'detail' => ['id'],
  35. 'list' => ['page', 'limit'],
  36. 'add' => ['company_name','social_credit_code'],
  37. 'edit' => ['id','company_name','social_credit_code'],
  38. 'set_status' => ['id', 'status'],
  39. 'delete' => ['id'],
  40. ];
  41. /**
  42. * 获取已定义验证规则的错误消息
  43. *
  44. * @return array
  45. */
  46. public function messages()
  47. {
  48. return [
  49. 'name.required' => '名称必填',
  50. 'id.required' => 'ID未知',
  51. 'id.integer' => 'ID格式错误',
  52. 'id.gt' => 'ID格式错误',
  53. 'status.required' => '状态未知',
  54. 'status.integer' => '状态格式错误',
  55. 'status.in' => '状态格式错误',
  56. 'page.integer' => '页码格式错误',
  57. 'page.min' => '页码格式错误',
  58. 'limit.integer' => '每页数量格式错误',
  59. 'limit.min' => '每页数量格式错误',
  60. 'company_name.required' => '公司名称必填',
  61. 'social_credit_code.required' => '社会信用代码必填',
  62. ];
  63. }
  64. }