Skip to content

Commit

Permalink
🤡seo优化
Browse files Browse the repository at this point in the history
  • Loading branch information
aoaostar committed Jan 6, 2022
1 parent 49fa931 commit 28f26b8
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 76 deletions.
29 changes: 23 additions & 6 deletions app/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,15 @@ function tree_github($github, $type = 'tree')
function config_get($key)
{
$model = \app\model\Config::getByKey($key);
return $model->value;
if (isset($model->value)) {

return $model->value;
}
$arr = [];
foreach ($model as $v) {
$arr[substr($v->key, strlen($key))] = $v->value;
}
return $arr;
}

function config_set($key, $value)
Expand All @@ -341,15 +349,24 @@ function format_date($timestamp = null)
return date('Y-m-d H:i:s', $timestamp);
}

//当前命名空间的包名
function base_space_name($space)
{
$str_replace = str_replace('\\', '/', $space);
return basename($str_replace);
}


if (!function_exists('str_starts_with')) {
function str_starts_with($str, $start)
{
return (@substr_compare($str, $start, 0, strlen($start)) == 0);
}
}
//当前命名空间的包名
function base_space_name($space)
{
$str_replace = str_replace('\\', '/', $space);
return basename($str_replace);
if (!function_exists('str_ends_with')) {
function str_ends_with(string $haystack, string $needle): bool
{
$needle_len = strlen($needle);
return ($needle_len === 0 || 0 === substr_compare($haystack, $needle, -$needle_len));
}
}
4 changes: 2 additions & 2 deletions app/controller/master/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public function get(){
"icon" => "fa fa-cloud-upload",
"target" => "_self",
],
]
],
],
]
];
$systemInit = [
'homeInfo' => $homeInfo,
Expand Down
3 changes: 2 additions & 1 deletion app/middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
// 多语言加载
// \think\middleware\LoadLangPack::class,
// Session初始化
\think\middleware\SessionInit::class
\think\middleware\SessionInit::class,
\app\middleware\Response::class
];
21 changes: 21 additions & 0 deletions app/middleware/Response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
declare (strict_types=1);

namespace app\middleware;

class Response
{
/**
* @param $request
* @param \Closure $next
* @return Response
*/
public function handle($request, \Closure $next)
{
return $next($request)->header([
'X-Powered-By' => 'ASP.NET',
'Author' => 'AOAOSTAR/Pluto',
'Home-Page' => 'www.aoaostar.com',
]);
}
}
5 changes: 1 addition & 4 deletions app/middleware/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ public function handle($request, \Closure $next)
$categories = Category::select();

\think\facade\View::assign([
"app" => [
"title" => config_get('global.title'),
"subTitle" => config_get("global.subtitle")
],
"app" => config_get('global.'),
'categories' => $categories,
'user' => get_user(),
]);
Expand Down
9 changes: 7 additions & 2 deletions app/model/Config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
declare (strict_types=1);

namespace app\model;

Expand All @@ -24,7 +24,12 @@ public static function all()

public static function getByKey($key)
{
$model = Config::where('key', $key)->cache(60)->findOrEmpty();
$model = Config::cache(60);
if (str_ends_with($key, '.')) {
$model = $model->where('key', 'like', "%$key%")->select();
} else {
$model = $model->where('key', $key)->findOrEmpty();
}
return $model;
}
}
2 changes: 1 addition & 1 deletion config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
// | 版本号
// +----------------------------------------------------------------------

define('VERSION', 'v1.1');
define('VERSION', 'v1.1.2');
Binary file modified docs/images/view_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 7 additions & 15 deletions public/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
<head>
<meta charset="utf-8">
<title>傲星工具箱 - 后台管理中心</title>
<meta name="keywords" content="layuimini,layui,layui模板,layui后台,后台模板,admin,admin模板,layui mini">
<meta name="description"
content="layuimini基于layui的轻量级前端后台管理框架,最简洁、易用的后台框架模板,面向所有层次的前后端程序,只需提供一个接口就直接初始化整个框架,无需复杂操作。">
<meta name="keywords" content="傲星工具箱,在线工具箱,aoaostar,pluto">
<meta name="description" content="这是一个非常Nice的在线工具箱">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Access-Control-Allow-Origin" content="*">
Expand Down Expand Up @@ -69,6 +68,9 @@
<li class="layui-nav-item layuimini-setting">
<a href="javascript:;">管理员</a>
<dl class="layui-nav-child">
<dd>
<a target="_blank" href="/">网站首页</a>
</dd>
<dd>
<a href="javascript:;" class="login-out">退出登录</a>
</dd>
Expand Down Expand Up @@ -129,11 +131,9 @@
<script src="js/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script src="js/common.js" charset="utf-8"></script>
<script>
layui.use(['jquery', 'layer', 'miniAdmin', 'miniTongji'], function () {
layui.use(['jquery', 'miniAdmin'], function () {
var $ = layui.jquery,
layer = layui.layer,
miniAdmin = layui.miniAdmin,
miniTongji = layui.miniTongji;
miniAdmin = layui.miniAdmin;

$.ajaxSetup({
dataType: "json",
Expand Down Expand Up @@ -176,14 +176,6 @@
};
miniAdmin.render(options);

// 百度统计代码,只统计指定域名
miniTongji.render({
specific: true,
domains: [
'aoaostar.com',
],
});

$('.login-out').on("click", function () {
window.location.href = "/auth/logout";
});
Expand Down
40 changes: 0 additions & 40 deletions public/admin/js/lay-module/layuimini/miniTongji.js

This file was deleted.

1 change: 1 addition & 0 deletions public/admin/page/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
var title = $(this).children('.layuimini-notice-title').text(),
noticeTime = $(this).children('.layuimini-notice-extra').text(),
content = $(this).children('.layuimini-notice-content').html();
content = content.replaceAll('\n', '<br/>')
let html = `<div>
<p>版本号:${title}</p>
<p>发布时间:${noticeTime}</p>
Expand Down
1 change: 0 additions & 1 deletion route/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use think\facade\Route;


Route::any('/stars', 'Index/stars')
->middleware(\app\middleware\Auth::class)
->middleware(\app\middleware\View::class);
Expand Down
2 changes: 1 addition & 1 deletion route/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
return msg("error", "该Api不存在该方法");
}
return $app->$method();
})->pattern(['alias' => '[\w|\-/]+'])->middleware([\app\middleware\RequestRecord::class]);
})->middleware([\app\middleware\RequestRecord::class]);

Route::get(':alias', function () {
$alias = plugin_alias_get();
Expand Down
2 changes: 1 addition & 1 deletion view/index/default/auth/login.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{extend name="layout/layout" /}

{block name="title"}{$app.title} - {$app.subTitle}{/block}
{block name="title"}Login - {$app.title}{/block}
{block name="main"}
<style>
.card{
Expand Down
2 changes: 1 addition & 1 deletion view/index/default/layout/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 11l5-5m0 0l5 5m-5-5v12"/>
</svg>
</button>
{:config_get('global.foot_code')}
{$app.foot_code|raw}
3 changes: 3 additions & 0 deletions view/index/default/layout/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<title>{block name="title"}标题{/block}</title>
<link rel="icon" href="/favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="keywords" content="{$app.keywords}">
<meta name="description" content="{$app.description}">
<meta name="author" content="Pluto" />
<link href="https://cdn.jsdelivr.net/npm/daisyui@1.16.5/dist/full.css" rel="stylesheet" type="text/css"/>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2/dist/tailwind.min.css" rel="stylesheet" type="text/css"/>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
Expand Down
3 changes: 3 additions & 0 deletions view/index/default/layout/plugin_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<title>{block name="title"}标题{/block}</title>
<link rel="icon" href="/favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="keywords" content="{$plugin.title},{$app.keywords}">
<meta name="description" content="{$plugin.desc}">
<meta name="author" content="Pluto" />
<link href="https://cdn.jsdelivr.net/npm/daisyui@1.16.5/dist/full.css" rel="stylesheet" type="text/css"/>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2/dist/tailwind.min.css" rel="stylesheet" type="text/css"/>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
Expand Down
2 changes: 1 addition & 1 deletion view/index/default/layout/tools.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{extend name="layout/layout" /}

{block name="title"}{$app.title} - {$app.subTitle}{/block}
{block name="title"}{$app.title} - {$app.subtitle}{/block}
{block name="main"}
<div class="container mx-auto" id="app">

Expand Down

0 comments on commit 28f26b8

Please sign in to comment.