From f256e76153bd483bb235eaf7ab8d1e553172dabb Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Tue, 11 Mar 2025 16:59:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/v1/PublicController.php | 26 +++- .../v1/publics/ArticleCategoryController.php | 43 ++++++ .../v1/publics/ArticleController.php | 120 +++++++++++++++ .../v1/publics/CaseCategoryController.php | 43 ++++++ .../controller/v1/publics/CaseController.php | 145 ++++++++++++++++++ .../v1/publics/ProcessController.php | 62 ++++++++ crmeb/app/api/route/v1.php | 54 +++++++ 7 files changed, 492 insertions(+), 1 deletion(-) create mode 100644 crmeb/app/api/controller/v1/publics/ArticleCategoryController.php create mode 100644 crmeb/app/api/controller/v1/publics/ArticleController.php create mode 100644 crmeb/app/api/controller/v1/publics/CaseCategoryController.php create mode 100644 crmeb/app/api/controller/v1/publics/CaseController.php create mode 100644 crmeb/app/api/controller/v1/publics/ProcessController.php diff --git a/crmeb/app/api/controller/v1/PublicController.php b/crmeb/app/api/controller/v1/PublicController.php index fa4397d..4bb3834 100644 --- a/crmeb/app/api/controller/v1/PublicController.php +++ b/crmeb/app/api/controller/v1/PublicController.php @@ -116,7 +116,31 @@ class PublicController */ public function getSiteConfig() { - $data['record_No'] = sys_config('record_No'); +// $data['record_No'] = sys_config('record_No'); + $data['site_name'] = sys_config("site_name"); + + + $data['official_website_logo'] = sys_config("official_website_logo"); + $data['company_name'] = sys_config("company_name"); + $data['record_number'] = sys_config("record_number"); + $data['official_contact_qr_code'] = sys_config("official_contact_qr_code"); + $data['official_website_address'] = sys_config("official_website_address"); + $data['luoyang_sales_hotline'] = sys_config("luoyang_sales_hotline"); + $data['website_construction_and_development_consulting'] = sys_config("website_construction_and_development_consulting"); + $data['internet_network_security_hosting'] = sys_config("internet_network_security_hosting"); + $data['internet_marketing_consulting'] = sys_config("internet_marketing_consulting"); + $data['new_media_wechat_public_number'] = sys_config("new_media_wechat_public_number"); + $data['new_media_tiktok_short_video_operation'] = sys_config("new_media_tiktok_short_video_operation"); + $data['internet_big_data_public_opinion'] = sys_config("internet_big_data_public_opinion"); + + $data['recruitment_training'] = sys_config("recruitment_training"); + $data['luoyang_company_address'] = sys_config("luoyang_company_address"); + $data['zhengzhou_company_address'] = sys_config("zhengzhou_company_address"); + + $data['technical_center_address'] = sys_config("technical_center_address"); + $data['name_of_company_and_subsidiary'] = sys_config("name_of_company_and_subsidiary"); + $data['legal_adviser'] = sys_config("legal_adviser"); + return app('json')->success($data); } diff --git a/crmeb/app/api/controller/v1/publics/ArticleCategoryController.php b/crmeb/app/api/controller/v1/publics/ArticleCategoryController.php new file mode 100644 index 0000000..2c05dae --- /dev/null +++ b/crmeb/app/api/controller/v1/publics/ArticleCategoryController.php @@ -0,0 +1,43 @@ + +// +---------------------------------------------------------------------- +namespace app\api\controller\v1\publics; + +use app\services\article\ArticleCategoryServices; +use crmeb\services\CacheService; + +/** + * 文章分类类 + * Class ArticleCategoryController + * @package app\api\controller\publics + */ +class ArticleCategoryController +{ + protected $services; + + public function __construct(ArticleCategoryServices $services) + { + $this->services = $services; + } + + /** + * 文章分类列表 + * @return mixed + */ + public function lst() + { + $cateInfo = CacheService::remember('ARTICLE_CATEGORY', function () { + $cateInfo = $this->services->getArticleCategory(); + array_unshift($cateInfo, ['id' => 0, 'title' => '热门']); + return $cateInfo; + }); + return app('json')->success($cateInfo); + } +} diff --git a/crmeb/app/api/controller/v1/publics/ArticleController.php b/crmeb/app/api/controller/v1/publics/ArticleController.php new file mode 100644 index 0000000..2eb56c1 --- /dev/null +++ b/crmeb/app/api/controller/v1/publics/ArticleController.php @@ -0,0 +1,120 @@ + +// +---------------------------------------------------------------------- +namespace app\api\controller\v1\publics; + +use app\services\article\ArticleServices; + +/** + * 文章类 + * Class ArticleController + * @package app\api\controller\publics + */ +class ArticleController +{ + protected $services; + + public function __construct(ArticleServices $services) + { + $this->services = $services; + } + + /** + * 文章列表 + * @param $cid + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function lst($cid) + { + if ($cid == 0) { + $where = ['is_hot' => 1]; + } else { + $where = ['cid' => $cid]; + } + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList($where, $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } + + /** + * 文章详情 + * @param $id + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function details($id) + { + $info = $this->services->getInfo($id); + return app('json')->success($info); + } + + /** + * 获取热门文章 + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function hot() + { + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList(['is_hot' => 1], $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } + + /** + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function new() + { + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList([], $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } + + /** + * 获取顶部banner文章 + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function banner() + { + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList(['is_banner' => 1], $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } +} diff --git a/crmeb/app/api/controller/v1/publics/CaseCategoryController.php b/crmeb/app/api/controller/v1/publics/CaseCategoryController.php new file mode 100644 index 0000000..c2bca46 --- /dev/null +++ b/crmeb/app/api/controller/v1/publics/CaseCategoryController.php @@ -0,0 +1,43 @@ + +// +---------------------------------------------------------------------- +namespace app\api\controller\v1\publics; + +use app\services\caseinfo\CaseCategoryServices; +use crmeb\services\CacheService; + +/** + * 案例分类类 + * Class ArticleCategoryController + * @package app\api\controller\publics + */ +class CaseCategoryController +{ + protected $services; + + public function __construct(CaseCategoryServices $services) + { + $this->services = $services; + } + + /** + * 案例分类列表 + * @return mixed + */ + public function lst() + { + $cateInfo = CacheService::remember('ARTICLE_CATEGORY', function () { + $cateInfo = $this->services->getArticleCategory(); + array_unshift($cateInfo, ['id' => 0, 'title' => '热门']); + return $cateInfo; + }); + return app('json')->success($cateInfo); + } +} diff --git a/crmeb/app/api/controller/v1/publics/CaseController.php b/crmeb/app/api/controller/v1/publics/CaseController.php new file mode 100644 index 0000000..4ff9e24 --- /dev/null +++ b/crmeb/app/api/controller/v1/publics/CaseController.php @@ -0,0 +1,145 @@ + +// +---------------------------------------------------------------------- +namespace app\api\controller\v1\publics; + +use app\services\caseinfo\CaseServices; + +/** + * 案例类 + * Class ArticleController + * @package app\api\controller\publics + */ +class CaseController +{ + protected $services; + + public function __construct(CaseServices $services) + { + $this->services = $services; + } + + /** + * 案例列表 + * @param $cid + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function lst($cid) + { + if ($cid == 0) { + $where = ['is_hot' => 1]; + } else { + $where = ['cid' => $cid]; + } + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList($where, $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } + + /** + * 案例详情 + * @param $id + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function details($id) + { + $info = $this->services->getInfo($id); + return app('json')->success($info); + } + + /** + * 获取热门案例 + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function hot() + { + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList(['is_hot' => 1], $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } + + /** + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function new() + { + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList([], $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } + + /** + * 获取顶部banner案例 + * @return mixed + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function banner() + { + [$page, $limit] = $this->services->getPageValue(); + $list = $this->services->getList(['is_banner' => 1], $page, $limit)['list']; + foreach ($list as &$item){ + $item['add_time'] = date('Y-m-d H:i', $item['add_time']); + } + return app('json')->success($list); + } + + + + + /** + * 官网客户见证数据 + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public function customer_witness() + { + $customer_witness = sys_data('customer_witness') ?? []; +// $searchKeyword = []; +// if (count($routineHotSearch)) { +// foreach ($routineHotSearch as $key => &$item) { +// array_push($searchKeyword, $item['title']); +// } +// } + return app('json')->success($customer_witness); + } + + + +} diff --git a/crmeb/app/api/controller/v1/publics/ProcessController.php b/crmeb/app/api/controller/v1/publics/ProcessController.php new file mode 100644 index 0000000..1e051b9 --- /dev/null +++ b/crmeb/app/api/controller/v1/publics/ProcessController.php @@ -0,0 +1,62 @@ + + * +---------------------------------------------------------------------- + */ + +/** + * 公司历程 + * @author crud自动生成代码 + * @date 2025/02/21 + */ + +namespace app\api\controller\v1\publics; + +use think\facade\App; +use app\services\crud\ProcessServices; + +/** + * Class Process + * @date 2025/02/21 + * @package app\adminapi\controller\crud + */ +class ProcessController +{ + + /** + * @var ProcessServices + */ + protected $service; + + /** + * ProcessController constructor. + * @param ProcessServices $service + */ + public function __construct(ProcessServices $service) + { + + $this->service = $service; + } + + + /** + * 列表 + * @date 2025/02/21 + * @return \think\Response + */ + public function lst() + { + $where = []; + return app('json')->success($this->service->getCrudListIndex($where)); + } + + + +} diff --git a/crmeb/app/api/route/v1.php b/crmeb/app/api/route/v1.php index 45998e0..7e49f3c 100644 --- a/crmeb/app/api/route/v1.php +++ b/crmeb/app/api/route/v1.php @@ -26,3 +26,57 @@ Route::miss(function () { } else return Response::create()->code(404); }); + + +//未授权接口 +Route::group(function () { + + Route::group(function () { + + //公共类 + Route::get('site_config', 'v1.PublicController/getSiteConfig')->name('getSiteConfig')->option(['real_name' => '获取网站配置']);//获取网站配置 + + })->option(['mark' => 'index', 'mark_name' => '主页接口']); + + Route::group(function () { + + Route::group(function () { + //文章分类类 + Route::get('article/category/list', 'v1.publics.ArticleCategoryController/lst')->name('articleCategoryList')->option(['real_name' => '文章分类列表']);//文章分类列表 + //文章类 + Route::get('article/list/:cid', 'v1.publics.ArticleController/lst')->name('articleList')->option(['real_name' => '文章列表']);//文章列表 + Route::get('article/details/:id', 'v1.publics.ArticleController/details')->name('articleDetails')->option(['real_name' => '文章详情']);//文章详情 + Route::get('article/hot/list', 'v1.publics.ArticleController/hot')->name('articleHotList')->option(['real_name' => '文章 热门']);//文章 热门 + Route::get('article/new/list', 'v1.publics.ArticleController/new')->name('articleNewList')->option(['real_name' => '文章 最新']);//文章 最新 + Route::get('article/banner/list', 'v1.publics.ArticleController/banner')->name('articleBannerList')->option(['real_name' => '文章 banner']);//文章 banner + })->option(['parent' => 'activity_nologin', 'cate_name' => '文章(未授权)']); + + + Route::group(function () { + //案例分类类 + Route::get('caseinfo/category/list', 'v1.publics.CaseCategoryController/lst')->name('caseCategoryController')->option(['real_name' => '案例分类列表']);//文章分类列表 + //案例类 + Route::get('caseinfo/list/:cid', 'v1.publics.CaseController/lst')->name('caseList')->option(['real_name' => '案例列表']);//文章列表 + Route::get('caseinfo/details/:id', 'v1.publics.CaseController/details')->name('caseDetails')->option(['real_name' => '案例详情']);//文章详情 + Route::get('caseinfo/hot/list', 'v1.publics.CaseController/hot')->name('caseHotList')->option(['real_name' => '案例 热门']);//文章 热门 + Route::get('caseinfo/new/list', 'v1.publics.CaseController/new')->name('caseNewList')->option(['real_name' => '案例 最新']);//文章 最新 + Route::get('caseinfo/banner/list', 'v1.publics.CaseController/banner')->name('caseBannerList')->option(['real_name' => '案例 banner']);//文章 banner + + Route::get('caseinfo/customer', 'v1.publics.CaseController/customer_witness')->name('caseCustomer')->option(['real_name' => '官网客户见证数据列表']);//文章分类列表 + + })->option(['parent' => 'caseinfo', 'cate_name' => '案例(未授权)']); + + + + Route::group(function () { + //公司历程 + Route::get('process/list', 'v1.publics.ProcessController/lst')->name('processList')->option(['real_name' => '公司历程列表']);//文章列表 + + })->option(['parent' => 'activity_nologin', 'cate_name' => '公司历程']); + + })->option(['mark' => 'web_site_info', 'mark_name' => '官网']); + + +})->middleware(\app\http\middleware\AllowOriginMiddleware::class) + ->middleware(\app\api\middleware\StationOpenMiddleware::class) + ->middleware(\app\api\middleware\AuthTokenMiddleware::class, false); \ No newline at end of file