截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VirtualDeliveryValidate.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\shop\validate\order;
  3. use app\common\basics\Validate;
  4. use app\common\model\order\Order;
  5. /**
  6. * 虚拟发货验证
  7. * Class virtualDeliveryValidate
  8. * @package app\shop\validate\order
  9. */
  10. class VirtualDeliveryValidate extends Validate
  11. {
  12. protected $rule = [
  13. 'order_id' => 'require|checkOrder',
  14. 'delivery_content' => 'require',
  15. ];
  16. protected $message = [
  17. 'order_id.require' => '缺少ID字段',
  18. 'delivery_content.require' => '请填写发货内容',
  19. ];
  20. /**
  21. * @notes 校验订单信息
  22. * @param $value
  23. * @param $rule
  24. * @param $data
  25. * @return bool|string
  26. * @author 段誉
  27. * @date 2022/4/7 18:26
  28. */
  29. protected function checkOrder($value, $rule, $data)
  30. {
  31. $order = Order::findOrEmpty($value);
  32. if ($order->isEmpty()) {
  33. return '订单不存在';
  34. }
  35. if ($order['del'] == 1) {
  36. return '订单已删除';
  37. }
  38. if ($order['shipping_status'] == 1) {
  39. return '此订单已发货';
  40. }
  41. return true;
  42. }
  43. }