feat : order list

This commit is contained in:
2025-04-07 15:03:24 +08:00
parent 1033572005
commit 28713fff72
2 changed files with 37 additions and 7 deletions

View File

@@ -12,8 +12,11 @@ namespace App\Service\Admin\Good;
use App\Cache\Redis\Api\ApiRedisKey; use App\Cache\Redis\Api\ApiRedisKey;
use App\Cache\Redis\Api\GoodCache; use App\Cache\Redis\Api\GoodCache;
use App\Constants\Admin\UserCode;
use App\Constants\Common\GoodCode; use App\Constants\Common\GoodCode;
use App\Exception\ErrException; use App\Exception\ErrException;
use App\Model\AdminUser;
use App\Model\Chef;
use App\Model\Sku; use App\Model\Sku;
use App\Model\Spu; use App\Model\Spu;
use App\Service\Admin\BaseService; use App\Service\Admin\BaseService;
@@ -38,6 +41,18 @@ class SkuService extends BaseService
#[Inject] #[Inject]
protected Spu $spuModel; protected Spu $spuModel;
/**
* @var Chef
*/
#[Inject]
protected Chef $chefModel;
/**
* @var AdminUser
*/
#[Inject]
protected AdminUser $adminUserModel;
/** /**
* @return array * @return array
*/ */
@@ -84,6 +99,8 @@ class SkuService extends BaseService
$spuInfo = $this->spuModel->getInfoById($spuId); $spuInfo = $this->spuModel->getInfoById($spuId);
if (empty($spuInfo)) throw new ErrException('请选择spu'); if (empty($spuInfo)) throw new ErrException('请选择spu');
$this->checkChefInfo();
$insertModel = new Sku(); $insertModel = new Sku();
$imageIds = $this->request->input('image_ids'); $imageIds = $this->request->input('image_ids');
@@ -118,6 +135,17 @@ class SkuService extends BaseService
return $this->return->success(); return $this->return->success();
} }
/**
* @return void
*/
private function checkChefInfo()
{
$chefId = (int)$this->request->input('chef_id');
$chefInfo = $this->chefModel->getInfoById($chefId);
$chefUserInfo = $this->adminUserModel->getAdminInfoById($chefInfo->user_id);
if ($chefUserInfo->status == UserCode::DISABLE) throw new ErrException('该厨师已禁用');
}
/** /**
* @return array * @return array
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
@@ -129,6 +157,8 @@ class SkuService extends BaseService
$skuInfo = $this->skuModel->getInfoById($id); $skuInfo = $this->skuModel->getInfoById($id);
$this->checkChefInfo();
if (empty($skuInfo)) throw new ErrException('原数据不存在,无法修改'); if (empty($skuInfo)) throw new ErrException('原数据不存在,无法修改');
$spuInfo = $this->spuModel->getInfoById($skuInfo->spu_id); $spuInfo = $this->spuModel->getInfoById($skuInfo->spu_id);

View File

@@ -148,7 +148,7 @@ class SpuService extends BaseService
$insertModel->city_id = $this->cityId; $insertModel->city_id = $this->cityId;
$insertModel->cycle_id = $cycleInfo->id; $insertModel->cycle_id = $cycleInfo->id;
$insertModel->kitchen_id = $this->request->input('kitchen_id'); $insertModel->kitchen_id = $this->request->input('kitchen_id');
$insertModel->chef_id = $this->request->input('chef_id'); // $insertModel->chef_id = $this->request->input('chef_id');
$insertModel->title = $title; $insertModel->title = $title;
$insertModel->sub_title = $this->request->input('sub_title',''); $insertModel->sub_title = $this->request->input('sub_title','');
$insertModel->caterer_id = $this->request->input('caterer_id'); $insertModel->caterer_id = $this->request->input('caterer_id');
@@ -192,11 +192,11 @@ class SpuService extends BaseService
if ($kitchenInfo->status == SiteCode::KITCHEN_DISABLE) throw new ErrException('该厨房已禁用'); if ($kitchenInfo->status == SiteCode::KITCHEN_DISABLE) throw new ErrException('该厨房已禁用');
$chefId = (int)$this->request->input('chef_id'); // $chefId = (int)$this->request->input('chef_id');
$chefInfo = $this->chefModel->getInfoById($chefId); // $chefInfo = $this->chefModel->getInfoById($chefId);
$chefUserInfo = $this->adminUserModel->getAdminInfoById($chefInfo->user_id); // $chefUserInfo = $this->adminUserModel->getAdminInfoById($chefInfo->user_id);
//
if ($chefUserInfo->status == UserCode::DISABLE) throw new ErrException('该厨师已禁用'); // if ($chefUserInfo->status == UserCode::DISABLE) throw new ErrException('该厨师已禁用');
} }
/** /**
@@ -213,7 +213,7 @@ class SpuService extends BaseService
$this->checkInfo(); $this->checkInfo();
$info->kitchen_id = $this->request->input('kitchen_id'); $info->kitchen_id = $this->request->input('kitchen_id');
$info->chef_id = $this->request->input('chef_id'); // $info->chef_id = $this->request->input('chef_id');
$info->title = $this->request->input('title'); $info->title = $this->request->input('title');
$info->caterer_id = $this->request->input('caterer_id'); $info->caterer_id = $this->request->input('caterer_id');
$info->sub_title = $this->request->input('sub_title',''); $info->sub_title = $this->request->input('sub_title','');