feat : spu
This commit is contained in:
@@ -10,12 +10,17 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Admin\Order;
|
||||
|
||||
use App\Constants\Common\OrderCode;
|
||||
use App\Constants\Common\RefundCode;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\Order;
|
||||
use App\Service\Admin\BaseService;
|
||||
use App\Service\Amqp\Refund\FullRefundOrderService;
|
||||
use App\Service\Amqp\Refund\PartialRefundOrderService;
|
||||
use App\Service\ServiceTrait\Common\OrderChangeStatusTrait;
|
||||
use Exception;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
@@ -70,13 +75,37 @@ class RefundService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
use OrderChangeStatusTrait;
|
||||
|
||||
/**
|
||||
* @var Order
|
||||
*/
|
||||
#[Inject]
|
||||
protected Order $orderModel;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function refundBatch(): array
|
||||
{
|
||||
$siteId = $this->request->input('site_id');
|
||||
$kitchenId = $this->request->input('kitchen_id');
|
||||
$cycleId = (int)$this->request->input('cycle_id');
|
||||
$reason = $this->request->input('reason');
|
||||
|
||||
$orderIds = $this->orderModel
|
||||
->where('kitchen_id', $kitchenId)
|
||||
->where('cycle_id', $cycleId)
|
||||
->where('status', OrderCode::FINISH)
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (empty($orderIds)) throw new ErrException('暂无数据');
|
||||
|
||||
foreach ($orderIds as $orderId) {
|
||||
$this->joinRefundQueue($orderId,RefundCode::FULL_GOOD_REFUND,$reason);
|
||||
}
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user