新车列表
This commit is contained in:
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\controller;
|
||||||
|
|
||||||
|
use support\Request;
|
||||||
|
use support\Response;
|
||||||
|
use app\apis\model\VehicleNewAlbumModel;
|
||||||
|
use app\apis\service\VehicleNewAlbumService;
|
||||||
|
use app\apis\validate\VehicleNewAlbumValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewAlbumController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewAlbumValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewAlbumService(new VehicleNewAlbumModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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\VehicleNewAlbumTranslationModel;
|
||||||
|
use app\apis\service\VehicleNewAlbumTranslationService;
|
||||||
|
use app\apis\validate\VehicleNewAlbumTranslationValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewAlbumTranslationController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewAlbumTranslationValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewAlbumTranslationService(new VehicleNewAlbumTranslationModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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\VehicleNewAskedModel;
|
||||||
|
use app\apis\service\VehicleNewAskedService;
|
||||||
|
use app\apis\validate\VehicleNewAskedValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewAskedController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewAskedValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewAskedService(new VehicleNewAskedModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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\VehicleNewAskedTranslationModel;
|
||||||
|
use app\apis\service\VehicleNewAskedTranslationService;
|
||||||
|
use app\apis\validate\VehicleNewAskedTranslationValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewAskedTranslationController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewAskedTranslationValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewAskedTranslationService(new VehicleNewAskedTranslationModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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\VehicleNewContentModel;
|
||||||
|
use app\apis\service\VehicleNewContentService;
|
||||||
|
use app\apis\validate\VehicleNewContentValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewContentController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewContentValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewContentService(new VehicleNewContentModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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\VehicleNewContentTranslationModel;
|
||||||
|
use app\apis\service\VehicleNewContentTranslationService;
|
||||||
|
use app\apis\validate\VehicleNewContentTranslationValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewContentTranslationController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewContentTranslationValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewContentTranslationService(new VehicleNewContentTranslationModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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,154 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\controller;
|
||||||
|
|
||||||
|
use support\Request;
|
||||||
|
use support\Response;
|
||||||
|
use app\apis\model\VehicleNewModel;
|
||||||
|
use app\apis\service\VehicleNewService;
|
||||||
|
use app\apis\validate\VehicleNewValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewService(new VehicleNewModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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'],
|
||||||
|
'vin' => $item['vin'],
|
||||||
|
'price' => $item['price'],
|
||||||
|
'cover' => $item['cover'],
|
||||||
|
'brand' => is_array($item['brand']) ? $item['brand']['translation']['brand_id'] : $item['brand'],
|
||||||
|
'energy' => is_array($item['energy']) ? $item['energy']['translation']['energy_id'] : $item['energy'],
|
||||||
|
'type' => isset($item['types']) ? $item['types']['translation']['type_id'] : $item['type'],
|
||||||
|
'model' => isset($item['models']) ? $item['models']['translation']['model_id'] : $item['model'],
|
||||||
|
'video' => $item['video'],
|
||||||
|
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
|
||||||
|
'condition_desc' => isset($item['translation']) ? $item['translation']['condition_desc'] : '',
|
||||||
|
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s', $item['updated_at']),
|
||||||
|
|
||||||
|
'brand_name' => is_array($item['brand']) ? $item['brand']['translation']['name'] : '',
|
||||||
|
'energy_name' => is_array($item['energy']) ? $item['energy']['translation']['name'] : '',
|
||||||
|
'type_name' => isset($item['types']) ? $item['types']['translation']['name'] : '',
|
||||||
|
'model_name' => isset($item['models']) ? $item['models']['translation']['name'] : '',
|
||||||
|
];
|
||||||
|
if ($item['cover']) {
|
||||||
|
$result['cover_full'] = (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($item['cover']);
|
||||||
|
}
|
||||||
|
if ($item['video']) {
|
||||||
|
$result['video_full'] = (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($item['video']);
|
||||||
|
}
|
||||||
|
foreach ($item['asked'] as $asked) {
|
||||||
|
$askedRes['id'] = $asked['id'];
|
||||||
|
$askedRes['vehicle_id'] = $asked['vehicle_id'];
|
||||||
|
$askedRes['status'] = $asked['status'];
|
||||||
|
$askedRes['title'] = isset($asked['translation']) ? $asked['translation']['title']:'';
|
||||||
|
$askedRes['content'] = isset($asked['translation']) ? $asked['translation']['content']:'';
|
||||||
|
$result['asked'][] = $askedRes;
|
||||||
|
}
|
||||||
|
foreach ($item['trait'] as $trait) {
|
||||||
|
$traitRes['id'] = $trait['id'];
|
||||||
|
$traitRes['vehicle_id'] = $trait['vehicle_id'];
|
||||||
|
$traitRes['status'] = $trait['status'];
|
||||||
|
$traitRes['title'] = isset($trait['translation']) ? $trait['translation']['title']:'';
|
||||||
|
$traitRes['content'] = isset($trait['translation']) ? $trait['translation']['content']:'';
|
||||||
|
$result['trait'][] = $traitRes;
|
||||||
|
}
|
||||||
|
foreach ($item['album'] as $album) {
|
||||||
|
$albumRes['id'] = $album['id'];
|
||||||
|
$albumRes['vehicle_id'] = $album['vehicle_id'];
|
||||||
|
$albumRes['pic'] = $album['pic'];
|
||||||
|
$albumRes['status'] = $album['status'];
|
||||||
|
$albumRes['alt'] = isset($album['translation']) ? $album['translation']['alt']:'';
|
||||||
|
|
||||||
|
if ($albumRes['pic']) {
|
||||||
|
$albumRes['pic_full'] = (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($albumRes['pic']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result['album'][] = $albumRes;
|
||||||
|
}
|
||||||
|
foreach ($item['content'] as $content) {
|
||||||
|
$contentRes['id'] = $content['id'];
|
||||||
|
$contentRes['vehicle_id'] = $content['vehicle_id'];
|
||||||
|
$contentRes['status'] = $content['status'];
|
||||||
|
$contentRes['content'] = isset($content['translation']) ? $content['translation']['content']:'';
|
||||||
|
$result['content'][] = $contentRes;
|
||||||
|
}
|
||||||
|
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 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\controller;
|
||||||
|
|
||||||
|
use support\Request;
|
||||||
|
use support\Response;
|
||||||
|
use app\apis\model\VehicleNewTraitModel;
|
||||||
|
use app\apis\service\VehicleNewTraitService;
|
||||||
|
use app\apis\validate\VehicleNewTraitValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewTraitController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewTraitValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewTraitService(new VehicleNewTraitModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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\VehicleNewTraitTranslationModel;
|
||||||
|
use app\apis\service\VehicleNewTraitTranslationService;
|
||||||
|
use app\apis\validate\VehicleNewTraitTranslationValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewTraitTranslationController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewTraitTranslationValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewTraitTranslationService(new VehicleNewTraitTranslationModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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\VehicleNewTranslationModel;
|
||||||
|
use app\apis\service\VehicleNewTranslationService;
|
||||||
|
use app\apis\validate\VehicleNewTranslationValidator;
|
||||||
|
use app\mzl\common\controller\BaseController;
|
||||||
|
|
||||||
|
class VehicleNewTranslationController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要验证token的接口
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedJwt = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected mixed $validator = VehicleNewTranslationValidator::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回业务 Service 实例
|
||||||
|
*/
|
||||||
|
protected function getService()
|
||||||
|
{
|
||||||
|
return new VehicleNewTranslationService(new VehicleNewTranslationModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段处理 (根据场景处理)
|
||||||
|
* @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,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewAlbumModel
|
||||||
|
*/
|
||||||
|
class VehicleNewAlbumModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_album';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'vehicle_id', 'pic', 'status', 'sort', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单条翻译
|
||||||
|
*/
|
||||||
|
public function translation()
|
||||||
|
{
|
||||||
|
return $this->hasOne(VehicleNewAlbumTranslationModel::class, 'album_id')->where('locale', locale());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多条翻译
|
||||||
|
*/
|
||||||
|
public function translations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewAlbumTranslationModel::class, 'album_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
const TRANS_FIELDS = [
|
||||||
|
'alt',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewAlbumTranslationModel
|
||||||
|
*/
|
||||||
|
class VehicleNewAlbumTranslationModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_album_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'album_id', 'locale', 'alt', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewAskedModel
|
||||||
|
*/
|
||||||
|
class VehicleNewAskedModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_asked';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'vehicle_id', 'status', 'sort', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相册字段
|
||||||
|
*/
|
||||||
|
const VEHICLE_NEW_ASKED_FIELDS = [
|
||||||
|
'title',
|
||||||
|
'content',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单条翻译
|
||||||
|
*/
|
||||||
|
public function translation()
|
||||||
|
{
|
||||||
|
return $this->hasOne(VehicleNewAskedTranslationModel::class, 'asked_id')->where('locale', locale());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多条翻译
|
||||||
|
*/
|
||||||
|
public function translations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewAskedTranslationModel::class, 'asked_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewAskedTranslationModel
|
||||||
|
*/
|
||||||
|
class VehicleNewAskedTranslationModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_asked_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'asked_id', 'locale', 'title', 'content', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewContentModel
|
||||||
|
*/
|
||||||
|
class VehicleNewContentModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_content';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'vehicle_id', 'status', 'sort', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单条翻译
|
||||||
|
*/
|
||||||
|
public function translation()
|
||||||
|
{
|
||||||
|
return $this->hasOne(VehicleNewContentTranslationModel::class, 'content_id')->where('locale', locale());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多条翻译
|
||||||
|
*/
|
||||||
|
public function translations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewContentTranslationModel::class, 'content_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewContentTranslationModel
|
||||||
|
*/
|
||||||
|
class VehicleNewContentTranslationModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_content_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'content_id', 'locale', 'content', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewModel
|
||||||
|
*/
|
||||||
|
class VehicleNewModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'vin', 'brand', 'cover', 'album', 'price', 'type', 'energy', 'model', 'video', 'views', 'created_at', 'updated_at', 'location'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
const TRANS_FIELDS = [
|
||||||
|
'name', 'condition_desc'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单条翻译
|
||||||
|
*/
|
||||||
|
public function translation()
|
||||||
|
{
|
||||||
|
return $this->hasOne(VehicleNewTranslationModel::class, 'vehicle_id')->where('locale', locale());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多条翻译
|
||||||
|
*/
|
||||||
|
public function translations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewTranslationModel::class, 'vehicle_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function brand()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BrandModel::class, 'brand');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function models()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ModelModel::class, 'model');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function location()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(LocationModel::class, 'location');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function types()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(TypesModel::class, 'type', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function energy()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(EnergyModel::class, 'energy', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function album()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewAlbumModel::class, 'vehicle_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asked()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewAskedModel::class, 'vehicle_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function trait()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewTraitModel::class, 'vehicle_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function content()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewContentModel::class, 'vehicle_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewTraitModel
|
||||||
|
*/
|
||||||
|
class VehicleNewTraitModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_trait';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'vehicle_id', 'status', 'sort', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单条翻译
|
||||||
|
*/
|
||||||
|
public function translation()
|
||||||
|
{
|
||||||
|
return $this->hasOne(VehicleNewTraitTranslationModel::class, 'trait_id')->where('locale', locale());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多条翻译
|
||||||
|
*/
|
||||||
|
public function translations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleNewTraitTranslationModel::class, 'trait_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewTraitTranslationModel
|
||||||
|
*/
|
||||||
|
class VehicleNewTraitTranslationModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_trait_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'trait_id', 'locale', 'title', 'content', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VehicleNewTranslationModel
|
||||||
|
*/
|
||||||
|
class VehicleNewTranslationModel extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'hs_vehicle_new_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型的数据字段的保存格式。
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'vehicle_id', 'locale', 'name', 'condition_desc', 'location', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewAlbumModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewAlbumService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewAlbumModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewAlbumTranslationModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewAlbumTranslationService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewAlbumTranslationModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewAskedModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewAskedService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewAskedModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewAskedTranslationModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewAskedTranslationService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewAskedTranslationModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewContentModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewContentService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewContentModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewContentTranslationModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewContentTranslationService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewContentTranslationModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'default' => function ($params) {
|
||||||
|
$keyword = $params['keyword'] ?? '';
|
||||||
|
return [
|
||||||
|
'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
],
|
||||||
|
'fields' => ['id', 'vin', 'brand', 'cover', 'price', 'type', 'energy', 'model', 'video', 'views', 'created_at', 'updated_at'],
|
||||||
|
'relations' => [
|
||||||
|
'translation' => ['vehicle_id', 'locale', 'name', 'condition_desc', 'location'],
|
||||||
|
'asked' => ['id', 'vehicle_id', 'status', 'sort'],
|
||||||
|
'asked.translation' => ['id', 'asked_id', 'locale', 'title', 'content'],
|
||||||
|
'trait' => ['id', 'vehicle_id', 'status', 'sort'],
|
||||||
|
'trait.translation' => ['id', 'trait_id', 'locale', 'title', 'content'],
|
||||||
|
'album' => ['id', 'vehicle_id', 'pic', 'status', 'sort'],
|
||||||
|
'album.translation' => ['id', 'album_id', 'locale', 'alt'],
|
||||||
|
'content' => ['id', 'vehicle_id', 'status', 'sort'],
|
||||||
|
'content.translation' => ['id', 'content_id', 'locale', 'content'],
|
||||||
|
'brand.translation' => ['brand_id', 'name'],
|
||||||
|
'types.translation' => ['type_id', 'name'],
|
||||||
|
'energy.translation' => ['energy_id', 'name'],
|
||||||
|
'models.translation' => ['model_id', 'name'],
|
||||||
|
],
|
||||||
|
'sorts' => [
|
||||||
|
['field' => 'id', 'direction' => 'desc']
|
||||||
|
],
|
||||||
|
'pagination' => [
|
||||||
|
'page' => $params['page'] ?? 1,
|
||||||
|
'per_page' => $params['per_page'] ?? 10,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
},
|
||||||
|
'show' => function ($params) {
|
||||||
|
$keyword = $params['keyword'] ?? '';
|
||||||
|
return [
|
||||||
|
'filters' => [
|
||||||
|
['field'=>'id', 'operator'=>'=', 'value'=> $params['id']],
|
||||||
|
],
|
||||||
|
'fields' => ['id', 'vin', 'brand', 'cover', 'price', 'type', 'energy', 'model', 'video', 'views', 'created_at', 'updated_at'],
|
||||||
|
'relations' => [
|
||||||
|
'translation' => ['vehicle_id', 'locale', 'name', 'condition_desc', 'location'],
|
||||||
|
'asked' => ['id', 'vehicle_id', 'status', 'sort'],
|
||||||
|
'asked.translation' => ['id', 'asked_id', 'locale', 'title', 'content'],
|
||||||
|
'trait' => ['id', 'vehicle_id', 'status', 'sort'],
|
||||||
|
'trait.translation' => ['id', 'trait_id', 'locale', 'title', 'content'],
|
||||||
|
'album' => ['id', 'vehicle_id', 'pic', 'status', 'sort'],
|
||||||
|
'album.translation' => ['id', 'album_id', 'locale', 'alt'],
|
||||||
|
'content' => ['id', 'vehicle_id', 'status', 'sort'],
|
||||||
|
'content.translation' => ['id', 'content_id', 'locale', 'content'],
|
||||||
|
'brand.translation' => ['brand_id', 'name'],
|
||||||
|
'types.translation' => ['type_id', 'name'],
|
||||||
|
'energy.translation' => ['energy_id', 'name'],
|
||||||
|
'models.translation' => ['model_id', 'name'],
|
||||||
|
],
|
||||||
|
'sorts' => [
|
||||||
|
['field' => 'id', 'direction' => 'desc']
|
||||||
|
],
|
||||||
|
'pagination' => [
|
||||||
|
'page' => $params['page'] ?? 1,
|
||||||
|
'per_page' => $params['per_page'] ?? 10,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 声明需要多语言翻译
|
||||||
|
protected array $translatable = [
|
||||||
|
'condition_desc','name',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewTraitModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewTraitService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewTraitModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewTraitTranslationModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewTraitTranslationService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewTraitTranslationModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\service;
|
||||||
|
|
||||||
|
use app\apis\model\VehicleNewTranslationModel;
|
||||||
|
use app\mzl\common\services\BaseService;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VehicleNewTranslationService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 定义模型
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModel(): string
|
||||||
|
{
|
||||||
|
return VehicleNewTranslationModel::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多场景配置
|
||||||
|
*/
|
||||||
|
public function queryScenes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// 'default' => function ($params) {
|
||||||
|
// $keyword = $params['keyword'] ?? '';
|
||||||
|
// return [
|
||||||
|
// 'filters' => [
|
||||||
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||||
|
// ],
|
||||||
|
// 'fields' => ['id'],
|
||||||
|
// 'relations' => [],
|
||||||
|
// 'custom' => function(Builder $q) use ($keyword) {
|
||||||
|
// // 示例
|
||||||
|
// if ($keyword) {
|
||||||
|
// $q->where(function($q2) use($keyword) {
|
||||||
|
// $q2->whereHas('***', function($q3) use($keyword) {
|
||||||
|
// $q3->where('***', 'like', "%{$keyword}%");
|
||||||
|
// })->orWhereHas('***', function($q4) use($keyword) {
|
||||||
|
// $q4->where('***', 'like', "%{$keyword}%");
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'sorts' => [
|
||||||
|
// ['field' => 'created_at', 'direction' => 'desc']
|
||||||
|
// ],
|
||||||
|
// 'pagination' => [
|
||||||
|
// 'page' => $params['page'] ?? 1,
|
||||||
|
// 'per_page' => $params['per_page'] ?? 10,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewAlbumTranslationValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewAlbumValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewAskedTranslationValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewAskedValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewContentTranslationValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewContentValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewTraitTranslationValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewTraitValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewTranslationValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\apis\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class VehicleNewValidator extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -65,7 +65,7 @@ class BrandBannerModel extends Model
|
|||||||
*/
|
*/
|
||||||
public function translation()
|
public function translation()
|
||||||
{
|
{
|
||||||
return $this->hasOne(BrandBannerTranslationModel::class, 'brand_id')->where('locale', locale());
|
return $this->hasOne(BrandBannerTranslationModel::class, 'banner_id')->where('locale', locale());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,11 +73,11 @@ class BrandBannerModel extends Model
|
|||||||
*/
|
*/
|
||||||
public function translations()
|
public function translations()
|
||||||
{
|
{
|
||||||
return $this->hasMany(VehicleDataTranslationModel::class, 'brand_id');
|
return $this->hasMany(VehicleDataTranslationModel::class, 'banner_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const TRANS_FIELDS = [
|
const TRANS_FIELDS = [
|
||||||
'name', 'condition_desc'
|
'alt'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -79,6 +79,6 @@ class BrandTraitModel extends Model
|
|||||||
|
|
||||||
|
|
||||||
const TRANS_FIELDS = [
|
const TRANS_FIELDS = [
|
||||||
'name', 'condition_desc'
|
'title', 'content'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -70,6 +70,9 @@ class VehicleNewAlbumModel extends Model
|
|||||||
return $this->hasMany(VehicleNewAlbumTranslationModel::class, 'album_id');
|
return $this->hasMany(VehicleNewAlbumTranslationModel::class, 'album_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const VEHICLE_NEW_ALBUM_FIELDS = [
|
||||||
|
'pic',
|
||||||
|
];
|
||||||
const TRANS_FIELDS = [
|
const TRANS_FIELDS = [
|
||||||
'alt',
|
'alt',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ Route::group('/apis', function() {
|
|||||||
Route::any('/agt/privacy', [\app\apis\controller\AgreementController::class, 'one']);
|
Route::any('/agt/privacy', [\app\apis\controller\AgreementController::class, 'one']);
|
||||||
// 品牌按字母查询
|
// 品牌按字母查询
|
||||||
// Route::any('/brand/letterAll', [\app\apis\controller\BrandController::class, 'letterAll']);
|
// Route::any('/brand/letterAll', [\app\apis\controller\BrandController::class, 'letterAll']);
|
||||||
|
// 新车管理
|
||||||
|
Route::any('/vehicle/new/list', [\app\console\controller\VehicleNewController::class, 'index']);
|
||||||
|
Route::any('/vehicle/new/{id}/detail', [\app\console\controller\VehicleNewController::class, 'detail']);
|
||||||
});
|
});
|
||||||
// ====== ====== ====== 网站 ====== ====== ======
|
// ====== ====== ====== 网站 ====== ====== ======
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user