This commit is contained in:
2025-06-18 14:05:52 +08:00
parent 93ee1c3d47
commit 0955e8c9d8
28 changed files with 1483 additions and 0 deletions
@@ -0,0 +1,81 @@
<?php
namespace app\apis\controller;
use support\Request;
use support\Response;
use app\apis\model\VehicleNewAttributeValuesModel;
use app\apis\service\VehicleNewAttributeValuesService;
use app\apis\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\apis\controller;
use support\Request;
use support\Response;
use app\apis\model\VehicleNewAttributeValuesTranslationModel;
use app\apis\service\VehicleNewAttributeValuesTranslationService;
use app\apis\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,81 @@
<?php
namespace app\apis\controller;
use support\Request;
use support\Response;
use app\apis\model\VehicleNewAttributesModel;
use app\apis\service\VehicleNewAttributesService;
use app\apis\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') {
}
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\apis\controller;
use support\Request;
use support\Response;
use app\apis\model\VehicleNewAttributesTranslationModel;
use app\apis\service\VehicleNewAttributesTranslationService;
use app\apis\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());
}
}
}
@@ -2,6 +2,8 @@
namespace app\apis\controller;
use app\apis\model\VehicleNewAttributesTranslationModel;
use app\apis\model\VehicleNewAttributeValuesTranslationModel;
use support\Request;
use support\Response;
use app\apis\model\VehicleNewModel;
@@ -104,6 +106,16 @@ class VehicleNewController extends BaseController
$contentRes['content'] = isset($content['translation']) ? $content['translation']['content']:'';
$result['content'][] = $contentRes;
}
foreach ($item['sku'] as &$sku) {
foreach ($sku['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'];
}
$result['sku'][] = $sku;
}
return $result;
}
@@ -0,0 +1,81 @@
<?php
namespace app\apis\controller;
use support\Request;
use support\Response;
use app\apis\model\VehicleNewSkuAttributesModel;
use app\apis\service\VehicleNewSkuAttributesService;
use app\apis\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') {
}
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,98 @@
<?php
namespace app\apis\controller;
use app\apis\model\VehicleNewAttributesTranslationModel;
use app\apis\model\VehicleNewAttributeValuesTranslationModel;
use support\Request;
use support\Response;
use app\apis\model\VehicleNewSkusModel;
use app\apis\service\VehicleNewSkusService;
use app\apis\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 {
return parent::index($request, $scene);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
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());
}
}
}