|
|
@@ -9,6 +9,7 @@ use App\Traits\ServiceAppAop;
|
|
|
use App\DeliveryAppointment;
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
+use phpDocumentor\Reflection\Types\Integer;
|
|
|
|
|
|
class DeliveryAppointmentService
|
|
|
{
|
|
|
@@ -143,4 +144,19 @@ class DeliveryAppointmentService
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 验证预约单完整性修改状态
|
|
|
+ *
|
|
|
+ * @param integer $id
|
|
|
+ */
|
|
|
+ public function checkFull($id)
|
|
|
+ {
|
|
|
+ /** @var DeliveryAppointment|\stdClass $delivery */
|
|
|
+ $delivery = DeliveryAppointment::query()->withCount(["cars"=>function($query){
|
|
|
+ /** @var Builder $query */
|
|
|
+ $query->whereNull("delivery_time");
|
|
|
+ }])->find($id);
|
|
|
+ if ($delivery->cars_count == 0)$delivery->update(["status"=>2]);
|
|
|
+ }
|
|
|
}
|