feat : order list
This commit is contained in:
@@ -12,8 +12,11 @@ namespace App\Service\Admin\Good;
|
||||
|
||||
use App\Cache\Redis\Api\ApiRedisKey;
|
||||
use App\Cache\Redis\Api\GoodCache;
|
||||
use App\Constants\Admin\UserCode;
|
||||
use App\Constants\Common\GoodCode;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\AdminUser;
|
||||
use App\Model\Chef;
|
||||
use App\Model\Sku;
|
||||
use App\Model\Spu;
|
||||
use App\Service\Admin\BaseService;
|
||||
@@ -38,6 +41,18 @@ class SkuService extends BaseService
|
||||
#[Inject]
|
||||
protected Spu $spuModel;
|
||||
|
||||
/**
|
||||
* @var Chef
|
||||
*/
|
||||
#[Inject]
|
||||
protected Chef $chefModel;
|
||||
|
||||
/**
|
||||
* @var AdminUser
|
||||
*/
|
||||
#[Inject]
|
||||
protected AdminUser $adminUserModel;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -84,6 +99,8 @@ class SkuService extends BaseService
|
||||
$spuInfo = $this->spuModel->getInfoById($spuId);
|
||||
if (empty($spuInfo)) throw new ErrException('请选择spu');
|
||||
|
||||
$this->checkChefInfo();
|
||||
|
||||
$insertModel = new Sku();
|
||||
|
||||
$imageIds = $this->request->input('image_ids');
|
||||
@@ -118,6 +135,17 @@ class SkuService extends BaseService
|
||||
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
|
||||
* @throws ContainerExceptionInterface
|
||||
@@ -129,6 +157,8 @@ class SkuService extends BaseService
|
||||
|
||||
$skuInfo = $this->skuModel->getInfoById($id);
|
||||
|
||||
$this->checkChefInfo();
|
||||
|
||||
if (empty($skuInfo)) throw new ErrException('原数据不存在,无法修改');
|
||||
|
||||
$spuInfo = $this->spuModel->getInfoById($skuInfo->spu_id);
|
||||
|
||||
@@ -148,7 +148,7 @@ class SpuService extends BaseService
|
||||
$insertModel->city_id = $this->cityId;
|
||||
$insertModel->cycle_id = $cycleInfo->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->sub_title = $this->request->input('sub_title','');
|
||||
$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('该厨房已禁用');
|
||||
|
||||
$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('该厨师已禁用');
|
||||
// $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('该厨师已禁用');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +213,7 @@ class SpuService extends BaseService
|
||||
$this->checkInfo();
|
||||
|
||||
$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->caterer_id = $this->request->input('caterer_id');
|
||||
$info->sub_title = $this->request->input('sub_title','');
|
||||
|
||||
Reference in New Issue
Block a user