feat: spu

This commit is contained in:
2025-01-21 10:28:40 +08:00
parent 8e454659e1
commit df78fc705d
5 changed files with 63 additions and 1 deletions

View File

@@ -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);
}
}