mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-22 19:44:02 +08:00
35 lines
641 B
PHP
35 lines
641 B
PHP
<?php
|
|
|
|
namespace App\Services\Logic\Order;
|
|
|
|
use App\Models\Order as OrderModel;
|
|
use App\Services\Logic\OrderTrait;
|
|
use App\Services\Logic\Service;
|
|
use App\Validators\Order as OrderValidator;
|
|
|
|
class OrderCancel extends Service
|
|
{
|
|
|
|
use OrderTrait;
|
|
|
|
public function handle($sn)
|
|
{
|
|
$order = $this->checkOrderBySn($sn);
|
|
|
|
$user = $this->getLoginUser();
|
|
|
|
$validator = new OrderValidator();
|
|
|
|
$validator->checkOwner($user->id, $order->owner_id);
|
|
|
|
$validator->checkIfAllowCancel($order);
|
|
|
|
$order->status = OrderModel::STATUS_CLOSED;
|
|
|
|
$order->update();
|
|
|
|
return $order;
|
|
}
|
|
|
|
}
|