This commit is contained in:
tao 2022-08-02 18:46:05 +08:00
parent 36bdf774ba
commit 7eb272c437
31 changed files with 815 additions and 490 deletions

View File

@ -3,8 +3,8 @@
> TaoLer是一个简单迅捷的轻论坛系统适用于个人或组织区域型信息交流发布平台。
* 官网https://www.aieok.com
* 版本TaoLer 1.9.2
* 日期2022.4.19
* 版本TaoLer 1.9.3
* 日期2022.4.22
webman版新架构已适配90%
@ -99,21 +99,16 @@
#### 前后台独立域名的绑定
1. 手动修改`config/app.php`文件内的`'domain_bind'`对应的应用。
```html
// 域名绑定(自动多应用模式有效)
'domain_bind' => [
'bbs' => 'index', //bbs.xxx.com 访问的是Index应用
'adm' => 'admin', //adm.xxx.com 访问的是Admin应用
'api' => 'api' //api.xxx.com 访问的是Admin应用
'www.test.com' => 'test' //www.test.com 访问的是Test应用
],
```
2. 后面会针对动态的设置绑定域名功能开发...此处待完成
1. 支持设置绑定域名
> 如果绑定`index`应用对应的域名,后台`admin`应用也必须独立绑定域名,否则原`xxx.com/admin`访问路径就无法再访问。
2. 支持应用设置映射
> 域名绑定的优先级高于应用映射若绑定过域名直接访问域名如果没有绑定过域名访问路径为xxx.com/youbind.
如后台的映射地址 www.xxx.com/youadmin
#### 使用说明

Binary file not shown.

View File

@ -123,7 +123,8 @@ class Index extends AdminController
$res['msg'] = '';
$res['count'] = $count;
foreach($forumList as $k=>$v){
$url = (string) str_replace("admin","index",$this->domain.url('article/detail',['id'=>$v['aid']]));
//$url = (string) str_replace("admin","index",$this->domain.url('article/detail',['id'=>$v['aid']]));
$url = $this->getRouteUrl($v['aid']);
$res['data'][]= ['id'=>$url,'title'=>htmlspecialchars($v['title']),'name'=>$v['name'],'catename'=>$v['catename'],'pv'=>$v['pv']];
}
} else {
@ -152,7 +153,7 @@ class Index extends AdminController
if ($count) {
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($replys as $k => $v){
$res['data'][] = ['content'=>htmlspecialchars($v['content']),'title'=>htmlspecialchars($v['title']),'cid'=>str_replace("admin","index",$this->domain.(string) url('article/detail',['id'=>$v['cid']])),'name'=>$v['name']];
$res['data'][] = ['content'=>htmlspecialchars($v['content']),'title'=>htmlspecialchars($v['title']),'cid'=>$this->getRouteUrl($v['cid']),'name'=>$v['name']];
}
} else {
$res = ['code'=>-1,'msg'=>'本周还没评论'];
@ -183,7 +184,6 @@ class Index extends AdminController
//$mail = Db::name('system')->where('id',1)->value('auth_mail'); // bug邮件发送
if(Request::isAjax()){
$data = Request::only(['type','title','content','post']);
//halt($data);
$apiRes = Api::urlPost($url,$data);
$data['poster'] = Session::get('admin_id');
unset($data['post']);

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2022-04-13 09:54:31
* @LastEditTime: 2022-04-19 16:42:47
* @LastEditTime: 2022-04-21 11:39:38
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\controller\Seo.php
@ -16,19 +16,30 @@ use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use taoser\SetArr;
use app\admin\model\PushJscode;
class Seo extends AdminController
{
public function index()
{
// 站点地图
$xml = '';
$xmlArr = $this->getXmlFile(public_path());
foreach($xmlArr as $v) {
$map = $this->getIndexUrl().'/'.$v;
$xml .= $map."\n";
}
// robots
if(is_file($rob = public_path().'robots.txt')){
$robots = file_get_contents($rob);
} else {
$robots = '';
}
View::assign('robots',$robots);
// push_js
$pushjs = new PushJscode();
$jscode = $pushjs->getAllCodes();
View::assign(['xml'=>$xml,'jscode'=>$jscode,'robots'=>$robots]);
return View::fetch();
}
@ -161,7 +172,6 @@ class Seo extends AdminController
$str .= <<<STR
<url>
<loc>$url</loc>
<mobile:mobile type="pc,mobile"/>
<lastmod>$time</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
@ -258,46 +268,41 @@ class Seo extends AdminController
}
/**
* 获取文章链接地址
* 保存搜索平台js代码
*
* @param integer $aid
* @return string
* @return void
*/
protected function getRouteUrl(int $aid) : string
public function savePushJs()
{
$indexUrl = $this->getIndexUrl();
$artUrl = (string) url('detail_id', ['id' => $aid]);
$data = Request::only(['name','jscode']);
if(empty($data['name'])) {
return json(['code'=>-1,'msg'=>'请术输入名称']);
}
if(empty($data['jscode'])){
return json(['code'=>-1,'msg'=>'请术输入代码']);
}
$push = new PushJscode();
$res = $push->saveCode($data);
if(!$res) {
return json(['code'=>-1,'msg'=>'保存失败']);
}
return json(['code'=>0,'msg'=>'保存成功']);
}
// 判断是否开启绑定
//$domain_bind = array_key_exists('domain_bind',config('app'));
// 判断index应用是否绑定域名
$bind_index = array_search('index',config('app.domain_bind'));
// 判断admin应用是否绑定域名
$bind_admin = array_search('admin',config('app.domain_bind'));
// 判断index应用是否域名映射
$map_index = array_search('index',config('app.app_map'));
// 判断admin应用是否域名映射
$map_admin = array_search('admin',config('app.app_map'));
$index = $map_index ? $map_index : 'index'; // index应用名
$admin = $map_admin ? $map_admin : 'admin'; // admin应用名
if($bind_index) {
// index绑定域名
$url = $indexUrl . str_replace($admin.'/','',$artUrl);
} else { // index未绑定域名
// admin绑定域名
if($bind_admin) {
$url = $indexUrl .'/' . $index . $artUrl;
} else {
$url = $indexUrl . str_replace($admin,$index,$artUrl);
}
}
return $url;
/**
* 删除平台js代码
*
* @return void
*/
public function delPushJs()
{
$id = (int) input('id');
$push = new PushJscode();
$res = $push->delCode($id);
if(!$res) {
return json(['code'=>-1,'msg'=>'删除失败']);
}
return json(['code'=>0,'msg'=>'删除成功']);
}
}

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-19 14:06:54
* @LastEditTime: 2022-04-22 06:30:01
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\controller\Set.php
@ -22,6 +22,7 @@ use taoler\com\Files;
use think\facade\Session;
use think\facade\Cookie;
use taoser\SetArr;
use app\common\lib\SetArr as SetArrConf;
class Set extends AdminController
{
@ -30,13 +31,22 @@ class Set extends AdminController
parent::initialize();
$this->sysInfo = $this->getSystem();
}
//网站设置显示
public function index()
{
$mailserver = MailServer::find(1);
$template = Files::getDirName('../view');
$email = Db::name('admin')->where('id',1)->value('email');
View::assign(['sysInfo'=>$this->sysInfo,'mailserver'=>$mailserver,'template'=>$template,'email'=>$email]);
// 应用映射
$index_map = array_search('index',config('app.app_map'));
$admin_map = array_search('admin',config('app.app_map'));
$index_map = $index_map ? $index_map : '';
$admin_map = $admin_map ? $admin_map : '';
View::assign(['sysInfo'=>$this->sysInfo,'mailserver'=>$mailserver,'template'=>$template,'email'=>$email,'index_map'=>$index_map,'admin_map'=>$admin_map]);
// 域名绑定
if(!empty(config('app.domain_bind'))){
$data = array_flip(config('app.domain_bind'));
$domain_bind = [
@ -50,6 +60,20 @@ class Set extends AdminController
];
}
View::assign($domain_bind);
// url美化
$urlArr = config('taoler.url_rewrite');
$urlRe = [];
foreach($urlArr as $k => $v) {
if(!empty($v)) {
$urlRe[$k] = substr($v, 0, strrpos($v, '/'));
} else {
$urlRe[$k] = '';
}
}
View::assign('url_re',$urlRe);
return View::fetch('set/system/website');
}
@ -68,44 +92,6 @@ class Set extends AdminController
}
}
// 域名绑定
public function setDomain()
{
if(Request::isPost()){
//$data = Request::only(['index','admin']);
$data = Request::param();
//dump($data);
if($data['domain_check'] == 'on') {
unset($data['domain_check']);
$data = array_flip($data);
if(empty(config('app.domain_bind'))){
// 写入token
$res = SetArr::name('app')->add([
'domain_bind'=> $data,
]);
}else{
// 编辑
$res = SetArr::name('app')->edit([
'domain_bind'=> $data,
]);
}
//清空缓存
Cookie::delete('adminAuth');
Session::clear();
} else {
$res = SetArr::name('app')->delete([
'domain_bind'=> config('app.domain_bind'),
]);
}
if($res == true){
return json(['code'=>0,'msg'=>'成功']);
} else{
return json(['code'=>-1,'msg'=>'失败']);
}
}
}
//综合设置
public function server()
{
@ -130,6 +116,11 @@ class Set extends AdminController
}
}
/**
* 发验证码
*
* @return void
*/
public function sendMailCode()
{
if(Request::isPost()){
@ -146,6 +137,11 @@ class Set extends AdminController
return json($res);
}
/**
* 邮件激活
*
* @return void
*/
public function activeMailServer()
{
if(Request::isPost()){
@ -199,13 +195,150 @@ class Set extends AdminController
}
}
// 域名绑定
public function setDomain()
{
$str = file_get_contents(str_replace('\\', '/', app()->getConfigPath() . 'app.php'));
if(Request::isPost()){
$data = Request::only(['index','admin','domain_check']);
//$data = Request::param();
//dump($data);
if($data['domain_check'] == 'on') {
// 过滤空项目
$domain_bind = [];
if(!empty($data['index'])){
$domain_bind[$data['index']] ='index';
if(config('app.default_app') == $domain_bind[$data['index']]) {
if(empty($data['admin'])) {
return json(['code'=>-1, 'msg'=>'默认应用和Index一致时必须绑定Admin域名,否则无法进入后台']);
}
}
}
if(!empty($data['admin'])){
$domain_bind[$data['admin']] ='admin';
}
// 匹配整个domain_map数组
$pats_domain_bind = '/\'(domain_bind)\'[^\]]*\],/';
// 空数组
$rep_domain_null = "'domain_bind'\t=> [\n\t],";
$str = preg_replace($pats_domain_bind, $rep_domain_null, $str);
// 匹配'domain_bind' => [
$pats = '/\'(domain_bind)\'\s*=>\s*\[\r?\n/';
preg_match($pats,$str,$arr);
// 拼接数组内字符串
$domainArr = '';
foreach($domain_bind as $k => $v){
$domainArr .= "\t\t'". $k. "' => '" . $v . "',\n";
}
// 追加组成新数组写入文件
$reps = $arr[0].$domainArr;
$str = preg_replace($pats, $reps, $str);
$res = file_put_contents(app()->getConfigPath() . 'app.php', $str);
// 如果编辑了后台 ,需要清理退出缓存
if(!empty($domain_bind[$data['admin']])) {
//清空缓存
Cookie::delete('adminAuth');
Session::clear();
}
} else {
$res = SetArr::name('app')->delete([
'domain_bind'=> config('app.domain_bind'),
]);
}
if($res == true){
return json(['code'=>0,'msg'=>'成功']);
} else{
return json(['code'=>-1,'msg'=>'失败']);
}
}
}
/**
* 绑定应用映射
*
* @return void
*/
public function bindMap()
{
$data = Request::only(['index_map','admin_map']);
$str = file_get_contents(str_replace('\\', '/', app()->getConfigPath() . 'app.php'));
// 过滤空项目
$app_map = [];
if(!empty($data['index_map'])){
$app_map[$data['index_map']]='index';
}
if(!empty($data['admin_map'])){
$app_map[$data['admin_map']] ='admin';
}
//halt($app_map);
// $set = new SetArrConf('app');
// $res = $set->delete(['app_map' => config('app.app_map')])->add([
// 'app_map' => $app_map,
// ])->put();
// halt($res);
// 匹配整个app_map数组
$pats_app_map = '/\'(app_map)\'[^\]]*\],/';
preg_match($pats_app_map,$str,$arr_map);
// 空数组
$rep_map_null = "'app_map'\t=> [\n\t],";
$str = preg_replace($pats_app_map, $rep_map_null, $str);
// 匹配'app_map' => [
$pats = '/\'(app_map)\'\s*=>\s*\[\r?\n/';
preg_match($pats,$str,$arr);
// 拼接数组内字符串
$appArr = '';
foreach($app_map as $k => $v){
$appArr .= "\t\t'". $k. "' => '" . $v . "',\n";
}
// 追加组成新数组写入文件
$reps = $arr[0].$appArr;
$str = preg_replace($pats, $reps, $str);
$res = file_put_contents(app()->getConfigPath() . 'app.php', $str);
if(!$res) {
return json(['code'=>-1,'msg'=>'绑定失败']);
}
return json(['code'=>0,'msg'=>'绑定成功']);
}
/**
* URL美化设置访问链接
*
* @return void
*/
public function setUrl()
{
//
$data = Request::only(['article_as','cate_as']);
$arr = [
'url_rewrite'=>$data,
];
$arr = [];
foreach($data as $k => $v) {
if(!empty($v)) {
$arr['url_rewrite'][$k] = $v . '/';
} else {
$arr['url_rewrite'][$k] = '';
}
}
if(empty($arr['url_rewrite']['cate_as'])) return json(['code'=>-1,'msg'=>'分类不能为空']);
if(!array_key_exists('url_rewrite',config('taoler'))){
$result = SetArr::name('taoler')->add($arr);
} else {

View File

@ -0,0 +1,63 @@
<?php
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2022-04-20 10:45:41
* @LastEditTime: 2022-04-20 12:34:40
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\model\PushJscode.php
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
*/
namespace app\admin\model;
use think\Model;
class PushJscode extends Model
{
/**
* 保存代码
*
* @param [type] $data
* @return void
*/
public function saveCode($data)
{
$res = $this->save($data);
if($res == true) {
return true;
} else {
return false;
}
}
/**
* 获取所有数据
*
* @return void
*/
public function getAllCodes()
{
//
return $this->select();
}
/**
* 删除数据
*
* @param [type] $id
* @return void
*/
public function delCode($id)
{
//
$res = $this::destroy($id);
if($res == true) {
return true;
} else {
return false;
}
}
}

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-19 14:31:41
* @LastEditTime: 2022-04-21 17:02:15
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\route\route.php
@ -11,8 +11,8 @@
use think\facade\Route;
//详情页URL别称
// 动态详情页URL别称
$detail_as = config('taoler.url_rewrite.article_as');
Route::get('captcha/[:config]','\\think\\captcha\\CaptchaController@index');
Route::get($detail_as.'/:id', '\app\index\controller\Article::detail')->name('detail_id');
Route::get(config('taoler.url_rewrite.article_as').'<id>', '\app\index\controller\Article@detail')->name('detail_id');

View File

@ -85,13 +85,13 @@
<div carousel-item>
<ul class="layui-row layui-col-space10">
<li class="layui-col-xs6">
<a lay-href="{:url('admin/Forum/replys')}" class="layadmin-backlog-body">
<a lay-href="{:url('Forum/replys')}" class="layadmin-backlog-body">
<h3>待审评论</h3>
<p><cite>{$comms}</cite></p>
</a>
</li>
<li class="layui-col-xs6">
<a lay-href="{:url('admin/Forum/list')}" class="layadmin-backlog-body">
<a lay-href="{:url('Forum/list')}" class="layadmin-backlog-body">
<h3>待审帖子</h3>
<p><cite>{$forums}</cite></p>
</a>
@ -226,7 +226,7 @@
<td>
<script type="text/html" template>
TaoLer_{:config('taoler.version')}
<a href="http://bbs.aieok.com/doc/timeline.html" target="_blank" style="padding-left: 15px;">更新日志</a>
<a href="https://www.aieok.com/bbs/doc/timeline.html" target="_blank" style="padding-left: 15px;">更新日志</a>
</script>
</td>
</tr>

View File

@ -1,3 +1,12 @@
<!--
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-21 11:05:47
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\view\public\base.html
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
-->
<!DOCTYPE html>
<html>
<head>
@ -10,7 +19,7 @@
<link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
{block name="css"}{/block}
</head>
<body {if($Request.url=='/admin/index/index')}class="layui-layout-body"{/if}>
<body {if($Request.url==url('index/index'))}class="layui-layout-body"{/if}>
{block name="body"}内容{/block}
<script src="/static/layui/jquery.min.js" charset="utf-8"></script>
<script src="/static/layui/layui.js"></script>

View File

@ -1,5 +1,14 @@
<!--
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-21 11:06:13
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\view\public\footer.html
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
-->
<div class="layui-footer">
<!-- 底部固定区域 -->
© <a href="http://www.aieok.com">aieok.com</a> - 联系QQ317927823
© <a href="https://www.aieok.com">aieok.com</a> - 联系QQ317927823
</div>

View File

@ -12,6 +12,7 @@
<li class="layui-this" lay-id="push">百度推送</li>
<li lay-id="map">站点地图</li>
<li lay-id="robots">robots</li>
<li lay-id="push_js">自动提交</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item">
@ -97,6 +98,12 @@
<button class="layui-btn" lay-submit lay-filter="map_xml">生成</button>
</div>
</div>
<hr>
<div class="layui-form-item">
<div class="layui-input-block">
<textarea type="text" class="layui-textarea" style="height: 300px;">{$xml}</textarea>
</div>
</div>
</div>
</div>
@ -105,7 +112,7 @@
<div class="layui-form-item">
<label class="layui-form-label">内容</label>
<div class="layui-input-block">
<textarea type="text" name="robots" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 500px;">{$robots}</textarea>
<textarea type="text" name="robots" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 400px;">{$robots}</textarea>
<div class="layui-form-mid layui-word-aux">会自动写入sitemap的链接</div>
</div>
</div>
@ -115,6 +122,47 @@
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="push_js">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" required placeholder="请正确填写js平台名称" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">js自动收录平台</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS代码</label>
<div class="layui-input-block">
<textarea type="text" name="jscode" required placeholder="请正确填写robots内容" class="layui-textarea" style="height: 200px;"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="push_jscode_submit">新增</button>
</div>
</div>
</div>
{volist name="jscode" id="vo"}
<hr>
<div class="layui-form" wid100>
<div class="layui-form-item">
<label class="layui-form-label">{$vo.name}</label>
<div class="layui-input-block">
<textarea type="text" name="jscode" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 200px;">{$vo.jscode}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<input type="text" name="id" class="layui-hide" value="{$vo.id}">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="push_jscode_del">删除</button>
</div>
</div>
</div>
{/volist}
</div>
</div>
@ -145,10 +193,11 @@
var field = data.field;
$.post("{:url('seo/push')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
layer.open({title:"推送失败",content:res.msg,icon:5,anim:6});
}
});
return false;
@ -159,10 +208,11 @@
var field = data.field;
$.post("{:url('seo/config')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"置失败",content:res.msg,icon:5,anim:6});
layer.open({title:"置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
@ -173,21 +223,23 @@
var field = data.field;
$.post("{:url('seo/map')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
layer.open({title:"生成失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// map
// robots
form.on('submit(robots_submit)', function(data){
var field = data.field;
$.post("{:url('seo/robots')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
@ -196,12 +248,40 @@
return false;
});
// 添加自动提交JS代码
form.on('submit(push_jscode_submit)', function(data){
var field = data.field;
$.post("{:url('seo/savePushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 删除自动提交JS代码
form.on('submit(push_jscode_del)', function(data){
var field = data.field;
$.post("{:url('seo/delPushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"删除失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 显示当前tab
if(location.hash){
element.tabChange('seo-tabs-brief', location.hash.replace(/^#/, ''));
}
element.on('tab(seo-tabs-brief)', function(){
var othis = $(this), layid = othis.attr('lay-id');
if(layid){

View File

@ -13,6 +13,7 @@
<li lay-id="email">邮箱服务</li>
<li lay-id="config">服务配置</li>
<li lay-id="domain">域名绑定</li>
<li lay-id="bind_map">应用映射</li>
<li lay-id="url_rewrite">URL美化</li>
</ul>
<div class="layui-tab-content">
@ -276,14 +277,14 @@
<div class="layui-form-item">
<label class="layui-form-label">Index前端</label>
<div class="layui-input-inline">
<input type="text" name="index" {if(!empty(config('app.domain_bind'))) } value="{$index}" {/if} class="layui-input">
<input type="text" name="index" value="{$index}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">www.aieok.com</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Admin后端</label>
<div class="layui-input-inline">
<input type="text" name="admin" {if(!empty(config('app.domain_bind'))) } value="{$admin}" {/if} class="layui-input">
<input type="text" name="admin" value="{$admin}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">admin.aieok.com</div>
</div>
@ -298,20 +299,43 @@
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="bind_map">
<div class="layui-form-item">
<label class="layui-form-label">Index应用</label>
<div class="layui-input-inline">
<input type="text" name="index_map" required value="{$index_map}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">改变后原路径访问无效</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Admin应用</label>
<div class="layui-input-inline">
<input type="text" name="admin_map" required value="{$admin_map}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">设置后需要使用新路径</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="set_bind_map">确认保存</button>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="url_rewrite">
<div class="layui-form-item">
<label class="layui-form-label">帖子别名</label>
<div class="layui-input-inline">
<input type="text" name="article_as" required value="{:config('taoler.url_rewrite.article_as')}" class="layui-input">
<input type="text" name="article_as" required value="{$url_re['article_as']}" class="layui-input">
</div>
<div id="artdesc" class="layui-form-mid layui-word-aux">www.aieok.com/article/1.html</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分类别名</label>
<div class="layui-input-inline">
<input type="text" name="cate_as" required value="{:config('taoler.url_rewrite.cate_as')}" class="layui-input">
<input type="text" name="cate_as" required value="{$url_re['cate_as']}" class="layui-input">
</div>
<div id="catedesc" class="layui-form-mid layui-word-aux">www.aieok.com/cate/ask.html</div>
</div>
@ -358,8 +382,7 @@
,bindAction: '#logo-upload-button'
,done: function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
},function(){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
@ -367,12 +390,14 @@
}
}
});
//网站配置
form.on('submit(set_system_config)', function(data){
var field = data.field;
$.post("{:url('set/config')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
@ -385,7 +410,8 @@
var field = data.field;
$.post("{:url('set/sendMailCode')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
@ -399,7 +425,8 @@
var field = data.field;
$.post("{:url('set/activeMailServer')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
@ -413,9 +440,8 @@
var field = data.field;
$.post("{:url('set/setDomain')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
}, function(){
parent.location.href = '/';
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
@ -429,9 +455,8 @@
var field = data.field;
$.post("{:url('set/setUrl')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
}, function(){
//parent.location.href = '/';
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
@ -450,7 +475,7 @@
$('#catedesc').html('如www.aieok.com/'+ content +'/ask.html');
})
// 域名绑定
form.on('switch(domain_check)', function(data){
var data = data.elem;
status = data.checked ? 'on' : 'off';
@ -460,9 +485,8 @@
$('#set_domain').addClass('layui-hide');
$.post("{:url('set/setDomain')}",{"domain_check":status},function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000
}, function(){
parent.location.href = '/';
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
@ -470,13 +494,28 @@
});
}
return false;
});
// 应用映射
form.on('submit(set_bind_map)', function(data){
var field = data.field;
$.post("{:url('set/bindMap')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
window.location.reload();
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
//显示当前tab
if(location.hash){
element.tabChange('website-tabs-brief', location.hash.replace(/^#/, ''));
}
element.on('tab(website-tabs-brief)', function(){
var othis = $(this), layid = othis.attr('lay-id');
if(layid){

View File

@ -137,5 +137,48 @@ class AdminController extends \app\BaseController
return $runTime;
}
/**
* 获取文章链接地址
*
* @param integer $aid
* @return string
*/
protected function getRouteUrl(int $aid) : string
{
$indexUrl = $this->getIndexUrl();
$artUrl = (string) url('detail_id', ['id' => $aid]);
// 判断是否开启绑定
//$domain_bind = array_key_exists('domain_bind',config('app'));
// 判断index应用是否绑定域名
$bind_index = array_search('index',config('app.domain_bind'));
// 判断admin应用是否绑定域名
$bind_admin = array_search('admin',config('app.domain_bind'));
// 判断index应用是否域名映射
$map_index = array_search('index',config('app.app_map'));
// 判断admin应用是否域名映射
$map_admin = array_search('admin',config('app.app_map'));
$index = $map_index ? $map_index : 'index'; // index应用名
$admin = $map_admin ? $map_admin : 'admin'; // admin应用名
if($bind_index) {
// index绑定域名
$url = $indexUrl . str_replace($admin.'/','',$artUrl);
} else { // index未绑定域名
// admin绑定域名
if($bind_admin) {
$url = $indexUrl .'/' . $index . $artUrl;
} else {
$url = $indexUrl . str_replace($admin,$index,$artUrl);
}
}
return $url;
}
}

View File

@ -1,101 +1,64 @@
<?php
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2022-04-10 14:13:41
* @LastEditTime: 2022-04-16 11:30:02
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\common\lib\SetArr.php
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
/**
* PHP配置文件的新增、编辑、删除
* 正则字符串内容进行替换
* 支持三级数组
* 数组内数值索引元素在前,关联子数组在后
* @author Taoser changlin_zhao@qq.com
* 2022
*/
namespace app\common\lib;
class SetArr
{
protected static string $str = '';
protected static string $configName = '';
protected static string $configFile = '';
/**
* 数组字符串
*
* @var string
*/
protected string $str = '';
function __construct(string $configName)
{
self::$configName = $configName;
self::$configFile = app()->getConfigPath() . $configName . '.php';
self::$str = file_get_contents(self::$configFile); //加载配置文件
}
/**
* 修改配置
* @param string $file
* @param array $data
* @return \think\response\Json
*/
function setConfig(string $file,array $data=[])
{
if (is_array($data)){
$fileurl = app()->getConfigPath() . $file.".php";
$string = file_get_contents($fileurl); //加载配置文件
foreach ($data as $key => $value) {
if(is_array($value)){//二维数组
foreach ($value as $k => $v) {
if(is_int($v)){//数字类型
$pats = '/\'' . $k . '\'(.*?),/';
$reps = "'". $k. "'". " => " . $v .",";
//halt($reps);
}else{//字符类型
$pats = '/\'' . $k . '\'(.*?)\',/';
$reps = "'". $k. "'". " => " . "'".$v ."',";
}
$string = preg_replace($pats, $reps, $string); // 正则查找然后替换
}
}else{//一维数组
if(is_int($value)){//数字类型
$pats = '/\'' . $key . '\'(.*?),/';
$reps = "'". $key. "'". " => " . "".$value .",";
}else{//字符类型
$pats = '/\'' . $key . '\'(.*?)\',/';
$reps = "'". $key. "'". " => " . "'".$value ."',";
}
$string = preg_replace($pats, $reps, $string); // 正则查找然后替换
}
}
try {
file_put_contents($fileurl, $string); // 写入配置文件
}
catch (\Exception $e) {
// 这是进行异常捕获
//$e->getMessage();
return json(['code'=>-1,'msg'=> $file . '无写入权限']);
}
return json(['code'=>0,'msg'=>'配置修改成功']);
/*
// 自动识别是插件配置还是项目配置
if(stripos()(__DIR__, 'vendor')){
// confing/plugin插件配置路径
$namespace = strtolower(__NAMESPACE__);
$path = config_path() . '/plugin/'.$namespace.'/'.$configName.'.php';
} else {
return json(['code'=>-1,'msg'=>'配置项错误!']);
//config/*.php配置路径
$path= config_path() . '/' . $configName. ".php";
}
*/
// 配置文件名称
$this->configName = $configName;
// 文件路径
$this->configFile = str_replace('\\', '/', app()->getConfigPath() . $configName . '.php');
//加载配置文件
$this->str = file_get_contents($this->configFile);
}
/**
* 新增配置项,支持三级数组配置
*
* @param array $arr
* @return boolean
* @return $this
*/
public static function add(array $arr) :bool
public function add(array $arr)
{
//dump(self::$str);
//dump($this->str);
//正则];数组结尾
$end = '/\];/';
//一级配置内容追加到return [一级配置,之后
$start = self::getArrSonCount(config(self::$configName)) ? '/return\s*\[[^\[|\]]*,\r?\n/' : '/return\s*\[\r?\n?/';
$start = $this->getArrSonCount(config($this->configName)) ? '/return\s*\[[^\[|\]]*,\r?\n/' : '/return\s*\[\r?\n?/';
if(is_array($arr)) {
foreach ($arr as $k => $v)
{
if(!is_array($v)) {
preg_match($start,self::$str,$arrstart);
preg_match($start,$this->str,$arrstart);
if(is_int($k)) {
// 数值数组
if(is_string($v)){
@ -114,7 +77,7 @@ class SetArr
} else {
// 键值关联数组
//判断是否存在KEY
if (array_key_exists($k,config(self::$configName))) {
if (array_key_exists($k,config($this->configName))) {
echo $k.'不能添加已存在的配置项';
return false;
}
@ -130,12 +93,12 @@ class SetArr
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
}
}
self::$str = preg_replace($start, $reps, self::$str);
$this->str = preg_replace($start, $reps, $this->str);
} else {
// $v是数组存在多级配置
// $k不存在新增二级配置数组, 数组插入];之前
if (!array_key_exists($k,config(self::$configName))) {
if (!array_key_exists($k,config($this->configName))) {
// 拼接数组内元素
$sonArr = '';
foreach($v as $kk => $vv) {
@ -246,14 +209,14 @@ class SetArr
}
}
$reps = "\t'". $k. "' => [\n".$sonArr."\t],\n];";
self::$str = preg_replace($end, $reps, self::$str);
$this->str = preg_replace($end, $reps, $this->str);
} else {
// $k已存在二级配置是数组需要添加二级或三数组元素
// 把$v的子元素追加在匹配$k => [之后
// //匹配$k => [
// $kpats = '/\''.$k.'\'\s*=>\s*\[\r?\n/';
// preg_match($kpats,self::$str,$arrk);
// preg_match($kpats,$this->str,$arrk);
// 新增二级配置
// 往数组中追加子元素
@ -266,11 +229,20 @@ class SetArr
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[]*,[^\]]/';
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
// 添加一维数组,数组中有元素匹配到最后一个数组,没有数组,匹配到数组开头[
$kpats = self::getArrSonCount(config(self::$configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
preg_match($kpats,self::$str,$arrk);
//halt($arrk);
// 读$k 数组
$k_arr = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*\]/';
preg_match($k_arr,$this->str,$k_arr);
//$k_arr[0]
$k_arr = preg_replace('/[\s|\'|>]/', '', $k_arr[0]);
dump($k_arr);
$k_ar = eval('$'.$k_arr);
$n = $this->getArrSonCount($k_ar);
dump($n);
$kpats = $this->getArrSonCount(config($this->configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
preg_match($kpats,$this->str,$arrk);
dump($k,$kpats,$this->str,$arrk);
if(!is_int($kk)) {
if(array_key_exists($kk,config(self::$configName.'.'.$k))) {
if(array_key_exists($kk,config($this->configName.'.'.$k))) {
echo $kk.'不能添加已存在的配置项kk';
return false;
}
@ -301,24 +273,24 @@ class SetArr
$reps = $arrk[0]."\t\t". $vv . ",\n";
}
}
self::$str = preg_replace($kpats, $reps, self::$str);
$this->str = preg_replace($kpats, $reps, $this->str);
} else {
// 2. $vv是数组
// 匹配到数组内部的后面
$sonArrnum = self::getArrSonNum(config(self::$configName.'.'.$k));
$sonArrnum = $this->getArrSonNum(config($this->configName.'.'.$k));
if($sonArrnum > 0) {
// 数组存在子数组,匹配到最后一个数组],\n后面
$kpats = '/\''.$k.'\'([^\]]*\]){'.$sonArrnum.'},\r?\n/';
} else {
// 没有子数组
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
$kpats = self::getArrSonCount(config(self::$configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
$kpats = $this->getArrSonCount(config($this->configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
}
preg_match($kpats,self::$str,$arrk);
//dump($sonArrnum,$arrk);
preg_match($kpats,$this->str,$arrk);
// a.$vv数组不存在新建数组及它的子数组$kkk
if(!array_key_exists($kk,config(self::$configName . '.' . $k))) {
if(!array_key_exists($kk,config($this->configName . '.' . $k))) {
$sonArrson = '';
foreach($vv as $kkk => $vvv) {
@ -359,7 +331,7 @@ class SetArr
$sonArrsonArr = '';
foreach($vvv as $kkkk => $vvvv) {
if(!is_int($kkkk)) {
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
if(array_key_exists($kkkk,config($this->configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
echo $kkkk."已存在?";
return false;
}
@ -397,12 +369,12 @@ class SetArr
}
}
$reps = $arrk[0]."\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
self::$str = preg_replace($kpats, $reps, self::$str);
$this->str = preg_replace($kpats, $reps, $this->str);
} else {
// b.$vv数组已存在
// 匹配包含$k $kk=>[
// $kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
// preg_match($kkpats,self::$str,$arrkk);
// preg_match($kkpats,$this->str,$arrkk);
foreach($vv as $kkk => $vvv) {
//halt(123,$arrkk[0]);
@ -411,12 +383,12 @@ class SetArr
// 匹配包含$k $kk=>[ ***,
//$kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
//$kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'\s*=>\s*\[[^\[|\]]*,/';
$kkpats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
preg_match($kkpats,self::$str,$arrkk);
//halt($arrkk);
$kkpats = $this->getArrSonCount(config($this->configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
preg_match($kkpats,$this->str,$arrkk);
if(!is_int($kkk)) {
//判断第三级key是否存在
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
if(array_key_exists($kkk,config($this->configName.'.'.$k.'.'.$kk))) {
echo $kkk.'不能添加已存在的配置项kkk';
return false;
}
@ -446,12 +418,12 @@ class SetArr
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
}
}
self::$str = preg_replace($kkpats,$repsk, self::$str);
$this->str = preg_replace($kkpats,$repsk, $this->str);
} else {
// $vvv是数组,a.数组存在b.数组不存在
//a. $kkk数组存在
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
if(array_key_exists($kkk,config($this->configName.'.'.$k.'.'.$kk))) {
//匹配包含$k $kk $kkk 到]的内容
//$sonPats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[\s\S]*?(?:'.$kkk.')\' [^\]]*/';
//[\s\S]*?(?:'.$kkk.')\'(.*),/
@ -459,14 +431,14 @@ class SetArr
// $k3pats = '/\'' . $kk k. '\'[\s\S]*?(?:'.$kkk.')\'\s*=>\s*\[\r?\n/';
// 正则到数组内的元素,不包含子数组
//$k3pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
$k3pats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk)) ? '/\''.$kkk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kkk.'\'\s*=>\s*\[\r?\n/';
preg_match($k3pats,self::$str,$arrk3);
//halt($arrk3);
$k3pats = $this->getArrSonCount(config($this->configName.'.'.$k.'.'.$kk.'.'.$kkk)) ? '/\''.$kkk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kkk.'\'\s*=>\s*\[\r?\n/';
preg_match($k3pats,$this->str,$arrk3);
foreach($vvv as $kkkk => $vvvv) {
preg_match($k3pats,self::$str,$arrk3);
preg_match($k3pats,$this->str,$arrk3);
if(!is_int($kkkk)) {
// 多维数组
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
if(array_key_exists($kkkk,config($this->configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
echo $kkkk."已存在k4";
return false;
}
@ -497,23 +469,23 @@ class SetArr
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
}
}
self::$str = preg_replace($k3pats,$sonReps, self::$str);
$this->str = preg_replace($k3pats,$sonReps, $this->str);
}
} else {
// b. $kkk不存在
// 匹配到数组内部的后面k
$sonArrnum = self::getArrSonNum(config(self::$configName.'.'.$k.'.'.$kk));
$sonArrnum = $this->getArrSonNum(config($this->configName.'.'.$k.'.'.$kk));
if($sonArrnum > 0) {
// 数组存在子数组,匹配到最后一个数组],\n后面
$kkpats = '/\''.$kk.'\'([^\]]*\]){'.$sonArrnum.'},\r?\n/';
} else {
// 没有子数组k
//$kkpats = '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
$kkpats = self::getArrSonCount(config(self::$configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
$kkpats = $this->getArrSonCount(config($this->configName.'.'.$k.'.'.$kk)) ? '/\''.$kk.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$kk.'\'\s*=>\s*\[\r?\n/';
}
preg_match($kkpats,self::$str,$arrkk);
//halt($arrkk);
preg_match($kkpats,$this->str,$arrkk);
$sonArrsonArr = '';
foreach($vvv as $kkkk => $vvvv) {
if(is_array($vvvv)) {
@ -549,7 +521,7 @@ class SetArr
}
}
$reps = $arrkk[0]."\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
self::$str = preg_replace($kkpats,$reps, self::$str);
$this->str = preg_replace($kkpats,$reps, $this->str);
}
}
}
@ -560,7 +532,9 @@ class SetArr
}
}
//写入配置
return file_put_contents(self::$configFile, self::$str) ? true : false;
//return file_put_contents($this->configFile, $this->str) ? true : false;
return $this;
}
}
@ -570,9 +544,9 @@ class SetArr
* 仅支持键值对的数组修改
*
* @param array $arr
* @return boolean
* @return $this
*/
public static function edit($arr) :bool
public function edit($arr)
{
// 只能修改有键值对的数组
@ -580,14 +554,14 @@ class SetArr
foreach($arr as $k => $v) {
// key不存在
if(!array_key_exists($k,config(self::$configName))) {
if(!array_key_exists($k,config($this->configName))) {
echo $k.'不存在 ';
return false;
}
// 一级数组修改
if(!is_array($v)) {
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
preg_match($pats,self::$str,$arr);
preg_match($pats,$this->str,$arr);
//halt($arr);
if(is_string($v)){
// 字符串
@ -606,13 +580,13 @@ class SetArr
$patk = '/\'' . $k . '\'(.*),/';
$reps = preg_replace($patk, $repk, $arr[0]);
// 正则查找然后替换
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
} else {
// 正则二级配置
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,/';
// 二级和三级
foreach($v as $kk => $vv) {
if(!array_key_exists($kk, config(self::$configName.'.'.$k))) {
if(!array_key_exists($kk, config($this->configName.'.'.$k))) {
echo $kk.'不存在';
return false;
}
@ -633,18 +607,18 @@ class SetArr
// 数字
$repkk = "'". $kk . "' => " . $vv .",";
}
preg_match($pats,self::$str,$arrk);
preg_match($pats,$this->str,$arrk);
// 正则需要替换的部分
$patkk = '/\'' . $kk . '\'(.*?),/';
$reps = preg_replace($patkk, $repkk, $arrk[0]);
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
} else {
// 三级配置
// 正则二级下的三级配置
//$pats = '/\'' . $kkk . '\'[\s\S]*?(?:'.$kkk.')\'(.*),/';
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,/';
foreach($vv as $kkk => $vvv) {
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
if(!array_key_exists($kkk, config($this->configName.'.'.$k.'.'.$kk))) {
echo $kkk.'不存在';
return false;
}
@ -662,18 +636,18 @@ class SetArr
} else {
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
}
preg_match($pats,self::$str,$arrkk);
preg_match($pats,$this->str,$arrkk);
// 正则需要替换的部分
$arrPats = '/\'' . $kkk . '\'(.*),/';
$reps = preg_replace($arrPats, $arrReps, $arrkk[0]);
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
} else {
// 四级配置
// 正则$kkk
//$pats = '/\'' . $kk . '\'[\s\S]*?(?:'.$kkk.')\'[\s\S]*?(?:'.$kkkk.')\'(.*),/';
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,/';
foreach($vvv as $kkkk => $vvvv) {
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
if(!array_key_exists($kkkk, config($this->configName.'.'.$k.'.'.$kk.'.'.$kkk))){
echo $kkk.'不存在';
return false;
}
@ -690,10 +664,10 @@ class SetArr
} else {
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
}
preg_match($pats,self::$str,$arrkkk);
preg_match($pats,$this->str,$arrkkk);
$patskkkk = '/\'' . $kkkk . '\'(.*),/';
$reps = preg_replace($patskkkk, $repskkkk, $arrkkk[0]);
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
}
}
@ -704,7 +678,8 @@ class SetArr
}
//写入配置
return file_put_contents(self::$configFile, self::$str) ? true : false;
//return file_put_contents($this->configFile, $this->str) ? true : false;
return $this;
}
/**
@ -713,9 +688,9 @@ class SetArr
* 子元素被删除会清理空数组
*
* @param array $arr
* @return boolean
* @return $this
*/
public static function delete($arr) :bool
public function delete($arr)
{
// 只能修改有键值对的数组
if(!is_array($arr)) return false;
@ -725,17 +700,17 @@ class SetArr
if(!is_array($v)) {
// 正则开头到,不包含子数组
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
preg_match($pats,self::$str,$arr);
preg_match($pats,$this->str,$arr);
if(!isset($arr[0])) {
echo '有误,删除项可能并不存在';
return false;
}
if(is_int($k)) {
// 一维数组正则
$patk = self::getPats($v);
$patk = $this->getPats($v);
} else {
// key不存在
if(!array_key_exists($k,config(self::$configName))) {
if(!array_key_exists($k,config($this->configName))) {
echo $k.'不存在 ';
return false;
}
@ -744,7 +719,7 @@ class SetArr
// 正则查找然后替换
$reps = preg_replace($patk, '', $arr[0]);
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
} else {
// 二级和三级
@ -753,16 +728,16 @@ class SetArr
if(!is_array($vv)) {
// 正则二级配置
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
preg_match($pats,self::$str,$arrk);
preg_match($pats,$this->str,$arrk);
if(!isset($arrk[0])) {
echo $k.'有误,可能并不存在';
return false;
}
if(is_int($kk)) {
$patkk = self::getPats($vv);
$patkk = $this->getPats($vv);
} else {
// key不存在
if(!array_key_exists($kk,config(self::$configName.'.'.$k))) {
if(!array_key_exists($kk,config($this->configName.'.'.$k))) {
echo $kk.'不存在 ';
return false;
}
@ -770,7 +745,7 @@ class SetArr
$patkk = '/[^\n]*\'' . $kk . '\'(.*?),\r?\n/';
}
$reps = preg_replace($patkk, '', $arrk[0]);
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
} else {
// 三级配置
@ -778,15 +753,15 @@ class SetArr
if(!is_array($vvv)) {
// 正则二级下的三级配置
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
preg_match($pats,self::$str,$arrkk);
preg_match($pats,$this->str,$arrkk);
if(!isset($arrkkk[0])) {
echo $kk.'有误,可能并不存在';
return false;
}
if(is_int($kkk)) {
$patkkk = self::getPats($vvv);
$patkkk = $this->getPats($vvv);
} else {
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
if(!array_key_exists($kkk, config($this->configName.'.'.$k.'.'.$kk))) {
echo $kkk.'不存在';
return false;
}
@ -795,7 +770,7 @@ class SetArr
// 正则需要替换的部分
$reps = preg_replace($patkkk, '', $arrkk[0]);
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
} else {
// 四级配置
@ -803,15 +778,15 @@ class SetArr
if(!is_array($vvvv)) {
// 正则$kkk
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
preg_match($pats,self::$str,$arrkkk);
preg_match($pats,$this->str,$arrkkk);
if(!isset($arrkkk[0])) {
echo $kkk.'有误,可能并不存在';
return false;
}
if(is_int($kkkk)) {
$patskkkk = self::getPats($vvvv);
$patskkkk = $this->getPats($vvvv);
} else {
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
if(!array_key_exists($kkkk, config($this->configName.'.'.$k.'.'.$kk.'.'.$kkk))){
echo $kkkk.'不存在';
return false;
}
@ -819,7 +794,7 @@ class SetArr
}
$reps = preg_replace($patskkkk, '', $arrkkk[0]);
self::$str = preg_replace($pats, $reps, self::$str);
$this->str = preg_replace($pats, $reps, $this->str);
} else {
echo '不支持更多的层级数组';
}
@ -836,13 +811,19 @@ class SetArr
* 'key' => [
* ],
*/
$nullArray = '/[^\n]*\'\w+\'\s*=>\s*\[\s*\]{1}\S*\,?\r?\n/m';
//preg_match($nullArray,self::$str,$arr);
self::$str = preg_replace($nullArray, '', self::$str);
//$nullArray = '/[^\n]*\'\w+\'\s*=>\s*\[\s*\]{1}\S*\,?\r?\n/m';
//preg_match($nullArray,$this->str,$arr);
//$this->str = preg_replace($nullArray, '', $this->str);
}
//写入配置
return file_put_contents(self::$configFile, self::$str) ? true : false;
//return file_put_contents($this->configFile, $this->str) ? true : false;
return $this;
}
public function put()
{
return file_put_contents($this->configFile, $this->str) ? true : false;
}
/**
@ -851,7 +832,7 @@ class SetArr
* @param [type] $arr
* @return integer
*/
public static function getArrSonNum($arr) :int
public function getArrSonNum($arr) :int
{
$i = 0;
foreach ($arr as $val) {
@ -860,7 +841,7 @@ class SetArr
foreach($val as $vv){
if(is_array($vv)){
$i++;
self::getArrSonNum($vv);
$this->getArrSonNum($vv);
}
}
}
@ -874,7 +855,7 @@ class SetArr
* @param [type] $v
* @return string
*/
public static function getPats($v) :string
public function getPats($v) :string
{
if(is_bool($v)){
//布尔
@ -928,7 +909,7 @@ class SetArr
* @param array $array
* @return boolean
*/
public static function getArrSonCount(array $array) :bool
public function getArrSonCount(array $array) :bool
{
// 数组元素数量
$count = count($array);

View File

@ -14,8 +14,7 @@ use think\exception\ValidateException;
use taoler\com\Message;
use app\common\lib\Msgres;
use app\common\lib\Uploads;
use app\common\lib\SetArr;
use taoler\com\Api;
use taoser\SetArr;
class Article extends BaseController
{
@ -94,8 +93,9 @@ class Article extends BaseController
$ad_artImg = $ad->getSliderList(4);
//分类钻展赞助
$ad_comm = $ad->getSliderList(7);
$push_js = Db::name('push_jscode')->where(['delete_time'=>0])->cache(true)->select();
View::assign(['article'=>$artDetail,'pv'=>$pv,'artHot'=>$artHot,'ad_art'=>$ad_artImg,'ad_comm'=>$ad_comm,$download,'page'=>$page,'comments'=>$comments,'jspage'=>'jie']);
View::assign(['article'=>$artDetail,'pv'=>$pv,'artHot'=>$artHot,'ad_art'=>$ad_artImg,'ad_comm'=>$ad_comm,$download,'page'=>$page,'comments'=>$comments,'jspage'=>'jie','push_js'=>$push_js]);
return View::fetch('article/'.$tpl.'/detail');
}
@ -391,7 +391,7 @@ class Article extends BaseController
$post_data = substr($o,0,-1);
$res = $this->request_post($url, $post_data);
// 写入token
(new SetArr('taoler'))::edit([
SetArr::name('taoler')->edit([
'baidu'=> [
'access_token' => json_decode($res)->access_token,
]

View File

@ -3,6 +3,7 @@ namespace app\index\controller;
use app\common\controller\BaseController;
use think\facade\Session;
use think\facade\Cache;
use app\common\model\Comment as CommentModel;
use app\common\model\Article;
use app\common\model\UserZan;
@ -22,6 +23,8 @@ class Comment extends BaseController
if($jie){
$res['status'] = 0;
}
// 清除文章tag缓存
Cache::tag('tagArtDetail')->clear();
}
return json($res);
}

View File

@ -37,10 +37,6 @@ class Login extends BaseController
}
//获取登录前访问页面refer
$refer = Request::server('HTTP_REFERER');
//$domain = Request::domain();
//截取域名后面的字符
//$url = substr($refer,strlen($domain));
Cookie::set('url',$refer);
if(Request::isAjax()) {
//登陆前数据校验
@ -86,7 +82,7 @@ class Login extends BaseController
$user = new User();
$res = $user->login($data);
if ($res == 1) { //登陆成功
return Msgres::success('login_success',Cookie::get('url'));
return Msgres::success('login_success',$refer);
} else {
return Msgres::error($res);
}

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-19 13:19:28
* @LastEditTime: 2022-04-22 06:33:20
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\index\route\route.php
@ -18,14 +18,13 @@ $cate_as = config('taoler.url_rewrite.cate_as');
Route::get('captcha/[:config]','\\think\\captcha\\CaptchaController@index');
Route::rule('/', 'index'); // 首页访问路由
Route::group(function () use($detail_as,$cate_as){
Route::get($detail_as .'/:id', 'article/detail');
Route::get($cate_as.'/<ename>$','article/cate');
Route::get($cate_as.'/<ename>/<type>$', 'article/cate')->name('cate_type');
Route::rule($cate_as.'/<ename>/<type>/<page>', 'article/cate')->name('cate_page');
Route::get("$detail_as<id>", 'article/detail');
Route::get("$cate_as<ename>",'article/cate')->name('cate');
Route::get("$cate_as<ename>/<type>$", 'article/cate')->name('cate_type');
Route::rule("$cate_as<ename>/<type>/<page>", 'article/cate')->name('cate_page');
Route::rule('add','Article/add');
Route::rule('tags','Article/tags')->allowCrossDomain();
Route::rule('edit/[:id]','Article/edit');
//Route::rule('del/:id','article/delete');
})->pattern([
'ename' => '\w+',
'type' => '\w+',
@ -40,7 +39,7 @@ Route::rule('login','login/index');
Route::rule('forget','login/forget');
Route::rule('postcode','login/postcode');
Route::rule('respass','login/respass');
Route::rule('reg','Login/reg')
Route::rule('reg$','Login/reg')
->middleware(\app\middleware\CheckRegister::class);
Route::rule('search/[:keywords]', 'index/search'); // 搜索

View File

@ -1,4 +1,13 @@
<?php
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-22 06:24:03
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\middleware\Auth.php
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
*/
declare(strict_types=1);
namespace app\middleware;
@ -45,12 +54,12 @@ class Auth
//没有登录及当前非登录页重定向登录页
if(!Session::has('admin_id') && $path !== 'admin/login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) )
{
return redirect((string) url('admin/login/index'));
return redirect((string) url('login/index'));
}
//登陆后无法访问登录页
if(Session::has('admin_id') && $path == 'admin/login/index'){
return redirect((string) url('admin/index/index'));
return redirect((string) url('index/index'));
}
// 排除公共权限

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-19 16:49:29
* @LastEditTime: 2022-04-21 20:56:48
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\config\app.php
@ -28,16 +28,9 @@ return [
// 应用映射(自动多应用模式有效)
'app_map' => [
//'bbs' => 'index',
//'*' => 'home',
//'admin1' => 'admin',
],
// 域名绑定(自动多应用模式有效)
'domain_bind' => [
//'bbs' => 'index',
//'adm' => 'admin',
//'www'=>'home',
//'api' => 'api'
],
// 禁止URL访问的应用列表自动多应用模式有效

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-04-19 16:48:27
* @LastEditTime: 2022-04-22 06:57:15
* @LastEditors: TaoLer
* @Description: 网站公共配置
* @FilePath: \TaoLer\config\taoler.php
@ -16,13 +16,12 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
'version' => '1.9.2',
'version' => '1.9.3',
// 加盐
'salt' => 'taoler',
// 数据库备份目录
'databasebackdir' => app()->getRootPath() .'data/',
'article_as' => 'aa',
'cate_as' => 'column',
// 配置
'config' =>[
'email_notice' => 0,
@ -38,8 +37,8 @@ return [
// 百度标签分词
'baidu' => [
'grant_type' => '',
'client_id' => 'aa',
'client_secret' => 'aa',
'client_id' => '',
'client_secret' => '',
'access_token' => '',
'push_api' => 'http://',
],
@ -58,9 +57,9 @@ return [
// URL美化
'url_rewrite' => [
// 详情url
'article_as' => 'article',
'article_as' => 'article/',
// 分类url
'cate_as' => 'column',
'cate_as' => 'column/',
],

View File

@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '1250b449335a867caa1976e6117d3b3448b5d7bf',
'reference' => '3f2bac47e4326e46b7e195dcaf909dfef2fb4c17',
'name' => 'taoser/taoler',
'dev' => true,
),
@ -160,7 +160,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '1250b449335a867caa1976e6117d3b3448b5d7bf',
'reference' => '3f2bac47e4326e46b7e195dcaf909dfef2fb4c17',
'dev_requirement' => false,
),
'taoser/think-addons' => array(

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2022-04-18 13:52:33
// This file is automatically generated at:2022-04-22 08:07:42
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -2,10 +2,10 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2022-04-14 16:05:35
* @LastEditTime: 2022-04-17 07:04:31
* @LastEditTime: 2022-04-20 14:49:27
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \undefinede:\github\think-setarr\src\SetArr.php
* @FilePath: \TaoLer\vendor\taoser\think-setarr\src\SetArr.php
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
*/
namespace taoser;
@ -219,6 +219,7 @@ class SetArr
//$kpats = '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
// 添加一维数组,数组中有元素匹配到最后一个数组,没有数组,匹配到数组开头[
$kpats = self::getArrSonCount(config(self::$configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
preg_match($kpats,self::$str,$arrk);
if(!is_int($kk)) {
@ -790,7 +791,7 @@ class SetArr
*/
$nullArray = '/[^\n]*\'\w+\'\s*=>\s*\[\s*\]{1}\S*\,?\r?\n/m';
//preg_match($nullArray,self::$str,$arr);
self::$str = preg_replace($nullArray, '', self::$str);
//self::$str = preg_replace($nullArray, '', self::$str);
}
//写入配置

View File

@ -416,19 +416,10 @@ $("#rdown").hover(function(){
content: "<img src='/qrcode/?text={$Request.domain}{:url('article/detail',['id' => $article.id])}&size=230'>"
});
}
//推送百度收录服务
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
{volist name="push_js" id="vo"}
{$vo.jscode|raw}
{/volist}
{/block}

View File

@ -10,37 +10,19 @@
<div class="layui-col-md12 content detail">
<div class="fly-panel detail-box">
{//标题}
<h1 style="color:{$article.title_color};" align="center">{$article.title}</h1>
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
<h1 style="color:{$article.title_color}; margin:10px 5px 15px 5px;" align="center">{$article.title}</h1>
{//图标}
<div class="fly-detail-info">
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
<span class="fly-list-nums">
<a href="#comment"><i class="iconfont" title="{:lang('reply')}">&#xe60c;</i>{$article.comments_count}</a><i class="iconfont" title="浏览">&#xe60b;</i>{$pv}
</span>
</div>
{//作者}
<div class="detail-about">
<a class="fly-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
<img src="{$article.user.user_img}" alt="{$article.user.name}">
<i class="iconfont icon-renzheng" title="认证信息"></i>
</a>
<div class="fly-detail-user">
<a href="{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($article.user.area_id) ?: '无'}</i>{/if}
<cite>{$article.user.nickname ?: $article.user.name}</cite>
</a>
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
</div>
<div class="detail-hits">
<!--span style="padding-right: 10px; color: #FF7200">悬赏60飞吻</span-->
<span class="post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
<div class="detail-about" align="center">
<div class="detail-hits" style="left:-30px;">
<span>{$article.user.name} /</span>
<span class="post-time" style="padding-top: 5px;" data="{$article.create_time}">{$article.create_time}</span>
<span>/ <i class="iconfont" title="浏览">&#xe60b;</i> {$pv}</span>
</div>
</div>
<hr>
<hr style="margin-bottom: 25px">
{// 内容}
<div class="detail-body photos" id="content">{$article.content}</div>
<div class="detail-body photos" style="font-size: 18px;line-height: 200%;" id="content">{$article.content}</div>
{//管理}
{if (($article.upzip !== '') || session('?user_name'))}
@ -51,8 +33,12 @@
<div class="fly-admin-box" data-id="{$article.id}">
{if ($user.auth ?? '')}
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
{if($article.is_top == 0)}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
{else /}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>{/if}
{if($article.is_top == 0)}
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
{else /}
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>
{/if}
{if($article.is_hot == 0)}
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
{else /}
@ -306,18 +292,10 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
});
}
//推送百度收录服务
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
{volist name="push_js" id="vo"}
{$vo.jscode|raw}
{/volist}
{/block}

View File

@ -391,20 +391,10 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
content: "<img src='/qrcode/?text={$Request.domain}{:url('article/detail',['id' => $article.id])}&size=230'>"
});
}
//推送百度收录服务
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
{volist name="push_js" id="vo"}
{$vo.jscode|raw}
{/volist}
{/block}

View File

@ -7,7 +7,7 @@
<div class="fly-panel fly-panel-user" pad20>
<div class="layui-tab layui-tab-brief" lay-filter="user">
<ul class="layui-tab-title">
<li><a href="{:url('index/login/index')}">{:lang('login')}</a></li>
<li><a href="{:url('login/index')}">{:lang('login')}</a></li>
<li class="layui-this">{if cache('repass')==2}{:lang('reset password')}{else /}{:lang('retrieve password')}{/if}</li>
</ul>
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">

View File

@ -6,7 +6,7 @@
</li>
{volist name="cateList" id="cate"}
<li {if condition="$cate.ename eq $Request.param.ename"} class="layui-this" {/if}>
<a href="{:url('article/cate',['ename' => $cate.ename])}">{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}{if condition="$cate.is_hot eq 1"}<span class="layui-badge-dot"></span>{/if}</a>
<a href="{:url('cate',['ename' => $cate.ename])}">{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}{if condition="$cate.is_hot eq 1"}<span class="layui-badge-dot"></span>{/if}</a>
</li>
{/volist}
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>

View File

@ -35,7 +35,7 @@
{volist name="cateList" id="cate"}
<li {if condition="$cate.ename eq $Request.param.ename"} class="layui-this" {/if}>
<div class="layui-menu-body-title">
<a href="{:url('article/cate',['ename' => $cate.ename])}"><i class="layui-icon {$cate.icon}"></i> {:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}
<a href="{:url('cate',['ename' => $cate.ename])}"><i class="layui-icon {$cate.icon}"></i> {:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}
<span class="layui-font-12 layui-font-gray">>> {$cate.ename}</span>
{if condition="$cate.is_hot eq 1"}<span class="layui-badge-dot"></span>{/if}
</a>

View File

@ -1,3 +1,12 @@
<!--
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:51
* @LastEditTime: 2022-04-21 21:52:57
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\view\taoler\index\user\message.html
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
-->
{extend name="public/user" /} {block name="content"}
<div class="layui-tab layui-tab-brief" lay-filter="user" id="LAY_msg" style="margin-top: 15px">
<button class="layui-btn layui-btn-danger" id="LAY_delallmsg">
@ -7,9 +16,9 @@
</div>
{/block} {block name="script"}
<script>
var messageFind = "{:url('index/Message/find')}",
messageRemove = "{:url('index/Message/remove')}",
userNameJump = "{:url('index/Index/jump')}";
var messageFind = "{:url('Message/find')}",
messageRemove = "{:url('Message/remove')}",
userNameJump = "{:url('Index/jump')}";
//点开标题改变帖子已读状态
$("#LAY_minemsg").on("click", ".art-title", function () {