feat : check

This commit is contained in:
2025-04-01 16:08:07 +08:00
parent dae9d1a38a
commit 263d7b4372
5 changed files with 65 additions and 3 deletions

View File

@@ -17,13 +17,18 @@ use App\Model\Order;
use App\Model\OrderGood;
use App\Model\OrderMealCateringLog;
use App\Service\Admin\Catering\CateringBaseService;
use App\Service\ServiceTrait\Admin\Catering\PrintTrait;
use Exception;
use Hyperf\DbConnection\Db;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class CheckService extends CateringBaseService
{
use PrintTrait;
/**
* @var OrderMealCateringLog
*/
@@ -49,6 +54,8 @@ class CheckService extends CateringBaseService
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function handle(): array
{
@@ -67,7 +74,7 @@ class CheckService extends CateringBaseService
->where('quantity','>',0)
->first();
if (!empty($todayLog)) return $this->return->success();
if (!empty($todayLog)) return $this->closeSku();
$orderIds = $this->orderModel
->where('cycle_id', $this->cycleId)
@@ -88,6 +95,18 @@ class CheckService extends CateringBaseService
return $this->return->success();
}
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function closeSku(): array
{
$this->closeMealSku((int)$this->request->input('sku_id'), $this->cycleId);
return $this->return->success();
}
/**
* @return void
*/