新车sku

This commit is contained in:
2025-06-17 15:54:24 +08:00
parent 50e962c4aa
commit fee2241317
35 changed files with 2400 additions and 3 deletions
@@ -129,9 +129,6 @@ class BrandController extends BaseController
*/
public function index(Request $request, string $scene = 'default'): Response
{
// $Brand = BrandModel::with('banner')->with('trait')->where('id',314)->first()->toArray();
// var_dump($Brand);
// return json($Brand);
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
@@ -0,0 +1,119 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleNewAttributeCategoriesModel;
use app\console\service\VehicleNewAttributeCategoriesService;
use app\console\validate\VehicleNewAttributeCategoriesValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewAttributeCategoriesController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewAttributeCategoriesValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewAttributeCategoriesService(new VehicleNewAttributeCategoriesModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default' || $scene === 'show') {
$result = [
'id' => $item['id'],
'sort_order' => $item['sort_order'],
'category_name' => isset($item['translation']) ? $item['translation']['category_name'] : '',
];
return $result;
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
public function add(Request $request): Response
{
try {
return $this->getService()->add($request->all())
? $this->successResponse()
: $this->errorResponse();
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
public function edit(Request $request, int $id): Response
{
try {
return $this->getService()->edit($request->all(), $id)
? $this->successResponse()
: $this->errorResponse();
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
public function detail(Request $request, int $id, string $scene = 'show'): Response
{
try {
$request->setGet(['id'=>$id]);
return parent::one($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleNewAttributeCategoriesTranslationModel;
use app\console\service\VehicleNewAttributeCategoriesTranslationService;
use app\console\validate\VehicleNewAttributeCategoriesTranslationValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewAttributeCategoriesTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewAttributeCategoriesTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewAttributeCategoriesTranslationService(new VehicleNewAttributeCategoriesTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleNewAttributeValuesModel;
use app\console\service\VehicleNewAttributeValuesService;
use app\console\validate\VehicleNewAttributeValuesValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewAttributeValuesController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewAttributeValuesValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewAttributeValuesService(new VehicleNewAttributeValuesModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleNewAttributeValuesTranslationModel;
use app\console\service\VehicleNewAttributeValuesTranslationService;
use app\console\validate\VehicleNewAttributeValuesTranslationValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewAttributeValuesTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewAttributeValuesTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewAttributeValuesTranslationService(new VehicleNewAttributeValuesTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
}
@@ -0,0 +1,125 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleNewAttributesModel;
use app\console\service\VehicleNewAttributesService;
use app\console\validate\VehicleNewAttributesValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewAttributesController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewAttributesValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewAttributesService(new VehicleNewAttributesModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default' || $scene === 'show') {
$result = [
'id' => $item['id'],
'status' => $item['status'],
'attribute_name' => isset($item['translation']) ? $item['translation']['attribute_name'] : '',
];
foreach ($item['value'] as $value) {
$valueRes['id'] = $value['id'];
$valueRes['attribute_id'] = $value['attribute_id'];
$valueRes['value_name'] = isset($value['translation']) ? $value['translation']['value_name']:'';
$result['value'][] = $valueRes;
}
return $result;
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getFile().$th->getLine());
}
}
public function add(Request $request): Response
{
try {
return $this->getService()->add($request->all())
? $this->successResponse()
: $this->errorResponse();
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
public function edit(Request $request, int $id): Response
{
try {
return $this->getService()->edit($request->all(), $id)
? $this->successResponse()
: $this->errorResponse();
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
public function detail(Request $request, int $id, string $scene = 'show'): Response
{
try {
$request->setGet(['id'=>$id]);
return parent::one($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleNewAttributesTranslationModel;
use app\console\service\VehicleNewAttributesTranslationService;
use app\console\validate\VehicleNewAttributesTranslationValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewAttributesTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewAttributesTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewAttributesTranslationService(new VehicleNewAttributesTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
}
@@ -0,0 +1,87 @@
<?php
namespace app\console\controller;
use app\console\model\VehicleNewAttributesTranslationModel;
use app\console\model\VehicleNewAttributeValuesTranslationModel;
use support\Request;
use support\Response;
use app\console\model\VehicleNewSkuAttributesModel;
use app\console\service\VehicleNewSkuAttributesService;
use app\console\validate\VehicleNewSkuAttributesValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewSkuAttributesController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewSkuAttributesValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewSkuAttributesService(new VehicleNewSkuAttributesModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default' || $scene === 'show') {
$attribute = VehicleNewAttributesTranslationModel::where(['attributes_id' => $item['attribute']['id'],'locale'=>locale()])->first();
$value = VehicleNewAttributeValuesTranslationModel::where(['values_id' => $item['value']['id'],'locale'=>locale()])->first();
$item['attribute']['attribute_name'] = $attribute['attribute_name'] ;
$item['value']['value_name'] = $value['value_name'];
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
}
@@ -0,0 +1,125 @@
<?php
namespace app\console\controller;
use app\console\model\VehicleNewAttributesTranslationModel;
use app\console\model\VehicleNewAttributeValuesTranslationModel;
use app\console\model\VehicleNewSkuAttributesModel;
use support\Request;
use support\Response;
use app\console\model\VehicleNewSkusModel;
use app\console\service\VehicleNewSkusService;
use app\console\validate\VehicleNewSkusValidator;
use app\mzl\common\controller\BaseController;
class VehicleNewSkusController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleNewSkusValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleNewSkusService(new VehicleNewSkusModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default' || $scene === 'show') {
foreach ($item['skuAttributes'] as &$skuAttribute){
$attribute = VehicleNewAttributesTranslationModel::where(['attributes_id' => $skuAttribute['attribute']['id'],'locale'=>locale()])->first();
$value = VehicleNewAttributeValuesTranslationModel::where(['values_id' => $skuAttribute['value']['id'],'locale'=>locale()])->first();
$skuAttribute['attribute']['attribute_name'] = $attribute['attribute_name'] ;
$skuAttribute['value']['value_name'] = $value['value_name'];
}
}
return $item;
}
/**
* 参数预处理 (根据场景处理)
* @param Request $request
* @param string $scene
* @return array
*/
protected function prepareParams(Request $request, string $scene): array
{
$params = parent::prepareParams($request, $scene);
if ($scene === 'default') {
}
return $params;
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request, string $scene = 'default'): Response
{
try {
// $res = VehicleNewSkusModel::with('skuAttributes')->find(9);
// return $this->successResponse($res);
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
public function add(Request $request): Response
{
try {
return $this->getService()->add($request->all())
? $this->successResponse()
: $this->errorResponse();
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
public function edit(Request $request, int $id): Response
{
try {
return $this->getService()->edit($request->all(), $id)
? $this->successResponse()
: $this->errorResponse();
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage().$th->getLine().$th->getFile());
}
}
public function detail(Request $request, int $id, string $scene = 'show'): Response
{
try {
$request->setGet(['id'=>$id]);
return parent::one($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
}