底部链接处理
This commit is contained in:
parent
c898aa3e94
commit
770d24f656
|
|
@ -6,6 +6,7 @@
|
|||
* @Date 2022-08-10 16:45:58
|
||||
* @LastEditTime 2022-08-10 17:03:40
|
||||
*/
|
||||
|
||||
/**
|
||||
* ShareViewData.php
|
||||
*
|
||||
|
|
@ -20,6 +21,7 @@ namespace App\Http\Middleware;
|
|||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Beike\Repositories\FooterRepo;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Beike\Repositories\CategoryRepo;
|
||||
use Beike\Repositories\LanguageRepo;
|
||||
|
|
@ -47,7 +49,7 @@ class ShareViewData
|
|||
View::share('languages', LanguageRepo::enabled());
|
||||
View::share('shop_base_url', shop_route('home.index'));
|
||||
View::share('categories', hook_filter('header.categories', CategoryRepo::getTwoLevelCategories()));
|
||||
View::share('footer_content', hook_filter('footer.content', system_setting('base.footer_setting')));
|
||||
View::share('footer_content', hook_filter('footer.content', FooterRepo::handleFooterData()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Beike\Admin\Http\Controllers;
|
|||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Beike\Services\DesignService;
|
||||
use Beike\Repositories\FooterRepo;
|
||||
use Beike\Repositories\SettingRepo;
|
||||
|
||||
class DesignFooterController extends Controller
|
||||
|
|
@ -36,7 +36,7 @@ class DesignFooterController extends Controller
|
|||
$viewPath = "layout.footer";
|
||||
|
||||
$viewData = [
|
||||
'footer_content' => DesignService::handleModuleContent('footer', $content),
|
||||
'footer_content' => FooterRepo::handleFooterData($content),
|
||||
'design' => (bool)$request->get('design')
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/**
|
||||
* FooterRepo.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-08-11 18:16:06
|
||||
* @modified 2022-08-11 18:16:06
|
||||
*/
|
||||
|
||||
namespace Beike\Repositories;
|
||||
|
||||
use Beike\Models\Page;
|
||||
|
||||
class FooterRepo
|
||||
{
|
||||
/**
|
||||
* 处理页尾编辑器数据
|
||||
*
|
||||
* @return array|mixed
|
||||
*/
|
||||
public static function handleFooterData($footerSetting = [])
|
||||
{
|
||||
if (empty($footerSetting)) {
|
||||
$footerSetting = system_setting('base.footer_setting');
|
||||
}
|
||||
|
||||
$content = $footerSetting['content'];
|
||||
$contentLinkKeys = ['link1', 'link2', 'link3'];
|
||||
foreach ($contentLinkKeys as $contentLinkKey) {
|
||||
$links = $content[$contentLinkKey]['links'];
|
||||
$links = collect($links)->map(function ($link) {
|
||||
if ($link['type'] == 'static') {
|
||||
$link['link'] = shop_route($link['value']);
|
||||
$link['text'] = trans('shop/' . $link['value']);
|
||||
} elseif ($link['type'] == 'page') {
|
||||
$pageId = $link['value'];
|
||||
$page = Page::query()->find($pageId);
|
||||
if ($page) {
|
||||
$link['link'] = type_route('page', $link['value']);
|
||||
$link['text'] = $page->description->title;
|
||||
}
|
||||
}
|
||||
return $link;
|
||||
})->toArray();
|
||||
$footerSetting['content'][$contentLinkKey]['links'] = $links;
|
||||
}
|
||||
return $footerSetting;
|
||||
}
|
||||
}
|
||||
|
|
@ -49,8 +49,6 @@ class DesignService
|
|||
return self::handleBrand($content);
|
||||
} elseif ($moduleCode == 'tab_product') {
|
||||
return self::handleTabProducts($content);
|
||||
} elseif ($moduleCode == 'footer') {
|
||||
return self::handleFooter($content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
|
@ -138,18 +136,6 @@ class DesignService
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理页尾数据
|
||||
*
|
||||
* @param $content
|
||||
* @return mixed
|
||||
*/
|
||||
private static function handleFooter($content)
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理图片以及链接
|
||||
* @throws \Exception
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* PageController.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-08-11 18:13:06
|
||||
* @modified 2022-08-11 18:13:06
|
||||
*/
|
||||
|
||||
namespace Beike\Shop\Http\Controllers;
|
||||
|
||||
|
||||
class PageController extends Controller
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Route;
|
|||
use Beike\Shop\Http\Controllers\ZoneController;
|
||||
use Beike\Shop\Http\Controllers\CartController;
|
||||
use Beike\Shop\Http\Controllers\HomeController;
|
||||
use Beike\Shop\Http\Controllers\PagesController;
|
||||
use Beike\Shop\Http\Controllers\PageController;
|
||||
use Beike\Shop\Http\Controllers\ProductController;
|
||||
use Beike\Shop\Http\Controllers\CategoryController;
|
||||
use Beike\Shop\Http\Controllers\CheckoutController;
|
||||
|
|
@ -59,6 +59,8 @@ Route::prefix('/')
|
|||
Route::post('login', [LoginController::class, 'store'])->name('login.store');
|
||||
Route::get('logout', [LogoutController::class, 'index'])->name('logout');
|
||||
|
||||
Route::get('pages/{page}', [PageController::class, 'show'])->name('pages.show');
|
||||
|
||||
Route::get('products/{product}', [ProductController::class, 'show'])->name('products.show');
|
||||
|
||||
Route::get('register', [RegisterController::class, 'index'])->name('register.index');
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@
|
|||
return [
|
||||
'login' => 'Login',
|
||||
'new_account' => 'New Account',
|
||||
'index' => 'Account',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@
|
|||
return [
|
||||
'login' => 'Login',
|
||||
'new_account' => 'New Account',
|
||||
'index' => '个人中心',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue