ServiceWorkValidate.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. namespace app\workerapi\validate;
  3. use app\common\validate\BaseValidate;
  4. /**
  5. * ServiceWork验证器
  6. * Class ServiceWorkValidate
  7. * @package app\workerapi\validate\works
  8. */
  9. class ServiceWorkValidate extends BaseValidate
  10. {
  11. /**
  12. * 设置校验规则
  13. * @var string[]
  14. */
  15. protected $rule = [
  16. 'id' => 'require',
  17. 'work_sn' => 'require',
  18. 'mobile' => 'require',
  19. 'address' => 'require',
  20. 'title' => 'require',
  21. 'category_type' => 'require',
  22. 'goods_category_ids' => 'require',
  23. 'goods_category_id' => 'require',
  24. 'base_service_fee' => 'require',
  25. 'service_fee' => 'require',
  26. 'work_status' => 'require',
  27. 'service_status' => 'require',
  28. 'dispatch_time' => 'require',
  29. 'receive_time' => 'require',
  30. 'appointment_time' => 'require|dateFormat:Y-m-d H:i:s',
  31. 'finished_time' => 'require',
  32. 'master_worker_id' => 'require',
  33. 'order_sn'=>'require',
  34. 'amount'=>'require',
  35. 'finished_images'=>'require'
  36. ];
  37. /**
  38. * 参数描述
  39. * @var string[]
  40. */
  41. protected $field = [
  42. 'id' => 'id',
  43. 'work_sn' => '工单编号',
  44. 'mobile' => '手机号',
  45. 'address' => '客户地址',
  46. 'title' => '工单名称',
  47. 'category_type' => '服务类别',
  48. 'goods_category_ids' => '服务类目',
  49. 'goods_category_id' => '服务产品',
  50. 'base_service_fee' => '基础服务费',
  51. 'service_fee' => '服务费用',
  52. 'work_status' => '工单状态',
  53. 'service_status' => '订单服务状态',
  54. 'dispatch_time' => '派单时间',
  55. 'receive_time' => '领单时间',
  56. 'appointment_time' => '预约上门时间',
  57. 'finished_time' => '结单时间',
  58. 'master_worker_id' => '师傅',
  59. 'order_sn'=>'未获取到扫码信息',
  60. 'amount'=>'报价',
  61. 'finished_images'=>'完结服务拍照'
  62. ];
  63. /**
  64. * 领取场景
  65. * @return ServiceWorkValidate
  66. */
  67. public function scenePick()
  68. {
  69. return $this->only(['work_sn']);
  70. }
  71. /**
  72. * 领取场景
  73. * @return ServiceWorkValidate
  74. */
  75. public function sceneDetail()
  76. {
  77. return $this->only(['id']);
  78. }
  79. /**
  80. * 预约上门场景
  81. * @return ServiceWorkValidate
  82. */
  83. public function sceneAppoint()
  84. {
  85. return $this->only(['work_sn','address','appointment_time']);
  86. }
  87. /**
  88. * 确认上门场景
  89. * @return ServiceWorkValidate
  90. */
  91. public function sceneDoor()
  92. {
  93. return $this->only(['work_sn','order_sn']);
  94. }
  95. public function scenePrice()
  96. {
  97. return $this->only(['work_sn','amount']);
  98. }
  99. public function sceneFinished()
  100. {
  101. return $this->only(['work_sn','finished_images']);
  102. }
  103. }