ServiceWorkValidate.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. 'work_images'=>'require',
  37. 'spare_image' => 'require',
  38. ];
  39. /**
  40. * 参数描述
  41. * @var string[]
  42. */
  43. protected $field = [
  44. 'id' => 'id',
  45. 'work_sn' => '工单编号',
  46. 'mobile' => '手机号',
  47. 'address' => '客户地址',
  48. 'title' => '工单名称',
  49. 'category_type' => '服务类别',
  50. 'goods_category_ids' => '服务类目',
  51. 'goods_category_id' => '服务产品',
  52. 'base_service_fee' => '基础服务费',
  53. 'service_fee' => '服务费用',
  54. 'work_status' => '工单状态',
  55. 'service_status' => '订单服务状态',
  56. 'dispatch_time' => '派单时间',
  57. 'receive_time' => '领单时间',
  58. 'appointment_time' => '预约上门时间',
  59. 'finished_time' => '结单时间',
  60. 'master_worker_id' => '工程师',
  61. 'order_sn'=>'未获取到扫码信息',
  62. 'amount'=>'报价',
  63. 'finished_images'=>'完结服务拍照',
  64. 'work_images'=>'工作拍照',
  65. 'spare_image' =>'配件图片',
  66. ];
  67. /**
  68. * 领取场景
  69. * @return ServiceWorkValidate
  70. */
  71. public function scenePick()
  72. {
  73. return $this->only(['work_sn']);
  74. }
  75. /**
  76. * 领取场景
  77. * @return ServiceWorkValidate
  78. */
  79. public function sceneDetail()
  80. {
  81. return $this->only(['*']);
  82. }
  83. /**
  84. * 预约上门场景
  85. * @return ServiceWorkValidate
  86. */
  87. public function sceneAppoint()
  88. {
  89. return $this->only(['work_sn','address','appointment_time']);
  90. }
  91. /**
  92. * 确认上门场景
  93. * @return ServiceWorkValidate
  94. */
  95. public function sceneDoor()
  96. {
  97. return $this->only(['work_sn']);
  98. }
  99. public function scenePrice()
  100. {
  101. return $this->only(['work_sn','amount','work_images']);
  102. }
  103. public function sceneFinished()
  104. {
  105. return $this->only(['work_sn','finished_images']);
  106. }
  107. public function sceneSpare()
  108. {
  109. return $this->only(['work_sn']);
  110. }
  111. public function sceneSubmitAppointment()
  112. {
  113. return $this->only(['work_sn']);
  114. }
  115. public function sceneAgainDoor()
  116. {
  117. return $this->only(['work_sn','appointment_time']);
  118. }
  119. /**
  120. * 电话联系客户
  121. * @return ServiceWorkValidate
  122. */
  123. public function sceneContact()
  124. {
  125. return $this->only(['work_sn']);
  126. }
  127. public function sceneCancel()
  128. {
  129. return $this->only(['id']);
  130. }
  131. public function sceneSparepart()
  132. {
  133. return $this->only(['id','work_sn','spare_image']);
  134. }
  135. }