ServiceOrderValidate.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. namespace app\api\validate;
  3. use app\common\enum\PayEnum;
  4. use app\common\service\ConfigService;
  5. use app\common\validate\BaseValidate;
  6. /**
  7. * 服务订单验证器
  8. * Class ServiceOrderValidate
  9. * @package app\api\validate
  10. */
  11. class ServiceOrderValidate extends BaseValidate
  12. {
  13. protected $rule = [
  14. 'order_id'=>'require',
  15. 'sn'=>'require',
  16. 'address' => 'require',
  17. 'appointment_time' => 'require|dateFormat:Y/m/d H:i:s',
  18. 'pay_way' => 'require',
  19. 'goods_id' => 'require',
  20. 'contact_number' => 'require',
  21. 'contact_people' => 'require',
  22. 'lon' => 'require',
  23. 'lat' => 'require',
  24. 'worker_id'=>'require'
  25. ];
  26. protected $message = [
  27. 'order_id.require' => '订单ID错误',
  28. 'sn.require' => '订单编号错误',
  29. 'address.require' => '请填写地址',
  30. 'appointment_time.require' => '请填写预约上门时间',
  31. 'appointment_time.dateFormat' => '预约上门时间格式错误',
  32. 'pay_way.require' => '请选择支付方式',
  33. 'goods_id.require' => '订单商品不存在',
  34. 'contact_number.require' => '联系电话不存在',
  35. 'contact_people.require' => '联系人不存在',
  36. 'lon.require' => '经度不存在',
  37. 'lat.require' => '纬度不存在',
  38. 'worker_id.require' => '工程师不存在',
  39. ];
  40. public function sceneAdd()
  41. {
  42. return $this->only(['address','appointment_time','pay_way','goods_id','contact_number','contact_people']);
  43. }
  44. public function sceneFinal()
  45. {
  46. return $this->only(['sn']);
  47. }
  48. public function sceneDetail()
  49. {
  50. return $this->only(['sn']);
  51. }
  52. public function sceneWorker()
  53. {
  54. return $this->only(['sn']);
  55. }
  56. public function sceneCancel()
  57. {
  58. return $this->only(['sn']);
  59. }
  60. public function scenePrice()
  61. {
  62. return $this->only(['sn']);
  63. }
  64. public function sceneFinished()
  65. {
  66. return $this->only(['sn']);
  67. }
  68. public function sceneQueryEffective()
  69. {
  70. return $this->only(['sn']);
  71. }
  72. public function sceneReceiveEffective()
  73. {
  74. return $this->only(['sn','goods_id']);
  75. }
  76. public function sceneFirmOrderSave()
  77. {
  78. return $this->only(['address','appointment_time','pay_way','contact_number','contact_people']);
  79. }
  80. public function sceneCancelOrderCoupon()
  81. {
  82. return $this->only(['sn']);
  83. }
  84. public function sceneLonLat()
  85. {
  86. return $this->only(['lon','lat']);
  87. }
  88. public function sceneChangePrice()
  89. {
  90. return $this->only(['sn']);
  91. }
  92. public function sceneChangeAppointment()
  93. {
  94. return $this->only(['sn','appointment_time']);
  95. }
  96. public function sceneBindWorkerAndWork()
  97. {
  98. return $this->only(['sn','worker_id']);
  99. }
  100. }