SEO,域名绑定等
This commit is contained in:
parent
9a3faa0bd3
commit
97f2b926ac
@ -3,8 +3,8 @@
|
||||
> TaoLer是一个简单迅捷的轻论坛系统,适用于个人或组织区域型信息交流发布平台。
|
||||
|
||||
* 官网:https://www.aieok.com
|
||||
* 版本:TaoLer 1.9.0
|
||||
* 日期:2022.3.16
|
||||
* 版本:TaoLer 1.9.1
|
||||
* 日期:2022.4.16
|
||||
|
||||
webman版新架构已适配90%
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
|
||||
参考官网分享文章
|
||||
|
||||
aieok.com (http://wiki.aieok.com:888)
|
||||
aieok.com (http://wiki.aieok.com)
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
|
@ -77,7 +77,16 @@ class Forum extends AdminController
|
||||
$res['msg'] = '';
|
||||
$res['count'] = $count;
|
||||
foreach($forumList as $k=>$v){
|
||||
$res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']];
|
||||
$indexUrl = $this->getIndexUrl();
|
||||
$artUrl = (string) url('detail_id', ['id' => $v['aid']]);
|
||||
if(empty(config('app.domain_bind'))) {
|
||||
// 未绑定域名
|
||||
$url = $indexUrl . str_replace('admin','index',$artUrl);
|
||||
} else {
|
||||
// 单独绑定域名
|
||||
$url = $indexUrl . $artUrl;
|
||||
}
|
||||
$res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'url'=>$url,'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']];
|
||||
}
|
||||
} else {
|
||||
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
|
||||
|
268
app/admin/controller/Seo.php
Normal file
268
app/admin/controller/Seo.php
Normal file
@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: TaoLer <alipey_tao@qq.com>
|
||||
* @Date: 2022-04-13 09:54:31
|
||||
* @LastEditTime: 2022-04-17 16:55:13
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\app\admin\controller\Seo.php
|
||||
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\AdminController;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use think\facade\Db;
|
||||
use app\common\lib\SetArr;
|
||||
|
||||
class Seo extends AdminController
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
if(is_file($rob = public_path().'robots.txt')){
|
||||
$robots = file_get_contents($rob);
|
||||
} else {
|
||||
$robots = '';
|
||||
}
|
||||
|
||||
View::assign('robots',$robots);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
public function push()
|
||||
{
|
||||
if(empty(config('taoler.baidu.push_api'))) return json(['code'=>-1,'msg'=>'请先配置接口push_api']);
|
||||
$urls = [];
|
||||
$artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->column('id');
|
||||
foreach($artAllId as $aid) {
|
||||
$urls[] = $this->getRouteUrl($aid);
|
||||
}
|
||||
$api = config('taoler.baidu.push_api');
|
||||
$ch = curl_init();
|
||||
$options = array(
|
||||
CURLOPT_URL => $api,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POSTFIELDS => implode("\n", $urls),
|
||||
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
|
||||
);
|
||||
curl_setopt_array($ch, $options);
|
||||
$result = curl_exec($ch);
|
||||
if($result == false) {
|
||||
return json(['code'=>-1,'msg'=>'接口失败']);
|
||||
}
|
||||
$res = stripos($result,'error');
|
||||
$data = json_decode($result);
|
||||
if($res !== false) {
|
||||
return json(['code'=>-1,'msg'=>$data->message]);
|
||||
};
|
||||
return json(['code'=>0,'msg'=>'成功推送'.$data->success.'条,今天剩余'.$data->remain]);
|
||||
}
|
||||
|
||||
public function config()
|
||||
{
|
||||
//
|
||||
$baidu = [];
|
||||
$data = Request::only(['client_id','client_secret','push_api']);
|
||||
foreach($data as $k => $v) {
|
||||
if($v !== ''){
|
||||
if($k == 'push_api') {
|
||||
$baidu[$k] = "'$v'";
|
||||
} else {
|
||||
$baidu[$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$res = (new SetArr('taoler'))::edit([
|
||||
'baidu' => $baidu,
|
||||
]);
|
||||
if($res == true){
|
||||
return json(['code'=>0,'msg'=>'设置成功']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 百度谷歌sitemap生成xml文件
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$data = Request::only(['map_num','map_time','map_level']);
|
||||
// 写文件字符串
|
||||
$str = '';
|
||||
// 标记第一次调用写ID
|
||||
$flag= true;
|
||||
// 写ID
|
||||
$w_id = '';
|
||||
// 新文件编号
|
||||
$i = 1;
|
||||
// 获取public下所有xml文件
|
||||
$newFile = $this->getXmlFile(public_path());
|
||||
// 没有xml文件时,不存在重写
|
||||
if(empty($newFile)) {
|
||||
$rewrite = false;
|
||||
} else {
|
||||
$xmlFile = end($newFile);
|
||||
$strFile = file_get_contents(public_path().$xmlFile);
|
||||
$num = substr_count($strFile, '<url>');
|
||||
// 是否有需要追加在文件,判断最新文件是否未写满
|
||||
$rewrite = $num < $data['map_num'] ? true : false;
|
||||
}
|
||||
|
||||
if($rewrite){
|
||||
// 需要追加的数量
|
||||
$limit = (int) $data['map_num'] - $num;
|
||||
$name = pathinfo($xmlFile,PATHINFO_FILENAME);
|
||||
$arr = explode('_', $name);
|
||||
// 检验当天,避免重复生成
|
||||
if($arr[0] == date('Y-d-m'))
|
||||
{
|
||||
$i = $arr[1] + 1;
|
||||
}
|
||||
} else {
|
||||
$limit = (int) $data['map_num'];
|
||||
}
|
||||
// 最新ID
|
||||
$maxId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->max('id');
|
||||
|
||||
do
|
||||
{
|
||||
$wr_id = $flag ? config('taoler.sitemap.write_id') : $w_id;
|
||||
$artAllId = Db::name('article')
|
||||
->where(['delete_time'=>0,'status'=>1])
|
||||
->where('id', '>', (int) $wr_id)
|
||||
->order('id','asc')->limit($limit)->column('update_time','id');
|
||||
if(empty($artAllId)) {
|
||||
return json(['code'=>-1,'msg'=>'本次无需生成']);
|
||||
} else {
|
||||
// 本次最新文件ID
|
||||
$last_id = array_key_last($artAllId);
|
||||
// 循环拼接文件字符串
|
||||
foreach($artAllId as $aid => $uptime) {
|
||||
// url生成
|
||||
$url = $this->getRouteUrl($aid);
|
||||
$time = date('Y-m-d', $uptime);
|
||||
// 组装字符串
|
||||
$str .= <<<STR
|
||||
<url>
|
||||
<loc>$url</loc>
|
||||
<lastmod>$time</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>\n
|
||||
STR;
|
||||
}
|
||||
|
||||
// 写文件
|
||||
if($rewrite){
|
||||
// 写入旧xml文件
|
||||
$reps = $str.'</urlset>';
|
||||
$xml = preg_replace('/<\/urlset>/', $reps, $strFile);
|
||||
$res = file_put_contents(public_path().$xmlFile, $xml);
|
||||
if($res == false){
|
||||
return json(['code'=>-1,'msg'=>$xmlFile.'写入失败']);
|
||||
}
|
||||
$limit = $data['map_num'];
|
||||
$rewrite = false;
|
||||
} else {
|
||||
// 生成新xml
|
||||
$xml = <<<XML
|
||||
<?xml version="1.0" encoding="utf-8"?> <!-- XML文件需以utf-8编码-->
|
||||
<urlset>\n$str</urlset>
|
||||
XML;
|
||||
$res = file_put_contents(public_path().date('Y-m-d').'_'.$i.'.xml', $xml);
|
||||
if($res == false){
|
||||
return json(['code'=>-1,'msg'=>date('Y-m-d').'_'.$i.'.xml写入失败']);
|
||||
}
|
||||
}
|
||||
// 重置标记内容
|
||||
$str = '';
|
||||
$i++;
|
||||
$w_id = $last_id;
|
||||
$flag = false;
|
||||
}
|
||||
}
|
||||
while($last_id < (int) $maxId);
|
||||
// 写配置,标记最后写入ID
|
||||
$res = (new SetArr('taoler'))::edit([
|
||||
'sitemap' => [
|
||||
'map_num' => $data['map_num'],
|
||||
'write_id' => $last_id,
|
||||
],
|
||||
]);
|
||||
if($res == false){
|
||||
return json(['code'=>-1,'msg'=>'写xml配置失败']);
|
||||
}
|
||||
|
||||
return json(['code'=>0,'msg'=>'生成xml成功']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回public目录下xml名称数组
|
||||
*
|
||||
* @param string $dir
|
||||
* @return array
|
||||
*/
|
||||
public function getXmlFile(string $dir) : array
|
||||
{
|
||||
$arr = [];
|
||||
$files = array_diff(scandir($dir), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if(is_file("$dir/$file") && !is_link($dir) && (pathinfo("$dir/$file", PATHINFO_EXTENSION)) == 'xml')
|
||||
{
|
||||
$arr[] = "$file";
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成robots
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function robots()
|
||||
{
|
||||
if(Request::isPost()){
|
||||
$txt = input('robots');
|
||||
$xmlArr = $this->getXmlFile(public_path());
|
||||
foreach($xmlArr as $v) {
|
||||
$res = stripos($txt, $v);
|
||||
if($res == false){
|
||||
$map = $this->getIndexUrl().'/'.$v;
|
||||
$txt .= "\nsitemap:".$map;
|
||||
}
|
||||
}
|
||||
$res = file_put_contents(public_path().'robots.txt',$txt);
|
||||
if($res == false){
|
||||
return json(['code'=>-1,'msg'=>$v.'写入失败']);
|
||||
}
|
||||
return json(['code'=>0,'msg'=>'设置成功']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章链接地址
|
||||
*
|
||||
* @param integer $aid
|
||||
* @return string
|
||||
*/
|
||||
protected function getRouteUrl(int $aid) : string
|
||||
{
|
||||
$indexUrl = $this->getIndexUrl();
|
||||
$artUrl = (string) url('detail_id', ['id' => $aid]);
|
||||
if(empty(config('app.domain_bind'))) {
|
||||
// 未绑定域名
|
||||
$url = $indexUrl . str_replace('admin','index',$artUrl);
|
||||
} else {
|
||||
// 单独绑定域名
|
||||
$url = $indexUrl . $artUrl;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\AdminController;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use think\facade\Db;
|
||||
@ -11,8 +10,10 @@ use think\facade\Config;
|
||||
use app\admin\model\System;
|
||||
use app\admin\model\MailServer;
|
||||
use taoler\com\Files;
|
||||
use taoler\com\Api;
|
||||
use app\common\lib\SetConf;
|
||||
use app\common\lib\SetArr;
|
||||
use think\facade\Session;
|
||||
use think\facade\Cookie;
|
||||
|
||||
class Set extends AdminController
|
||||
{
|
||||
@ -28,6 +29,20 @@ class Set extends AdminController
|
||||
$template = Files::getDirName('../view');
|
||||
$email = Db::name('admin')->where('id',1)->value('email');
|
||||
View::assign(['sysInfo'=>$this->sysInfo,'mailserver'=>$mailserver,'template'=>$template,'email'=>$email]);
|
||||
if(!empty(config('app.domain_bind'))){
|
||||
$data = array_flip(config('app.domain_bind'));
|
||||
$domain_bind = [
|
||||
'index' => isset($data['index']) ? $data['index'] : '',
|
||||
'admin' => isset($data['admin']) ? $data['admin'] : '',
|
||||
];
|
||||
|
||||
} else {
|
||||
$domain_bind = [
|
||||
'index' => '',
|
||||
'admin' => '',
|
||||
];
|
||||
}
|
||||
View::assign($domain_bind);
|
||||
return View::fetch('set/system/website');
|
||||
}
|
||||
|
||||
@ -45,6 +60,44 @@ 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 = (new SetArr('app'))::add([
|
||||
'domain_bind'=> $data,
|
||||
]);
|
||||
}else{
|
||||
// 编辑
|
||||
$res = (new SetArr('app'))::edit([
|
||||
'domain_bind'=> $data,
|
||||
]);
|
||||
}
|
||||
//清空缓存
|
||||
Cookie::delete('adminAuth');
|
||||
Session::clear();
|
||||
} else {
|
||||
$res = (new SetArr('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()
|
||||
|
@ -25,6 +25,7 @@ use think\facade\Config;
|
||||
use think\facade\Log;
|
||||
use app\common\lib\ZipFile;
|
||||
use app\common\lib\SetConf;
|
||||
use app\common\lib\SetArr;
|
||||
use app\common\lib\SqlFile;
|
||||
use app\common\lib\Zip;
|
||||
|
||||
|
@ -12,4 +12,5 @@ use think\facade\Route;
|
||||
//Route::get('jie/:id','index/article/detail');
|
||||
|
||||
Route::get('captcha/[:config]','\\think\\captcha\\CaptchaController@index');
|
||||
Route::get('jie/:id', 'article/detail');
|
||||
//Route::get('jie/:id', '\app\index\controller\Article@detail')->name('detail_id');
|
||||
Route::get('jie/:id', 'index/Article/detail')->name('detail_id');
|
||||
|
@ -54,7 +54,7 @@
|
||||
<img style="display: inline-block; width: 50%; height: 100%;" src= "{{ d.avatar }}">
|
||||
</script>
|
||||
<script type="text/html" id="title">
|
||||
<a href="{$domain}/jie/{{d.id}}.html" target="_blank">{{d.title}}</a>
|
||||
<a href="{{ d.url }}" target="_blank">{{d.title}}</a>
|
||||
</script>
|
||||
<script type="text/html" id="buttonTpl">
|
||||
{{# if(d.top == 1){ }}
|
||||
|
204
app/admin/view/seo/index.html
Normal file
204
app/admin/view/seo/index.html
Normal file
@ -0,0 +1,204 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="body"}
|
||||
<div class="layui-fluid" id="component-tabs">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
|
||||
<div class="layui-tab layui-tab-card" lay-filter="seo-tabs-brief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" lay-id="push">百度推送</li>
|
||||
<li lay-id="map">站点地图</li>
|
||||
<li lay-id="robots">robots</li>
|
||||
<li lay-id="config">* 接口配置</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-form" wid100 lay-filter="push">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">链接提交</label>
|
||||
<div class="layui-input-block">
|
||||
{if condition="checkRuleButton('Seo/push')"}
|
||||
<button class="layui-btn" lay-submit lay-filter="search_push">提交推送</button>
|
||||
{else /}
|
||||
<button class="layui-btn layui-btn-disabled">提交推送</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form" wid100 lay-filter="map">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">限定数量</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="map_num" value="{:config('taoler.sitemap.map_num')}" placeholder="推荐5000" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">单个map文件xml数量</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">更新频率</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="map_time" value="" placeholder="daily" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">每天或定时</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">优先级</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="map_level" value="" placeholder="默认0.5" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">0.0-1.0之间</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="map_xml">生成</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form" wid100 lay-filter="robots">
|
||||
<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>
|
||||
<div class="layui-form-mid layui-word-aux">会自动写入sitemap的链接</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="robots_submit">生成</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form" wid100 lay-filter="config">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">key</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="client_id" value="{:config('taoler.baidu.client_id')}" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">百度分词API Key</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">secret</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="client_secret" value="{:config('taoler.baidu.client_secret')}" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">百度分词Secret Key</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收录token</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="push_api" value="{:config('taoler.baidu.push_api')}" 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="baidu_config">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="js"}
|
||||
<script>
|
||||
var setWebSite ="{:url('Set/website')}";
|
||||
var setEmail ="{:url('Set/email')}";
|
||||
layui.config({
|
||||
base: '/static/admin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index'], function(){
|
||||
var $ = layui.$
|
||||
,form = layui.form
|
||||
var element =layui.element ;
|
||||
|
||||
// baidu push
|
||||
form.on('submit(search_push)', function(data){
|
||||
//var field = data.field;
|
||||
$.post("{:url('seo/push')}",function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg,{icon:6,tiye:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//网站配置
|
||||
form.on('submit(baidu_config)', function(data){
|
||||
var field = data.field;
|
||||
$.post("{:url('seo/config')}",field,function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg,{icon:6,tiye:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// map
|
||||
form.on('submit(map_xml)', function(data){
|
||||
var field = data.field;
|
||||
$.post("{:url('seo/map')}",field,function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg,{icon:6,tiye:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// map
|
||||
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
|
||||
});
|
||||
} 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){
|
||||
location.hash = layid;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
@ -12,10 +12,11 @@
|
||||
<li class="layui-this" lay-id="website">网站设置</li>
|
||||
<li lay-id="email">邮箱服务</li>
|
||||
<li lay-id="config">服务配置</li>
|
||||
<li lay-id="domain">域名绑定</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-form" wid100 lay-filter="">
|
||||
<div class="layui-form" wid100 lay-filter="website">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网站名称</label>
|
||||
<div class="layui-input-block">
|
||||
@ -128,7 +129,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form" wid100 lay-filter="">
|
||||
<div class="layui-form" wid100 lay-filter="emai">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">SMTP服务器</label>
|
||||
<div class="layui-input-inline">
|
||||
@ -260,6 +261,46 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form" wid100 lay-filter="domain">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">多域名开关</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" name="domain_check" lay-skin="switch" lay-filter="domain_check" lay-text="开启|关闭" {if empty(config('app.domain_bind')) == false} checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
<div id="set_domain" class="{if empty(config('app.domain_bind')) == true} layui-hide {/if}">
|
||||
<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">
|
||||
</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">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">如:admin.aieok.com</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
{if condition="checkRuleButton('admin/Set/email')"}
|
||||
<button class="layui-btn" lay-submit lay-filter="set_system_domain">确认保存</button>
|
||||
{else /}<button class="layui-btn layui-btn-disabled">确认保存</button>{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -344,7 +385,44 @@
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//网站配置
|
||||
form.on('submit(set_system_domain)', function(data){
|
||||
var field = data.field;
|
||||
$.post("{:url('admin/set/setDomain')}",field,function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg,{icon:6,tiye:2000
|
||||
}, function(){
|
||||
parent.location.href = '/';
|
||||
});
|
||||
} else {
|
||||
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('switch(domain_check)', function(data){
|
||||
var data = data.elem;
|
||||
status = data.checked ? 'on' : 'off';
|
||||
if(status == 'on'){
|
||||
$('#set_domain').removeClass('layui-hide');
|
||||
} else {
|
||||
$('#set_domain').addClass('layui-hide');
|
||||
$.post("{:url('admin/set/setDomain')}",{"domain_check":status},function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg,{icon:6,tiye:2000
|
||||
}, function(){
|
||||
parent.location.href = '/';
|
||||
});
|
||||
} 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(/^#/, ''));
|
||||
|
@ -16,8 +16,8 @@
|
||||
<option {if condition="$slider.slid_type eq 7"} selected {/if} value="7">7详情赞助</option>
|
||||
<option {if condition="$slider.slid_type eq 8"} selected {/if} value="8">8温馨通道</option>
|
||||
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="9">9友情链接</option>
|
||||
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="10">10头部菜单</option>
|
||||
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="11">11页脚链接</option>
|
||||
<option {if condition="$slider.slid_type eq 10"} selected {/if} value="10">10头部菜单</option>
|
||||
<option {if condition="$slider.slid_type eq 11"} selected {/if} value="11">11页脚链接</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -91,7 +91,11 @@ function getCateDesc($ename)
|
||||
//过滤文章摘要
|
||||
function getArtContent($content)
|
||||
{
|
||||
return mb_substr(strip_tags($content),0,50).'...';
|
||||
// 过滤音视频图片
|
||||
$content = preg_replace('/[(img)|(audio)|(video)]+(\(\S+\))?\[\S+\]/','',$content);
|
||||
$content = preg_replace('/\s*/','',$content);
|
||||
$content = preg_replace('/\[[^\]]+\]/','',$content);
|
||||
return mb_substr(strip_tags($content),0,150).'...';
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,8 +3,6 @@ declare (strict_types = 1);
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\App;
|
||||
use think\facade\Session;
|
||||
use think\facade\View;
|
||||
use think\facade\Db;
|
||||
@ -37,14 +35,24 @@ class AdminController extends \app\BaseController
|
||||
protected function getMenu()
|
||||
{
|
||||
$menu = [];
|
||||
$admin_id = Session::get('admin_id');
|
||||
$admin_id = $this->aid;
|
||||
$auth = new Auth();
|
||||
|
||||
$auth_rule_list = Db::name('auth_rule')->where(['status'=> 1,'ishidden'=>1])->order(['sort' => 'asc'])->select();
|
||||
$auth_rule_list = Db::name('auth_rule')->where('delete_time',0)->where(['status'=> 1,'ishidden'=>1])->order(['sort' => 'asc'])->select();
|
||||
//var_export($auth_rule_list);
|
||||
|
||||
foreach ($auth_rule_list as $value) {
|
||||
if ($auth->check($value['name'], $admin_id) || $admin_id == 1) {
|
||||
// 查询是否设置映射
|
||||
// $map = array_search('admin',config('app.app_map'));
|
||||
// //dump($map,$value);
|
||||
// //stripos($value);
|
||||
// if($map){
|
||||
// $menu[] = strtr($value,'admin',$map);
|
||||
// } else {
|
||||
// $menu[] = $value;
|
||||
// }
|
||||
//dump($menu);
|
||||
$menu[] = $value;
|
||||
}
|
||||
}
|
||||
@ -59,7 +67,7 @@ class AdminController extends \app\BaseController
|
||||
protected function getMenus($type)
|
||||
{
|
||||
$menu = [];
|
||||
$auth_rule_list = Db::name('auth_rule')->where(['status'=> 1])->where('type',$type)->order(['sort' => 'ASC', 'id' => 'ASC'])->select();
|
||||
$auth_rule_list = Db::name('auth_rule')->where('delete_time',0)->where(['status'=> 1])->where('type',$type)->order(['sort' => 'ASC', 'id' => 'ASC'])->select();
|
||||
//var_export($auth_rule_list);
|
||||
|
||||
foreach ($auth_rule_list as $value) {
|
||||
@ -109,6 +117,7 @@ class AdminController extends \app\BaseController
|
||||
$syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version');
|
||||
$runTime = $this->getRunTime();
|
||||
View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]);
|
||||
return $domain;
|
||||
}
|
||||
|
||||
protected function getRunTime()
|
||||
|
@ -54,7 +54,7 @@ class BaseController extends BaseCtrl
|
||||
}
|
||||
}*/
|
||||
|
||||
// 显示导航
|
||||
// 显示导航
|
||||
protected function showNav()
|
||||
{
|
||||
//1.查询分类表获取所有分类
|
||||
|
952
app/common/lib/SetArr.php
Normal file
952
app/common/lib/SetArr.php
Normal file
@ -0,0 +1,952 @@
|
||||
<?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.
|
||||
*/
|
||||
namespace app\common\lib;
|
||||
|
||||
|
||||
class SetArr
|
||||
{
|
||||
protected static string $str = '';
|
||||
protected static string $configName = '';
|
||||
protected static string $configFile = '';
|
||||
|
||||
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'=>'配置修改成功']);
|
||||
}else{
|
||||
return json(['code'=>-1,'msg'=>'配置项错误!']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增配置项,支持三级数组配置
|
||||
*
|
||||
* @param array $arr
|
||||
* @return boolean
|
||||
*/
|
||||
public static function add(array $arr) :bool
|
||||
{
|
||||
//dump(self::$str);
|
||||
//正则];数组结尾
|
||||
$end = '/\];/';
|
||||
//一级配置,内容追加到return [一级配置,之后
|
||||
$start = self::getArrSonCount(config(self::$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);
|
||||
if(is_int($k)) {
|
||||
// 数值数组
|
||||
if(is_string($v)){
|
||||
|
||||
// 类、函数、注释,原样写入
|
||||
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||
$reps = $arrstart[0]. "\t'". $v ."',\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]. "\t". $v .",\n";
|
||||
}
|
||||
} elseif(is_bool($v)) {
|
||||
$reps = ($v == true) ? $arrstart[0]."\ttrue,\n" : $arrstart[0]."\tfalse,\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]."\t".$v . ",\n";
|
||||
}
|
||||
} else {
|
||||
// 键值关联数组
|
||||
//判断是否存在KEY
|
||||
if (array_key_exists($k,config(self::$configName))) {
|
||||
echo $k.'不能添加已存在的配置项';
|
||||
return false;
|
||||
}
|
||||
if(is_string($v)){
|
||||
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||
$reps = $arrstart[0]."\t'" . $k . "' => '" . $v ."',\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||
}
|
||||
} elseif(is_bool($v)) {
|
||||
$reps = ($v == true) ? $arrstart[0]."\t'" . $k . "' => true,\n" : $arrstart[0]."\t'" . $k . "' => false,\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($start, $reps, self::$str);
|
||||
} else {
|
||||
// $v是数组,存在多级配置
|
||||
|
||||
// $k不存在,新增二级配置数组, 数组插入];之前
|
||||
if (!array_key_exists($k,config(self::$configName))) {
|
||||
// 拼接数组内元素
|
||||
$sonArr = '';
|
||||
foreach($v as $kk => $vv) {
|
||||
// 1.$vv不是数组,新增配置只有二级元素
|
||||
if(!is_array($vv)) {
|
||||
if(!is_int($kk)) {
|
||||
// 键值对数组
|
||||
if(is_int($vv)) {
|
||||
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$sonArr .= ($vv == true) ? "\t\t'" . $kk . "' => true,\n" : "\t\t'" . $kk . "' => false,\n";
|
||||
} else {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$sonArr .= "\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||
} else {
|
||||
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 数值数组
|
||||
if(is_string($vv)) {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$sonArr .= "\t\t'" . $vv . "',\n";
|
||||
} else {
|
||||
$sonArr .= "\t\t" . $vv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$sonArr .= ($vv == true) ? "\t\ttrue,\n" :"\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArr .= "\t\t" . $vv . ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// 2.$vv是数组,新增中包含三级、四级子数组
|
||||
$sonArrson = '';
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
// $vvv不是数组,三级非数组
|
||||
if(!is_array($vvv)){
|
||||
if(!is_int($kkk)) {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvv)) {
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\t'". $kkk. "' => true,\n" : "\t\t\t'". $kkk. "' =>false,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvv)) {
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//$vvv是数组,但不支持子数组
|
||||
$sonArrsonArr = '';
|
||||
foreach($vvv as $kkkk =>$vvvv) {
|
||||
if(is_array($vvvv)) {
|
||||
echo $kkkk."不支持四级数组\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!is_int($kkkk)) {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'". $kkkk . "' => true,\n" : "\t\t\t\t'". $kkkk. "' =>false,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => [\n".$sonArrsonArr."\t\t\t],\n";
|
||||
//echo "不支持".$kkkk."是数组";
|
||||
}
|
||||
}
|
||||
$sonArr .= "\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||
}
|
||||
}
|
||||
$reps = "\t'". $k. "' => [\n".$sonArr."\t],\n];";
|
||||
self::$str = preg_replace($end, $reps, self::$str);
|
||||
} else {
|
||||
// $k已存在,二级配置是数组,需要添加二级或三数组元素
|
||||
|
||||
// 把$v的子元素追加在匹配$k => [之后
|
||||
// //匹配$k => [
|
||||
// $kpats = '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||
// preg_match($kpats,self::$str,$arrk);
|
||||
// 新增二级配置
|
||||
|
||||
// 往数组中追加子元素
|
||||
foreach ($v as $kk => $vv) {
|
||||
// 1. $vv不是数组
|
||||
if(!is_array($vv)) {
|
||||
// 新建二级配置
|
||||
|
||||
//匹配$k => [ ***,
|
||||
//$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);
|
||||
if(!is_int($kk)) {
|
||||
if(array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||
echo $kk.'不能添加已存在的配置项kk';
|
||||
return false;
|
||||
}
|
||||
if(is_string($vv)) {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||
} else {
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$reps = ($vv == true) ? $arrk[0]."\t\t'" . $kk . "' => true,\n" : $arrk[0]."\t\t'" . $kk . "' => false,\n";
|
||||
} else {
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vv)) {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$reps = $arrk[0] ."\t\t'" . $vv . "',\n";
|
||||
} else {
|
||||
$reps = $arrk[0] ."\t\t" . $vv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vv)) {
|
||||
$reps = ($vv == true) ? $arrk[0] . "\t\ttrue,\n" : $arrk[0] . "\t\tfalse,\n";
|
||||
} else {
|
||||
$reps = $arrk[0]."\t\t". $vv . ",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||
} else {
|
||||
// 2. $vv是数组
|
||||
|
||||
// 匹配到数组内部的后面
|
||||
$sonArrnum = self::getArrSonNum(config(self::$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/';
|
||||
}
|
||||
preg_match($kpats,self::$str,$arrk);
|
||||
//dump($sonArrnum,$arrk);
|
||||
// a.$vv数组不存在,新建数组及它的子数组$kkk
|
||||
if(!array_key_exists($kk,config(self::$configName . '.' . $k))) {
|
||||
|
||||
$sonArrson = '';
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
// $vvv不是数组
|
||||
if(!is_array($vvv)) {
|
||||
if(!is_int($kkk)) {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
//布尔
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\t'" . $kkk . "' => true,\n" : "\t\t\t'" . $kkk . "' => false,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t".$vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
//布尔
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// $vvv是数组
|
||||
$sonArrsonArr = '';
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
if(!is_int($kkkk)) {
|
||||
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||
echo $kkkk."已存在?";
|
||||
return false;
|
||||
}
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
//布尔
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
//布尔
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$sonArrson .= "\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||
//echo '不支持4级数组';
|
||||
}
|
||||
}
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||
} else {
|
||||
// b.$vv数组已存在
|
||||
// 匹配包含$k $kk=>[
|
||||
// $kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
|
||||
// preg_match($kkpats,self::$str,$arrkk);
|
||||
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
//halt(123,$arrkk[0]);
|
||||
// $vvv不是数组,追加$kkk
|
||||
if(!is_array($vvv)) {
|
||||
// 匹配包含$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);
|
||||
if(!is_int($kkk)) {
|
||||
//判断第三级key是否存在
|
||||
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||
echo $kkk.'不能添加已存在的配置项kkk';
|
||||
return false;
|
||||
}
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\t'" . $kkk . "' => true,\n" : $arrkk[0]."\t\t\t'" . $kkk . "' => false,\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$repsk = $arrkk[0]."\t\t\t'" . $vvv . "',\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\ttrue,\n" : $arrkk[0]."\t\t\tfalse,\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($kkpats,$repsk, self::$str);
|
||||
} else {
|
||||
// $vvv是数组,a.数组存在,b.数组不存在
|
||||
|
||||
//a. $kkk数组存在
|
||||
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||
//匹配包含$k $kk $kkk 到]的内容
|
||||
//$sonPats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[\s\S]*?(?:'.$kkk.')\' [^\]]*/';
|
||||
//[\s\S]*?(?:'.$kkk.')\'(.*),/
|
||||
|
||||
// $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);
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
preg_match($k3pats,self::$str,$arrk3);
|
||||
if(!is_int($kkkk)) {
|
||||
// 多维数组
|
||||
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||
echo $kkkk."已存在k4";
|
||||
return false;
|
||||
}
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\t'" . $kkkk . "' => true,\n" : $arrk3[0]."\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
// 数值数组
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\ttrue,\n" : $arrk3[0]."\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($k3pats,$sonReps, self::$str);
|
||||
}
|
||||
} else {
|
||||
// b. $kkk不存在
|
||||
|
||||
// 匹配到数组内部的后面k
|
||||
$sonArrnum = self::getArrSonNum(config(self::$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/';
|
||||
}
|
||||
preg_match($kkpats,self::$str,$arrkk);
|
||||
//halt($arrkk);
|
||||
$sonArrsonArr = '';
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
if(is_array($vvvv)) {
|
||||
echo '不支持四级数组';
|
||||
return false;
|
||||
}
|
||||
if(!is_int($kkkk)) {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$reps = $arrkk[0]."\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||
self::$str = preg_replace($kkpats,$reps, self::$str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//写入配置
|
||||
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑配置数组表
|
||||
* 一位数组修改请用delete和add组合
|
||||
* 仅支持键值对的数组修改
|
||||
*
|
||||
* @param array $arr
|
||||
* @return boolean
|
||||
*/
|
||||
public static function edit($arr) :bool
|
||||
{
|
||||
|
||||
// 只能修改有键值对的数组
|
||||
if(!is_array($arr)) return false;
|
||||
|
||||
foreach($arr as $k => $v) {
|
||||
// key不存在
|
||||
if(!array_key_exists($k,config(self::$configName))) {
|
||||
echo $k.'不存在 ';
|
||||
return false;
|
||||
}
|
||||
// 一级数组修改
|
||||
if(!is_array($v)) {
|
||||
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arr);
|
||||
//halt($arr);
|
||||
if(is_string($v)){
|
||||
// 字符串
|
||||
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||
$repk = "'". $k . "' => '" . $v . "',";
|
||||
} else {
|
||||
$repk = "'". $k . "' => " . $v . ",";
|
||||
}
|
||||
} elseif(is_bool($v)) {
|
||||
//布尔
|
||||
$repk = ($v == true) ? "'" . $k . "' => true," : "'" . $k . "' => false,";
|
||||
} else {
|
||||
// 数字
|
||||
$repk = "'". $k . "' => " . $v .",";
|
||||
}
|
||||
$patk = '/\'' . $k . '\'(.*),/';
|
||||
$reps = preg_replace($patk, $repk, $arr[0]);
|
||||
// 正则查找然后替换
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
// 正则二级配置
|
||||
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||
// 二级和三级
|
||||
foreach($v as $kk => $vv) {
|
||||
if(!array_key_exists($kk, config(self::$configName.'.'.$k))) {
|
||||
echo $kk.'不存在';
|
||||
return false;
|
||||
}
|
||||
//二级配置
|
||||
if(!is_array($vv)) {
|
||||
if(is_string($vv)){
|
||||
// 字符串
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$repkk = "'". $kk . "' => '" . $vv . "',";
|
||||
} else {
|
||||
$repkk = "'". $kk . "' => " . $vv . ",";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$repkk = ($vv == true) ? "'" . $kk . "' => true," : "'" . $kk . "' => false,";
|
||||
} else {
|
||||
// 数字
|
||||
$repkk = "'". $kk . "' => " . $vv .",";
|
||||
}
|
||||
preg_match($pats,self::$str,$arrk);
|
||||
// 正则需要替换的部分
|
||||
$patkk = '/\'' . $kk . '\'(.*?),/';
|
||||
$reps = preg_replace($patkk, $repkk, $arrk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$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))) {
|
||||
echo $kkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
if(!is_array($vvv)) {
|
||||
// 类型判断
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$arrReps = "'" . $kkk . "' => '" . $vvv . "',";
|
||||
} else {
|
||||
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||
}
|
||||
} elseif(is_bool($vvv)) {
|
||||
//布尔
|
||||
$arrReps = ($vvv == true) ? "'" . $kkk . "' => true," : "'" . $kkk . "' => false,";
|
||||
} else {
|
||||
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||
}
|
||||
preg_match($pats,self::$str,$arrkk);
|
||||
// 正则需要替换的部分
|
||||
$arrPats = '/\'' . $kkk . '\'(.*),/';
|
||||
$reps = preg_replace($arrPats, $arrReps, $arrkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$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))){
|
||||
echo $kkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
// 类型判断
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false) {
|
||||
$repskkkk = "'" . $kkkk . "' => '" . $vvvv . "',";
|
||||
} else {
|
||||
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||
}
|
||||
} elseif(is_bool($vvvv)) {
|
||||
//布尔
|
||||
$repskkkk = ($vvvv == true) ? "'" . $kkkk . "' => true," : "'" . $kkkk . "' => false,";
|
||||
} else {
|
||||
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||
}
|
||||
preg_match($pats,self::$str,$arrkkk);
|
||||
$patskkkk = '/\'' . $kkkk . '\'(.*),/';
|
||||
$reps = preg_replace($patskkkk, $repskkkk, $arrkkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//写入配置
|
||||
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配置数组表
|
||||
* 不支持一次性删除整个数组
|
||||
* 子元素被删除会清理空数组
|
||||
*
|
||||
* @param array $arr
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delete($arr) :bool
|
||||
{
|
||||
// 只能修改有键值对的数组
|
||||
if(!is_array($arr)) return false;
|
||||
|
||||
foreach($arr as $k => $v) {
|
||||
// 一级数组修改
|
||||
if(!is_array($v)) {
|
||||
// 正则开头到,不包含子数组
|
||||
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arr);
|
||||
if(!isset($arr[0])) {
|
||||
echo '有误,删除项可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($k)) {
|
||||
// 一维数组正则
|
||||
$patk = self::getPats($v);
|
||||
} else {
|
||||
// key不存在
|
||||
if(!array_key_exists($k,config(self::$configName))) {
|
||||
echo $k.'不存在 ';
|
||||
return false;
|
||||
}
|
||||
$patk = '/[^\n]*\'' . $v . '\'(.*?)\r?\n/';
|
||||
}
|
||||
|
||||
// 正则查找然后替换
|
||||
$reps = preg_replace($patk, '', $arr[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
|
||||
// 二级和三级
|
||||
foreach($v as $kk => $vv) {
|
||||
//二级配置
|
||||
if(!is_array($vv)) {
|
||||
// 正则二级配置
|
||||
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arrk);
|
||||
if(!isset($arrk[0])) {
|
||||
echo $k.'有误,可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($kk)) {
|
||||
$patkk = self::getPats($vv);
|
||||
} else {
|
||||
// key不存在
|
||||
if(!array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||
echo $kk.'不存在 ';
|
||||
return false;
|
||||
}
|
||||
// 正则需要替换的部分
|
||||
$patkk = '/[^\n]*\'' . $kk . '\'(.*?),\r?\n/';
|
||||
}
|
||||
$reps = preg_replace($patkk, '', $arrk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
// 三级配置
|
||||
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
if(!is_array($vvv)) {
|
||||
// 正则二级下的三级配置
|
||||
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arrkk);
|
||||
if(!isset($arrkkk[0])) {
|
||||
echo $kk.'有误,可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($kkk)) {
|
||||
$patkkk = self::getPats($vvv);
|
||||
} else {
|
||||
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||
echo $kkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
$patkkk = '/[^\n]*\'' . $kkk . '\'(.*),\r?\n/';
|
||||
}
|
||||
|
||||
// 正则需要替换的部分
|
||||
$reps = preg_replace($patkkk, '', $arrkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
// 四级配置
|
||||
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
if(!is_array($vvvv)) {
|
||||
// 正则$kkk
|
||||
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arrkkk);
|
||||
if(!isset($arrkkk[0])) {
|
||||
echo $kkk.'有误,可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($kkkk)) {
|
||||
$patskkkk = self::getPats($vvvv);
|
||||
} else {
|
||||
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
|
||||
echo $kkkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
$patskkkk = '/[^\n]*\'' . $kkkk . '\'(.*),\r?\n/';
|
||||
}
|
||||
|
||||
$reps = preg_replace($patskkkk, '', $arrkkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
echo '不支持更多的层级数组';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 匹配空数组
|
||||
* '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);
|
||||
|
||||
}
|
||||
//写入配置
|
||||
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数组中子元素为数组的个数
|
||||
*
|
||||
* @param [type] $arr
|
||||
* @return integer
|
||||
*/
|
||||
public static function getArrSonNum($arr) :int
|
||||
{
|
||||
$i = 0;
|
||||
foreach ($arr as $val) {
|
||||
if(is_array($val)){
|
||||
$i++;
|
||||
foreach($val as $vv){
|
||||
if(is_array($vv)){
|
||||
$i++;
|
||||
self::getArrSonNum($vv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一维数组在正则公式
|
||||
*
|
||||
* @param [type] $v
|
||||
* @return string
|
||||
*/
|
||||
public static function getPats($v) :string
|
||||
{
|
||||
if(is_bool($v)){
|
||||
//布尔
|
||||
$pats = $v ? '/[^\n]*true,\r?\n/' : '/[^\n]*false,\r?\n/';
|
||||
} else {
|
||||
// 字符串包含\
|
||||
if(stripos($v,"\\") !== false) {
|
||||
$v = str_replace("\\", "\\\\", $v);
|
||||
}
|
||||
// 字符串包含/
|
||||
if(stripos($v,'/') !== false) {
|
||||
$v = str_replace('/', '\/', $v);
|
||||
}
|
||||
if(stripos($v,'(') !== false) {
|
||||
$v = str_replace('(', "\(", $v);
|
||||
}
|
||||
if(stripos($v,')') !== false) {
|
||||
$v = str_replace(')', "\)", $v);
|
||||
}
|
||||
|
||||
// if(stripos($v,":") !== false) {
|
||||
// $v = str_replace(":", "\:", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
// if(stripos($v,'.') !== false) {
|
||||
// $v = str_replace('.', '\.', $v);
|
||||
// }
|
||||
// dump($v);
|
||||
// if(stripos($v,"'") !== false) {
|
||||
// $v = str_replace('\'', "\'", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
|
||||
// if(stripos($v,'-') !== false) {
|
||||
// $v = str_replace('-', "\-", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
// if(stripos($v,'>') !== false) {
|
||||
// $v = str_replace('>', "\>", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
$pats = '/[^\n]*' . $v . '(.*?)\r?\n/';
|
||||
}
|
||||
return $pats;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数组内数值数组的个数
|
||||
* 排除数组中元素为数组的元素
|
||||
*
|
||||
* @param array $array
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getArrSonCount(array $array) :bool
|
||||
{
|
||||
// 数组元素数量
|
||||
$count = count($array);
|
||||
// 子数组个数
|
||||
$i = 0;
|
||||
foreach ($array as $val) {
|
||||
if(is_array($val)) {
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// 数值数组的数量
|
||||
$count = $count - $i;
|
||||
if($count > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,13 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: TaoLer <alipey_tao@qq.com>
|
||||
* @Date: 2021-12-25 15:07:37
|
||||
* @LastEditTime: 2022-04-16 09:43:05
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\app\common\lib\Zip.php
|
||||
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||
*/
|
||||
namespace app\common\lib;
|
||||
|
||||
class Zip
|
||||
@ -17,7 +26,7 @@ class Zip
|
||||
|
||||
//压缩文件
|
||||
$zip = new \ZipArchive();
|
||||
$zip->open($filePath, ZipArchive::CREATE);
|
||||
$zip->open($filePath, \ZipArchive::CREATE);
|
||||
foreach ($files as $key => $file) {
|
||||
//检查文件是否存在
|
||||
if (!file_exists($file)) {
|
||||
|
@ -173,7 +173,7 @@ class Article extends Model
|
||||
$article = Cache::get('article_'.$id);
|
||||
if(!$article){
|
||||
//查询文章
|
||||
$article = $this::field('id,title,content,status,cate_id,user_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,tags,title_color,create_time')->where('status',1)->with([
|
||||
$article = $this::field('id,title,content,status,cate_id,user_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,tags,description,title_color,create_time')->where('status',1)->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename,ename');
|
||||
},
|
||||
|
@ -14,6 +14,8 @@ 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;
|
||||
|
||||
class Article extends BaseController
|
||||
{
|
||||
@ -154,24 +156,25 @@ class Article extends BaseController
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
//dump(empty(config('taoler.baidu.client_id')));
|
||||
if (Request::isAjax()) {
|
||||
$data = Request::only(['cate_id', 'title', 'title_color', 'user_id', 'content', 'upzip', 'tags', 'captcha']);
|
||||
|
||||
$data = Request::only(['cate_id', 'title', 'title_color', 'user_id', 'content', 'upzip', 'tags', 'description', 'captcha']);
|
||||
// 验证码
|
||||
if(Config::get('taoler.config.post_captcha') == 1)
|
||||
{
|
||||
if(!captcha_check($data['captcha'])){ // 验证失败
|
||||
if(!captcha_check($data['captcha'])){
|
||||
return json(['code'=>-1,'msg'=> '验证码失败']);
|
||||
};
|
||||
}
|
||||
|
||||
$validate = new \app\common\validate\Article; //调用验证器
|
||||
$result = $validate->scene('Artadd')->check($data); //进行数据验证
|
||||
|
||||
// 调用验证器
|
||||
$validate = new \app\common\validate\Article;
|
||||
$result = $validate->scene('Artadd')->check($data);
|
||||
if (true !== $result) {
|
||||
return Msgres::error($validate->getError());
|
||||
}
|
||||
|
||||
//获取内容图片音视频标识
|
||||
// 获取内容图片音视频标识
|
||||
$iva= $this->hasIva($data['content']);
|
||||
$data = array_merge($data,$iva);
|
||||
|
||||
@ -184,7 +187,7 @@ class Article extends BaseController
|
||||
}else{
|
||||
$link = (string)url('index/');
|
||||
}
|
||||
//清除文章tag缓存
|
||||
// 清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。');
|
||||
$res = Msgres::success($result['msg'], $link);
|
||||
@ -208,20 +211,19 @@ class Article extends BaseController
|
||||
public function edit($id)
|
||||
{
|
||||
$article = ArticleModel::find($id);
|
||||
//编辑
|
||||
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','tags','captcha']);
|
||||
|
||||
$data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','tags','description','captcha']);
|
||||
// 验证码
|
||||
if(Config::get('taoler.config.post_captcha') == 1)
|
||||
{
|
||||
if(!captcha_check($data['captcha'])){ // 验证失败
|
||||
if(!captcha_check($data['captcha'])){
|
||||
return json(['code'=>-1,'msg'=> '验证码失败']);
|
||||
};
|
||||
}
|
||||
|
||||
$validate = new \app\common\validate\Article(); //调用验证器
|
||||
$res = $validate->scene('Artadd')->check($data); //进行数据验证
|
||||
//调用验证器
|
||||
$validate = new \app\common\validate\Article();
|
||||
$res = $validate->scene('Artadd')->check($data);
|
||||
|
||||
if(true !== $res){
|
||||
return Msgres::error($validate->getError());
|
||||
@ -242,13 +244,13 @@ class Article extends BaseController
|
||||
return $editRes;
|
||||
}
|
||||
}
|
||||
//查询标签
|
||||
// 查询标签
|
||||
$tag = $article->tags;
|
||||
$attr = explode(',',$tag);
|
||||
$tags = [];
|
||||
foreach($attr as $key=>$v){
|
||||
foreach($attr as $key => $v){
|
||||
if ($v !='') {
|
||||
$tags[] = $v;
|
||||
$tags[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +258,11 @@ class Article extends BaseController
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//删除帖子
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$article = ArticleModel::find(input('id'));
|
||||
@ -269,6 +275,11 @@ class Article extends BaseController
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传接口
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function uploads()
|
||||
{
|
||||
$type = Request::param('type');
|
||||
@ -293,7 +304,12 @@ class Article extends BaseController
|
||||
return $upRes;
|
||||
}
|
||||
|
||||
//附件下载
|
||||
/**
|
||||
* 附件下载
|
||||
*
|
||||
* @param [type] $id
|
||||
* @return void
|
||||
*/
|
||||
public function download($id)
|
||||
{
|
||||
$zipdir = Db::name('article')->where('id',$id)->value('upzip');
|
||||
@ -304,19 +320,120 @@ class Article extends BaseController
|
||||
return download($zip,'my');
|
||||
}
|
||||
|
||||
//添加tag
|
||||
/**
|
||||
* 获取描述,过滤html
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
$data = Request::only(['content']);
|
||||
$description = getArtContent($data['content']);
|
||||
return json(['code'=>0,'data'=>$description]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键词
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tags()
|
||||
{
|
||||
$data = Request::only(['tags']);
|
||||
$att = explode(',',$data['tags']);
|
||||
$tags = [];
|
||||
foreach($att as $v){
|
||||
if ($v !='') {
|
||||
$tags[] = $v;
|
||||
}
|
||||
}
|
||||
$data = Request::only(['tags','flag']);
|
||||
$tags = [];
|
||||
|
||||
if($data['flag'] == 'on') {
|
||||
// 百度分词自动生成关键词
|
||||
if(!empty(config('taoler.baidu.client_id')) == true) {
|
||||
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
||||
|
||||
//headers数组内的格式
|
||||
$headers = array();
|
||||
$headers[] = "Content-Type:application/json";
|
||||
$body = array(
|
||||
"text" => $data['tags']
|
||||
);
|
||||
$postBody = json_encode($body);
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);//设置请求头
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postBody);//设置请求体
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');//使用一个自定义的请求信息来代替"GET"或"HEAD"作为HTTP请求。(这个加不加没啥影响)
|
||||
$datas = curl_exec($curl);
|
||||
if($datas == false) {
|
||||
echo '接口无法链接';
|
||||
} else {
|
||||
$res = stripos($datas,'error_code');
|
||||
// 接收返回的数据
|
||||
$dataItem = json_decode($datas);
|
||||
if($res == false) {
|
||||
// 数据正常
|
||||
$items = $dataItem->items;
|
||||
foreach($items as $item) {
|
||||
if($item->pos == 'n' && !in_array($item->item,$tags)){
|
||||
$tags[] = $item->item;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 接口正常但获取数据失败,可能参数错误,重新获取token
|
||||
$url = 'https://aip.baidubce.com/oauth/2.0/token';
|
||||
$post_data['grant_type'] = config('taoler.baidu.grant_type');;
|
||||
$post_data['client_id'] = config('taoler.baidu.client_id');
|
||||
$post_data['client_secret'] = config('taoler.baidu.client_secret');
|
||||
|
||||
$o = "";
|
||||
foreach ( $post_data as $k => $v )
|
||||
{
|
||||
$o.= "$k=" . urlencode( $v ). "&" ;
|
||||
}
|
||||
$post_data = substr($o,0,-1);
|
||||
$res = $this->request_post($url, $post_data);
|
||||
// 写入token
|
||||
(new SetArr('taoler'))::edit([
|
||||
'baidu'=> [
|
||||
'access_token' => json_decode($res)->access_token,
|
||||
]
|
||||
]);
|
||||
echo 'api接口数据错误,重新自动尝试链接';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 手动添加关键词
|
||||
// 中文一个或者多个空格转换为英文空格
|
||||
$str = preg_replace('/\s+/',' ',$data['tags']);
|
||||
$att = explode(' ', $str);
|
||||
foreach($att as $v){
|
||||
if ($v !='') {
|
||||
$tags[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json(['code'=>0,'data'=>$tags]);
|
||||
}
|
||||
|
||||
// api_post接口
|
||||
function request_post($url = '', $param = '')
|
||||
{
|
||||
if (empty($url) || empty($param)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$postUrl = $url;
|
||||
$curlPost = $param;
|
||||
$curl = curl_init();//初始化curl
|
||||
curl_setopt($curl, CURLOPT_URL,$postUrl);//抓取指定网页
|
||||
curl_setopt($curl, CURLOPT_HEADER, 0);//设置header
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
|
||||
curl_setopt($curl, CURLOPT_POST, 1);//post提交方式
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
|
||||
$data = curl_exec($curl);//运行curl
|
||||
curl_close($curl);
|
||||
return $data;
|
||||
}
|
||||
|
||||
//文章置顶,状态
|
||||
public function jieset(){
|
||||
@ -372,7 +489,12 @@ class Article extends BaseController
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//内容中是否有图片视频音频插入
|
||||
/**
|
||||
* 内容中是否有图片视频音频插入
|
||||
*
|
||||
* @param [type] $content
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasIva($content)
|
||||
{
|
||||
//判断是否插入图片
|
||||
|
@ -9,7 +9,6 @@ use think\facade\Db;
|
||||
use app\facade\Article;
|
||||
use app\common\model\Slider;
|
||||
use app\common\lib\Msgres;
|
||||
use app\common\lib\SetConf;
|
||||
|
||||
class Index extends BaseController
|
||||
{
|
||||
@ -21,16 +20,16 @@ class Index extends BaseController
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
{
|
||||
$types = input('type');
|
||||
|
||||
//幻灯
|
||||
$slider = new Slider();
|
||||
//幻灯
|
||||
$sliders = $slider->getSliderList(1);
|
||||
//置顶文章
|
||||
$artTop = Article::getArtTop(5);
|
||||
//首页文章列表,显示20个
|
||||
$artList = Article::getArtList(20);
|
||||
$artList = Article::getArtList(22);
|
||||
//热议文章
|
||||
$artHot = Article::getArtHot(10);
|
||||
//温馨通道
|
||||
|
@ -18,6 +18,7 @@ Route::group(function () {
|
||||
Route::get('column/<ename>/<type>$', 'article/cate')->name('cate_type');
|
||||
Route::rule('column/<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([
|
||||
|
@ -65,6 +65,7 @@ CREATE TABLE `tao_article` (
|
||||
`upzip` varchar(70) DEFAULT NULL COMMENT '文章附件',
|
||||
`downloads` int(5) NOT NULL DEFAULT '0' COMMENT '下载量',
|
||||
`tags` varchar(255) DEFAULT NULL COMMENT 'tag',
|
||||
`description` text NOT NULL COMMENT 'seo描述',
|
||||
`read_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '阅读权限0开放1回复可读2密码可读3私密',
|
||||
`art_pass` varchar(6) DEFAULT NULL COMMENT '文章加密密码',
|
||||
`title_color` varchar(10) DEFAULT NULL COMMENT '标题颜色',
|
||||
@ -182,88 +183,89 @@ INSERT INTO `tao_auth_rule` VALUES ('2', 'set', '设置', '', '1', '1', '0', '0'
|
||||
INSERT INTO `tao_auth_rule` VALUES ('3', 'administrator', '账户', '', '1', '1', '0', '0', 'layui-icon-username', '1', '7', '', '0', '1635757594', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('4', 'app', '应用', '', '1', '1', '0', '0', 'layui-icon-app', '1', '4', '', '0', '1635757536', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('5', 'article', '内容', '', '1', '1', '0', '0', 'layui-icon-read', '1', '1', '', '0', '1635757294', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('6', 'admin/User/list', '用户管理', '', '1', '1', '1', '1', '', '1', '1', '', '0', '1578901015', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('7', 'admin/Admin/index', '管理员', '', '1', '1', '1', '1', '', '1', '6', '', '0', '1578901133', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('8', 'admin/AuthGroup/list', '角色管理', '', '1', '1', '1', '1', '', '1', '11', '', '0', '1578901282', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('9', 'admin/AuthRule/index', '权限菜单', '', '1', '1', '2', '1', '', '1', '16', '', '0', '1611998671', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('10', 'admin/Set/index', '网站设置', '', '1', '1', '2', '1', '', '1', '1', '', '0', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('11', 'admin/Set/server', '综合服务', '', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('12', 'admin/Admin/info', '基本资料', '', '1', '1', '3', '1', '', '1', '50', '', '0', '1578980034', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('13', 'admin/Admin/repass', '修改密码', '', '1', '1', '3', '1', '', '1', '51', '', '0', '1578980034', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('15', 'admin/Forum/list', '帖子管理', '', '1', '1', '5', '1', '', '1', '1', '', '0', '1578902605', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('16', 'admin/Forum/tags', '分类管理', '', '1', '1', '5', '1', '', '1', '11', '', '0', '1578904950', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('17', 'admin/Forum/replys', '评论管理', '', '1', '1', '5', '1', '', '1', '7', '', '0', '1578904590', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('18', 'admin/Slider/index', '链接投放', '', '1', '1', '93', '1', '', '1', '4', '', '0', '1611999603', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('19', 'admin/Upgrade/index', '系统升级', '', '1', '1', '2', '1', '', '1', '8', '', '0', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('21', 'admin/Forum/listform', '编辑帖子', '', '1', '1', '15', '2', '', '0', '2', '', '0', '1611997428', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('22', 'admin/Forum/listdel', '删除帖子', '', '1', '1', '15', '2', '', '0', '3', '', '0', '1611997448', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('23', 'admin/Forum/check', '审核帖子', '', '1', '1', '15', '2', '', '0', '6', '', '0', '1611997474', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('24', 'admin/Forum/addtags', '添加分类', '', '1', '1', '16', '2', '', '0', '12', '', '0', '1611997513', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('25', 'admin/Forum/tagsform', '编辑分类', '', '1', '1', '16', '2', '', '0', '14', '', '0', '1611997535', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('26', 'admin/Forum/tagsdelete', '删除分类', '', '1', '1', '16', '2', '', '0', '13', '', '0', '1611997523', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('27', 'admin/Forum/replysform', '编辑评论', '', '1', '1', '17', '2', '', '0', '8', '', '0', '1611997484', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('28', 'admin/Forum/redel', '删除评论', '', '1', '1', '17', '2', '', '0', '9', '', '0', '1611997494', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('35', 'admin/User/userForm', '添加用户', '', '1', '1', '6', '2', '', '0', '2', '', '0', '1611997673', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('36', 'admin/User/userEdit', '编辑用户', '', '1', '1', '6', '2', '', '0', '3', '', '0', '1611997690', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('37', 'admin/User/delete', '删除用户', '', '1', '1', '6', '2', '', '0', '4', '', '0', '1611997701', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('38', 'admin/User/check', '审核用户', '', '1', '1', '6', '2', '', '0', '5', '', '0', '1611997713', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('39', 'admin/Admin/add', '添加管理员', '', '1', '1', '7', '2', '', '0', '7', '', '0', '1611997732', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('40', 'admin/Admin/edit', '编辑管理员', '', '1', '1', '7', '2', '', '0', '8', '', '0', '1611997747', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('41', 'admin/Admin/delete', '删除管理员', '', '1', '1', '7', '2', '', '0', '9', '', '0', '1611997760', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('42', 'admin/Admin/check', '审核管理员', '', '1', '1', '7', '2', '', '0', '10', '', '0', '1611997772', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('43', 'admin/AuthGroup/roleAdd', '添加角色', '', '1', '1', '8', '2', '', '0', '12', '', '0', '1611997790', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('44', 'admin/AuthGroup/roleEdit', '编辑角色', '', '1', '1', '8', '2', '', '0', '13', '', '0', '1611997805', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('45', 'admin/AuthGroup/roledel', '删除角色', '', '1', '1', '8', '2', '', '0', '14', '', '0', '1611997820', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('46', 'admin/AuthRule/add', '添加权限', '', '1', '1', '9', '2', '', '0', '21', '', '0', '1611997901', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('47', 'admin/AuthRule/edit', '编辑权限', '', '1', '1', '9', '2', '', '0', '17', '', '0', '1611997849', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('48', 'admin/AuthRule/delete', '删除权限', '', '1', '1', '9', '2', '', '0', '18', '', '0', '1611997869', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('49', 'admin/AuthRule/check', '审核权限', '', '1', '1', '9', '2', '', '0', '19', '', '0', '1611997884', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('50', 'admin/AuthRule/menushow', '菜单权限', '', '1', '1', '9', '2', '', '0', '20', '', '0', '1611997929', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('51', 'admin/Set/upload', '上传logo', '', '1', '1', '10', '2', '', '0', '2', '', '0', '1611998097', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('52', 'admin/Slider/add', '添加链接', '', '1', '1', '18', '2', '', '0', '5', '', '0', '1611998128', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('53', 'admin/Slider/edit', '编辑链接', '', '1', '1', '18', '2', '', '0', '14', '', '0', '1611998263', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('54', 'admin/Slider/delete', '删除链接', '', '1', '1', '18', '2', '', '0', '6', '', '0', '1611998141', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('55', 'admin/Slider/uploadimg', '上传链接图片', '', '1', '1', '18', '2', '', '0', '7', '', '0', '1611998156', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('56', 'admin/Upgrade/key', '设置key', '', '1', '1', '19', '2', '', '0', '9', '', '0', '1611998178', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('57', 'admin/Upgrade/keyedit', '修改key', '', '1', '1', '19', '2', '', '0', '10', '', '0', '1611998192', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('58', 'admin/Upgrade/check', '升级检测', '', '1', '1', '19', '2', '', '0', '11', '', '0', '1611998214', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('59', 'admin/Upgrade/upload', '自动升级', '', '1', '1', '19', '2', '', '0', '12', '', '0', '1611998230', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('60', 'admin/Upgrade/uploadzip', '上传升级包', '', '1', '1', '19', '2', '', '0', '13', '', '0', '1611998245', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('62', 'admin/Forum/top', '置顶帖子', '', '1', '1', '15', '2', '', '0', '4', '', '0', '1611997455', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('63', 'admin/Forum/hot', '加精帖子', '', '1', '1', '15', '2', '', '0', '5', '', '0', '1611997465', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('64', 'admin/Froum/recheck', '审核评论', '', '1', '1', '17', '2', '', '0', '10', '', '0', '1611997503', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('65', 'admin/User/uploadImg', '上传用户头像', '', '1', '1', '6', '2', '', '0', '0', '', '0', '1611997661', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('66', 'admin/AuthGroup/check', '审核角色', '', '1', '1', '8', '2', '', '0', '15', '', '0', '1611997835', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('67', 'admin/Sign/signRule', '签到规则', '', '1', '1', '11', '2', '', '0', '15', '', '1585547595', '1611998427', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('68', 'admin/Sign/add', '添加签到', '', '1', '1', '11', '2', '', '0', '16', '', '1585547705', '1611998444', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('69', 'admin/Sign/signEdit', '编辑签到', '', '1', '1', '11', '2', '', '0', '17', '', '1585547774', '1611998457', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('70', 'admin/Sign/delete', '删除签到', '', '1', '1', '11', '2', '', '0', '18', '', '1585547817', '1611998470', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('71', 'admin/Vip/vipRule', '用户等级', '', '1', '1', '11', '2', '', '0', '19', '', '1585547921', '1611998481', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('72', 'admin/Vip/add', '添加vip等级', '', '1', '1', '11', '2', '', '0', '20', '', '1585547981', '1611998492', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('73', 'admin/Vip/vipEdit', '编辑vip等级', '', '1', '1', '11', '2', '', '0', '21', '', '1585548029', '1611998556', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('74', 'admin/Vip/delete', '删除vip等级', '', '1', '1', '11', '2', '', '0', '22', '', '1585548077', '1611998503', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('75', 'admin/Set/email', '邮箱设置', '', '1', '1', '10', '2', '', '0', '23', '', '1585548143', '1611998372', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('76', 'admin/Notice/index', '发布通知', '', '1', '1', '4', '1', '', '1', '10', '', '1585618141', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('77', 'admin/Notice/add', '添加通知', '', '1', '1', '76', '2', '', '0', '11', '', '1585663336', '1611997580', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('78', 'admin/Notice/edit', '编辑通知', '', '1', '1', '76', '2', '', '0', '12', '', '1585663366', '1611997590', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('79', 'admin/Notice/delete', '删除通知', '', '1', '1', '76', '2', '', '0', '13', '', '1585663412', '1611997601', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('83', 'admin/AuthAccess/index', '管理员权限', '', '1', '1', '1', '1', '', '1', '22', '', '1585794015', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('84', 'admin/AuthAccess/add', '添加管理员权限', '', '1', '1', '83', '2', '', '0', '23', '', '1585806544', '1611998012', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('85', 'admin/AuthAccess/edit', '编辑管理员权限', '', '1', '1', '83', '2', '', '0', '24', '', '1585806592', '1611998030', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('86', 'admin/AuthAccess/delete', '删除管理员权限', '', '1', '1', '83', '2', '', '0', '25', '', '1585806620', '1611998046', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('87', 'admin/AuthAccess/check', '审核管理员权限', '', '1', '1', '83', '2', '', '0', '26', '', '1585806653', '1611998060', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('88', 'admin/Set/website', '网站信息保存', '', '1', '1', '10', '2', '', '0', '24', '', '1585819936', '1611998395', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('89', 'admin/User/auth', '设置超级用户', '', '1', '1', '6', '2', '', '0', '22', '', '1578984801', '1611997990', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('90', 'admin/Forum/tagshot', '开启热点', '', '1', '1', '16', '2', '', '0', '15', '', '1585841826', '1611997546', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('91', 'admin/Admin/infoSet', '资料设置', '', '1', '1', '12', '2', '', '0', '62', '', '1586245669', '1611998517', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('92', 'admin/Admin/repassSet', '密码设置', '', '1', '1', '13', '2', '', '0', '64', '', '1586245727', '1611998534', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('6', 'User/list', '用户管理', '', '1', '1', '1', '1', '', '1', '1', '', '0', '1578901015', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('7', 'Admin/index', '管理员', '', '1', '1', '1', '1', '', '1', '6', '', '0', '1578901133', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('8', 'AuthGroup/list', '角色管理', '', '1', '1', '1', '1', '', '1', '11', '', '0', '1578901282', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('9', 'AuthRule/index', '权限菜单', '', '1', '1', '2', '1', '', '1', '16', '', '0', '1611998671', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('10', 'Set/index', '网站设置', '', '1', '1', '2', '1', '', '1', '1', '', '0', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('11', 'Set/server', '综合服务', '', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('12', 'Admin/info', '基本资料', '', '1', '1', '3', '1', '', '1', '50', '', '0', '1578980034', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('13', 'Admin/repass', '修改密码', '', '1', '1', '3', '1', '', '1', '51', '', '0', '1578980034', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('15', 'Forum/list', '帖子管理', '', '1', '1', '5', '1', '', '1', '1', '', '0', '1578902605', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('16', 'Forum/tags', '分类管理', '', '1', '1', '5', '1', '', '1', '11', '', '0', '1578904950', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('17', 'Forum/replys', '评论管理', '', '1', '1', '5', '1', '', '1', '7', '', '0', '1578904590', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('18', 'Slider/index', '链接投放', '', '1', '1', '93', '1', '', '1', '4', '', '0', '1611999603', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('19', 'Upgrade/index', '系统升级', '', '1', '1', '2', '1', '', '1', '8', '', '0', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('21', 'Forum/listform', '编辑帖子', '', '1', '1', '15', '2', '', '0', '2', '', '0', '1611997428', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('22', 'Forum/listdel', '删除帖子', '', '1', '1', '15', '2', '', '0', '3', '', '0', '1611997448', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('23', 'Forum/check', '审核帖子', '', '1', '1', '15', '2', '', '0', '6', '', '0', '1611997474', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('24', 'Forum/addtags', '添加分类', '', '1', '1', '16', '2', '', '0', '12', '', '0', '1611997513', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('25', 'Forum/tagsform', '编辑分类', '', '1', '1', '16', '2', '', '0', '14', '', '0', '1611997535', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('26', 'Forum/tagsdelete', '删除分类', '', '1', '1', '16', '2', '', '0', '13', '', '0', '1611997523', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('27', 'Forum/replysform', '编辑评论', '', '1', '1', '17', '2', '', '0', '8', '', '0', '1611997484', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('28', 'Forum/redel', '删除评论', '', '1', '1', '17', '2', '', '0', '9', '', '0', '1611997494', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('35', 'User/userForm', '添加用户', '', '1', '1', '6', '2', '', '0', '2', '', '0', '1611997673', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('36', 'User/userEdit', '编辑用户', '', '1', '1', '6', '2', '', '0', '3', '', '0', '1611997690', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('37', 'User/delete', '删除用户', '', '1', '1', '6', '2', '', '0', '4', '', '0', '1611997701', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('38', 'User/check', '审核用户', '', '1', '1', '6', '2', '', '0', '5', '', '0', '1611997713', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('39', 'Admin/add', '添加管理员', '', '1', '1', '7', '2', '', '0', '7', '', '0', '1611997732', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('40', 'Admin/edit', '编辑管理员', '', '1', '1', '7', '2', '', '0', '8', '', '0', '1611997747', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('41', 'Admin/delete', '删除管理员', '', '1', '1', '7', '2', '', '0', '9', '', '0', '1611997760', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('42', 'Admin/check', '审核管理员', '', '1', '1', '7', '2', '', '0', '10', '', '0', '1611997772', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('43', 'AuthGroup/roleAdd', '添加角色', '', '1', '1', '8', '2', '', '0', '12', '', '0', '1611997790', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('44', 'AuthGroup/roleEdit', '编辑角色', '', '1', '1', '8', '2', '', '0', '13', '', '0', '1611997805', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('45', 'AuthGroup/roledel', '删除角色', '', '1', '1', '8', '2', '', '0', '14', '', '0', '1611997820', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('46', 'AuthRule/add', '添加权限', '', '1', '1', '9', '2', '', '0', '21', '', '0', '1611997901', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('47', 'AuthRule/edit', '编辑权限', '', '1', '1', '9', '2', '', '0', '17', '', '0', '1611997849', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('48', 'AuthRule/delete', '删除权限', '', '1', '1', '9', '2', '', '0', '18', '', '0', '1611997869', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('49', 'AuthRule/check', '审核权限', '', '1', '1', '9', '2', '', '0', '19', '', '0', '1611997884', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('50', 'AuthRule/menushow', '菜单权限', '', '1', '1', '9', '2', '', '0', '20', '', '0', '1611997929', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('51', 'Set/upload', '上传logo', '', '1', '1', '10', '2', '', '0', '2', '', '0', '1611998097', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('52', 'Slider/add', '添加链接', '', '1', '1', '18', '2', '', '0', '5', '', '0', '1611998128', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('53', 'Slider/edit', '编辑链接', '', '1', '1', '18', '2', '', '0', '14', '', '0', '1611998263', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('54', 'Slider/delete', '删除链接', '', '1', '1', '18', '2', '', '0', '6', '', '0', '1611998141', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('55', 'Slider/uploadimg', '上传链接图片', '', '1', '1', '18', '2', '', '0', '7', '', '0', '1611998156', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('56', 'Upgrade/key', '设置key', '', '1', '1', '19', '2', '', '0', '9', '', '0', '1611998178', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('57', 'Upgrade/keyedit', '修改key', '', '1', '1', '19', '2', '', '0', '10', '', '0', '1611998192', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('58', 'Upgrade/check', '升级检测', '', '1', '1', '19', '2', '', '0', '11', '', '0', '1611998214', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('59', 'Upgrade/upload', '自动升级', '', '1', '1', '19', '2', '', '0', '12', '', '0', '1611998230', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('60', 'Upgrade/uploadzip', '上传升级包', '', '1', '1', '19', '2', '', '0', '13', '', '0', '1611998245', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('62', 'Forum/top', '置顶帖子', '', '1', '1', '15', '2', '', '0', '4', '', '0', '1611997455', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('63', 'Forum/hot', '加精帖子', '', '1', '1', '15', '2', '', '0', '5', '', '0', '1611997465', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('64', 'Froum/recheck', '审核评论', '', '1', '1', '17', '2', '', '0', '10', '', '0', '1611997503', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('65', 'User/uploadImg', '上传用户头像', '', '1', '1', '6', '2', '', '0', '0', '', '0', '1611997661', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('66', 'AuthGroup/check', '审核角色', '', '1', '1', '8', '2', '', '0', '15', '', '0', '1611997835', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('67', 'Sign/signRule', '签到规则', '', '1', '1', '11', '2', '', '0', '15', '', '1585547595', '1611998427', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('68', 'Sign/add', '添加签到', '', '1', '1', '11', '2', '', '0', '16', '', '1585547705', '1611998444', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('69', 'Sign/signEdit', '编辑签到', '', '1', '1', '11', '2', '', '0', '17', '', '1585547774', '1611998457', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('70', 'Sign/delete', '删除签到', '', '1', '1', '11', '2', '', '0', '18', '', '1585547817', '1611998470', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('71', 'Vip/vipRule', '用户等级', '', '1', '1', '11', '2', '', '0', '19', '', '1585547921', '1611998481', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('72', 'Vip/add', '添加vip等级', '', '1', '1', '11', '2', '', '0', '20', '', '1585547981', '1611998492', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('73', 'Vip/vipEdit', '编辑vip等级', '', '1', '1', '11', '2', '', '0', '21', '', '1585548029', '1611998556', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('74', 'Vip/delete', '删除vip等级', '', '1', '1', '11', '2', '', '0', '22', '', '1585548077', '1611998503', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('75', 'Set/email', '邮箱设置', '', '1', '1', '10', '2', '', '0', '23', '', '1585548143', '1611998372', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('76', 'Notice/index', '发布通知', '', '1', '1', '4', '1', '', '1', '10', '', '1585618141', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('77', 'Notice/add', '添加通知', '', '1', '1', '76', '2', '', '0', '11', '', '1585663336', '1611997580', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('78', 'Notice/edit', '编辑通知', '', '1', '1', '76', '2', '', '0', '12', '', '1585663366', '1611997590', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('79', 'Notice/delete', '删除通知', '', '1', '1', '76', '2', '', '0', '13', '', '1585663412', '1611997601', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('83', 'AuthAccess/index', '管理员权限', '', '1', '1', '1', '1', '', '1', '22', '', '1585794015', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('84', 'AuthAccess/add', '添加管理员权限', '', '1', '1', '83', '2', '', '0', '23', '', '1585806544', '1611998012', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('85', 'AuthAccess/edit', '编辑管理员权限', '', '1', '1', '83', '2', '', '0', '24', '', '1585806592', '1611998030', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('86', 'AuthAccess/delete', '删除管理员权限', '', '1', '1', '83', '2', '', '0', '25', '', '1585806620', '1611998046', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('87', 'AuthAccess/check', '审核管理员权限', '', '1', '1', '83', '2', '', '0', '26', '', '1585806653', '1611998060', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('88', 'Set/website', '网站信息保存', '', '1', '1', '10', '2', '', '0', '24', '', '1585819936', '1611998395', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('89', 'User/auth', '设置超级用户', '', '1', '1', '6', '2', '', '0', '22', '', '1578984801', '1611997990', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('90', 'Forum/tagshot', '开启热点', '', '1', '1', '16', '2', '', '0', '15', '', '1585841826', '1611997546', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('91', 'Admin/infoSet', '资料设置', '', '1', '1', '12', '2', '', '0', '62', '', '1586245669', '1611998517', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('92', 'Admin/repassSet', '密码设置', '', '1', '1', '13', '2', '', '0', '64', '', '1586245727', '1611998534', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('93', 'servers', '服务', '', '1', '1', '0', '0', 'layui-icon-cols', '1', '3', '', '1611286515', '1635757525', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('94', 'admin/Database/index', '数据备份', '', '1', '1', '93', '1', '', '1', '9', '', '1611897141', '1611902589', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('95', 'admin/Database/backup', '进行备份', '', '1', '1', '94', '2', '', '0', '10', '', '1611897285', '1611902610', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('96', 'admin/Database/delete', '备份删除', '', '1', '1', '94', '2', '', '0', '0', '', '1611902429', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('94', 'Database/index', '数据备份', '', '1', '1', '93', '1', '', '1', '9', '', '1611897141', '1611902589', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('95', 'Database/backup', '进行备份', '', '1', '1', '94', '2', '', '0', '10', '', '1611897285', '1611902610', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('96', 'Database/delete', '备份删除', '', '1', '1', '94', '2', '', '0', '0', '', '1611902429', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('97', 'addons', '插件', '', '1', '1', '0', '0', 'layui-icon-flag', '1', '2', '', '1635757328', '1635757632', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('98', 'admin/Addons/index', '插件市场', '', '1', '1', '97', '1', '', '1', '0', '', '1635757426', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('99', 'admin/Addons/addonsList', '插件列表', '', '1', '1', '98', '2', '', '-1', '0', '', '1638775199', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('98', 'Addons/index', '插件市场', '', '1', '1', '97', '1', '', '1', '0', '', '1635757426', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('99', 'Addons/addonsList', '插件列表', '', '1', '1', '98', '2', '', '-1', '0', '', '1638775199', '0', '0');
|
||||
INSERT INTO `tao_auth_rule` VALUES ('111','Seo/index','SEO','1','1','0','0','layui-icon-component','1','7','','1649829142','0','0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tao_cate
|
||||
@ -481,7 +483,7 @@ CREATE TABLE `tao_system` (
|
||||
`is_comment` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开启评论1开启0关闭',
|
||||
`is_reg` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开放注册1开启0禁止',
|
||||
`icp` varchar(50) NOT NULL DEFAULT '' COMMENT '备案',
|
||||
`showlist` varchar(255) NOT NULL COMMENT '统计代码',
|
||||
`showlist` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '统计代码',
|
||||
`blackname` varchar(255) NOT NULL COMMENT '注册黑名单',
|
||||
`sys_version_num` varchar(5) NOT NULL COMMENT '系统版本',
|
||||
`key` varchar(60) DEFAULT NULL COMMENT 'key',
|
||||
|
@ -28,7 +28,8 @@
|
||||
"lotofbadcode/phpspirit_databackup": "^1.1",
|
||||
"wamkj/thinkphp6.0-databackup": "^1.0",
|
||||
"taoser/think-addons": "^1.0",
|
||||
"liliuwei/thinkphp-social": "^1.3"
|
||||
"liliuwei/thinkphp-social": "^1.3",
|
||||
"taoser/think-setarr": "^0.0.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "^4.2",
|
||||
|
66
composer.lock
generated
66
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "9a2defc1ce427f4ab5f63c13400425c3",
|
||||
"content-hash": "52d2121e202720cc23a0528605fafe09",
|
||||
"packages": [
|
||||
{
|
||||
"name": "firebase/php-jwt",
|
||||
@ -210,16 +210,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/mime-type-detection",
|
||||
"version": "1.9.0",
|
||||
"version": "1.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69"
|
||||
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -250,7 +250,7 @@
|
||||
"description": "Mime-type detection for Flysystem",
|
||||
"support": {
|
||||
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
||||
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.9.0"
|
||||
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.10.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -262,7 +262,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-11-21T11:48:40+00:00"
|
||||
"time": "2022-04-11T12:49:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "liliuwei/thinkphp-social",
|
||||
@ -821,6 +821,46 @@
|
||||
},
|
||||
"time": "2020-02-11T06:16:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "taoser/think-setarr",
|
||||
"version": "v0.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/taoser/think-setarr.git",
|
||||
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/taoser/think-setarr/zipball/6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"taoser\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"mit"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taoser",
|
||||
"email": "changlin_zhao@qq.com"
|
||||
}
|
||||
],
|
||||
"description": "php confing",
|
||||
"support": {
|
||||
"issues": "https://github.com/taoser/think-setarr/issues",
|
||||
"source": "https://github.com/taoser/think-setarr/tree/v0.0.3"
|
||||
},
|
||||
"time": "2022-04-16T23:08:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "topthink/framework",
|
||||
"version": "v6.0.12",
|
||||
@ -890,16 +930,16 @@
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-captcha",
|
||||
"version": "v3.0.4",
|
||||
"version": "v3.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/think-captcha.git",
|
||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad"
|
||||
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/db5be361d3cd664d236fb95d5dffe93a117283ad",
|
||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad",
|
||||
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -937,9 +977,9 @@
|
||||
"description": "captcha package for thinkphp",
|
||||
"support": {
|
||||
"issues": "https://github.com/top-think/think-captcha/issues",
|
||||
"source": "https://github.com/top-think/think-captcha/tree/v3.0.4"
|
||||
"source": "https://github.com/top-think/think-captcha/tree/v3.0.6"
|
||||
},
|
||||
"time": "2022-01-07T06:34:19+00:00"
|
||||
"time": "2022-03-18T09:11:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-helper",
|
||||
|
@ -1,4 +1,13 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: TaoLer <alipey_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:50
|
||||
* @LastEditTime: 2022-04-17 16:49:19
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\config\app.php
|
||||
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||
*/
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用设置
|
||||
// +----------------------------------------------------------------------
|
||||
@ -18,15 +27,19 @@ return [
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
|
||||
// 应用映射(自动多应用模式有效)
|
||||
'app_map' => [],
|
||||
'app_map' => [
|
||||
//'bbs' => 'index',
|
||||
//'*' => 'home',
|
||||
//'admin' => 'admin',
|
||||
],
|
||||
// 域名绑定(自动多应用模式有效)
|
||||
'domain_bind' => [
|
||||
//'bbs' => 'index',
|
||||
//'adm' => 'admin',
|
||||
//'www'=>'home',
|
||||
//'api' => 'api'
|
||||
],
|
||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||
'deny_app_list' => [],
|
||||
|
||||
// 异常页面的模板文件
|
||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||
@ -40,5 +53,5 @@ return [
|
||||
'http_exception_template' => [
|
||||
404 => \think\facade\App::getAppPath() . '404.html',
|
||||
500 => \think\facade\App::getAppPath() . '404.html',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
@ -1,28 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: TaoLer <alipey_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:50
|
||||
* @LastEditTime: 2022-04-17 16:54:16
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\config\taoler.php
|
||||
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
|
||||
*/
|
||||
// +----------------------------------------------------------------------
|
||||
// | 网站公共配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
//应用名,此项不可更改
|
||||
// 应用名,此项不可更改
|
||||
'appname' => 'TaoLer',
|
||||
//版本配置
|
||||
'version' => '1.9.0',
|
||||
//加盐
|
||||
// 版本配置
|
||||
'version' => '1.9.1',
|
||||
// 加盐
|
||||
'salt' => 'taoler',
|
||||
//数据库备份目录
|
||||
// 数据库备份目录
|
||||
'databasebackdir' => app()->getRootPath() .'data/',
|
||||
//配置
|
||||
// 配置
|
||||
'config' =>[
|
||||
'email_notice' => 0,
|
||||
'cate_show' => 0,
|
||||
'area_show' => 0,
|
||||
'cate_show' => 1,
|
||||
'area_show' => 1,
|
||||
'regist_check' => 0,
|
||||
'posts_check' => 0,
|
||||
'commnets_check' => 0,
|
||||
'login_captcha' => 0,
|
||||
'post_captcha' => 0,
|
||||
],
|
||||
|
||||
// 百度标签分词
|
||||
'baidu' => [
|
||||
'grant_type' => '',
|
||||
'client_id' => '',
|
||||
'client_secret' => '',
|
||||
'access_token' => '',
|
||||
'push_api' => '',
|
||||
],
|
||||
|
||||
// sitemap
|
||||
'sitemap' => [
|
||||
'map_num' => '1000',
|
||||
'map_time' => 'daily',
|
||||
'map_level' => '0.5',
|
||||
'write_id' => 0,
|
||||
|
||||
],
|
||||
|
||||
]
|
||||
|
||||
];
|
21
public/2022-04-16_1.xml
Normal file
21
public/2022-04-16_1.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> <!-- XML文件需以utf-8编码-->
|
||||
<urlset>
|
||||
<url>
|
||||
<loc>http://www.test.com/index/jie/7.html</loc>
|
||||
<lastmod>2022-01-01</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://www.test.com/index/jie/8.html</loc>
|
||||
<lastmod>2022-01-01</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://www.test.com/index/jie/9.html</loc>
|
||||
<lastmod>2022-04-12</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
</urlset>
|
21
public/2022-04-16_2.xml
Normal file
21
public/2022-04-16_2.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> <!-- XML文件需以utf-8编码-->
|
||||
<urlset>
|
||||
<url>
|
||||
<loc>http://www.test.com/index/jie/10.html</loc>
|
||||
<lastmod>2022-04-15</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://www.test.com/index/jie/11.html</loc>
|
||||
<lastmod>2022-04-12</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://www.test.com/index/jie/12.html</loc>
|
||||
<lastmod>2022-04-12</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
</urlset>
|
10
public/robots.txt
Normal file
10
public/robots.txt
Normal file
@ -0,0 +1,10 @@
|
||||
User-agent: *
|
||||
|
||||
Disallow: /admin/
|
||||
Disallow: /index/user/
|
||||
Disallow: /index/api/
|
||||
Disallow: /index/login.html
|
||||
Disallow: /index/reg.html
|
||||
Disallow: /*?*
|
||||
sitemap:http://www.test.com/2022-04-16_1.xml
|
||||
sitemap:http://www.test.com/2022-04-16_2.xml
|
@ -482,10 +482,8 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co
|
||||
/*详情页-问答*/
|
||||
.user-questions{position:relative; margin: 5px 0 15px;}
|
||||
.user-questions .user-avatar img{width: 25px; height: 25px; margin-top: 10; border-radius: 100%;}
|
||||
.user-questions .user-questions-right{position:absolute; right:0px; display: inline-block; font-size: 14px; padding-left: 5px;}
|
||||
.user-questions .user-questions-right i{padding: 0 3px 0 15px; font-size: 22px; color: #999;}
|
||||
|
||||
.detail-body-wenda{margin: 10px 0 5px; line-height: 26px; font-size: 16px; color: #999; word-wrap: break-word;}
|
||||
.detail-body-wenda{margin: 10px 0 5px; line-height: 26px; font-size: 16px; color: rgb(82, 80, 80); word-wrap: break-word;}
|
||||
.detail-body-wenda p{margin-bottom:15px;}
|
||||
.detail-body-wenda img{max-width: 100%; cursor: pointer;}
|
||||
.detail-body-wenda .layui-btn{margin: 0 10px 10px 0;}
|
||||
|
@ -116,7 +116,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
|
||||
var str = window.getSelection().toString();
|
||||
if(!str == ''){
|
||||
//var strB = '<b>'+ str + '</b>';
|
||||
layui.focusInsert(editor[0], '[strong] '+ str + '[/strong]');
|
||||
layui.focusInsert(editor[0], '[strong]'+ str + '[/strong]');
|
||||
//console.log(str);
|
||||
// console.log(strB);
|
||||
}
|
||||
@ -583,8 +583,8 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
|
||||
|
||||
//转义加粗
|
||||
.replace(/\[strong\]([\s\S]*)\[\/strong\]\n*/g, function(str){
|
||||
return str.replace(/\[strong\]\n*/g, '<b>')
|
||||
.replace(/\n*\[\/strong\]\n*/g, '</b>');
|
||||
return str.replace(/\[strong\]\n*/g,'<b>')
|
||||
.replace(/\n*\[\/strong\]\n*/g, '</b>');
|
||||
})
|
||||
|
||||
//转义换行
|
||||
|
4
vendor/composer/autoload_psr4.php
vendored
4
vendor/composer/autoload_psr4.php
vendored
@ -12,9 +12,9 @@ return array(
|
||||
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
|
||||
'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
|
||||
'think\\app\\' => array($vendorDir . '/topthink/think-multi-app/src'),
|
||||
'think\\' => array($vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-template/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/framework/src/think'),
|
||||
'think\\' => array($vendorDir . '/topthink/framework/src/think', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src'),
|
||||
'taoser\\think\\' => array($vendorDir . '/taoser/think-auth/src'),
|
||||
'taoser\\' => array($vendorDir . '/taoser/think-addons/src'),
|
||||
'taoser\\' => array($vendorDir . '/taoser/think-addons/src', $vendorDir . '/taoser/think-setarr/src'),
|
||||
'phpspirit\\databackup\\' => array($vendorDir . '/lotofbadcode/phpspirit_databackup/src'),
|
||||
'liliuwei\\social\\' => array($vendorDir . '/liliuwei/thinkphp-social/src'),
|
||||
'app\\' => array($baseDir . '/app'),
|
||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -113,6 +113,7 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
|
||||
'taoser\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/taoser/think-addons/src',
|
||||
1 => __DIR__ . '/..' . '/taoser/think-setarr/src',
|
||||
),
|
||||
'phpspirit\\databackup\\' =>
|
||||
array (
|
||||
|
95
vendor/composer/installed.json
vendored
95
vendor/composer/installed.json
vendored
@ -227,24 +227,18 @@
|
||||
},
|
||||
{
|
||||
"name": "league/mime-type-detection",
|
||||
"version": "1.9.0",
|
||||
"version_normalized": "1.9.0.0",
|
||||
"version": "1.10.0",
|
||||
"version_normalized": "1.10.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/mime-type-detection.git",
|
||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69"
|
||||
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
||||
"reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||
"reference": "3e4a35d756eedc67096f30240a68a3149120dae7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
@ -255,7 +249,7 @@
|
||||
"phpstan/phpstan": "^0.12.68",
|
||||
"phpunit/phpunit": "^8.5.8 || ^9.3"
|
||||
},
|
||||
"time": "2021-11-21T11:48:40+00:00",
|
||||
"time": "2022-04-11T12:49:04+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -276,7 +270,7 @@
|
||||
"description": "Mime-type detection for Flysystem",
|
||||
"support": {
|
||||
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
|
||||
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.9.0"
|
||||
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.10.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1264,6 +1258,49 @@
|
||||
],
|
||||
"install-path": "../taoser/think-auth"
|
||||
},
|
||||
{
|
||||
"name": "taoser/think-setarr",
|
||||
"version": "v0.0.3",
|
||||
"version_normalized": "0.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/taoser/think-setarr.git",
|
||||
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/taoser/think-setarr/zipball/6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||
"reference": "6651c31ef42417a6294ef08e6fb970917b7e7f86",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.0"
|
||||
},
|
||||
"time": "2022-04-16T23:08:43+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"taoser\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"mit"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taoser",
|
||||
"email": "changlin_zhao@qq.com"
|
||||
}
|
||||
],
|
||||
"description": "php confing",
|
||||
"support": {
|
||||
"issues": "https://github.com/taoser/think-setarr/issues",
|
||||
"source": "https://github.com/taoser/think-setarr/tree/v0.0.3"
|
||||
},
|
||||
"install-path": "../taoser/think-setarr"
|
||||
},
|
||||
{
|
||||
"name": "topthink/framework",
|
||||
"version": "v6.0.12",
|
||||
@ -1342,29 +1379,23 @@
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-captcha",
|
||||
"version": "v3.0.4",
|
||||
"version_normalized": "3.0.4.0",
|
||||
"version": "v3.0.6",
|
||||
"version_normalized": "3.0.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/think-captcha.git",
|
||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad"
|
||||
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/db5be361d3cd664d236fb95d5dffe93a117283ad",
|
||||
"reference": "db5be361d3cd664d236fb95d5dffe93a117283ad",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||
"reference": "3b60feb4d484381ff7ddda4af7582a6b9be5dacf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"topthink/framework": "^6.0.0"
|
||||
},
|
||||
"time": "2022-01-07T06:34:19+00:00",
|
||||
"time": "2022-03-18T09:11:51+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"think": {
|
||||
@ -1378,12 +1409,12 @@
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"think\\captcha\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/helper.php"
|
||||
]
|
||||
],
|
||||
"psr-4": {
|
||||
"think\\captcha\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
@ -1398,7 +1429,7 @@
|
||||
"description": "captcha package for thinkphp",
|
||||
"support": {
|
||||
"issues": "https://github.com/top-think/think-captcha/issues",
|
||||
"source": "https://github.com/top-think/think-captcha/tree/v3.0.4"
|
||||
"source": "https://github.com/top-think/think-captcha/tree/v3.0.6"
|
||||
},
|
||||
"install-path": "../topthink/think-captcha"
|
||||
},
|
||||
|
25
vendor/composer/installed.php
vendored
25
vendor/composer/installed.php
vendored
@ -5,7 +5,7 @@
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => 'c22383e6432ee0dc4992378dbd006d79492737b3',
|
||||
'reference' => 'f8f39741994332a33848a2cf4f58ade195aea126',
|
||||
'name' => 'taoser/taoler',
|
||||
'dev' => true,
|
||||
),
|
||||
@ -38,12 +38,12 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'league/mime-type-detection' => array(
|
||||
'pretty_version' => '1.9.0',
|
||||
'version' => '1.9.0.0',
|
||||
'pretty_version' => '1.10.0',
|
||||
'version' => '1.10.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../league/mime-type-detection',
|
||||
'aliases' => array(),
|
||||
'reference' => 'aa70e813a6ad3d1558fc927863d47309b4c23e69',
|
||||
'reference' => '3e4a35d756eedc67096f30240a68a3149120dae7',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'liliuwei/thinkphp-social' => array(
|
||||
@ -160,7 +160,7 @@
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => 'c22383e6432ee0dc4992378dbd006d79492737b3',
|
||||
'reference' => 'f8f39741994332a33848a2cf4f58ade195aea126',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'taoser/think-addons' => array(
|
||||
@ -181,6 +181,15 @@
|
||||
'reference' => '19bb04e4fb957a95ff3fdc142939922c19167b43',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'taoser/think-setarr' => array(
|
||||
'pretty_version' => 'v0.0.3',
|
||||
'version' => '0.0.3.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../taoser/think-setarr',
|
||||
'aliases' => array(),
|
||||
'reference' => '6651c31ef42417a6294ef08e6fb970917b7e7f86',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'topthink/framework' => array(
|
||||
'pretty_version' => 'v6.0.12',
|
||||
'version' => '6.0.12.0',
|
||||
@ -191,12 +200,12 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'topthink/think-captcha' => array(
|
||||
'pretty_version' => 'v3.0.4',
|
||||
'version' => '3.0.4.0',
|
||||
'pretty_version' => 'v3.0.6',
|
||||
'version' => '3.0.6.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../topthink/think-captcha',
|
||||
'aliases' => array(),
|
||||
'reference' => 'db5be361d3cd664d236fb95d5dffe93a117283ad',
|
||||
'reference' => '3b60feb4d484381ff7ddda4af7582a6b9be5dacf',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'topthink/think-helper' => array(
|
||||
|
@ -1,12 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## 1.10.0 - 2022-04-11
|
||||
|
||||
### Fixed
|
||||
|
||||
- Added Flysystem v1 inconclusive mime-types and made it configurable as a constructor parameter.
|
||||
|
||||
## 1.9.0 - 2021-11-21
|
||||
|
||||
### Updated
|
||||
|
||||
- Updated lookup
|
||||
|
||||
- ## 1.8.0 - 2021-09-25
|
||||
## 1.8.0 - 2021-09-25
|
||||
|
||||
### Added
|
||||
|
||||
|
2
vendor/league/mime-type-detection/LICENSE
vendored
2
vendor/league/mime-type-detection/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2013-2020 Frank de Jonge
|
||||
Copyright (c) 2013-2022 Frank de Jonge
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -11,7 +11,13 @@ use finfo;
|
||||
|
||||
class FinfoMimeTypeDetector implements MimeTypeDetector
|
||||
{
|
||||
private const INCONCLUSIVE_MIME_TYPES = ['application/x-empty', 'text/plain', 'text/x-asm'];
|
||||
private const INCONCLUSIVE_MIME_TYPES = [
|
||||
'application/x-empty',
|
||||
'text/plain',
|
||||
'text/x-asm',
|
||||
'application/octet-stream',
|
||||
'inode/x-empty',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var finfo
|
||||
@ -28,14 +34,21 @@ class FinfoMimeTypeDetector implements MimeTypeDetector
|
||||
*/
|
||||
private $bufferSampleSize;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
private $inconclusiveMimetypes;
|
||||
|
||||
public function __construct(
|
||||
string $magicFile = '',
|
||||
ExtensionToMimeTypeMap $extensionMap = null,
|
||||
?int $bufferSampleSize = null
|
||||
?int $bufferSampleSize = null,
|
||||
array $inconclusiveMimetypes = self::INCONCLUSIVE_MIME_TYPES
|
||||
) {
|
||||
$this->finfo = new finfo(FILEINFO_MIME_TYPE, $magicFile);
|
||||
$this->extensionMap = $extensionMap ?: new GeneratedExtensionToMimeTypeMap();
|
||||
$this->bufferSampleSize = $bufferSampleSize;
|
||||
$this->inconclusiveMimetypes = $inconclusiveMimetypes;
|
||||
}
|
||||
|
||||
public function detectMimeType(string $path, $contents): ?string
|
||||
@ -44,7 +57,7 @@ class FinfoMimeTypeDetector implements MimeTypeDetector
|
||||
? (@$this->finfo->buffer($this->takeSample($contents)) ?: null)
|
||||
: null;
|
||||
|
||||
if ($mimeType !== null && ! in_array($mimeType, self::INCONCLUSIVE_MIME_TYPES)) {
|
||||
if ($mimeType !== null && ! in_array($mimeType, $this->inconclusiveMimetypes)) {
|
||||
return $mimeType;
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,8 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
||||
'atomsvc' => 'application/atomsvc+xml',
|
||||
'atx' => 'application/vnd.antix.game-component',
|
||||
'au' => 'audio/x-au',
|
||||
'avci' => 'image/avci',
|
||||
'avcs' => 'image/avcs',
|
||||
'avi' => 'video/x-msvideo',
|
||||
'avif' => 'image/avif',
|
||||
'aw' => 'application/applixware',
|
||||
@ -160,6 +162,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
||||
'com' => 'application/x-msdownload',
|
||||
'conf' => 'text/plain',
|
||||
'cpio' => 'application/x-cpio',
|
||||
'cpl' => 'application/cpl+xml',
|
||||
'cpp' => 'text/x-c',
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'crd' => 'application/x-mscardfile',
|
||||
@ -583,6 +586,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
||||
'mpd' => 'application/dash+xml',
|
||||
'mpe' => 'video/mpeg',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpf' => 'application/media-policy-dataset+xml',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpg4' => 'video/mp4',
|
||||
'mpga' => 'audio/mpeg',
|
||||
@ -760,7 +764,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
||||
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
||||
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'pqa' => 'application/vnd.palm',
|
||||
'prc' => 'application/x-pilot',
|
||||
'prc' => 'model/prc',
|
||||
'pre' => 'application/vnd.lotus-freelance',
|
||||
'prf' => 'application/pics-rules',
|
||||
'provx' => 'application/provenance+xml',
|
||||
@ -1000,6 +1004,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
||||
'txd' => 'application/vnd.genomatix.tuxedo',
|
||||
'txf' => 'application/vnd.mobius.txf',
|
||||
'txt' => 'text/plain',
|
||||
'u3d' => 'model/u3d',
|
||||
'u8dsn' => 'message/global-delivery-status',
|
||||
'u8hdr' => 'message/global-headers',
|
||||
'u8mdn' => 'message/global-disposition-notification',
|
||||
@ -1096,6 +1101,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap
|
||||
'webp' => 'image/webp',
|
||||
'wg' => 'application/vnd.pmi.widget',
|
||||
'wgt' => 'application/widget',
|
||||
'wif' => 'application/watcherinfo+xml',
|
||||
'wks' => 'application/vnd.ms-works',
|
||||
'wm' => 'video/x-ms-wm',
|
||||
'wma' => 'audio/x-ms-wma',
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2022-03-16 18:40:36
|
||||
// This file is automatically generated at:2022-04-17 07:13:49
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'taoser\\addons\\Service',
|
||||
|
1
vendor/taoser/think-setarr/.gitignore
vendored
Normal file
1
vendor/taoser/think-setarr/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.idea
|
21
vendor/taoser/think-setarr/LICENSE
vendored
Normal file
21
vendor/taoser/think-setarr/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 taoser
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
221
vendor/taoser/think-setarr/README.md
vendored
Normal file
221
vendor/taoser/think-setarr/README.md
vendored
Normal file
@ -0,0 +1,221 @@
|
||||
## 简介
|
||||
插件化开发,安装插件时很多情况需要修改配置文件,通过正则能完美解决修改配置影响备注信息的问题。
|
||||
`taoser/think-setarr`通过配置数组,即可非常简便的修改、添加、删除配置文件中的数据,使得插件化开发更加统一和灵活的对配置文件的操作。
|
||||
|
||||
>配置文件数组遵守的规则为:
|
||||
1. 一个数组中,无论它有多少个元素及是否包含子数组,它的索引数组(一维)在前,关联(多维)数组排序在后。
|
||||
2. 数组每个元素后加`,`号,数组结尾`],`逗号,以方便需要插入新元素时识别。
|
||||
|
||||
## 安装
|
||||
```php
|
||||
composer require taoser/think-setarr
|
||||
```
|
||||
|
||||
## 使用
|
||||
> 类引用变量`app`即为config/app.php文件
|
||||
|
||||
```html
|
||||
use taoser\SetArr;
|
||||
|
||||
$data = [
|
||||
true,false,111,
|
||||
'aaa'=>'bbb',
|
||||
'ccc'=>[
|
||||
true,
|
||||
222,
|
||||
"app()";
|
||||
"//备注信息",
|
||||
......
|
||||
],
|
||||
......
|
||||
];
|
||||
$result = SetArr::name('app')->add($data);
|
||||
```
|
||||
|
||||
### 添加数组节点
|
||||
|
||||
> 可以对配置文件数组中添加新的元素,添加规则:
|
||||
1. 支持嵌套4级数组,最后一级数组元素只能是一维数组,
|
||||
2. 只能给一维数组元素添加备注`“//备注”`,不能添加在关联数组的前面,
|
||||
3. 函数,类,需要引号包裹`""`,
|
||||
4. bool,数值,字符串非索引的元素的添加会重复添加,
|
||||
5. 结果返回布尔值
|
||||
|
||||
```php
|
||||
$add = [
|
||||
1,true,false,
|
||||
"//支持备注的添加",
|
||||
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||
'a' => 1,
|
||||
'b' => 'b',
|
||||
'c' => true,
|
||||
'd' => false,
|
||||
'e' => "support\bootstrap\Session::class,",
|
||||
"// 这里这一行添加备注是无效的,在子数组前写备注位置会不正确",
|
||||
'f' => [
|
||||
22,true,false,
|
||||
'aa' => 11,
|
||||
'bb' => 'bb',
|
||||
'cc' => true,
|
||||
'dd' => false,
|
||||
"//支持备注的添加",
|
||||
'ee' => "base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||
'ff' => [
|
||||
333,true,false,
|
||||
'aaa' => 11,
|
||||
'bbb' => 'bb',
|
||||
'ccc' => true,
|
||||
'ddd' => false,
|
||||
'eee' => "support\bootstrap\Session::class,",
|
||||
'fff' => [
|
||||
"//支持备注的添加,最后一级数组只能是一维数组",
|
||||
'aaaa' => 11,
|
||||
'bbbb' => 'bb',
|
||||
'cccc' => true,
|
||||
'dddd' => false,
|
||||
'eeee' => "support\bootstrap\Session::class,",
|
||||
],
|
||||
],
|
||||
'gg' => [
|
||||
1,true,false,
|
||||
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||
'aa' => 11,
|
||||
'bb' => 'bb',
|
||||
'cc' => true,
|
||||
'dd' => false,
|
||||
'ee' => "support\bootstrap\Session::class,",
|
||||
],
|
||||
],
|
||||
'g' => [
|
||||
1,true,false,
|
||||
'ga' => 11,
|
||||
'gb' => 'bb',
|
||||
'gc' => true,
|
||||
'gd' => false,
|
||||
'ge' => "support\bootstrap\Session::class,",
|
||||
'gf' => [
|
||||
1,true,false,
|
||||
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||
'gaa' => 11,
|
||||
'gbb' => 'bb',
|
||||
'gcc' => true,
|
||||
'gdd' => false,
|
||||
'gee' => "support\bootstrap\Session::class,",
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$conf = \taoser\SetArr::name('app')->add($data);
|
||||
|
||||
```
|
||||
|
||||
### 编辑数组节点
|
||||
|
||||
> 数组编辑,
|
||||
1. 不能直接对非索引(下标0,1数值型索引)元素数组进行操作,
|
||||
2. 索引数组的编辑需要先`delete`删除(如true,111,"app()","//备注"),再`add`添加value(如,false,12345,"support\bootstrap\Session::class,","备注2")。
|
||||
|
||||
```php
|
||||
use taoser\SetArr;
|
||||
|
||||
$edit = [
|
||||
'a' => 1,
|
||||
'b' => 'b',
|
||||
'c' => true,
|
||||
'd' => false,
|
||||
'e' => "support\bootstrap\Session::class,",
|
||||
'f' => [
|
||||
'aa' => 11,
|
||||
'bb' => 'bb',
|
||||
'cc' => true,
|
||||
'dd' => false,
|
||||
'ee' => "base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||
'ff' => [
|
||||
'aaa' => 11,
|
||||
'bbb' => 'bb',
|
||||
'ccc' => true,
|
||||
'ddd' => false,
|
||||
'eee' => "support\bootstrap\Session::class,",
|
||||
'fff' => [
|
||||
'aaaa' => 11,
|
||||
'bbbb' => 'bb',
|
||||
'cccc' => true,
|
||||
'dddd' => false,
|
||||
'eeee' => "support\bootstrap\Session::class,",
|
||||
],
|
||||
],
|
||||
'gg' => [
|
||||
1,true,false,
|
||||
"base_path() . DIRECTORY_SEPARATOR . 'public',"
|
||||
'aa' => 11,
|
||||
'bb' => 'bb',
|
||||
'cc' => true,
|
||||
'dd' => false,
|
||||
'ee' => "support\bootstrap\Session::class,",
|
||||
],
|
||||
],
|
||||
'g' => [
|
||||
'ga' => 11,
|
||||
'gb' => 'bb',
|
||||
'ge' => "support\bootstrap\Session::class,",
|
||||
'gf' => [
|
||||
'gaa' => 11,
|
||||
'gbb' => 'bb',
|
||||
'gcc' => true,
|
||||
'gdd' => false,
|
||||
'gee' => "support\bootstrap\Session::class,",
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$conf = SetArr::name('app')->edit($edit);
|
||||
|
||||
```
|
||||
|
||||
### 删除数值
|
||||
|
||||
> 删除元素规则
|
||||
1. “//备注”、bool、111、'abcd'等,给定value即会删除;
|
||||
2. 关联数组需要给定key和value,value值为空,0,false,null均会删除。
|
||||
3. 删除数据是一条一条删除的,不能只给一个数组的key
|
||||
4. 一个数组删除后会空会把空数组删除
|
||||
|
||||
```php
|
||||
use taoser\SetArr;
|
||||
|
||||
$del = [
|
||||
true,false,111,'US-A',
|
||||
"// 删除备注",
|
||||
"base_path() . DIRECTORY_SEPARATOR . 'public',",
|
||||
'a' => 0,
|
||||
'b' => 0,
|
||||
'c' => 0,
|
||||
'd' => 0,
|
||||
'e' => 0,
|
||||
'f' => [
|
||||
'aa' => '',
|
||||
'bb' => '',
|
||||
'cc' => '',
|
||||
'dd' => '',
|
||||
'ee' => ""
|
||||
'ff' => [
|
||||
'aaa' => false,
|
||||
'bbb' => false,
|
||||
'ccc' => false,
|
||||
'ddd' => false,
|
||||
'eee' => false,
|
||||
'fff' => [
|
||||
'aaaa' => null,
|
||||
'bbbb' => null,
|
||||
'cccc' => null,
|
||||
'dddd' => null,
|
||||
'eeee' => null,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$conf = SetArr::name('app')->delete($del);
|
||||
|
||||
```
|
||||
|
||||
详细参考 [作者](http://wiki.aieok.com)
|
21
vendor/taoser/think-setarr/composer.json
vendored
Normal file
21
vendor/taoser/think-setarr/composer.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "taoser/think-setarr",
|
||||
"description": "php confing",
|
||||
"license": "mit",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taoser",
|
||||
"email": "changlin_zhao@qq.com",
|
||||
"website": "www.aieok.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"taoser\\": "src/"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
903
vendor/taoser/think-setarr/src/SetArr.php
vendored
Normal file
903
vendor/taoser/think-setarr/src/SetArr.php
vendored
Normal file
@ -0,0 +1,903 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: TaoLer <alipey_tao@qq.com>
|
||||
* @Date: 2022-04-14 16:05:35
|
||||
* @LastEditTime: 2022-04-17 07:04:31
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \undefinede:\github\think-setarr\src\SetArr.php
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
*/
|
||||
namespace taoser;
|
||||
|
||||
class SetArr
|
||||
{
|
||||
protected static string $str = '';
|
||||
protected static string $configName = '';
|
||||
protected static string $configFile = '';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
//self::$configName = $configName;
|
||||
// 配置文件路径
|
||||
self::$configFile = app()->getConfigPath() . self::$configName . '.php';
|
||||
// 加载配置文件
|
||||
self::$str = file_get_contents(self::$configFile);
|
||||
}
|
||||
|
||||
public static function name(string $configName)
|
||||
{
|
||||
self::$configName = $configName;
|
||||
return new self;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增配置项,支持三级数组配置
|
||||
*
|
||||
* @param array $arr
|
||||
* @return boolean
|
||||
*/
|
||||
public static function add(array $arr) :bool
|
||||
{
|
||||
//正则];数组结尾
|
||||
$end = '/\];/';
|
||||
//一级配置,内容追加到return [一级配置,之后
|
||||
$start = self::getArrSonCount(config(self::$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);
|
||||
if(is_int($k)) {
|
||||
// 数值数组
|
||||
if(is_string($v)){
|
||||
|
||||
// 类、函数、注释,原样写入
|
||||
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||
$reps = $arrstart[0]. "\t'". $v ."',\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]. "\t". $v .",\n";
|
||||
}
|
||||
} elseif(is_bool($v)) {
|
||||
$reps = ($v == true) ? $arrstart[0]."\ttrue,\n" : $arrstart[0]."\tfalse,\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]."\t".$v . ",\n";
|
||||
}
|
||||
} else {
|
||||
// 键值关联数组
|
||||
//判断是否存在KEY
|
||||
if (array_key_exists($k,config(self::$configName))) {
|
||||
echo $k.'不能添加已存在的配置项';
|
||||
return false;
|
||||
}
|
||||
if(is_string($v)){
|
||||
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||
$reps = $arrstart[0]."\t'" . $k . "' => '" . $v ."',\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||
}
|
||||
} elseif(is_bool($v)) {
|
||||
$reps = ($v == true) ? $arrstart[0]."\t'" . $k . "' => true,\n" : $arrstart[0]."\t'" . $k . "' => false,\n";
|
||||
} else {
|
||||
$reps = $arrstart[0]."\t'" . $k . "' => " . $v .",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($start, $reps, self::$str);
|
||||
} else {
|
||||
// $v是数组,存在多级配置
|
||||
|
||||
// $k不存在,新增二级配置数组, 数组插入];之前
|
||||
if (!array_key_exists($k,config(self::$configName))) {
|
||||
// 拼接数组内元素
|
||||
$sonArr = '';
|
||||
foreach($v as $kk => $vv) {
|
||||
// 1.$vv不是数组,新增配置只有二级元素
|
||||
if(!is_array($vv)) {
|
||||
if(!is_int($kk)) {
|
||||
// 键值对数组
|
||||
if(is_int($vv)) {
|
||||
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$sonArr .= ($vv == true) ? "\t\t'" . $kk . "' => true,\n" : "\t\t'" . $kk . "' => false,\n";
|
||||
} else {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$sonArr .= "\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||
} else {
|
||||
$sonArr .= "\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 数值数组
|
||||
if(is_string($vv)) {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$sonArr .= "\t\t'" . $vv . "',\n";
|
||||
} else {
|
||||
$sonArr .= "\t\t" . $vv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$sonArr .= ($vv == true) ? "\t\ttrue,\n" :"\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArr .= "\t\t" . $vv . ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// 2.$vv是数组,新增中包含三级、四级子数组
|
||||
$sonArrson = '';
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
// $vvv不是数组,三级非数组
|
||||
if(!is_array($vvv)){
|
||||
if(!is_int($kkk)) {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvv)) {
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\t'". $kkk. "' => true,\n" : "\t\t\t'". $kkk. "' =>false,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvv)) {
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//$vvv是数组,但不支持子数组
|
||||
$sonArrsonArr = '';
|
||||
foreach($vvv as $kkkk =>$vvvv) {
|
||||
if(is_array($vvvv)) {
|
||||
echo $kkkk."不支持四级数组\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!is_int($kkkk)) {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'". $kkkk . "' => true,\n" : "\t\t\t\t'". $kkkk. "' =>false,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => [\n".$sonArrsonArr."\t\t\t],\n";
|
||||
//echo "不支持".$kkkk."是数组";
|
||||
}
|
||||
}
|
||||
$sonArr .= "\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||
}
|
||||
}
|
||||
$reps = "\t'". $k. "' => [\n".$sonArr."\t],\n];";
|
||||
self::$str = preg_replace($end, $reps, self::$str);
|
||||
} else {
|
||||
// $k已存在,二级配置是数组,需要添加二级或三数组元素
|
||||
|
||||
// 把$v的子元素追加在匹配$k => [之后
|
||||
// //匹配$k => [
|
||||
// $kpats = '/\''.$k.'\'\s*=>\s*\[\r?\n/';
|
||||
// preg_match($kpats,self::$str,$arrk);
|
||||
// 新增二级配置
|
||||
|
||||
// 往数组中追加子元素
|
||||
foreach ($v as $kk => $vv) {
|
||||
// 1. $vv不是数组
|
||||
if(!is_array($vv)) {
|
||||
// 新建二级配置
|
||||
|
||||
//匹配$k => [ ***,
|
||||
//$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);
|
||||
|
||||
if(!is_int($kk)) {
|
||||
if(array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||
echo $kk.'不能添加已存在的配置项kk';
|
||||
return false;
|
||||
}
|
||||
if(is_string($vv)) {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => '" . $vv . "',\n";
|
||||
} else {
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$reps = ($vv == true) ? $arrk[0]."\t\t'" . $kk . "' => true,\n" : $arrk[0]."\t\t'" . $kk . "' => false,\n";
|
||||
} else {
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => " . $vv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vv)) {
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$reps = $arrk[0] ."\t\t'" . $vv . "',\n";
|
||||
} else {
|
||||
$reps = $arrk[0] ."\t\t" . $vv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vv)) {
|
||||
$reps = ($vv == true) ? $arrk[0] . "\t\ttrue,\n" : $arrk[0] . "\t\tfalse,\n";
|
||||
} else {
|
||||
$reps = $arrk[0]."\t\t". $vv . ",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||
} else {
|
||||
// 2. $vv是数组
|
||||
|
||||
// 匹配到数组内部的后面
|
||||
$sonArrnum = self::getArrSonNum(config(self::$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/';
|
||||
}
|
||||
preg_match($kpats,self::$str,$arrk);
|
||||
|
||||
// a.$vv数组不存在,新建数组及它的子数组$kkk
|
||||
if(!array_key_exists($kk,config(self::$configName . '.' . $k))) {
|
||||
|
||||
$sonArrson = '';
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
// $vvv不是数组
|
||||
if(!is_array($vvv)) {
|
||||
if(!is_int($kkk)) {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
//布尔
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\t'" . $kkk . "' => true,\n" : "\t\t\t'" . $kkk . "' => false,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$sonArrson .= "\t\t\t'" . $vvv . "',\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t".$vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
//布尔
|
||||
$sonArrson .= ($vvv == true) ? "\t\t\ttrue,\n" : "\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrson .= "\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// $vvv是数组
|
||||
$sonArrsonArr = '';
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
if(!is_int($kkkk)) {
|
||||
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||
echo $kkkk."已存在?";
|
||||
return false;
|
||||
}
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
//布尔
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk. "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
//布尔
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$sonArrson .= "\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||
//echo '不支持4级数组';
|
||||
}
|
||||
}
|
||||
$reps = $arrk[0]."\t\t'". $kk. "' => [\n".$sonArrson."\t\t],\n";
|
||||
self::$str = preg_replace($kpats, $reps, self::$str);
|
||||
} else {
|
||||
// b.$vv数组已存在
|
||||
// 匹配包含$k $kk=>[
|
||||
// $kkpats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[^\[]*\[\r?\n/';
|
||||
// preg_match($kkpats,self::$str,$arrkk);
|
||||
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
//halt(123,$arrkk[0]);
|
||||
// $vvv不是数组,追加$kkk
|
||||
if(!is_array($vvv)) {
|
||||
// 匹配包含$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);
|
||||
|
||||
if(!is_int($kkk)) {
|
||||
//判断第三级key是否存在
|
||||
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||
echo $kkk.'不能添加已存在的配置项kkk';
|
||||
return false;
|
||||
}
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => '" . $vvv . "',\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\t'" . $kkk . "' => true,\n" : $arrkk[0]."\t\t\t'" . $kkk . "' => false,\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t'". $kkk. "' => " . $vvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$repsk = $arrkk[0]."\t\t\t'" . $vvv . "',\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvv)) {
|
||||
$repsk = ($vvv == true) ? $arrkk[0]."\t\t\ttrue,\n" : $arrkk[0]."\t\t\tfalse,\n";
|
||||
} else {
|
||||
$repsk = $arrkk[0]."\t\t\t" . $vvv . ",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($kkpats,$repsk, self::$str);
|
||||
} else {
|
||||
// $vvv是数组,a.数组存在,b.数组不存在
|
||||
|
||||
//a. $kkk数组存在
|
||||
if(array_key_exists($kkk,config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||
//匹配包含$k $kk $kkk 到]的内容
|
||||
//$sonPats = '/\'' . $k . '\'[\s\S]*?(?:'.$kk.')\'[\s\S]*?(?:'.$kkk.')\' [^\]]*/';
|
||||
//[\s\S]*?(?:'.$kkk.')\'(.*),/
|
||||
|
||||
// $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);
|
||||
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
preg_match($k3pats,self::$str,$arrk3);
|
||||
if(!is_int($kkkk)) {
|
||||
// 多维数组
|
||||
if(array_key_exists($kkkk,config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))) {
|
||||
echo $kkkk."已存在k4";
|
||||
return false;
|
||||
}
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\t'" . $kkkk . "' => true,\n" : $arrk3[0]."\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
// 数值数组
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonReps = ($vvvv == true) ? $arrk3[0]."\t\t\t\ttrue,\n" : $arrk3[0]."\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonReps = $arrk3[0]."\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
self::$str = preg_replace($k3pats,$sonReps, self::$str);
|
||||
}
|
||||
} else {
|
||||
// b. $kkk不存在
|
||||
|
||||
// 匹配到数组内部的后面k
|
||||
$sonArrnum = self::getArrSonNum(config(self::$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/';
|
||||
}
|
||||
preg_match($kkpats,self::$str,$arrkk);
|
||||
|
||||
$sonArrsonArr = '';
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
if(is_array($vvvv)) {
|
||||
echo '不支持四级数组';
|
||||
return false;
|
||||
}
|
||||
if(!is_int($kkkk)) {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => '" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\t'" . $kkkk . "' => true,\n" : "\t\t\t\t'" . $kkkk . "' => false,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t'". $kkkk . "' => " . $vvvv . ",\n";
|
||||
}
|
||||
} else {
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false && stripos($vvvv,'//') === false) {
|
||||
$sonArrsonArr .= "\t\t\t\t'" . $vvvv . "',\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vvvv)) {
|
||||
$sonArrsonArr .= ($vvvv == true) ? "\t\t\t\ttrue,\n" : "\t\t\t\tfalse,\n";
|
||||
} else {
|
||||
$sonArrsonArr .= "\t\t\t\t" . $vvvv . ",\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$reps = $arrkk[0]."\t\t\t'".$kkk."' => [\n" . $sonArrsonArr . "\t\t\t],\n";
|
||||
self::$str = preg_replace($kkpats,$reps, self::$str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//写入配置
|
||||
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑配置数组表
|
||||
* 一位数组修改请用delete和add组合
|
||||
* 仅支持键值对的数组修改
|
||||
*
|
||||
* @param array $arr
|
||||
* @return boolean
|
||||
*/
|
||||
public static function edit($arr) :bool
|
||||
{
|
||||
|
||||
// 只能修改有键值对的数组
|
||||
if(!is_array($arr)) return false;
|
||||
|
||||
foreach($arr as $k => $v) {
|
||||
// key不存在
|
||||
if(!array_key_exists($k,config(self::$configName))) {
|
||||
echo $k.'不存在 ';
|
||||
return false;
|
||||
}
|
||||
// 一级数组修改
|
||||
if(!is_array($v)) {
|
||||
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arr);
|
||||
//halt($arr);
|
||||
if(is_string($v)){
|
||||
// 字符串
|
||||
if(stripos($v,'::class') == false && stripos($v,'()') == false && stripos($v,'//') === false) {
|
||||
$repk = "'". $k . "' => '" . $v . "',";
|
||||
} else {
|
||||
$repk = "'". $k . "' => " . $v . ",";
|
||||
}
|
||||
} elseif(is_bool($v)) {
|
||||
//布尔
|
||||
$repk = ($v == true) ? "'" . $k . "' => true," : "'" . $k . "' => false,";
|
||||
} else {
|
||||
// 数字
|
||||
$repk = "'". $k . "' => " . $v .",";
|
||||
}
|
||||
$patk = '/\'' . $k . '\'(.*),/';
|
||||
$reps = preg_replace($patk, $repk, $arr[0]);
|
||||
// 正则查找然后替换
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
// 正则二级配置
|
||||
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,/';
|
||||
// 二级和三级
|
||||
foreach($v as $kk => $vv) {
|
||||
if(!array_key_exists($kk, config(self::$configName.'.'.$k))) {
|
||||
echo $kk.'不存在';
|
||||
return false;
|
||||
}
|
||||
//二级配置
|
||||
if(!is_array($vv)) {
|
||||
if(is_string($vv)){
|
||||
// 字符串
|
||||
if(stripos($vv,'::class') == false && stripos($vv,'()') == false && stripos($vv,'//') === false) {
|
||||
$repkk = "'". $kk . "' => '" . $vv . "',";
|
||||
} else {
|
||||
$repkk = "'". $kk . "' => " . $vv . ",";
|
||||
}
|
||||
|
||||
} elseif(is_bool($vv)) {
|
||||
//布尔
|
||||
$repkk = ($vv == true) ? "'" . $kk . "' => true," : "'" . $kk . "' => false,";
|
||||
} else {
|
||||
// 数字
|
||||
$repkk = "'". $kk . "' => " . $vv .",";
|
||||
}
|
||||
preg_match($pats,self::$str,$arrk);
|
||||
// 正则需要替换的部分
|
||||
$patkk = '/\'' . $kk . '\'(.*?),/';
|
||||
$reps = preg_replace($patkk, $repkk, $arrk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$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))) {
|
||||
echo $kkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
if(!is_array($vvv)) {
|
||||
// 类型判断
|
||||
if(is_string($vvv)) {
|
||||
if(stripos($vvv,'::class') == false && stripos($vvv,'()') == false && stripos($vvv,'//') === false) {
|
||||
$arrReps = "'" . $kkk . "' => '" . $vvv . "',";
|
||||
} else {
|
||||
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||
}
|
||||
} elseif(is_bool($vvv)) {
|
||||
//布尔
|
||||
$arrReps = ($vvv == true) ? "'" . $kkk . "' => true," : "'" . $kkk . "' => false,";
|
||||
} else {
|
||||
$arrReps = "'" . $kkk . "' => " . $vvv . ",";
|
||||
}
|
||||
preg_match($pats,self::$str,$arrkk);
|
||||
// 正则需要替换的部分
|
||||
$arrPats = '/\'' . $kkk . '\'(.*),/';
|
||||
$reps = preg_replace($arrPats, $arrReps, $arrkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$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))){
|
||||
echo $kkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
// 类型判断
|
||||
if(is_string($vvvv)) {
|
||||
if(stripos($vvvv,'::class') == false && stripos($vvvv,'()') == false) {
|
||||
$repskkkk = "'" . $kkkk . "' => '" . $vvvv . "',";
|
||||
} else {
|
||||
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||
}
|
||||
} elseif(is_bool($vvvv)) {
|
||||
//布尔
|
||||
$repskkkk = ($vvvv == true) ? "'" . $kkkk . "' => true," : "'" . $kkkk . "' => false,";
|
||||
} else {
|
||||
$repskkkk = "'" . $kkkk . "' => " . $vvvv . ",";
|
||||
}
|
||||
preg_match($pats,self::$str,$arrkkk);
|
||||
$patskkkk = '/\'' . $kkkk . '\'(.*),/';
|
||||
$reps = preg_replace($patskkkk, $repskkkk, $arrkkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//写入配置
|
||||
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配置数组表
|
||||
* 不支持一次性删除整个数组
|
||||
* 子元素被删除会清理空数组
|
||||
*
|
||||
* @param array $arr
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delete($arr) :bool
|
||||
{
|
||||
// 只能修改有键值对的数组
|
||||
if(!is_array($arr)) return false;
|
||||
|
||||
foreach($arr as $k => $v) {
|
||||
// 一级数组修改
|
||||
if(!is_array($v)) {
|
||||
// 正则开头到,不包含子数组
|
||||
$pats ='/return\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arr);
|
||||
if(!isset($arr[0])) {
|
||||
echo '有误,删除项可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($k)) {
|
||||
// 一维数组正则
|
||||
$patk = self::getPats($v);
|
||||
} else {
|
||||
// key不存在
|
||||
if(!array_key_exists($k,config(self::$configName))) {
|
||||
echo $k.'不存在 ';
|
||||
return false;
|
||||
}
|
||||
$patk = '/[^\n]*\'' . $v . '\'(.*?)\r?\n/';
|
||||
}
|
||||
|
||||
// 正则查找然后替换
|
||||
$reps = preg_replace($patk, '', $arr[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
|
||||
// 二级和三级
|
||||
foreach($v as $kk => $vv) {
|
||||
//二级配置
|
||||
if(!is_array($vv)) {
|
||||
// 正则二级配置
|
||||
$pats = '/\'' . $k . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arrk);
|
||||
if(!isset($arrk[0])) {
|
||||
echo $k.'有误,可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($kk)) {
|
||||
$patkk = self::getPats($vv);
|
||||
} else {
|
||||
// key不存在
|
||||
if(!array_key_exists($kk,config(self::$configName.'.'.$k))) {
|
||||
echo $kk.'不存在 ';
|
||||
return false;
|
||||
}
|
||||
// 正则需要替换的部分
|
||||
$patkk = '/[^\n]*\'' . $kk . '\'(.*?),\r?\n/';
|
||||
}
|
||||
$reps = preg_replace($patkk, '', $arrk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
// 三级配置
|
||||
|
||||
foreach($vv as $kkk => $vvv) {
|
||||
if(!is_array($vvv)) {
|
||||
// 正则二级下的三级配置
|
||||
$pats = '/\'' . $kk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arrkk);
|
||||
if(!isset($arrkkk[0])) {
|
||||
echo $kk.'有误,可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($kkk)) {
|
||||
$patkkk = self::getPats($vvv);
|
||||
} else {
|
||||
if(!array_key_exists($kkk, config(self::$configName.'.'.$k.'.'.$kk))) {
|
||||
echo $kkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
$patkkk = '/[^\n]*\'' . $kkk . '\'(.*),\r?\n/';
|
||||
}
|
||||
|
||||
// 正则需要替换的部分
|
||||
$reps = preg_replace($patkkk, '', $arrkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
// 四级配置
|
||||
|
||||
foreach($vvv as $kkkk => $vvvv) {
|
||||
if(!is_array($vvvv)) {
|
||||
// 正则$kkk
|
||||
$pats = '/\'' . $kkk . '\'\s*=>\s*\[[^\[|\]]*,\r?\n/';
|
||||
preg_match($pats,self::$str,$arrkkk);
|
||||
if(!isset($arrkkk[0])) {
|
||||
echo $kkk.'有误,可能并不存在';
|
||||
return false;
|
||||
}
|
||||
if(is_int($kkkk)) {
|
||||
$patskkkk = self::getPats($vvvv);
|
||||
} else {
|
||||
if(!array_key_exists($kkkk, config(self::$configName.'.'.$k.'.'.$kk.'.'.$kkk))){
|
||||
echo $kkkk.'不存在';
|
||||
return false;
|
||||
}
|
||||
$patskkkk = '/[^\n]*\'' . $kkkk . '\'(.*),\r?\n/';
|
||||
}
|
||||
|
||||
$reps = preg_replace($patskkkk, '', $arrkkk[0]);
|
||||
self::$str = preg_replace($pats, $reps, self::$str);
|
||||
} else {
|
||||
echo '不支持更多的层级数组';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 匹配空数组
|
||||
* '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);
|
||||
|
||||
}
|
||||
//写入配置
|
||||
return file_put_contents(self::$configFile, self::$str) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数组中子元素为数组的个数
|
||||
*
|
||||
* @param [type] $arr
|
||||
* @return integer
|
||||
*/
|
||||
public static function getArrSonNum($arr) :int
|
||||
{
|
||||
$i = 0;
|
||||
foreach ($arr as $val) {
|
||||
if(is_array($val)){
|
||||
$i++;
|
||||
foreach($val as $vv){
|
||||
if(is_array($vv)){
|
||||
$i++;
|
||||
self::getArrSonNum($vv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一维数组在正则公式
|
||||
*
|
||||
* @param [type] $v
|
||||
* @return string
|
||||
*/
|
||||
public static function getPats($v) :string
|
||||
{
|
||||
if(is_bool($v)){
|
||||
//布尔
|
||||
$pats = $v ? '/[^\n]*true,\r?\n/' : '/[^\n]*false,\r?\n/';
|
||||
} else {
|
||||
// 字符串包含\
|
||||
if(stripos($v,"\\") !== false) {
|
||||
$v = str_replace("\\", "\\\\", $v);
|
||||
}
|
||||
// 字符串包含/
|
||||
if(stripos($v,'/') !== false) {
|
||||
$v = str_replace('/', '\/', $v);
|
||||
}
|
||||
if(stripos($v,'(') !== false) {
|
||||
$v = str_replace('(', "\(", $v);
|
||||
}
|
||||
if(stripos($v,')') !== false) {
|
||||
$v = str_replace(')', "\)", $v);
|
||||
}
|
||||
|
||||
// if(stripos($v,":") !== false) {
|
||||
// $v = str_replace(":", "\:", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
// if(stripos($v,'.') !== false) {
|
||||
// $v = str_replace('.', '\.', $v);
|
||||
// }
|
||||
// dump($v);
|
||||
// if(stripos($v,"'") !== false) {
|
||||
// $v = str_replace('\'', "\'", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
|
||||
// if(stripos($v,'-') !== false) {
|
||||
// $v = str_replace('-', "\-", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
// if(stripos($v,'>') !== false) {
|
||||
// $v = str_replace('>', "\>", $v);
|
||||
// }
|
||||
// dump($v);
|
||||
$pats = '/[^\n]*' . $v . '(.*?)\r?\n/';
|
||||
}
|
||||
return $pats;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数组内数值数组的个数
|
||||
* 排除数组中元素为数组的元素
|
||||
*
|
||||
* @param array $array
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getArrSonCount(array $array) :bool
|
||||
{
|
||||
// 数组元素数量
|
||||
$count = count($array);
|
||||
// 子数组个数
|
||||
$i = 0;
|
||||
foreach ($array as $val) {
|
||||
if(is_array($val)) {
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// 数值数组的数量
|
||||
$count = $count - $i;
|
||||
if($count > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
BIN
vendor/topthink/think-captcha/assets/zhttfs/1.otf
vendored
Normal file
BIN
vendor/topthink/think-captcha/assets/zhttfs/1.otf
vendored
Normal file
Binary file not shown.
@ -192,7 +192,7 @@ class Captcha
|
||||
$dir = dir($ttfPath);
|
||||
$ttfs = [];
|
||||
while (false !== ($file = $dir->read())) {
|
||||
if ('.' != $file[0] && substr($file, -4) == '.ttf') {
|
||||
if (substr($file, -4) == '.ttf' || substr($file, -4) == '.otf') {
|
||||
$ttfs[] = $file;
|
||||
}
|
||||
}
|
||||
@ -220,7 +220,7 @@ class Captcha
|
||||
|
||||
foreach ($text as $index => $char) {
|
||||
|
||||
$x = $this->fontSize * ($index + 1) * mt_rand(1.2, 1.6) * ($this->math ? 1 : 1.5);
|
||||
$x = $this->fontSize * ($index + 1) * ($this->math ? 1 : 1.5);
|
||||
$y = $this->fontSize + mt_rand(10, 20);
|
||||
$angle = $this->math ? 0 : mt_rand(-40, 40);
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}发表帖子{/block}
|
||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||
{block name="column"}{/block}
|
||||
@ -21,9 +20,9 @@
|
||||
<div class="layui-input-block">
|
||||
<select lay-verify="required" name="cate_id" lay-filter="column">
|
||||
<option></option>
|
||||
{volist name="cateList" id="cate"}
|
||||
{volist name="cateList" id="cate"}
|
||||
<option value="{$cate.id}">{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
|
||||
{/volist}
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -31,15 +30,15 @@
|
||||
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
</div>
|
||||
</div>
|
||||
{if ($user.auth == 1)}
|
||||
<div class="layui-col-md1">
|
||||
<div id="color"></div>
|
||||
</div>
|
||||
{/if}
|
||||
{if ($user.auth == 1)}
|
||||
<div class="layui-col-md1">
|
||||
<div id="color"></div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
||||
<div class="layui-col-md3">
|
||||
@ -73,29 +72,34 @@
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 260px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="upzip" value="" placeholder="zip,image文件" title="上传附件"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>{:lang('uploads')}</button>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>{:lang('uploads')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:lang('描述')}</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="description" class="layui-textarea" placeholder="SEO描述"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
||||
<input type="text" class="layui-input" name="tags" value="" placeholder="多个用空格隔开" title="添加标签"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-btn-container">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
@ -112,17 +116,18 @@
|
||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
||||
</div>
|
||||
</div-->
|
||||
{if config('taoler.config.post_captcha') == 1}
|
||||
|
||||
{if config('taoler.config.post_captcha') == 1}
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div >
|
||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
||||
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="article-add" lay-submit id="add">{:lang('post now')}</button>
|
||||
</div>
|
||||
@ -137,44 +142,36 @@
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
//删除tag
|
||||
$(document).ready(function(){
|
||||
$('.layui-btn-container').on('click','button',function(){
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['fly','form','colorpicker','upload','plyr'], function(){
|
||||
var $ = layui.jquery
|
||||
,fly = layui.fly
|
||||
,form = layui.form
|
||||
,colorpicker = layui.colorpicker
|
||||
,upload = layui.upload
|
||||
,plyr = layui.plyr;
|
||||
var $ = layui.jquery
|
||||
,fly = layui.fly
|
||||
,form = layui.form
|
||||
,colorpicker = layui.colorpicker
|
||||
,upload = layui.upload
|
||||
,plyr = layui.plyr;
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
$('.layui-textarea').each(function(){
|
||||
// 如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
$('.layui-textarea').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
})
|
||||
});
|
||||
|
||||
//预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '#393d49'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,done: function(color){
|
||||
//譬如你可以在回调中把得到的 color 赋值给表单
|
||||
$('#L_title_color').val(color);
|
||||
//改变标题颜色
|
||||
$('#L_title').css("color", color);
|
||||
}
|
||||
});
|
||||
// 预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '#393d49'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,done: function(color){
|
||||
//譬如你可以在回调中把得到的 color 赋值给表单
|
||||
$('#L_title_color').val(color);
|
||||
//改变标题颜色
|
||||
$('#L_title').css("color", color);
|
||||
}
|
||||
});
|
||||
|
||||
//上传附件
|
||||
upload.render({
|
||||
upload.render({
|
||||
elem: '#zip-button'
|
||||
,url: "{:url('article/uploads')}" //改成您自己的上传接口
|
||||
,data: {type:'zip'}
|
||||
@ -187,72 +184,110 @@
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//发布文章
|
||||
form.on('submit(article-add)', function(data){
|
||||
var field = data.field;
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
tags = numArr.lenth ? '' : numArr.join(',');
|
||||
var index = layer.load(1);
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/add')}",
|
||||
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha},
|
||||
dataType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000}, function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.open({title:'发布失败',content:data.msg,icon:5,anim:6});
|
||||
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//添加tags
|
||||
$('#article-tags-button').on('click',function(){
|
||||
|
||||
// 发布文章
|
||||
form.on('submit(article-add)', function(data){
|
||||
var field = data.field;
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
tags = numArr.lenth ? '' : numArr.join(',');
|
||||
var index = layer.load(1);
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/add')}",
|
||||
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"description":field.description,"captcha":field.captcha},
|
||||
dataType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000}, function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.open({title:'发布失败',content:data.msg,icon:5,anim:6});
|
||||
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 获取描述的内容
|
||||
$("#L_content").bind('input propertychange', function(){
|
||||
var content = $(this).val()
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/getDescription')}",
|
||||
data:{"content":content},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
$('[name="description"]').val(data.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
|
||||
// 手动添加tags
|
||||
$('#article-tags-button').on('click',function(){
|
||||
var tags = $("input[name='tags']").val();
|
||||
var flag = 'off';
|
||||
getTags(tags,flag);
|
||||
});
|
||||
|
||||
// 获取tag的内容
|
||||
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
||||
if(conf !== '1'){
|
||||
$("#L_title").on('blur', function(){
|
||||
var title = $(this).val();
|
||||
var flag = 'on';
|
||||
// 清空上次生成的tag button
|
||||
$('.layui-btn-container').children('button').each(function(){$(this).remove()});
|
||||
getTags(title,flag);
|
||||
})
|
||||
}
|
||||
|
||||
// 添加关键词button
|
||||
function getTags(tags,flag)
|
||||
{
|
||||
if(tags == ''){
|
||||
layer.msg('不能为空');
|
||||
layer.msg('tag不能为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
//把得到的tags放进数组
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
|
||||
for(var i=0; i<numArr.length; i++){
|
||||
if(tags.indexOf(numArr[i])>=0){
|
||||
layer.msg('不能重复添加'+numArr[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//console.log(tags);
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/tags')}",
|
||||
data:{"tags":tags},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
for(var i=0; i<data.data.length; i++){
|
||||
$('.layui-btn-container').append('<button type="button" class="layui-btn" value='+data.data[i]+'>'+data.data[i]+'</button>');
|
||||
}
|
||||
$("input[name='tags']").val("");
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/tags')}",
|
||||
data:{"tags":tags,"flag":flag},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
for(var i=0; i<data.data.length; i++){
|
||||
if($.inArray(data.data[i],numArr) < 0){
|
||||
$('.layui-btn-container').append('<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" value='+data.data[i]+'>'+data.data[i]+' x'+'</button>');
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
$("input[name='tags']").val("");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 删除tag
|
||||
$(document).ready(function(){
|
||||
$('.layui-btn-container').on('click','button',function(){
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
//加载播放器
|
||||
|
@ -1,8 +1,8 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||
{block name="keywords"}{$article.title},{$article.tags}{/block}
|
||||
{block name="description"}{$article.title},{:getArtContent($article.content)}{/block}
|
||||
{block name="keywords"}{$article.tags}{/block}
|
||||
{block name="description"}{$article.title},{$article.description}{/block}
|
||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
||||
{block name="content"}
|
||||
@ -10,87 +10,90 @@
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md9 content detail">
|
||||
<div class="fly-panel detail-box">
|
||||
{//标题}
|
||||
<div class="title layui-clear">
|
||||
<h1 style="color:{$article.title_color};">{$article.title}</h1>
|
||||
{if ($article.jie == 0)}
|
||||
{//标题}
|
||||
<div class="title layui-clear"><h1 style="color:{$article.title_color};">{$article.title}</h1></div>
|
||||
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
|
||||
|
||||
{//图标}
|
||||
<div class="user-questions">
|
||||
<a class="user-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
|
||||
<img src="{$article.user.user_img}" alt="{$article.user.name}">
|
||||
<cite>{$article.user.nickname ?: $article.user.name} / </cite>
|
||||
</a>
|
||||
<span class="user-post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
|
||||
/ <i class="iconfont" title="{:lang('reply')}"></i> {$article.comments_count} / <i class="iconfont" title="浏览"></i> {$pv}
|
||||
{if ($article.jie == 0)}
|
||||
<span class="layui-btn layui-btn-xs" style="background-color: #FF5722;">{:lang('no finished')}</span>
|
||||
{else /}
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs" style="background-color: #009688;">{:lang('finished')}</span>
|
||||
{/if}
|
||||
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
||||
</div>
|
||||
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
|
||||
|
||||
{//图标}
|
||||
<div class="user-questions">
|
||||
<a class="user-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
|
||||
<img src="{$article.user.user_img}" alt="{$article.user.name}">
|
||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||
</a>
|
||||
<span class="user-post-time" data="{$article.create_time}" style="padding-top: 5px;">2019-12-01</span>
|
||||
<span class="user-questions-right">
|
||||
<i class="iconfont" title="{:lang('reply')}"></i>{$article.comments_count}<i class="iconfont" title="浏览"></i>{$pv}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{//问题内容}
|
||||
<div>问题描述:</div>
|
||||
<div class="detail-body-wenda photos" id="content">{$article.content}</div>
|
||||
|
||||
{//管理}
|
||||
{if (($article.upzip !== '') || (session('user_id')==$article.user_id) OR ($user.auth ?? ''))}
|
||||
<div class="detail-assist">
|
||||
{notempty name="$article.upzip"}
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
{/notempty}
|
||||
<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_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 /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
||||
{/if}
|
||||
{if($article.is_reply == 1)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
||||
{/if}
|
||||
<span id="color">{:lang('title color')}</span>
|
||||
{/if}
|
||||
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{//评论区}
|
||||
{if condition="$article.is_reply == 1"}
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<a name="comment"></a>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item que-comments">
|
||||
<input type="hidden" name="article_id" value="{$article.id}">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
<button class="layui-btn layui-btn-danger" lay-filter="user-comment" lay-submit>{:lang('submit comments')}</button>
|
||||
</div>
|
||||
{/if}
|
||||
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
||||
</div>
|
||||
{else /}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm layui-disabled" style="margin: 100px 0 20px; padding: 50px 20px; text-align: center; color: #999!important;">本帖已设置禁止回复</blockquote>
|
||||
{/if}
|
||||
{//评论内容}
|
||||
|
||||
{//管理}
|
||||
{if (($article.upzip !== '') || (session('user_id')==$article.user_id) OR ($user.auth ?? ''))}
|
||||
<div class="detail-assist">
|
||||
{notempty name="$article.upzip"}
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
{/notempty}
|
||||
<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_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 /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
||||
{/if}
|
||||
{if($article.is_reply == 1)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
||||
{/if}
|
||||
<span id="color">{:lang('title color')}</span>
|
||||
{/if}
|
||||
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<hr class="layui-border-green">
|
||||
|
||||
{//问题内容}
|
||||
<div style="margin-top: 15px; font-size: 18px; font-weight:bold; color: rgb(130, 125, 125);">问题描述:</div>
|
||||
<hr>
|
||||
<div class="detail-body-wenda photos" id="content">{$article.content}</div>
|
||||
</div>
|
||||
|
||||
{//评论区}
|
||||
{if condition="$article.is_reply == 1"}
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<a name="comment"></a>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item que-comments">
|
||||
<input type="hidden" name="article_id" value="{$article.id}">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
<button class="layui-btn layui-btn-danger" lay-filter="user-comment" lay-submit>{:lang('submit comments')}</button>
|
||||
</div>
|
||||
</div>
|
||||
{else /}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm layui-disabled" style="margin: 100px 0 20px; padding: 50px 20px; text-align: center; color: #999!important;">本帖已设置禁止回复</blockquote>
|
||||
{/if}
|
||||
{//评论内容}
|
||||
<div class="fly-panel detail-box" id="flyReply">
|
||||
<span style="font-size:18px;">评论 {$article.comments_count}</span>
|
||||
<ul class="jieda" id="jieda">
|
||||
{volist name="comments" id="vo" empty= ""}
|
||||
{volist name="comments" id="vo" empty= ""}
|
||||
<li data-id="{$vo.id}" class="jieda-daan">
|
||||
<a name="item-1111111111"></a>
|
||||
<div class="detail-about detail-about-reply">
|
||||
@ -104,7 +107,7 @@
|
||||
{if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
|
||||
</div>
|
||||
<div class="detail-hits"><span class="post-time" data="{$vo.create_time}"></span></div>
|
||||
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
|
||||
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
|
||||
</div>
|
||||
<div class="detail-body jieda-body photos">{$vo.content}</div>
|
||||
<div class="jieda-reply">
|
||||
@ -112,72 +115,75 @@
|
||||
<i class="iconfont icon-zan"></i><em>{$vo.zan}</em>赞
|
||||
</span>
|
||||
<span type="reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
|
||||
{//评论编辑删除采纳权限}
|
||||
{//评论编辑删除采纳权限}
|
||||
<div class="jieda-admin">
|
||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
||||
<span type="edit">{:lang('edit')}</span>
|
||||
<span type="del">{:lang('delete')}</span>
|
||||
{/if}
|
||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}<span class="jieda-accept" type="accept">{:lang('accept')}</span>{/if}
|
||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
||||
<span type="edit">{:lang('edit')}</span>
|
||||
<span type="del">{:lang('delete')}</span>
|
||||
{/if}
|
||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}
|
||||
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/volist}
|
||||
{/volist}
|
||||
</ul>
|
||||
<div style="text-align: center" id="pages"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{// 右栏}
|
||||
<div class="layui-col-md3">
|
||||
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-main wenda-user">
|
||||
<div class="user-img">
|
||||
<a href="{:url('user/home',['id'=>$article.user.id])}">
|
||||
<img class="" src="{$article.user.user_img}" alt="{$article.user.name}">
|
||||
{if($article.user.vip > 0)}<i class="iconfont icon-renzheng" title="认证信息"></i>{/if}
|
||||
</a>
|
||||
</div>
|
||||
<div class="questions">
|
||||
<span class="layui-badge layui-bg-green">回答 100</span> <span class="layui-badge layui-bg-green">提问 100</span> <span class="layui-badge layui-bg-green">+ 关注</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-main wenda-user">
|
||||
<div class="user-img">
|
||||
<a href="{:url('user/home',['id'=>$article.user.id])}">
|
||||
<img class="" src="{$article.user.user_img}" alt="{$article.user.name}">
|
||||
{if($article.user.vip > 0)}<i class="iconfont icon-renzheng" title="认证信息"></i>{/if}
|
||||
</a>
|
||||
</div>
|
||||
<div class="questions">
|
||||
<span class="layui-badge layui-bg-green">回答 100</span> <span class="layui-badge layui-bg-green">提问 100</span> <span class="layui-badge layui-bg-green">+ 关注</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
||||
<a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
|
||||
</div>
|
||||
<div class="fly-panel-main">
|
||||
{volist name="ad_comm" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
||||
<a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
|
||||
</div>
|
||||
<dl class="fly-panel fly-list-one">
|
||||
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
|
||||
{volist name="artHot" id="vo"}
|
||||
<dd>
|
||||
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
||||
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
||||
</dd>
|
||||
{/volist}
|
||||
</dl>
|
||||
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
||||
<div class="fly-panel-main">
|
||||
{volist name="ad_comm" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color:{$vo.slid_color};">{$vo.slid_name}</a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<dl class="fly-panel fly-list-one">
|
||||
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
|
||||
{volist name="artHot" id="vo"}
|
||||
<dd>
|
||||
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
||||
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
||||
</dd>
|
||||
{/volist}
|
||||
</dl>
|
||||
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
||||
{volist name="ad_art" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--底部栏-->
|
||||
<!--底部栏-->
|
||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||
</div>
|
||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/menu" /}
|
||||
{/block}
|
||||
{block name="script"}
|
||||
|
||||
<script>
|
||||
var collectionFind = "{:url('Collection/find')}",
|
||||
collection = "{:url('collection/')}",
|
||||
@ -204,7 +210,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
//tpl模板给发布时间赋值
|
||||
$('div.user-questions').children('span.user-post-time').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
//time: html
|
||||
time: othis.attr('data')
|
||||
});
|
||||
@ -216,7 +222,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
//tpl模板给发布时间赋值
|
||||
$('div.detail-hits').children('span.post-time').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
//time: html
|
||||
time: othis.attr('data')
|
||||
});
|
||||
@ -259,9 +265,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
var index = layer.load(1);
|
||||
var filed = data.field;
|
||||
if (uid == -1) {
|
||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||
location.href = "{:url('login/index')}";
|
||||
});
|
||||
layer.msg('请先登陆',{icon:5,time:2000},function(){location.href = "{:url('login/index')}"});
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
@ -270,9 +274,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
dataType: "json",
|
||||
success:function (data) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000},function () {
|
||||
location.reload(true);
|
||||
});
|
||||
layer.msg(data.msg,{icon:6,time:2000},function () {location.reload(true)});
|
||||
} else {
|
||||
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
||||
}
|
||||
@ -294,7 +296,7 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
//首次不执行
|
||||
if(!first){
|
||||
var page = obj.curr;
|
||||
var url = "{:url('article/detail',['id'=>$article.id])}";
|
||||
var url = "{:url('article/detail',['id'=>$article.id])}";
|
||||
var id = "{$article.id}";
|
||||
$.post("{:url('article/detail')}",{"id":id,"page":page},function(){
|
||||
window.location.href = url + '?page=' + page + '#flyReply';
|
||||
@ -333,9 +335,9 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
});
|
||||
</script>
|
||||
|
||||
// 点击图片放大
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// 点击图片放大
|
||||
$(function(){
|
||||
$(".photos").on("click","img",function(){
|
||||
var _this = $(this);
|
||||
|
@ -15,121 +15,127 @@
|
||||
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
|
||||
<input type="hidden" name="id" value="{$article.id}">
|
||||
<div class="layui-row layui-col-space15 layui-form-item">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">{:lang('special column')}</label>
|
||||
<div class="layui-input-block">
|
||||
<select lay-verify="required" name="cate_id" lay-filter="column">
|
||||
<option></option>
|
||||
{volist name="cateList" id="cate"}
|
||||
<option value="{$cate.id}" {if $article.cate_id == $cate.id}selected{/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{$article.id}">
|
||||
<div class="layui-row layui-col-space15 layui-form-item">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">{:lang('special column')}</label>
|
||||
<div class="layui-input-block">
|
||||
<select lay-verify="required" name="cate_id" lay-filter="column">
|
||||
<option></option>
|
||||
{volist name="cateList" id="cate"}
|
||||
<option value="{$cate.id}" {if $article.cate_id == $cate.id}selected{/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-col-md8">
|
||||
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" value="{$article.title_color}">
|
||||
<input type="hidden" name="user_id" value="{$article.user_id}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md8">
|
||||
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" value="{$article.title_color}">
|
||||
<input type="hidden" name="user_id" value="{$article.user_id}">
|
||||
</div>
|
||||
</div>
|
||||
{if ($user.auth == 1)}
|
||||
<div class="layui-col-md1">
|
||||
<div id="color"></div>
|
||||
<div id="test9" style="margin-left: 30px;"></div>
|
||||
<div id="color"></div>
|
||||
<div id="test9" style="margin-left: 30px;"></div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">所属产品</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="project">
|
||||
<option></option>
|
||||
<option value="layui">layui</option>
|
||||
<option value="独立版layer">独立版layer</option>
|
||||
<option value="独立版layDate">独立版layDate</option>
|
||||
<option value="LayIM">LayIM</option>
|
||||
<option value="Fly社区模板">Fly社区模板</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label" for="L_version">版本号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_version" value="" name="version" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
</div>
|
||||
<!--div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">所属产品</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细描述" class="layui-textarea fly-editor" style="height: 260px;">{$article.content|raw|htmlspecialchars_decode}</textarea>
|
||||
<select name="project">
|
||||
<option></option>
|
||||
<option value="layui">layui</option>
|
||||
<option value="独立版layer">独立版layer</option>
|
||||
<option value="独立版layDate">独立版layDate</option>
|
||||
<option value="LayIM">LayIM</option>
|
||||
<option value="Fly社区模板">Fly社区模板</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">悬赏飞吻</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<select name="experience">
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
<option value="50">50</option>
|
||||
<option value="60">60</option>
|
||||
<option value="80">80</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label" for="L_version">版本号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_version" value="" name="version" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="upzip" value="{$article.upzip}" placeholder="zip,jpg格式" title="上传附件"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>上传文件</button>
|
||||
<div class="layui-col-md6">
|
||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||
</div-->
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea fly-editor" style="height: 260px;">{$article.content|raw|htmlspecialchars_decode}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">悬赏飞吻</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<select name="experience">
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
<option value="50">50</option>
|
||||
<option value="60">60</option>
|
||||
<option value="80">80</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-btn-container">
|
||||
{volist name="tags" id="vo" }
|
||||
<button type="button" class="layui-btn" value="{$vo}">{$vo}</button>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
{if config('taoler.config.post_captcha') == 1}
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="upzip" value="{$article.upzip}" placeholder="zip,jpg格式" title="上传附件"/>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>上传文件</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:lang('描述')}</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="description" class="layui-textarea" placeholder="SEO描述">{$article.description}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="tags" placeholder="多个用空格隔开" title="添加标签"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="edit">{:lang('post now')}</button>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-btn-container">
|
||||
{volist name="tags" id="vo" }
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" value="{$vo}">{$vo} x</button>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
{if config('taoler.config.post_captcha') == 1}
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="edit">{:lang('post now')}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -143,30 +149,30 @@
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.use(['fly','colorpicker','form','upload','plyr'], function(){
|
||||
var $ = layui.jquery
|
||||
,fly = layui.fly
|
||||
,colorpicker = layui.colorpicker
|
||||
,form = layui.form
|
||||
,upload = layui.upload
|
||||
,plyr = layui.plyr;
|
||||
var $ = layui.jquery
|
||||
,fly = layui.fly
|
||||
,colorpicker = layui.colorpicker
|
||||
,form = layui.form
|
||||
,upload = layui.upload
|
||||
,plyr = layui.plyr;
|
||||
|
||||
//预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '{$article.title_color}'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,done: function(color){
|
||||
//console.log(color);
|
||||
//譬如你可以在回调中把得到的 color 赋值给表单
|
||||
$('#L_title_color').val(color);
|
||||
//改变标题颜色
|
||||
$('#L_title').css("color", color);
|
||||
}
|
||||
});
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '{$article.title_color}'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,done: function(color){
|
||||
//console.log(color);
|
||||
//譬如你可以在回调中把得到的 color 赋值给表单
|
||||
$('#L_title_color').val(color);
|
||||
//改变标题颜色
|
||||
$('#L_title').css("color", color);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//指定允许上传的文件类型
|
||||
upload.render({
|
||||
upload.render({
|
||||
elem: '#zip-button'
|
||||
,url: "{:url('article/uploads')}" //改成您自己的上传接口
|
||||
,data: {type:'zip'}
|
||||
@ -179,7 +185,7 @@
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//编辑文章
|
||||
form.on('submit(article-edit)', function(data){
|
||||
@ -192,7 +198,7 @@
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/edit')}",
|
||||
data:{"id":field.id,"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha},
|
||||
data:{"id":field.id,"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"description":field.description,"captcha":field.captcha},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
@ -208,55 +214,81 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
//添加tags
|
||||
$('#article-tags-button').on('click',function(){
|
||||
var tags = $("input[name='tags']").val();
|
||||
// 获取描述的内容
|
||||
$("#L_content").bind('input propertychange', function(){
|
||||
var content = $(this).val()
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/getDescription')}",
|
||||
data:{"content":content},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
$('[name="description"]').val(data.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
|
||||
if(tags == ''){
|
||||
layer.msg('不能为空');
|
||||
return false;
|
||||
}
|
||||
// 手动添加tags
|
||||
$('#article-tags-button').on('click',function(){
|
||||
var tags = $("input[name='tags']").val();
|
||||
var flag = 'off';
|
||||
getTags(tags,flag);
|
||||
});
|
||||
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
for(var i=0; i<numArr.length; i++){
|
||||
if(tags.indexOf(numArr[i])>=0){
|
||||
layer.msg('不能重复添加'+numArr[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//保存tags
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/tags')}",
|
||||
data:{"tags":tags},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
for(var i=0; i<data.data.length; i++){
|
||||
$('.layui-btn-container').append('<button type="button" class="layui-btn" value='+data.data[i]+'>'+data.data[i]+'</button>');
|
||||
}
|
||||
$("input[name='tags']").val("");
|
||||
} else {
|
||||
layer.open({
|
||||
title:'添加失败',
|
||||
content:data.msg,
|
||||
icon:5,
|
||||
anim:6
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 获取tag的内容
|
||||
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
||||
if(conf !== '1'){
|
||||
$("#L_title").on('blur', function(){
|
||||
var title = $(this).val();
|
||||
var flag = 'on';
|
||||
// 清空上次生成的tag button
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
getTags(title,flag);
|
||||
})
|
||||
}
|
||||
|
||||
// 循环添加button
|
||||
function getTags(tags,flag)
|
||||
{
|
||||
if(tags == ''){
|
||||
layer.msg('不能为空');
|
||||
return false;
|
||||
}
|
||||
//把得到的tags放进数组
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/tags')}",
|
||||
data:{"tags":tags,"flag":flag},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
for(var i=0; i<data.data.length; i++){
|
||||
if($.inArray(data.data[i],numArr) < 0){
|
||||
$('.layui-btn-container').append('<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" value='+data.data[i]+'>'+data.data[i]+' x'+'</button>');
|
||||
}
|
||||
}
|
||||
$("input[name='tags']").val("");
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
//删除tag
|
||||
$(document).ready(function(){
|
||||
$('.layui-btn-container').on('click','button',function(){
|
||||
$(this).remove();
|
||||
});
|
||||
$('.layui-btn-container').on('click','button',function(){
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
|
104
view/taoler/index/article/news/cate.html
Normal file
104
view/taoler/index/article/news/cate.html
Normal file
@ -0,0 +1,104 @@
|
||||
{extend name="public/base" /}
|
||||
{block name="title"}{$Request.param.ename|getCateName}-{$sysInfo.webname}{/block}
|
||||
{block name="keywords"}{$Request.param.ename|getCateName},{$sysInfo.webname}{/block}
|
||||
{block name="description"}{$Request.param.ename|getCateDesc}{/block}
|
||||
{block name="column"}{include file="/public/column" /}{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="layui-container">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md9">
|
||||
<div class="fly-panel" style="margin-bottom: 0;">
|
||||
<ul class="fly-list">
|
||||
{volist name="artList['data']" id="art"}
|
||||
<li>
|
||||
<a href="{:url('user/home',['id'=>$art.user.id])}" class="fly-avatar">
|
||||
<img src="{$art.user.user_img}" alt="{$art.user.name}">
|
||||
</a>
|
||||
<h2>
|
||||
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>{/if}
|
||||
<a href="{:url('article/detail',['id' => $art.id])}" style="color:{$art.title_color};">{$art.title}</a>
|
||||
</h2>
|
||||
<div class="fly-list-info">
|
||||
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
{if config('taoler.config.area_show') == 1}<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>{/if}
|
||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||
</a>
|
||||
<span>
|
||||
{$art.has_img ?= ' <i class="layui-icon layui-icon-picture" style=" color: #5FB878;"></i>'}
|
||||
{$art.has_video ?= ' <i class="layui-icon layui-icon-play" style="color: #FF5722;"></i>'}
|
||||
{$art.has_audio ?= ' <i class="layui-icon layui-icon-speaker" style="color: #000000;"></i>'}
|
||||
{$art.upzip ?= ' <i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i>'}
|
||||
</span>
|
||||
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览"></i> {$art.pv}</span>
|
||||
<span class="fly-list-nums">
|
||||
<i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}
|
||||
</span>
|
||||
</div>
|
||||
<div class="fly-list-badge">
|
||||
{if ($art.is_hot == 1)}<i class="layui-icon layui-icon-fire layui-hide-md" style="font-size: 20px; color: #FF5722;"></i><span class="layui-badge layui-bg-red layui-hide-xs">{:lang('hot')}</span> {/if}
|
||||
</div>
|
||||
</li>
|
||||
{/volist}
|
||||
</ul>
|
||||
<div style="text-align: center" id="pages"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md3">
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
||||
{volist name="ad_cateImg" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<dl class="fly-panel fly-list-one layui-hide-xs">
|
||||
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
|
||||
{volist name="artHot" id="vo"}
|
||||
<dd>
|
||||
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
||||
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
||||
</dd>
|
||||
{/volist}
|
||||
</dl>
|
||||
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
||||
<a href="" class="fly-link fly-joinad ">{:lang('i want to join')}</a>
|
||||
</div>
|
||||
<div class="fly-panel-main">
|
||||
{volist name="ad_comm" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/menu" /}
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.use(['laypage'], function(){
|
||||
var laypage = layui.laypage;
|
||||
|
||||
//执行一个laypage实例
|
||||
laypage.render({
|
||||
elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号
|
||||
,count: "{$artList['total']}" //数据总数,从服务端得到
|
||||
,limit: "{$artList['per_page']}"
|
||||
,curr : "{$artList['current_page']}"
|
||||
|
||||
//获取起始页
|
||||
,jump: function(obj, first){
|
||||
|
||||
//首次不执行
|
||||
if(!first){
|
||||
window.location.href = '{$path}/'+obj.curr+'.html'; //跳转
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
323
view/taoler/index/article/news/detail.html
Normal file
323
view/taoler/index/article/news/detail.html
Normal file
@ -0,0 +1,323 @@
|
||||
{extend name="public/base" /}
|
||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||
{block name="keywords"}{$article.tags}{/block}
|
||||
{block name="description"}{$article.title},{$article.description}{/block}
|
||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
||||
{block name="content"}
|
||||
<div class="layui-container">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<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>
|
||||
|
||||
{//图标}
|
||||
<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')}"></i>{$article.comments_count}</a><i class="iconfont" title="浏览"></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>
|
||||
</div>
|
||||
<hr>
|
||||
{// 内容}
|
||||
<div class="detail-body photos" id="content">{$article.content}</div>
|
||||
|
||||
{//管理}
|
||||
{if (($article.upzip !== '') || session('?user_name'))}
|
||||
<div class="detail-assist">
|
||||
{notempty name="$article.upzip"}
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
{/notempty}
|
||||
<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_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 /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
||||
{/if}
|
||||
{if($article.is_reply == 1)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
||||
{/if}
|
||||
<span id="color">{:lang('title color')}</span>
|
||||
{/if}
|
||||
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="fly-panel detail-box" >
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--底部栏-->
|
||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/menu" /}
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
var collectionFind = "{:url('Collection/find')}",
|
||||
collection = "{:url('collection/')}",
|
||||
articleJieset = "{:url('Article/jieset')}",
|
||||
articleDelete = "{:url('Article/delete')}",
|
||||
commentJiedaZan = "{:url('Comment/jiedaZan')}",
|
||||
commentJiedaCai = "{:url('Comment/jiedaCai')}",
|
||||
commentGetDa = "{:url('Comment/getDa')}",
|
||||
commentUpdateDa = "{:url('Comment/updateDa')}",
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
|
||||
layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
var $ = layui.jquery
|
||||
,form = layui.form
|
||||
,fly = layui.fly
|
||||
,colorpicker = layui.colorpicker
|
||||
,plyr = layui.plyr;
|
||||
var laytpl = layui.laytpl;
|
||||
var uid = layui.cache.user.uid;
|
||||
var laypage = layui.laypage;
|
||||
|
||||
//tpl模板给发布时间赋值
|
||||
$('div.detail-hits').children('span.post-time').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
//time: html
|
||||
time: othis.attr('data')
|
||||
});
|
||||
var posttime = layui.util.timeAgo(string, 1);
|
||||
|
||||
othis.text(posttime);
|
||||
//console.log(othis.attr('data'));
|
||||
});
|
||||
|
||||
|
||||
//预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '#393d49'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,size: 'xs'
|
||||
,done: function(color){
|
||||
//改变标题颜色
|
||||
$('h1').css("color", color);
|
||||
var id = "{$article.id}";
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('Article/titleColor')}",
|
||||
data:{id: id,title_color: color},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{icon:6,time:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({content:data.msg,icon:5,adim:6});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//评论需要登陆
|
||||
form.on('submit(user-comment)',function (data){
|
||||
var index = layer.load(1);
|
||||
var filed = data.field;
|
||||
if (uid == -1) {
|
||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||
location.href = "{:url('login/index')}";
|
||||
});
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "{:url('article/comment')}",
|
||||
data: filed,
|
||||
dataType: "json",
|
||||
success:function (data) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000},function () {
|
||||
location.reload(true);
|
||||
});
|
||||
}else {
|
||||
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//执行一个laypage实例
|
||||
laypage.render({
|
||||
elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号
|
||||
,count: "{$article.comments_count}" //数据总数,从服务端得到
|
||||
,limit: 10
|
||||
,curr : {$page}
|
||||
|
||||
//获取起始页
|
||||
,jump: function(obj, first){
|
||||
//首次不执行
|
||||
if(!first){
|
||||
var page = obj.curr;
|
||||
var url = "{:url('article/detail',['id'=>$article.id])}";
|
||||
var id = "{$article.id}";
|
||||
$.post("{:url('article/detail')}",{"id":id,"page":page},function(){
|
||||
window.location.href = url + '?page=' + page + '#flyReply';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//下载
|
||||
$('#zip-download').click(function (){
|
||||
var id = "{$article.id}";
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/download')}",
|
||||
data:{id:id},
|
||||
success:function (data) {
|
||||
location.href = "{:url('article/download',['id'=>$article.id])}";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
$('.detail-body').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
});
|
||||
//加载播放器
|
||||
plyr.setup();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
// 点击图片放大
|
||||
$(function(){
|
||||
$(".photos").on("click","img",function(){
|
||||
var _this = $(this);
|
||||
console.log(_this);
|
||||
imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
|
||||
});
|
||||
});
|
||||
function imgShow(outerdiv, innerdiv, bigimg, _this){
|
||||
var src = _this.attr("src");
|
||||
$(bigimg).attr("src", src);
|
||||
|
||||
$("<img/>").attr("src", src).on("load",function(){
|
||||
var windowW = $(window).width();
|
||||
var windowH = $(window).height();
|
||||
var realWidth = this.width;
|
||||
var realHeight = this.height;
|
||||
var imgWidth, imgHeight;
|
||||
var scale = 0.8;
|
||||
if(realHeight>windowH*scale) {
|
||||
//判断图片高度
|
||||
imgHeight = windowH*scale;
|
||||
imgWidth = imgHeight/realHeight*realWidth;
|
||||
if(imgWidth>windowW*scale) {
|
||||
//如宽度扔大于窗口宽度
|
||||
imgWidth = windowW*scale;
|
||||
}
|
||||
} else if(realWidth>windowW*scale) {
|
||||
|
||||
imgWidth = windowW*scale;
|
||||
imgHeight = imgWidth/realWidth*realHeight;
|
||||
} else {
|
||||
//如果图片真实高度和宽度都符合要求,高宽不变
|
||||
imgWidth = realWidth;
|
||||
imgHeight = realHeight;
|
||||
}
|
||||
$(bigimg).css("width",imgWidth);
|
||||
var w = (windowW-imgWidth)/2;
|
||||
var h = (windowH-imgHeight)/2;
|
||||
$(innerdiv).css({"top":h, "left":w});
|
||||
$(outerdiv).fadeIn("fast");
|
||||
});
|
||||
$(outerdiv).click(function(){
|
||||
//再次点击淡出消失弹出层
|
||||
$(this).fadeOut("fast");
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
|
||||
<div id="innerdiv" style="position:absolute;">
|
||||
<img id="bigimg" style="border:5px solid #fff;" src="" />
|
||||
</div>
|
||||
|
||||
{:hook('markdownhook')}
|
||||
|
||||
<script>
|
||||
//扫码阅读
|
||||
$("#rdown").hover(function(){
|
||||
$("#phonedl").show().stop();
|
||||
},function(){
|
||||
$("#phonedl").hide().stop();
|
||||
});
|
||||
|
||||
$("#phonedl").hover(function(){
|
||||
$("#phonedl").show().stop();
|
||||
},function(){
|
||||
$("#phonedl").hide().stop();
|
||||
});
|
||||
|
||||
function PhoneDown(){
|
||||
layer.open({
|
||||
title: "扫码查阅",
|
||||
skin: 'layui-layer',
|
||||
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>
|
||||
|
||||
{/block}
|
@ -1,8 +1,8 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||
{block name="keywords"}{$article.title},{$article.tags}{/block}
|
||||
{block name="description"}{$article.title},{:getArtContent($article.content)}{/block}
|
||||
{block name="keywords"}{$article.tags}{/block}
|
||||
{block name="description"}{$article.title},{$article.description}{/block}
|
||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
||||
{block name="content"}
|
||||
@ -10,74 +10,84 @@
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md9 content detail">
|
||||
<div class="fly-panel detail-box">
|
||||
{//标题}
|
||||
{//标题}
|
||||
<h1 style="color:{$article.title_color};">{$article.title}</h1>
|
||||
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
|
||||
{//图标}
|
||||
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
|
||||
{//图标}
|
||||
<div class="fly-detail-info">
|
||||
<span class="layui-badge layui-bg-green fly-detail-column">{:cookie('think_lang') == 'en-us' ? $article.cate.ename : $article.cate.catename}</span>
|
||||
<span class="layui-badge layui-bg-green fly-detail-column">{:cookie('think_lang') == 'en-us' ? $article.cate.ename : $article.cate.catename}</span>
|
||||
{if ($article.is_top == 1)}<span class="layui-badge layui-bg-black">{:lang('top')}</span>{/if}
|
||||
{if ($article.is_hot == 1)}<span class="layui-badge layui-bg-red">{:lang('hot')}</span>{/if}
|
||||
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
||||
<span class="fly-list-nums">
|
||||
<a href="#comment"><i class="iconfont" title="{:lang('reply')}"></i>{$article.comments_count}</a><i class="iconfont" title="浏览"></i>{$pv}
|
||||
</span>
|
||||
{if ($article.is_hot == 1)}<span class="layui-badge layui-bg-red">{:lang('hot')}</span>{/if}
|
||||
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
||||
<span class="fly-list-nums">
|
||||
<a href="#comment"><i class="iconfont" title="{:lang('reply')}"></i>{$article.comments_count}</a><i class="iconfont" title="浏览"></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>
|
||||
|
||||
</div>
|
||||
<div class="detail-body photos" id="content">{$article.content}</div>
|
||||
{//管理}
|
||||
{if (($article.upzip !== '') || session('?user_name'))}
|
||||
<div class="detail-assist">
|
||||
{notempty name="$article.upzip"}
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
{/notempty}
|
||||
<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_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 /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
||||
{/if}
|
||||
{if($article.is_reply == 1)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
||||
{/if}
|
||||
<span id="color">{:lang('title color')}</span>
|
||||
{/if}
|
||||
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
||||
{/if}
|
||||
<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>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<hr>
|
||||
{// 内容}
|
||||
<div class="detail-body photos" id="content">{$article.content}</div>
|
||||
|
||||
{//管理}
|
||||
{if (($article.upzip !== '') || session('?user_name'))}
|
||||
<div class="detail-assist">
|
||||
{notempty name="$article.upzip"}
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
{/notempty}
|
||||
<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_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 /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
||||
{/if}
|
||||
{if($article.is_reply == 1)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
||||
{/if}
|
||||
<span id="color">{:lang('title color')}</span>
|
||||
{/if}
|
||||
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{//评论}
|
||||
|
||||
<div class="fly-panel detail-box" >
|
||||
|
||||
</div>
|
||||
|
||||
{//评论}
|
||||
<div class="fly-panel detail-box" id="flyReply">
|
||||
<span style="font-size:18px;">评论 {$article.comments_count}</span>
|
||||
<ul class="jieda" id="jieda">
|
||||
{volist name="comments" id="vo" empty= ""}
|
||||
{volist name="comments" id="vo" empty= ""}
|
||||
<li data-id="{$vo.id}" class="jieda-daan">
|
||||
<a name="item-1111111111"></a>
|
||||
<div class="detail-about detail-about-reply">
|
||||
@ -86,13 +96,13 @@
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($vo.user.area_id) ?: '无'}</i>{/if}
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($vo.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$vo.user.nickname ?: $vo.user.name}</cite>
|
||||
</a>
|
||||
{if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
|
||||
</div>
|
||||
<div class="detail-hits"><span class="post-time" data="{$vo.create_time}"></span></div>
|
||||
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
|
||||
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
|
||||
</div>
|
||||
<div class="detail-body jieda-body photos">{$vo.content}</div>
|
||||
<div class="jieda-reply">
|
||||
@ -100,69 +110,71 @@
|
||||
<i class="iconfont icon-zan"></i><em>{$vo.zan}</em>
|
||||
</span>
|
||||
<span type="reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
|
||||
{//评论编辑删除采纳权限}
|
||||
{//评论编辑删除采纳权限}
|
||||
<div class="jieda-admin">
|
||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
||||
<span type="edit">{:lang('edit')}</span>
|
||||
<span type="del">{:lang('delete')}</span>
|
||||
{/if}
|
||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}<span class="jieda-accept" type="accept">{:lang('accept')}</span>{/if}
|
||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
||||
<span type="edit">{:lang('edit')}</span>
|
||||
<span type="del">{:lang('delete')}</span>
|
||||
{/if}
|
||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}
|
||||
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/volist}
|
||||
{/volist}
|
||||
</ul>
|
||||
<div style="text-align: center" id="pages"></div>
|
||||
<div style="text-align: center" id="pages"></div>
|
||||
{if condition="$article.is_reply == 1"}
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<a name="comment"></a>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input type="hidden" name="article_id" value="{$article.id}">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
<button class="layui-btn" lay-filter="user-comment" lay-submit>{:lang('submit comments')}</button>
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<a name="comment"></a>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input type="hidden" name="article_id" value="{$article.id}">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
<button class="layui-btn" lay-filter="user-comment" lay-submit>{:lang('submit comments')}</button>
|
||||
</div>
|
||||
</div>
|
||||
{else /}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm layui-disabled" style="margin: 100px 0 20px; padding: 50px 20px; text-align: center; color: #999!important;">本帖已设置禁止回复</blockquote>
|
||||
{/if}
|
||||
{else /}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm layui-disabled" style="margin: 100px 0 20px; padding: 50px 20px; text-align: center; color: #999!important;">本帖已设置禁止回复</blockquote>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md3">
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
||||
<a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
|
||||
</div>
|
||||
<div class="fly-panel-main">
|
||||
{volist name="ad_comm" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
||||
{/volist}
|
||||
</div>
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
||||
<a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
|
||||
</div>
|
||||
<dl class="fly-panel fly-list-one">
|
||||
<div class="fly-panel-main">
|
||||
{volist name="ad_comm" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: {$vo.slid_color};">{$vo.slid_name}</a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<dl class="fly-panel fly-list-one">
|
||||
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
|
||||
{volist name="artHot" id="vo"}
|
||||
<dd>
|
||||
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
||||
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
||||
</dd>
|
||||
{/volist}
|
||||
</dl>
|
||||
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
||||
{volist name="ad_art" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>
|
||||
{/volist}
|
||||
</div>
|
||||
{volist name="artHot" id="vo"}
|
||||
<dd>
|
||||
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
||||
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
||||
</dd>
|
||||
{/volist}
|
||||
</dl>
|
||||
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
||||
{volist name="ad_art" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--底部栏-->
|
||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||
</div>
|
||||
<!--底部栏-->
|
||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/menu" /}
|
||||
{/block}
|
||||
@ -177,8 +189,8 @@ var collectionFind = "{:url('Collection/find')}",
|
||||
commentGetDa = "{:url('Comment/getDa')}",
|
||||
commentUpdateDa = "{:url('Comment/updateDa')}",
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
|
||||
layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
var $ = layui.jquery
|
||||
@ -193,17 +205,15 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
//tpl模板给发布时间赋值
|
||||
$('div.detail-hits').children('span.post-time').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
//time: html
|
||||
time: othis.attr('data')
|
||||
});
|
||||
var posttime = layui.util.timeAgo(string, 1);
|
||||
|
||||
othis.text(posttime);
|
||||
//console.log(othis.attr('data'));
|
||||
});
|
||||
|
||||
|
||||
//预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
@ -211,73 +221,71 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
,predefine: true // 开启预定义颜色
|
||||
,size: 'xs'
|
||||
,done: function(color){
|
||||
//改变标题颜色
|
||||
$('h1').css("color", color);
|
||||
var id = "{$article.id}";
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('Article/titleColor')}",
|
||||
data:{id: id,title_color: color},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{icon:6,time:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({content:data.msg,icon:5,adim:6});
|
||||
}
|
||||
}
|
||||
});
|
||||
//改变标题颜色
|
||||
$('h1').css("color", color);
|
||||
var id = "{$article.id}";
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('Article/titleColor')}",
|
||||
data:{id: id,title_color: color},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{icon:6,time:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({content:data.msg,icon:5,adim:6});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//评论需要登陆
|
||||
form.on('submit(user-comment)',function (data){
|
||||
var index = layer.load(1);
|
||||
var filed = data.field;
|
||||
var index = layer.load(1);
|
||||
var filed = data.field;
|
||||
if (uid == -1) {
|
||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||
location.href = "{:url('login/index')}";
|
||||
layer.msg('请先登陆',{icon:5,time:2000},function(){location.href = "{:url('login/index')}"});
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "{:url('article/comment')}",
|
||||
data: filed,
|
||||
dataType: "json",
|
||||
success:function (data) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000},function () {
|
||||
location.reload(true);
|
||||
});
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "{:url('article/comment')}",
|
||||
data: filed,
|
||||
dataType: "json",
|
||||
success:function (data) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000},function () {
|
||||
location.reload(true);
|
||||
});
|
||||
}else {
|
||||
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//执行一个laypage实例
|
||||
laypage.render({
|
||||
elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号
|
||||
,count: "{$article.comments_count}" //数据总数,从服务端得到
|
||||
,limit: 10
|
||||
,curr : {$page}
|
||||
elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号
|
||||
,count: "{$article.comments_count}" //数据总数,从服务端得到
|
||||
,limit: 10
|
||||
,curr : {$page}
|
||||
|
||||
//获取起始页
|
||||
,jump: function(obj, first){
|
||||
//首次不执行
|
||||
if(!first){
|
||||
var page = obj.curr;
|
||||
var url = "{:url('article/detail',['id'=>$article.id])}";
|
||||
var id = "{$article.id}";
|
||||
$.post("{:url('article/detail')}",{"id":id,"page":page},function(){
|
||||
window.location.href = url + '?page=' + page + '#flyReply';
|
||||
});
|
||||
}
|
||||
//获取起始页
|
||||
,jump: function(obj, first){
|
||||
//首次不执行
|
||||
if(!first){
|
||||
var page = obj.curr;
|
||||
var url = "{:url('article/detail',['id'=>$article.id])}";
|
||||
var id = "{$article.id}";
|
||||
$.post("{:url('article/detail')}",{"id":id,"page":page},function(){
|
||||
window.location.href = url + '?page=' + page + '#flyReply';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//下载
|
||||
@ -304,16 +312,16 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
});
|
||||
</script>
|
||||
|
||||
// 点击图片放大
|
||||
<script type="text/javascript">
|
||||
|
||||
// 点击图片放大
|
||||
$(function(){
|
||||
$(".photos").on("click","img",function(){
|
||||
var _this = $(this);
|
||||
console.log(_this);
|
||||
imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function imgShow(outerdiv, innerdiv, bigimg, _this){
|
||||
var src = _this.attr("src");
|
||||
$(bigimg).attr("src", src);
|
||||
@ -353,13 +361,12 @@ layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
|
||||
$(this).fadeOut("fast");
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
|
||||
<div id="innerdiv" style="position:absolute;">
|
||||
<img id="bigimg" style="border:5px solid #fff;" src="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{:hook('markdownhook')}
|
||||
|
||||
@ -384,6 +391,7 @@ 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');
|
||||
|
@ -56,7 +56,7 @@
|
||||
</div>
|
||||
<div class="fly-panel-main" style="padding: 13px 15px;">
|
||||
{volist name="ad_index" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: {$vo.slid_color};">{$vo.slid_name}</a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -78,10 +78,8 @@
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
<span style="color: #c00;">
|
||||
<div ><img id="captcha" src="{:captcha_src()}?id=1" onclick="this.src='{:captcha_src()}?id=1'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></div>
|
||||
</span>
|
||||
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||
<img id="captcha" src="{:captcha_src()}?id=1" onclick="this.src='{:captcha_src()}?id=1'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
@ -26,7 +26,7 @@
|
||||
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('please input the password')}">
|
||||
</div>
|
||||
</div>
|
||||
{if config('taoler.config.login_captcha') == 1}
|
||||
{if config('taoler.config.login_captcha') == 1}
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
@ -36,8 +36,8 @@
|
||||
<img src="{:captcha_src()}" style="float:left; cursor:pointer;" id="captcha" alt="captcha" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<input type="checkbox" name="remember" title="{:lang('remember password')}" lay-skin="primary" lay-filter="remember" value="1">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
@ -13,53 +13,47 @@
|
||||
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_username" class="layui-form-label">{:lang('username')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_username" name="name" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('it cannot be changed')}">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_username" class="layui-form-label">{:lang('username')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_username" name="name" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('it cannot be changed')}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_email" class="layui-form-label">{:lang('email')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" class="layui-input" placeholder="{:lang('email')}">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_email" class="layui-form-label">{:lang('email')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" class="layui-input" placeholder="{:lang('the only way to get back your password')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">{:lang('the only way to get back your password')}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_pass" class="layui-form-label">{:lang('password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('6-16 characters')}">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_pass" class="layui-form-label">{:lang('password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('6-16 characters')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">{:lang('strong type encryption')}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_repass" class="layui-form-label">{:lang('confirm password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_repass" name="repassword" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('please confirm the password')}">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_repass" class="layui-form-label">{:lang('confirm password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_repass" name="repassword" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('please confirm the password')}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">
|
||||
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" alt="captcha" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="user-register" lay-submit>{:lang('register now')}</button>
|
||||
</div>
|
||||
<div >
|
||||
<span style="color: #c00;">
|
||||
<div>
|
||||
<img id="captcha" src="{:captcha_src()}" style="float:left; cursor:pointer;" alt="captcha" />
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="user-register" lay-submit>{:lang('register now')}</button>
|
||||
</div>
|
||||
<!--div class="layui-form-item fly-form-app">
|
||||
<span>或者直接使用社交账号快捷注册</span>
|
||||
<a href="" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-qq" title="QQ登入"></a>
|
||||
<a href="" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-weibo" title="微博登入"></a>
|
||||
</div-->
|
||||
<!--div class="layui-form-item fly-form-app">
|
||||
<span>或者直接使用社交账号快捷注册</span>
|
||||
<a href="" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-qq" title="QQ登入"></a>
|
||||
<a href="" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-weibo" title="微博登入"></a>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -78,7 +72,9 @@ var layer = layui.layer;
|
||||
//注册
|
||||
form.on('submit(user-register)', function(data){
|
||||
var field = data.field;
|
||||
var loading = layer.load(2, {shade: [0.2, '#000']});
|
||||
var loading = layer.load(2, {
|
||||
shade: [0.2, '#000']
|
||||
});
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('Login/reg')}",
|
||||
@ -96,9 +92,8 @@ var layer = layui.layer;
|
||||
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}}
|
||||
});
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
@ -4,7 +4,7 @@
|
||||
</a>
|
||||
<h2>
|
||||
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>{/if}
|
||||
<a href="{:url('article/detail',['id' => $art.id])}" style="color:'{$art.title_color}';">{$art.title}</a>
|
||||
<a href="{:url('article/detail',['id' => $art.id])}" style="color:{$art.title_color};">{$art.title}</a>
|
||||
</h2>
|
||||
<div class="fly-list-info">
|
||||
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
|
@ -4,7 +4,7 @@
|
||||
</a>
|
||||
<h2>
|
||||
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>{/if}
|
||||
<a href="{:url('article/detail',['id' => $top.id])}" style="color:'{$top.title_color}';">{$top.title}</a>
|
||||
<a href="{:url('article/detail',['id' => $top.id])}" style="color:{$top.title_color};">{$top.title}</a>
|
||||
</h2>
|
||||
<div class="fly-list-info">
|
||||
<a href="{:url('user/home',['id'=>$top.user_id])}" link>
|
||||
|
Loading…
x
Reference in New Issue
Block a user