ViolationProduct.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace App\Http\Requests\Manager\WashConfig;
  3. use App\Http\Requests\BaseRequest;
  4. /**
  5. * 数据清洗配置-违规商品
  6. * @author 唐远望
  7. * @version 1.0
  8. * @date 2025-12-03
  9. *
  10. */
  11. class ViolationProduct 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. 'image_url' => 'required',
  28. 'link_url' => 'required',
  29. 'sort' => 'required|integer|min:0',
  30. 'product_name' => 'required',
  31. 'product_specs' => 'required',
  32. 'suggested_price' => 'required',
  33. 'store_scope' => 'required',
  34. 'platform' => 'required',
  35. 'file' => 'required|mimes:xlsx,xls,csv|max:10240'
  36. ];
  37. }
  38. // 场景列表
  39. protected $scenes = [
  40. 'detail' => ['id'],
  41. 'list' => ['page', 'limit'],
  42. 'add' => ['platform','product_name', 'product_specs'],
  43. 'edit' => ['id','platform','product_name', 'product_specs'],
  44. 'set_status' => ['id', 'status'],
  45. 'delete' => ['id'],
  46. 'import_data' =>['file'],
  47. ];
  48. /**
  49. * 获取已定义验证规则的错误消息
  50. *
  51. * @return array
  52. */
  53. public function messages()
  54. {
  55. return [
  56. 'name.required' => '名称必填',
  57. 'id.required' => 'ID未知',
  58. 'id.integer' => 'ID格式错误',
  59. 'id.gt' => 'ID格式错误',
  60. 'status.required' => '状态未知',
  61. 'status.integer' => '状态格式错误',
  62. 'status.in' => '状态格式错误',
  63. 'page.integer' => '页码格式错误',
  64. 'page.min' => '页码格式错误',
  65. 'limit.integer' => '每页数量格式错误',
  66. 'limit.min' => '每页数量格式错误',
  67. 'image_url.required' => '图片链接未知',
  68. 'link_url.required' => '链接地址未知',
  69. 'sort.required' => '排序未知',
  70. 'sort.integer' => '排序格式错误',
  71. 'sort.min' => '排序格式错误',
  72. 'product_name.required' => '商品名称未知',
  73. 'product_specs.required' => '商品规格未知',
  74. 'suggested_price.required' => '建议价格未知',
  75. 'store_scope.required' => '适用门店未知',
  76. 'platform.required' => '平台未知',
  77. ];
  78. }
  79. }