feat: spu
This commit is contained in:
@@ -15,11 +15,13 @@ use App\Constants\Common\GoodCode;
|
||||
use App\Constants\Common\SiteCode;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\AdminUser;
|
||||
use App\Model\Category;
|
||||
use App\Model\Chef;
|
||||
use App\Model\Cycle;
|
||||
use App\Model\Kitchen;
|
||||
use App\Model\Sku;
|
||||
use App\Model\Spu;
|
||||
use App\Model\SystemCity;
|
||||
use App\Service\Admin\BaseService;
|
||||
use App\Service\ServiceTrait\Admin\GetUserInfoTrait;
|
||||
use App\Service\ServiceTrait\Common\OssTrait;
|
||||
@@ -242,6 +244,19 @@ class SpuService extends BaseService
|
||||
return $this->return->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* @var SystemCity $systemCityModel
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemCity $systemCityModel;
|
||||
|
||||
/**
|
||||
* @var Category $categoryModel
|
||||
*/
|
||||
#[Inject]
|
||||
protected Category $categoryModel;
|
||||
|
||||
|
||||
/**
|
||||
* spu 详情
|
||||
* @return array
|
||||
@@ -253,6 +268,13 @@ class SpuService extends BaseService
|
||||
$info = $this->spuModel->getInfoById($id);
|
||||
if (empty($info)) throw new ErrException('数据不存在');
|
||||
|
||||
return $this->return->success('success',$info->toArray());
|
||||
$info = $info->toArray();
|
||||
|
||||
$info['city_name'] = $this->systemCityModel->getCityNameById((int)$info['city_id']);
|
||||
$info['kitchen_name'] = $this->kitchenModel->getNameById((int)$info['kitchen_id']);
|
||||
$info['chef_name'] = $this->chefModel->getChineseNameById((int)$info['chef_id']);
|
||||
$info['category_name'] = $this->categoryModel->getNameById((int)$info['category_id']);
|
||||
|
||||
return $this->return->success('success',$info);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user