Initial commit

This commit is contained in:
18338781771
2025-05-14 13:19:23 +08:00
commit 1ab607f65a
313 changed files with 27595 additions and 0 deletions
@@ -0,0 +1,111 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\AgreementModel;
use app\console\service\AgreementService;
use app\console\validate\AgreementValidator;
use app\mzl\common\controller\BaseController;
class AgreementController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = AgreementValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new AgreementService(new AgreementModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
return [
'id' => $item['id'],
'key' => $item['key'],
'status' => $item['status'],
'title' => isset($item['translation']) ? $item['translation']['title'] : '',
'content' => isset($item['translation']) ? $item['translation']['content'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at'])
];
}
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());
}
}
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());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\AgreementTranslationModel;
use app\console\service\AgreementTranslationService;
use app\console\validate\AgreementTranslationValidator;
use app\mzl\common\controller\BaseController;
class AgreementTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = AgreementTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new AgreementTranslationService(new AgreementTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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());
}
}
}
+129
View File
@@ -0,0 +1,129 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\BrandModel;
use app\console\service\BrandService;
use app\console\validate\BrandValidator;
use app\mzl\common\controller\BaseController;
class BrandController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = BrandValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new BrandService(new BrandModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
return [
'id' => $item['id'],
'status' => $item['status'],
'sort' => $item['sort'],
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at'])
];
}
if ($scene === 'preset') {
return [
'id' => $item['id'],
'name' => isset($item['translation']) ? $item['translation']['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 presets(Request $request, string $scene = 'preset'): Response
{
try {
return parent::all($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());
}
}
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());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\BrandTranslationModel;
use app\console\service\BrandTranslationService;
use app\console\validate\BrandTranslationValidator;
use app\mzl\common\controller\BaseController;
class BrandTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = BrandTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new BrandTranslationService(new BrandTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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\DraftsModel;
use app\console\service\DraftsService;
use app\console\validate\DraftsValidator;
use app\mzl\common\controller\BaseController;
class DraftsController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = DraftsValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new DraftsService(new DraftsModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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());
}
}
}
+129
View File
@@ -0,0 +1,129 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\EnergyModel;
use app\console\service\EnergyService;
use app\console\validate\EnergyValidator;
use app\mzl\common\controller\BaseController;
class EnergyController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = EnergyValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new EnergyService(new EnergyModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
return [
'id' => $item['id'],
'status' => $item['status'],
'sort' => $item['sort'],
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at'])
];
}
if ($scene === 'preset') {
return [
'id' => $item['id'],
'name' => isset($item['translation']) ? $item['translation']['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 presets(Request $request, string $scene = 'preset'): Response
{
try {
return parent::all($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());
}
}
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());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\EnergyTranslationModel;
use app\console\service\EnergyTranslationService;
use app\console\validate\EnergyTranslationValidator;
use app\mzl\common\controller\BaseController;
class EnergyTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = EnergyTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new EnergyTranslationService(new EnergyTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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());
}
}
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace app\console\controller;
use app\console\model\BrandModel;
use support\Request;
use support\Response;
use app\console\model\VehicleDataModel;
use app\console\service\VehicleDataService;
use app\console\validate\VehicleDataValidator;
use app\mzl\common\controller\BaseController;
class HomeController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleDataValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleDataService(new VehicleDataModel());
}
/**
* 分页
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function datas(Request $request): Response
{
try {
$vehicleCounts = VehicleDataModel::count('id');
$inTransitCounts = VehicleDataModel::where('store_status', 2)->count('id');
$inOrderCounts = VehicleDataModel::where('store_status', 3)->count('id');
$brandCounts = BrandModel::count('id');
$data = [
'vehicleCounts' => $vehicleCounts,
'inTransitCounts' => $inTransitCounts,
'inOrderCounts' => $inOrderCounts,
'brandCounts' => $brandCounts
];
return $this->successResponse($data);
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
}
@@ -0,0 +1,126 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\LocationModel;
use app\console\service\LocationService;
use app\console\validate\LocationValidator;
use app\mzl\common\controller\BaseController;
class LocationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = LocationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new LocationService(new LocationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
return [
'id' => $item['id'],
'status' => $item['status'],
'sort' => $item['sort'],
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at'])
];
}
if ($scene === 'preset') {
return [
'id' => $item['id'],
'name' => isset($item['translation']) ? $item['translation']['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 presets(Request $request, string $scene = 'preset'): Response
{
try {
return parent::all($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());
}
}
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());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\LocationTranslationModel;
use app\console\service\LocationTranslationService;
use app\console\validate\LocationTranslationValidator;
use app\mzl\common\controller\BaseController;
class LocationTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = LocationTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new LocationTranslationService(new LocationTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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());
}
}
}
+131
View File
@@ -0,0 +1,131 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\ModelModel;
use app\console\service\ModelService;
use app\console\validate\ModelValidator;
use app\mzl\common\controller\BaseController;
class ModelController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = ModelValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new ModelService(new ModelModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
return [
'id' => $item['id'],
'status' => $item['status'],
'sort' => $item['sort'],
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
'brand_id' => $item['brand_id'],
'brand' => isset($item['brand']) ? $item['brand']['translation']['name'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at'])
];
}
if ($scene === 'preset') {
return [
'id' => $item['id'],
'name' => isset($item['translation']) ? $item['translation']['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 presets(Request $request, string $scene = 'preset'): Response
{
try {
return parent::all($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());
}
}
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());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\ModelTranslationModel;
use app\console\service\ModelTranslationService;
use app\console\validate\ModelTranslationValidator;
use app\mzl\common\controller\BaseController;
class ModelTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = ModelTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new ModelTranslationService(new ModelTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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());
}
}
}
+131
View File
@@ -0,0 +1,131 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\TypesModel;
use app\console\service\TypesService;
use app\console\validate\TypesValidator;
use app\mzl\common\controller\BaseController;
class TypesController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = TypesValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new TypesService(new TypesModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
return [
'id' => $item['id'],
'img_full' => $item['img'] ? (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($item['img']) : '',
'img' => $item['img'],
'status' => $item['status'],
'sort' => $item['sort'],
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at'])
];
}
if ($scene === 'preset') {
return [
'id' => $item['id'],
'name' => isset($item['translation']) ? $item['translation']['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 presets(Request $request, string $scene = 'preset'): Response
{
try {
return parent::all($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());
}
}
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());
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\TypesTranslationModel;
use app\console\service\TypesTranslationService;
use app\console\validate\TypesTranslationValidator;
use app\mzl\common\controller\BaseController;
class TypesTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = TypesTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new TypesTranslationService(new TypesTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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,77 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\UsersModel;
use app\console\service\UsersService;
use app\console\validate\UsersValidator;
use app\mzl\common\controller\BaseController;
class UsersController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = UsersValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new UsersService(new UsersModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
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,77 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleAlbumModel;
use app\console\service\VehicleAlbumService;
use app\console\validate\VehicleAlbumValidator;
use app\mzl\common\controller\BaseController;
class VehicleAlbumController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleAlbumValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleAlbumService(new VehicleAlbumModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
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,101 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleApplyModel;
use app\console\service\VehicleApplyService;
use app\console\validate\VehicleApplyValidator;
use app\mzl\common\controller\BaseController;
class VehicleApplyController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleApplyValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleApplyService(new VehicleApplyModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
return [
'id' => $item['id'],
'vehicle_data_id' => $item['vehicle_data_id'],
'apply_status' => $item['apply_status'],
'desc' => $item['desc'],
'name' => $item['vehicleDataInfo'] ? $item['vehicleDataInfo']['translation']['name'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at'])
];
}
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 doApply(Request $request, int $id): Response
{
try {
return $this->getService()->doApply($request->all(), $id)
? $this->successResponse()
: $this->errorResponse();
} catch (\Throwable $th) {
return $this->errorResponse($th->getMessage());
}
}
}
@@ -0,0 +1,248 @@
<?php
namespace app\console\controller;
use support\Request;
use support\Response;
use app\console\model\VehicleDataModel;
use app\console\service\VehicleDataService;
use app\console\validate\VehicleDataValidator;
use app\mzl\common\controller\BaseController;
class VehicleDataController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleDataValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleDataService(new VehicleDataModel());
}
/**
* 额外字段处理 (根据场景处理)
* @param array $item
* @param string $scene
* @return array
*/
protected function postProcessItem(array $item, string $scene): array
{
if ($scene === 'default') {
if ($item['cover']) {
$item['cover'] = (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($item['cover']);
}
return [
'id' => $item['id'],
'vin' => $item['vin'],
'user_nickname' => isset($item['user']) ? $item['user']['nickname'] : '',
'price' => $item['price'],
'brand' => is_array($item['brand']) ? $item['brand']['translation']['name'] : '',
'energy' => is_array($item['energy']) ? $item['energy']['translation']['name'] : '',
'type' => isset($item['types']) ? $item['types']['translation']['name'] : '',
'model' => isset($item['models']) ? $item['models']['translation']['name'] : '',
'mileage' => $item['mileage'],
'vehicle_age' => $item['vehicle_age'],
'views' => $item['views'],
'is_hot' => $item['is_hot'],
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
'condition_desc' => isset($item['translation']) ? $item['translation']['condition_desc'] : '',
'cover' => isset($item['cover']) ? $item['cover'] : '',
'created_at' => date('Y-m-d H:i:s', $item['created_at']),
'updated_at' => date('Y-m-d H:i:s', $item['updated_at']),
'location' => $item['location'] ? $item['location']['translation']['name'] : '',
];
}
if ($scene === 'show') {
if ($item['cover']) {
$item['cover_full'] = (new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($item['cover']);
}
$arr = [];
if (isset($item['album'])) {
$albumFields = \app\console\model\VehicleAlbumModel::VEHICLE_ALBUM_FIELDS;
$arr = [];
foreach ($albumFields as $field) {
$arr[] = [
'field' => $field,
'name' => trans($field),
'value_full' => $item['album'][$field]
? htmlspecialchars((new \app\mzl\modules\upload\service\OssService())->generatePrivateUrl($item['album'][$field]), ENT_NOQUOTES)
: '',
'value' => $item['album'][$field]
];
}
}
return [
'id' => $item['id'],
'vin' => $item['vin'],
'user_nickname' => isset($item['user']) ? $item['user']['nickname'] : '',
'price' => $item['price'],
'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'] : '',
'mileage' => $item['mileage'],
'vehicle_age' => $item['vehicle_age'],
'views' => $item['views'],
'is_hot' => $item['is_hot'],
'name' => isset($item['translation']) ? $item['translation']['name'] : '',
'condition_desc' => isset($item['translation']) ? $item['translation']['condition_desc'] : '',
'cover' => isset($item['cover']) ? $item['cover'] : '',
'cover_full' => isset($item['cover']) ? $item['cover_full'] : '',
'albums' => $arr,
'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' => 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'],
'location_name' => $item['location'] ? $item['location']['translation']['name'] : '',
'location' => is_array($item['location']) ? $item['location']['translation']['location_id'] : $item['location'],
];
}
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') {
$params['filters'] = [];
$params['filters'][] = ['field' => 'info_status', 'operator' => '=', 'value' => 1];
// 是否热门
if (isset($params['is_hot']) && $params['is_hot']) {
$params['page'] = 1;
$params['per_page'] = 4;
$params['filters'][] = ['field' => 'is_hot', 'operator' => '=', 'value' => $params['is_hot']];
return $params;
} else if (isset($params['vehicle_id']) && $params['vehicle_id']) {
$params['page'] = 1;
$params['per_page'] = 3;
$xgInfo = $this->getService()->find($params['vehicle_id']);
$params['filters'][] = ['field' => 'brand', 'operator' => '=', 'value' => $xgInfo->brand];
return $params;
} else {
// 品牌
if (isset($params['brand']) && $params['brand']) {
$params['filters'][] = ['field' => 'brand', 'operator' => '=', 'value' => $params['brand']];
}
// 车型
if (isset($params['model']) && $params['model']) {
$params['filters'][] = ['field' => 'model', 'operator' => '=', 'value' => $params['model']];
}
// 能源
if (isset($params['energy']) && $params['energy']) {
$params['filters'][] = ['field' => 'energy', 'operator' => '=', 'value' => $params['energy']];
}
// 状态
if (isset($params['store_status']) && $params['store_status']) {
$params['filters'][] = ['field' => 'store_status', 'operator' => '=', 'value' => $params['store_status']];
}
// 类型
if (isset($params['type']) && $params['type']) {
$params['filters'][] = ['field' => 'type', 'operator' => '=', 'value' => $params['type']];
}
// 价格
if ((isset($params['min_price']) && $params['min_price']) && (isset($params['max_price']) && $params['max_price'])) {
$params['filters'][] = ['field' => 'price', 'operator' => '>', 'value' => $params['min_price']];
$params['filters'][] = ['field' => 'price', 'operator' => '<', 'value' => $params['max_price']];
}
// 里程
if ((isset($params['min_mileage']) && $params['min_mileage']) && (isset($params['max_mileage']) && $params['max_mileage'])) {
$params['filters'][] = ['field' => 'mileage', 'operator' => '>', 'value' => $params['min_mileage']];
$params['filters'][] = ['field' => 'mileage', 'operator' => '<', 'value' => $params['max_mileage']];
}
// 年份
if ((isset($params['start_year']) && $params['start_year']) && (isset($params['end_year']) && $params['end_year'])) {
$params['filters'][] = ['field' => 'start_use', 'operator' => '=', 'value' => $params['start_year']];
$params['filters'][] = ['field' => 'end_use', 'operator' => '=', 'value' => $params['end_year']];
}
}
}
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());
}
}
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());
}
}
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());
}
}
/**
* 操作销售状态
*/
public function doSaled(Request $request, int $id): Response
{
try {
return $this->getService()->doSaled($request->all(), $id)
? $this->successResponse()
: $this->errorResponse();
} 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\VehicleDataTranslationModel;
use app\console\service\VehicleDataTranslationService;
use app\console\validate\VehicleDataTranslationValidator;
use app\mzl\common\controller\BaseController;
class VehicleDataTranslationController extends BaseController
{
/**
* 不需要验证token的接口
* @var array
*/
protected $noNeedJwt = [];
/**
* 验证器
*/
protected mixed $validator = VehicleDataTranslationValidator::class;
/**
* 返回业务 Service 实例
*/
protected function getService()
{
return new VehicleDataTranslationService(new VehicleDataTranslationModel());
}
/**
* 额外字段处理 (根据场景处理)
* @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());
}
}
}
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace app\console\model;
use support\Model;
/**
* AgreementModel
*/
class AgreementModel 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_agreement';
/**
* 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', 'key', 'status', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function translation()
{
return $this->hasOne(AgreementTranslationModel::class, 'agreement_id')->where('locale', locale());
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* AgreementTranslationModel
*/
class AgreementTranslationModel 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_agreement_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', 'agreement_id', 'locale', 'title', 'content', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+67
View File
@@ -0,0 +1,67 @@
<?php
namespace app\console\model;
use support\Model;
/**
* BrandModel
*/
class BrandModel 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_brand';
/**
* 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', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function translation()
{
return $this->hasOne(BrandTranslationModel::class, 'brand_id')->where('locale', locale());
}
public function translations()
{
return $this->hasMany(BrandTranslationModel::class, 'brand_id');
}
}
@@ -0,0 +1,62 @@
<?php
namespace app\console\model;
use support\Model;
/**
* BrandTranslationModel
*/
class BrandTranslationModel 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_brand_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', 'brand_id', 'locale', 'name'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function brand()
{
return $this->belongsTo(BrandModel::class, 'brand_id');
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* DraftsModel
*/
class DraftsModel 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_drafts';
/**
* 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', 'user_id', 'title', 'body', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace app\console\model;
use support\Model;
/**
* EnergyModel
*/
class EnergyModel 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_energy';
/**
* 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', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function translation()
{
return $this->hasOne(EnergyTranslationModel::class, 'energy_id')->where('locale', locale());
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* EnergyTranslationModel
*/
class EnergyTranslationModel 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_energy_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', 'energy_id', 'locale', 'name'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace app\console\model;
use support\Model;
/**
* LocationModel
*/
class LocationModel 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_location';
/**
* 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', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function translation()
{
return $this->hasOne(LocationTranslationModel::class, 'location_id')->where('locale', locale());
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* LocationTranslationModel
*/
class LocationTranslationModel 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_location_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', 'location_id', 'locale', 'name', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace app\console\model;
use support\Model;
/**
* ModelModel
*/
class ModelModel 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_model';
/**
* 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', 'brand_id', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function translation()
{
return $this->hasOne(ModelTranslationModel::class, 'model_id')->where('locale', locale());
}
public function brand()
{
return $this->belongsTo(BrandModel::class, 'brand_id', 'id');
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* ModelTranslationModel
*/
class ModelTranslationModel 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_model_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', 'model_id', 'locale', 'name'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace app\console\model;
use support\Model;
/**
* TypesModel
*/
class TypesModel 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_types';
/**
* 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', 'img', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function translation()
{
return $this->hasOne(TypesTranslationModel::class, 'type_id')->where('locale', locale());
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* TypesTranslationModel
*/
class TypesTranslationModel 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_types_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', 'type_id', 'locale', 'name'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* UsersModel
*/
class UsersModel 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_users';
/**
* 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', 'user_sn', 'nickname', 'avatar', 'realname', 'phone', 'company', 'openid', 'language', 'status', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+88
View File
@@ -0,0 +1,88 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleAlbumModel
*/
class VehicleAlbumModel 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_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_data_id', 'front_45_degree', 'front_left_45_degree', 'front_left_headlight', 'front_view', 'lower_front', 'wheel_hub', 'front_right_seat', 'right_lower_side', 'rear_right_taillight', 'rear_right_45_degree', 'lower_rear', 'trunk', 'left_lower_side', 'rear_seats', 'center_console', 'control_panel', 'gear_shift', 'car_key', 'steering_wheel', 'dashboard', 'odometer_reading', 'front_left_door_panel', 'front_left_door_function_area', 'front_left_seat', 'interior_ceiling', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 相册字段
*/
const VEHICLE_ALBUM_FIELDS = [
'front_45_degree',
'front_left_45_degree',
'front_left_headlight',
'front_view',
'lower_front',
'wheel_hub',
'front_right_seat',
'right_lower_side',
'rear_right_taillight',
'rear_right_45_degree',
'lower_rear',
'trunk',
'left_lower_side',
'rear_seats',
'center_console',
'control_panel',
'gear_shift',
'car_key',
'steering_wheel',
'dashboard',
'odometer_reading',
'front_left_door_panel',
'front_left_door_function_area',
'front_left_seat',
'interior_ceiling'
];
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleApplyModel
*/
class VehicleApplyModel 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_apply';
/**
* 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_data_id', 'admin_id', 'desc', 'apply_status', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function vehicleDataInfo()
{
return $this->belongsTo(VehicleDataModel::class, 'vehicle_data_id', 'id');
}
}
+118
View File
@@ -0,0 +1,118 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleDataModel
*/
class VehicleDataModel 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_data';
/**
* 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', 'user_id', 'cover', 'price', 'brand', 'type', 'energy', 'model', 'mileage', 'vehicle_age', 'info_status', 'is_saled', 'store_status', 'start_use', 'end_use', 'location', 'views', 'is_hot', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function user()
{
return $this->belongsTo(UsersModel::class, 'user_id', 'id');
}
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->hasOne(VehicleAlbumModel::class, 'vehicle_data_id', 'id');
}
public function apply()
{
return $this->hasOne(VehicleApplyModel::class, 'vehicle_data_id', '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 translation()
{
return $this->hasOne(VehicleDataTranslationModel::class, 'vehicle_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(VehicleDataTranslationModel::class, 'vehicle_id');
}
const TRANS_FIELDS = [
'name', 'condition_desc'
];
}
@@ -0,0 +1,62 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleDataTranslationModel
*/
class VehicleDataTranslationModel 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_data_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'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function vehicle()
{
return $this->belongsTo(VehicleDataModel::class, 'vehicle_id');
}
}
+117
View File
@@ -0,0 +1,117 @@
<?php
namespace app\console\service;
use app\console\model\AgreementModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use support\Db;
use app\mzl\modules\translation\service\TranslationService;
class AgreementService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return AgreementModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id', 'key', 'status', 'created_at', 'updated_at'],
'relations' => [
'translation' => ['agreement_id', 'title', 'content']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
}
];
}
protected array $translatable = [
'title', 'content'
];
public function add(array $params)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->create($params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'agreement',
$info->id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
public function edit(array $params, int $id)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->update($id, $params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'agreement',
$id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\AgreementTranslationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class AgreementTranslationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return AgreementTranslationModel::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,
// ]
// ];
// }
];
}
}
+132
View File
@@ -0,0 +1,132 @@
<?php
namespace app\console\service;
use app\console\model\BrandModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use support\Db;
use app\mzl\modules\translation\service\TranslationService;
class BrandService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return BrandModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id', 'status', 'sort', 'created_at', 'updated_at'],
'relations' => [
'translation' => ['brand_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
},
'preset' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id'],
'relations' => [
'translation' => ['brand_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
]
];
}
];
}
protected array $translatable = [
'name'
];
public function add(array $params)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->create($params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'brand',
$info->id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
public function edit(array $params, int $id)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->update($id, $params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'brand',
$id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\BrandTranslationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class BrandTranslationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return BrandTranslationModel::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,
// ]
// ];
// }
];
}
}
+59
View File
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\DraftsModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class DraftsService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return DraftsModel::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,
// ]
// ];
// }
];
}
}
+131
View File
@@ -0,0 +1,131 @@
<?php
namespace app\console\service;
use app\console\model\EnergyModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use support\Db;
use app\mzl\modules\translation\service\TranslationService;
class EnergyService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return EnergyModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id', 'status', 'sort', 'created_at', 'updated_at'],
'relations' => [
'translation' => ['energy_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
},
'preset' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id'],
'relations' => [
'translation' => ['energy_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
]
];
}
];
}
protected array $translatable = [
'name'
];
public function add(array $params)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->create($params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'energy',
$info->id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
public function edit(array $params, int $id)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->update($id, $params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'energy',
$id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\EnergyTranslationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class EnergyTranslationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return EnergyTranslationModel::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,
// ]
// ];
// }
];
}
}
+131
View File
@@ -0,0 +1,131 @@
<?php
namespace app\console\service;
use app\console\model\LocationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use support\Db;
use app\mzl\modules\translation\service\TranslationService;
class LocationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return LocationModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id', 'status', 'sort', 'created_at', 'updated_at'],
'relations' => [
'translation' => ['location_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
},
'preset' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id'],
'relations' => [
'translation' => ['location_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
]
];
}
];
}
protected array $translatable = [
'name'
];
public function add(array $params)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->create($params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'location',
$info->id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
public function edit(array $params, int $id)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->update($id, $params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'location',
$id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\LocationTranslationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class LocationTranslationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return LocationTranslationModel::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,
// ]
// ];
// }
];
}
}
+133
View File
@@ -0,0 +1,133 @@
<?php
namespace app\console\service;
use app\console\model\ModelModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use support\Db;
use app\mzl\modules\translation\service\TranslationService;
class ModelService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return ModelModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id', 'brand_id', 'status', 'sort', 'created_at', 'updated_at'],
'relations' => [
'translation' => ['model_id', 'name'],
'brand.translation' => ['brand_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
},
'preset' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1'],
['field' => 'brand_id', 'operator' => '=', 'value' => $params['brand_id']]
],
'fields' => ['id'],
'relations' => [
'translation' => ['model_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
]
];
}
];
}
protected array $translatable = [
'name'
];
public function add(array $params)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->create($params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'model',
$info->id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
public function edit(array $params, int $id)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->update($id, $params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'model',
$id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\ModelTranslationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class ModelTranslationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return ModelTranslationModel::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,
// ]
// ];
// }
];
}
}
+131
View File
@@ -0,0 +1,131 @@
<?php
namespace app\console\service;
use app\console\model\TypesModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use support\Db;
use app\mzl\modules\translation\service\TranslationService;
class TypesService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return TypesModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id', 'img', 'status', 'sort', 'created_at', 'updated_at'],
'relations' => [
'translation' => ['type_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
},
'preset' => function ($params) {
return [
'filters' => [
['field' => 'status', 'operator' => '=', 'value' => '1']
],
'fields' => ['id'],
'relations' => [
'translation' => ['type_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
]
];
}
];
}
protected array $translatable = [
'name'
];
public function add(array $params)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->create($params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'type',
$info->id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
public function edit(array $params, int $id)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
Db::beginTransaction();
try {
$info = $this->update($id, $params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'type',
$id,
$sourceLocale,
$sourceFields
);
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\TypesTranslationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class TypesTranslationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return TypesTranslationModel::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,
// ]
// ];
// }
];
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace app\console\service;
use app\console\model\UsersModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class UsersService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return UsersModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
// ['field' => '***', 'operator' => '=', 'value' => '***']
],
'fields' => ['id', 'user_sn', 'nickname', 'avatar', 'realname', 'phone', 'company', 'created_at', 'updated_at'],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
}
];
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\VehicleAlbumModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class VehicleAlbumService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return VehicleAlbumModel::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,80 @@
<?php
namespace app\console\service;
use app\console\model\VehicleApplyModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use app\apis\model\VehicleDataModel;
class VehicleApplyService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return VehicleApplyModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function ($params) {
return [
'filters' => [
// ['field' => '***', 'operator' => '=', 'value' => '***']
],
'fields' => ['id', 'vehicle_data_id', 'apply_status', 'desc', 'created_at', 'updated_at'],
'relations' => [
'vehicleDataInfo.translation' => ['vehicle_id', 'name']
],
'sorts' => [
['field' => 'id', 'direction' => 'desc']
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
]
];
}
];
}
/**
* 操作审核
*/
public function doApply(array $data, int $id): bool
{
$info = $this->model->where('id', $id)->first();
if (!$info) {
throw new BusinessException('未找到待审核信息', 404);
}
$info->apply_status = $data['apply_status'];
$info->desc = $data['desc'];
$info->admin_id = 1;
$vDataInfo = VehicleDataModel::where('id', $info->vehicle_data_id)->first();
if (!$vDataInfo) {
throw new BusinessException('未找到审核信息关联的车辆信息', 404);
}
$vDataInfo->info_status = $data['apply_status'];
if (!$info->save() || !$vDataInfo->save()) {
throw new BusinessException('审核失败,请重试', 500);
}
return true;
}
}
+285
View File
@@ -0,0 +1,285 @@
<?php
namespace app\console\service;
use app\console\model\DraftsModel;
use app\console\model\VehicleApplyModel;
use app\apis\model\VehicleAlbumModel;
use app\console\model\VehicleDataModel;
use app\mzl\common\org\XunfeiFanyi;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use support\exception\BusinessException;
use support\Db;
use app\mzl\modules\translation\service\TranslationService;
class VehicleDataService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return VehicleDataModel::class;
}
/**
* 多场景配置
*/
public function queryScenes(): array
{
return [
'default' => function(array $params) {
return [
'filters' => $params['filters'],
'fields' => [
'id','vin','price','cover',
'type','energy','model','mileage','vehicle_age',
'views','is_hot','created_at','updated_at', 'brand', 'model', 'user_id', 'location'
],
'relations' => [
'translation' => ['vehicle_id', 'name','condition_desc'],
'brand.translation' => ['brand_id', 'name'],
'album' => [
'id', 'vehicle_data_id', 'front_45_degree',
'front_left_45_degree', 'front_left_headlight',
'front_view', 'lower_front', 'wheel_hub',
'front_right_seat', 'right_lower_side',
'rear_right_taillight', 'rear_right_45_degree',
'lower_rear', 'trunk', 'left_lower_side',
'rear_seats', 'center_console', 'control_panel',
'gear_shift', 'car_key', 'steering_wheel',
'dashboard', 'odometer_reading',
'front_left_door_panel', 'front_left_door_function_area',
'front_left_seat', 'interior_ceiling'
],
'user' => ['realname', 'nickname'],
'types.translation' => ['type_id', 'name'],
'energy.translation' => ['energy_id', 'name'],
'models.translation' => ['model_id', 'name'],
'user' => ['nickname'],
'location.translation' => ['location_id', 'name']
],
'sorts' => [
['field'=>'id','direction'=>'desc'],
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
],
];
},
'show' => function(array $params) {
return [
'filters' => [
['field'=>'id', 'operator'=>'=', 'value'=> $params['id']],
],
'fields' => [
'id','vin','price','cover',
'type','energy','model','mileage','vehicle_age',
'views','is_hot','created_at','updated_at', 'brand', 'model', 'user_id', 'location'
],
'relations' => [
'translation' => ['vehicle_id', 'name','condition_desc'],
'brand.translation' => ['brand_id', 'name'],
'album' => [
'id', 'vehicle_data_id', 'front_45_degree',
'front_left_45_degree', 'front_left_headlight',
'front_view', 'lower_front', 'wheel_hub',
'front_right_seat', 'right_lower_side',
'rear_right_taillight', 'rear_right_45_degree',
'lower_rear', 'trunk', 'left_lower_side',
'rear_seats', 'center_console', 'control_panel',
'gear_shift', 'car_key', 'steering_wheel',
'dashboard', 'odometer_reading',
'front_left_door_panel', 'front_left_door_function_area',
'front_left_seat', 'interior_ceiling'
],
'user' => ['realname', 'nickname'],
'types.translation' => ['type_id', 'name'],
'energy.translation' => ['energy_id', 'name'],
'models.translation' => ['model_id', 'name'],
'user' => ['nickname'],
'location.translation' => ['location_id', 'name']
],
'sorts' => [
['field'=>'id','direction'=>'desc'],
],
'pagination' => [
'page' => $params['page'] ?? 1,
'per_page' => $params['per_page'] ?? 10,
],
];
},
];
}
/**
* 操作销售状态
*/
public function doSaled(array $data, int $id): bool
{
$info = $this->model->where('id', $id)->first();
if (!$info) {
throw new BusinessException('未找到车辆信息', 404);
}
$info->is_saled = $data['is_saled'];
if (!$info->save()) {
throw new BusinessException('设置失败,请重试', 500);
}
return true;
}
// 声明需要多语言翻译
protected array $translatable = [
'name',
'condition_desc',
// 'location'
];
public function add(array $params)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
$albums = VehicleAlbumModel::VEHICLE_ALBUM_FIELDS;
foreach ($params as $ko => $vo) {
if (in_array($ko, $albums)) {
$album[$ko] = $vo ?? '';
} else {
if (in_array($ko, VehicleDataModel::TRANS_FIELDS)) {
$trans[$ko] = $vo ?? '';
} else {
$data[$ko] = $vo ?? '';
}
}
}
Db::beginTransaction();
try {
$data['info_status'] = 1;
$info = $this->create($data);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'vehicle',
$info->id,
$sourceLocale,
$sourceFields
);
$album['vehicle_data_id'] = $info->id;
$albumModel = new VehicleAlbumModel();
if (!$albumModel->create($album)) {
throw new BusinessException('提交失败');
}
// $applyModel = new VehicleApplyModel();
// if (!$applyModel->create([
// 'vehicle_data_id' => $info->id,
// 'desc' => '提交审核'
// ])) {
// throw new BusinessException('提交失败');
// }
// if (isset($params['draft_id']) && $params['draft_id']) {
// if (!DraftsModel::where('id', $params['draft_id'])->delete()) {
// throw new BusinessException('草稿移除失败');
// }
// }
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
public function edit(array $params, int $id)
{
$sourceLocale = locale();
$sourceFields = $this->extractSourceFields($params);
if (empty($sourceFields)) {
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
};
$album = [];
$trans = [];
$albums = VehicleAlbumModel::VEHICLE_ALBUM_FIELDS;
foreach ($params as $ko => $vo) {
if (in_array($ko, $albums)) {
$album[$ko] = $vo ?? '';
} else {
if (in_array($ko, VehicleDataModel::TRANS_FIELDS)) {
$trans[$ko] = $vo ?? '';
} else {
$data[$ko] = $vo ?? '';
}
}
}
Db::beginTransaction();
try {
$info = $this->update($id, $params);
if (!$info) {
throw new BusinessException('提交失败');
}
// 异步翻译并写入 hs_vehicle_data_translation 表
(new TranslationService())->queueTranslations(
'vehicle',
$id,
$sourceLocale,
$sourceFields
);
if ($album) {
// $album['vehicle_data_id'] = $info->id;
$albumModel = new VehicleAlbumModel();
if (!$albumModel->updateOrCreate(
['vehicle_data_id' => $id],
$album
)) {
throw new BusinessException('提交失败');
}
}
// $applyModel = new VehicleApplyModel();
// if (!$applyModel->create([
// 'vehicle_data_id' => $info->id,
// 'desc' => '提交审核'
// ])) {
// throw new BusinessException('提交失败');
// }
// if (isset($params['draft_id']) && $params['draft_id']) {
// if (!DraftsModel::where('id', $params['draft_id'])->delete()) {
// throw new BusinessException('草稿移除失败');
// }
// }
Db::commit();
return true;
} catch (\Throwable $th) {
Db::rollBack();
throw $th;
}
}
}
@@ -0,0 +1,59 @@
<?php
namespace app\console\service;
use app\console\model\VehicleDataTranslationModel;
use app\mzl\common\services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class VehicleDataTranslationService extends BaseService
{
/**
* 定义模型
*
* @return string
*/
public function getModel(): string
{
return VehicleDataTranslationModel::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\console\validate;
use think\Validate;
class AgreementTranslationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class AgreementValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class BrandTranslationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class BrandValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class DraftsValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class EnergyTranslationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class EnergyValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class LocationTranslationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class LocationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class ModelTranslationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class ModelValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class TypesTranslationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class TypesValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class UsersValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class VehicleAlbumValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class VehicleApplyValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class VehicleDataTranslationValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -0,0 +1,29 @@
<?php
namespace app\console\validate;
use think\Validate;
class VehicleDataValidator extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}