This commit is contained in:
taoser 2023-05-05 12:09:57 +08:00
parent 0c8ebe8290
commit d3bfb9b3c3
37 changed files with 723 additions and 289 deletions

View File

@ -318,22 +318,23 @@ abstract class BaseController
*/ */
public function uploadFiles($type) public function uploadFiles($type)
{ {
$max_file_seze = $this->getSystem()['upsize'];
$uploads = new Uploads(); $uploads = new Uploads();
switch ($type){ switch ($type){
case 'image': case 'image':
$upRes = $uploads->put('file','article_pic',2048,'image'); $upRes = $uploads->put('file','article_pic',$max_file_seze,'image');
break; break;
case 'zip': case 'zip':
$upRes = $uploads->put('file','article_zip',1024,'application|image'); $upRes = $uploads->put('file','article_zip',$max_file_seze,'application|image');
break; break;
case 'video': case 'video':
$upRes = $uploads->put('file','article_video',102400,'video|audio'); $upRes = $uploads->put('file','article_video',$max_file_seze,'video|audio');
break; break;
case 'audio': case 'audio':
$upRes = $uploads->put('file','article_audio',102400,'audio'); $upRes = $uploads->put('file','article_audio',$max_file_seze,'audio');
break; break;
default: default:
$upRes = $uploads->put('file','article_file',2048,'image'); $upRes = $uploads->put('file','article_file',$max_file_seze,'image');
break; break;
} }
return $upRes; return $upRes;

View File

@ -12,15 +12,13 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">账号</label> <label class="layui-form-label">账号</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="name" lay-verify="title" autocomplete="off" placeholder="请输入标题" <input type="text" name="name" lay-verify="title" autocomplete="off" placeholder="请输入用户名" class="layui-input">
class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">邮箱</label> <label class="layui-form-label">邮箱</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="email" lay-verify="email" autocomplete="off" placeholder="请输入邮箱" <input type="text" name="email" lay-verify="email" autocomplete="off" placeholder="请输入邮箱" class="layui-input">
class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -33,15 +31,13 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">密码</label> <label class="layui-form-label">密码</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="password" lay-verify="password" autocomplete="off" placeholder="请输入密码" <input type="text" name="password" lay-verify="password" autocomplete="off" placeholder="请输入密码" class="layui-input">
class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">电话</label> <label class="layui-form-label">电话</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="phone" lay-verify="title" autocomplete="off" placeholder="请输入标题" <input type="text" name="phone" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -55,8 +51,7 @@
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="button-container"> <div class="button-container">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="user-save">
lay-filter="user-save">
<i class="layui-icon layui-icon-ok"></i> <i class="layui-icon layui-icon-ok"></i>
提交 提交
</button> </button>

View File

@ -90,8 +90,8 @@
icon: 1, icon: 1,
time: 1000 time: 1000
}, function() { }, function() {
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
parent.layui.table.reload("user-table"); parent.layui.table.reload("user-table");
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
}); });
} else { } else {
layer.msg(result.msg, { layer.msg(result.msg, {

View File

@ -13,13 +13,13 @@
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
<label class="layui-form-label">ID</label> <label class="layui-form-label">ID</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input"> <input type="text" name="id" placeholder="请输入ID号" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
<label class="layui-form-label">用户</label> <label class="layui-form-label">用户</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="name" placeholder="" class="layui-input"> <input type="text" name="name" placeholder="用户名" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
@ -35,7 +35,7 @@
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
<label class="layui-form-label">邮箱</label> <label class="layui-form-label">邮箱</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="email" placeholder="" class="layui-input"> <input type="text" name="email" placeholder="邮箱" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
@ -100,9 +100,9 @@
</script> </script>
<script type="text/html" id="user-sex"> <script type="text/html" id="user-sex">
{{#if (d.sex == 1) { }} {{#if (d.sex == 0) { }}
<span></span> <span></span>
{{# }else if(d.sex == 2){ }} {{# }else if(d.sex == 1){ }}
<span></span> <span></span>
{{# } }} {{# } }}
</script> </script>
@ -148,7 +148,7 @@
templet: '#imgTpl' templet: '#imgTpl'
}, },
{ {
title: '账号', title: '用户',
field: 'username', field: 'username',
align: 'center', align: 'center',
width: 100 width: 100
@ -191,7 +191,7 @@
align: 'center' align: 'center'
}, },
{ {
title: '启用', title: '状态',
field: 'check', field: 'check',
align: 'center', align: 'center',
width: 95, width: 95,

View File

@ -84,9 +84,9 @@ class BaseController extends BaseCtrl
// dump($this->showNav()); // dump($this->showNav());
//1.查询父分类id //1.查询父分类id
$pCate = Db::name('cate')->field('id,pid,ename,catename,is_hot')->where(['ename'=>input('ename'),'status'=>1,'delete_time'=>0])->find(); $pCate = Db::name('cate')->field('id,pid,ename,catename,is_hot')->where(['ename'=>input('ename'),'status'=>1,'delete_time'=>0])->find();
if(empty($pCate)) { // 没有点击任何分类,点击首页获取全部分类信息 if(empty($pCate)) { // 没有点击任何分类,点击首页获取全部分类信息
$subCateList = $this->showNav(); $subCateList = [];
} else { // 点击分类,获取子分类信息 } else { // 点击分类,获取子分类信息
$parentId = $pCate['id']; $parentId = $pCate['id'];
$subCate = Db::name('cate')->field('id,ename,catename,is_hot,pid')->where(['pid'=>$parentId,'status'=>1,'delete_time'=>0])->select()->toArray(); $subCate = Db::name('cate')->field('id,ename,catename,is_hot,pid')->where(['pid'=>$parentId,'status'=>1,'delete_time'=>0])->select()->toArray();

View File

@ -111,7 +111,7 @@ class Article extends Model
{ {
return Cache::remember('topArticle', function() use($num){ return Cache::remember('topArticle', function() use($num){
return $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,upzip,has_img,has_video,has_audio') return $this::field('id,title,title_color,cate_id,user_id,content,create_time,is_top,pv,upzip,has_img,has_video,has_audio')
->where([['is_top', '=', 1], ['status', '=', 1]]) ->where([['is_top', '=', 1], ['status', '=', 1]])
->with([ ->with([
'cate' => function ($query) { 'cate' => function ($query) {
@ -140,7 +140,7 @@ class Article extends Model
public function getArtList(int $num) public function getArtList(int $num)
{ {
return Cache::remember('indexArticle', function() use($num){ return Cache::remember('indexArticle', function() use($num){
return $this::field('id,title,title_color,cate_id,user_id,create_time,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type') return $this::field('id,title,title_color,cate_id,user_id,content,create_time,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type')
->with([ ->with([
'cate' => function($query){ 'cate' => function($query){
$query->where('delete_time',0)->field('id,catename,ename,detpl'); $query->where('delete_time',0)->field('id,catename,ename,detpl');

View File

@ -15,26 +15,25 @@ use think\facade\Cache;
$taglib_pre_load = Cache::remember('taglib', function(){ $taglib_pre_load = Cache::remember('taglib', function(){
$tagsArr = []; $tagsArr = [];
//获取app/common/taglib //获取应用公共标签app/common/taglib
$common_taglib = Files::getAllFile(root_path().'app/common/taglib'); $common_taglib = Files::getAllFile(root_path().'app/common/taglib');
foreach ($common_taglib as $t) { foreach ($common_taglib as $t) {
$tagsArr[] = str_replace('/','\\',strstr(strstr($t, 'app/'), '.php', true)); $tagsArr[] = str_replace('/','\\',strstr(strstr($t, 'app/'), '.php', true));
} }
//获取addons/taglib文件 //获取插件下标签 addons/taglib文件
$localAddons = Files::getDirName('../addons/'); $localAddons = Files::getDirName('../addons/');
foreach($localAddons as $v) { foreach($localAddons as $v) {
$dir = root_path(). 'addons'. DIRECTORY_SEPARATOR . $v . DIRECTORY_SEPARATOR .'taglib'; $dir = root_path(). 'addons'. DIRECTORY_SEPARATOR . $v . DIRECTORY_SEPARATOR .'taglib';
if(!file_exists($dir)) continue; if(!file_exists($dir)) continue;
$addons_taglib = Files::getAllFile($dir); $addons_taglib = Files::getAllFile($dir);
foreach ($addons_taglib as $a) { foreach ($addons_taglib as $a) {
$tagsArr[] = str_replace('/','\\',strstr(strstr($a, 'addons/'), '.php', true)); $tagsArr[] = str_replace('/','\\',strstr(strstr($a, 'addons'), '.php', true));
} }
} }
return implode(',', $tagsArr); return implode(',', $tagsArr);
}); });
return [ return [
// 模板引擎类型使用Think // 模板引擎类型使用Think
'type' => 'Think', 'type' => 'Think',

View File

@ -32,7 +32,7 @@ class Index extends BaseController
//置顶文章 //置顶文章
$artTop = Article::getArtTop(5); $artTop = Article::getArtTop(5);
//首页文章列表,显示20个 //首页文章列表,显示20个
$artList = Article::getArtList(22); $artList = Article::getArtList(15);
//热议文章 //热议文章
$artHot = Article::getArtHot(10); $artHot = Article::getArtHot(10);

View File

@ -15,7 +15,6 @@ use app\common\controller\BaseController;
use think\facade\View; use think\facade\View;
use think\facade\Request; use think\facade\Request;
use app\facade\Article; use app\facade\Article;
use app\common\model\Slider;
class Search extends BaseController class Search extends BaseController
{ {
@ -25,9 +24,6 @@ class Search extends BaseController
$ser = Request::only(['keywords']); $ser = Request::only(['keywords']);
$artList = Article::getSearchKeyWord($ser['keywords']); $artList = Article::getSearchKeyWord($ser['keywords']);
$counts = $artList->count(); $counts = $artList->count();
$slider = new Slider();
//首页右栏
$ad_comm = $slider->getSliderList(2);
// 查询热议 // 查询热议
$artHot = Article::getArtHot(10); $artHot = Article::getArtHot(10);
@ -35,7 +31,6 @@ class Search extends BaseController
'artList' => $artList, 'artList' => $artList,
'keywords' => $ser['keywords'], 'keywords' => $ser['keywords'],
'counts' => $counts, 'counts' => $counts,
'ad_comm'=>$ad_comm,
'artHot'=>$artHot, 'artHot'=>$artHot,
'jspage'=>'' 'jspage'=>''
]; ];

36
composer.lock generated
View File

@ -2687,16 +2687,16 @@
}, },
{ {
"name": "topthink/think-captcha", "name": "topthink/think-captcha",
"version": "v3.0.8", "version": "v3.0.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-captcha.git", "url": "https://github.com/top-think/think-captcha.git",
"reference": "52fba122c953995bec3013c635025172491ae299" "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/52fba122c953995bec3013c635025172491ae299", "url": "https://api.github.com/repos/top-think/think-captcha/zipball/b1ef360670578214edeebcf824aaf6ab7ee0528b",
"reference": "52fba122c953995bec3013c635025172491ae299", "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -2706,7 +2706,7 @@
] ]
}, },
"require": { "require": {
"topthink/framework": "^6.0" "topthink/framework": "^6.0|^8.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -2740,9 +2740,9 @@
"description": "captcha package for thinkphp", "description": "captcha package for thinkphp",
"support": { "support": {
"issues": "https://github.com/top-think/think-captcha/issues", "issues": "https://github.com/top-think/think-captcha/issues",
"source": "https://github.com/top-think/think-captcha/tree/v3.0.8" "source": "https://github.com/top-think/think-captcha/tree/v3.0.9"
}, },
"time": "2022-10-26T07:59:42+00:00" "time": "2023-04-27T07:18:40+00:00"
}, },
{ {
"name": "topthink/think-helper", "name": "topthink/think-helper",
@ -2963,16 +2963,16 @@
}, },
{ {
"name": "topthink/think-orm", "name": "topthink/think-orm",
"version": "v2.0.60", "version": "v2.0.61",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-orm.git", "url": "https://github.com/top-think/think-orm.git",
"reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46" "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", "url": "https://api.github.com/repos/top-think/think-orm/zipball/10528ebf4a5106b19c3bac9c6deae7a67ff49de6",
"reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -3018,9 +3018,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/top-think/think-orm/issues", "issues": "https://github.com/top-think/think-orm/issues",
"source": "https://github.com/top-think/think-orm/tree/v2.0.60" "source": "https://github.com/top-think/think-orm/tree/v2.0.61"
}, },
"time": "2023-03-19T04:51:56+00:00" "time": "2023-04-20T14:27:51+00:00"
}, },
{ {
"name": "topthink/think-template", "name": "topthink/think-template",
@ -3263,16 +3263,16 @@
}, },
{ {
"name": "workerman/workerman", "name": "workerman/workerman",
"version": "v4.1.9", "version": "v4.1.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/walkor/workerman.git", "url": "https://github.com/walkor/workerman.git",
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7" "reference": "e967b79f95b9251a72acb971be05623ec1a51e83"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/walkor/workerman/zipball/1f92d02c26106b5fbe6f61ea776198aad6e426f7", "url": "https://api.github.com/repos/walkor/workerman/zipball/e967b79f95b9251a72acb971be05623ec1a51e83",
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7", "reference": "e967b79f95b9251a72acb971be05623ec1a51e83",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -3328,7 +3328,7 @@
"type": "patreon" "type": "patreon"
} }
], ],
"time": "2023-03-10T13:59:12+00:00" "time": "2023-05-01T02:12:20+00:00"
}, },
{ {
"name": "yansongda/pay", "name": "yansongda/pay",

View File

@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改 // 应用名,此项不可更改
'appname' => 'TaoLer', 'appname' => 'TaoLer',
// 版本配置 // 版本配置
'version' => '2.3.3', 'version' => '2.3.4',
// 加盐 // 加盐
'salt' => 'taoler', 'salt' => 'taoler',
// 数据库备份目录 // 数据库备份目录

View File

@ -1,9 +1,4 @@
/** 
@Name: Fly社区
@Author: 贤心
@Site: fly.layui.com
*/
/* 全局 */ /* 全局 */
html,body{overflow-x: hidden;} html,body{overflow-x: hidden;}
html body{margin-top: 61px;} html body{margin-top: 61px;}
@ -185,9 +180,10 @@ pre{overflow-y: auto;
/* 头部 */ /* 头部 */
.fly-header{position: fixed; left: 0; top: 0; z-index: 10000; width: 100%; height: 60px; border-bottom: 1px solid #404553; border-right: 1px solid #404553; border-radius: 0;} .fly-header{position: fixed; left: 0; top: 0; z-index: 10000; width: 100%; height: 60px; border-bottom: 1px solid #404553; border-right: 1px solid #404553; border-radius: 0;}
.fly-logo{position: absolute; left: 15px; top: 11px;} .fly-header .layui-container{position: relative; height: 100%; line-height: 60px; text-align: center;}
.fly-logo-m{position: absolute; left:calc(50% - 45px); top: 11px;} .fly-logo{position: absolute; left: 15px;}
.fly-nav{margin-left: 200px;} .fly-logo-m{width: 91px;}
.fly-nav{position: absolute; left: 200px;}
.fly-nav a i{position: absolute; left: 15px; top: 0; padding-right: 10px; font-size: 22px;} .fly-nav a i{position: absolute; left: 15px; top: 0; padding-right: 10px; font-size: 22px;}
.fly-nav a .icon-shouye, .nav a .icon-shezhi{top: 2px;} .fly-nav a .icon-shouye, .nav a .icon-shezhi{top: 2px;}
@ -198,7 +194,7 @@ pre{overflow-y: auto;
.fly-nav-avatar .fly-badge-vip{position: relative; margin-left: 10px;} .fly-nav-avatar .fly-badge-vip{position: relative; margin-left: 10px;}
.fly-nav-user .layui-nav-child a i{position: relative; top: 2px; margin-right: 10px; font-size: 26px;} .fly-nav-user .layui-nav-child a i{position: relative; top: 2px; margin-right: 10px; font-size: 26px;}
.fly-nav-msg{position:absolute; top: 50%; right: 5px; height: 20px; line-height: 20px; margin-top: -10px; padding:0 6px; background-color: #FF7200; color: #fff; border-radius: 2px;} .fly-nav-msg{position:absolute; top: 10px; right: 1px; width:16px; height: 16px; line-height: 16px; background-color: #FF7200; color: #fff; font-size:12px; border-radius: 10px;}
.fly-nav-msg:hover{color:#fff;} .fly-nav-msg:hover{color:#fff;}
.fly-header .layui-nav{padding: 0; background: none;} .fly-header .layui-nav{padding: 0; background: none;}
@ -212,19 +208,9 @@ pre{overflow-y: auto;
.fly-header .layui-nav .layui-nav-bar, .fly-header .layui-nav .layui-nav-bar,
.fly-header .fly-nav-user .layui-nav-more{display: none !important;} .fly-header .fly-nav-user .layui-nav-more{display: none !important;}
.fly-header .fly-nav-user .layui-nav-child{left: auto; right: 0; width: 120px; min-width: 0;} .fly-header .fly-nav-user .layui-nav-child{left: auto; right: 0; width: 120px; min-width: 0;}
/*
.fly-html-layui .fly-nav-avatar .layui-nav-more{display: none !important;}
.fly-header .fly-nav-user .layui-nav-child{left: auto; right: 0; width: 120px; min-width: 0;}
.fly-html-layui .fly-nav-msg{left: -30px;}
.fly-html-layui .layui-header .layui-nav-child dd{text-align: center;}
.fly-html-layui .layui-header .layui-nav-item a cite{padding: 0 0 0 10px;}
.fly-html-layui .layui-header .layui-nav .fly-layui-user{margin: 0; margin-left: 40px;}
.fly-html-layui .layui-header .layui-nav .fly-layui-user a{padding: 0;}
.fly-layui-user .layui-nav-child{left: auto; right: 0; min-width: 0; width: 120px;}
*/
/* 搜索 */ /* 搜索 */
.fly-search{display: inline-block; vertical-align: top; width: 50px; height: 50px; padding-top:20px;margin-right: 10px; text-align: center; cursor: pointer; font-size: 20px;} .fly-search{display: inline-block; width: 50px; margin-right: 10px; cursor: pointer; font-size: 20px;}
.fly-search .layui-icon{font-size: 20px;} .fly-search .layui-icon{font-size: 20px;}
.fly-search:hover{color: #5FB878;} .fly-search:hover{color: #5FB878;}
.fly-layer-search input{height: 75px; line-height: 75px; width: 500px; padding: 0 15px; font-size: 20px; border: none 0; background: none;} .fly-layer-search input{height: 75px; line-height: 75px; width: 500px; padding: 0 15px; font-size: 20px; border: none 0; background: none;}
@ -882,4 +868,190 @@ blockquote {
/* 右下角固定栏*/ /* 右下角固定栏*/
.layui-fixbar li { .layui-fixbar li {
border-radius:100%; border-radius:100%;
} }
/*列表新增*/
.section {
display: block;
}
.list-grid.list-grid-padding .list-item {
padding: 1rem;
}
.list-grid .list-item {
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
.list-item {
position: relative;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
}
.list-grid .list-item .media {
border-radius: inherit;
}
.media {
position: relative;
display: block;
overflow: hidden;
padding: 0;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
border-radius: inherit;
}
.media-content img{
width: 233px;
height: 155px;
border-radius: 5px;
object-fit: cover;
}
.d-none {
display: none !important;
}
.media {
display: -ms-flexbox;
display: flex;
-ms-flex-align: start;
align-items: flex-start;
}
.col-4 {
-ms-flex: 0 0 33.333333%;
flex: 0 0 33.333333%;
max-width: 33.333333%;
}
.card, .block {
background: #fff;
border-width: 0;
border-radius: 2px;
-webkit-box-shadow: 0 0 10px -2px rgba(158,158,158,.2);
box-shadow: 0 0 10px -2px rgba(158,158,158,.2);
}
.list-grid.list-grid-padding .list-content {
padding: 0 0 0 1rem;
}
.list-width {
width: 100%;
}
.list-content {
padding: 1rem 0;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-flex: 1;
flex: 1 1 auto;
-webkit-box-pack: center;
justify-content: center;
min-width: 0;
}
.list-body {
-webkit-box-flex: 1;
flex: 1 1 auto;
}
.h-3x {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
line-height: 1.7;
}
.text-secondary {
color: #5e646d !important;
}
.text-sm {
font-size: .875rem !important;
}
.text-secondary {
color: #6c757d !important;
}
.mb-3, .my-3 {
margin-bottom: 1rem !important;
}
.mt-3, .my-3 {
margin-top: 1rem !important;
}
@media (min-width: 768px) {
.d-md-block {
display: block !important;
}
}
figure {
margin: 0;
}
@media (min-width: 768px){
.ml-md-2, .mx-md-2 {
margin-left: .5rem !important;
}
}
@media (min-width: 768px){
.mr-md-2, .mx-md-2 {
margin-right: .5rem !important;
}
}
.ml-1, .mx-1 {
margin-left: .25rem !important;
}
.mr-1, .mx-1 {
margin-right: .25rem !important;
}
.d-inline-block {
display: inline-block !important;
}
.text-muted {
color: #9ca0ad !important;
}
.text-xs {
font-size: .75rem !important;
}
.text-muted {
color: #6c757d !important;
}
.align-items-center {
-ms-flex-align: center !important;
align-items: center !important;
}
.flex-fill {
-ms-flex: 1 1 auto !important;
flex: 1 1 auto !important;
}
.list-footer {
margin-top: .5rem;
}
.d-flex {
display: -ms-flexbox !important;
display: flex !important;
}
@media (min-width: 768px) and (max-width: 991.98px) {
.card, .block {margin-bottom: 1rem;}
}

View File

@ -704,7 +704,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
var ins = carousel.render({ var ins = carousel.render({
elem: '#FLY_topline' elem: '#FLY_topline'
,width: '100%' ,width: '100%'
,height: '172px' ,height: '250px'
,anim: 'fade' ,anim: 'fade'
}); });
@ -712,11 +712,11 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
var width = $(this).prop('innerWidth'); var width = $(this).prop('innerWidth');
if(width >= 1200){ if(width >= 1200){
ins.reload({ ins.reload({
height: '172px' height: '250px'
}); });
} else if(width >= 992){ } else if(width >= 992){
ins.reload({ ins.reload({
height: '141px' height: '250px'
}); });
} else if(width >= 768){ } else if(width >= 768){
ins.reload({ ins.reload({

View File

@ -294,7 +294,7 @@ layui.define(['laypage', 'fly', 'element', 'flow', 'imgcom'], function(exports){
//我的消息 //我的消息
gather.minemsg = function(){ gather.minemsg = function(){
var delAll = $('#LAY_delallmsg') var delAll = $('#LAY_delallmsg')
,tpl = '{{# var len = d.rows.length;\ ,tpl = '{{# var len = d.rows.length;\
if(len === 0){ }}\ if(len === 0){ }}\
<div class="fly-none">您暂时没有最新消息</div>\ <div class="fly-none">您暂时没有最新消息</div>\
{{# } else { }}\ {{# } else { }}\

View File

@ -2678,23 +2678,29 @@
}, },
{ {
"name": "topthink/think-captcha", "name": "topthink/think-captcha",
"version": "v3.0.8", "version": "v3.0.9",
"version_normalized": "3.0.8.0", "version_normalized": "3.0.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-captcha.git", "url": "https://github.com/top-think/think-captcha.git",
"reference": "52fba122c953995bec3013c635025172491ae299" "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-captcha/zipball/52fba122c953995bec3013c635025172491ae299", "url": "https://api.github.com/repos/top-think/think-captcha/zipball/b1ef360670578214edeebcf824aaf6ab7ee0528b",
"reference": "52fba122c953995bec3013c635025172491ae299", "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b",
"shasum": "" "shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"topthink/framework": "^6.0" "topthink/framework": "^6.0|^8.0"
}, },
"time": "2022-10-26T07:59:42+00:00", "time": "2023-04-27T07:18:40+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {
@ -2728,7 +2734,7 @@
"description": "captcha package for thinkphp", "description": "captcha package for thinkphp",
"support": { "support": {
"issues": "https://github.com/top-think/think-captcha/issues", "issues": "https://github.com/top-think/think-captcha/issues",
"source": "https://github.com/top-think/think-captcha/tree/v3.0.8" "source": "https://github.com/top-think/think-captcha/tree/v3.0.9"
}, },
"install-path": "../topthink/think-captcha" "install-path": "../topthink/think-captcha"
}, },
@ -2963,17 +2969,17 @@
}, },
{ {
"name": "topthink/think-orm", "name": "topthink/think-orm",
"version": "v2.0.60", "version": "v2.0.61",
"version_normalized": "2.0.60.0", "version_normalized": "2.0.61.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-orm.git", "url": "https://github.com/top-think/think-orm.git",
"reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46" "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", "url": "https://api.github.com/repos/top-think/think-orm/zipball/10528ebf4a5106b19c3bac9c6deae7a67ff49de6",
"reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -2993,7 +2999,7 @@
"require-dev": { "require-dev": {
"phpunit/phpunit": "^7|^8|^9.5" "phpunit/phpunit": "^7|^8|^9.5"
}, },
"time": "2023-03-19T04:51:56+00:00", "time": "2023-04-20T14:27:51+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -3021,7 +3027,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/top-think/think-orm/issues", "issues": "https://github.com/top-think/think-orm/issues",
"source": "https://github.com/top-think/think-orm/tree/v2.0.60" "source": "https://github.com/top-think/think-orm/tree/v2.0.61"
}, },
"install-path": "../topthink/think-orm" "install-path": "../topthink/think-orm"
}, },
@ -3337,17 +3343,17 @@
}, },
{ {
"name": "workerman/workerman", "name": "workerman/workerman",
"version": "v4.1.9", "version": "v4.1.10",
"version_normalized": "4.1.9.0", "version_normalized": "4.1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/walkor/workerman.git", "url": "https://github.com/walkor/workerman.git",
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7" "reference": "e967b79f95b9251a72acb971be05623ec1a51e83"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/walkor/workerman/zipball/1f92d02c26106b5fbe6f61ea776198aad6e426f7", "url": "https://api.github.com/repos/walkor/workerman/zipball/e967b79f95b9251a72acb971be05623ec1a51e83",
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7", "reference": "e967b79f95b9251a72acb971be05623ec1a51e83",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -3362,7 +3368,7 @@
"suggest": { "suggest": {
"ext-event": "For better performance. " "ext-event": "For better performance. "
}, },
"time": "2023-03-10T13:59:12+00:00", "time": "2023-05-01T02:12:20+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -3,7 +3,7 @@
'name' => 'taoser/taoler', 'name' => 'taoser/taoler',
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '2aa133f33d26cc3d1dba9eb687b1744690f4026c', 'reference' => '0c8ebe8290a2eb8d8b043782f0d3ce7bbb3b71c7',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -349,7 +349,7 @@
'taoser/taoler' => array( 'taoser/taoler' => array(
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '2aa133f33d26cc3d1dba9eb687b1744690f4026c', 'reference' => '0c8ebe8290a2eb8d8b043782f0d3ce7bbb3b71c7',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -401,9 +401,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'topthink/think-captcha' => array( 'topthink/think-captcha' => array(
'pretty_version' => 'v3.0.8', 'pretty_version' => 'v3.0.9',
'version' => '3.0.8.0', 'version' => '3.0.9.0',
'reference' => '52fba122c953995bec3013c635025172491ae299', 'reference' => 'b1ef360670578214edeebcf824aaf6ab7ee0528b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../topthink/think-captcha', 'install_path' => __DIR__ . '/../topthink/think-captcha',
'aliases' => array(), 'aliases' => array(),
@ -446,9 +446,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'topthink/think-orm' => array( 'topthink/think-orm' => array(
'pretty_version' => 'v2.0.60', 'pretty_version' => 'v2.0.61',
'version' => '2.0.60.0', 'version' => '2.0.61.0',
'reference' => '8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46', 'reference' => '10528ebf4a5106b19c3bac9c6deae7a67ff49de6',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../topthink/think-orm', 'install_path' => __DIR__ . '/../topthink/think-orm',
'aliases' => array(), 'aliases' => array(),
@ -509,9 +509,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'workerman/workerman' => array( 'workerman/workerman' => array(
'pretty_version' => 'v4.1.9', 'pretty_version' => 'v4.1.10',
'version' => '4.1.9.0', 'version' => '4.1.10.0',
'reference' => '1f92d02c26106b5fbe6f61ea776198aad6e426f7', 'reference' => 'e967b79f95b9251a72acb971be05623ec1a51e83',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../workerman/workerman', 'install_path' => __DIR__ . '/../workerman/workerman',
'aliases' => array(), 'aliases' => array(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2023-04-19 16:12:11 // This file is automatically generated at:2023-05-05 12:09:30
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'taoser\\addons\\Service', 0 => 'taoser\\addons\\Service',

View File

@ -9,7 +9,7 @@
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"require": { "require": {
"topthink/framework": "^6.0" "topthink/framework": "^6.0|^8.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -117,7 +117,7 @@ class Captcha
} }
for ($i = 0; $i < $this->length; $i++) { for ($i = 0; $i < $this->length; $i++) {
$bag .= $characters[rand(0, count($characters) - 1)]; $bag .= $characters[random_int(0, count($characters) - 1)];
} }
$key = mb_strtolower($bag, 'UTF-8'); $key = mb_strtolower($bag, 'UTF-8');
@ -178,11 +178,11 @@ class Captcha
// 图片高(px) // 图片高(px)
$this->imageH || $this->imageH = $this->fontSize * 2.5; $this->imageH || $this->imageH = $this->fontSize * 2.5;
$this->imageW = intval($this->imageW); $this->imageW = (int)$this->imageW;
$this->imageH = intval($this->imageH); $this->imageH = (int)$this->imageH;
// 建立一幅 $this->imageW x $this->imageH 的图像 // 建立一幅 $this->imageW x $this->imageH 的图像
$this->im = imagecreate((int) $this->imageW, (int) $this->imageH); $this->im = imagecreate($this->imageW, $this->imageH);
// 设置背景 // 设置背景
imagecolorallocate($this->im, $this->bg[0], $this->bg[1], $this->bg[2]); imagecolorallocate($this->im, $this->bg[0], $this->bg[1], $this->bg[2]);
@ -196,7 +196,7 @@ class Captcha
$dir = dir($ttfPath); $dir = dir($ttfPath);
$ttfs = []; $ttfs = [];
while (false !== ($file = $dir->read())) { while (false !== ($file = $dir->read())) {
if (substr($file, -4) == '.ttf' || substr($file, -4) == '.otf') { if (substr($file, -4) === '.ttf' || substr($file, -4) === '.otf') {
$ttfs[] = $file; $ttfs[] = $file;
} }
} }
@ -228,7 +228,7 @@ class Captcha
$y = $this->fontSize + mt_rand(10, 20); $y = $this->fontSize + mt_rand(10, 20);
$angle = $this->math ? 0 : mt_rand(-40, 40); $angle = $this->math ? 0 : mt_rand(-40, 40);
imagettftext($this->im, intval($this->fontSize), intval($this->fontSize), intval($x), intval($y), $this->color, $fontttf, $char); imagettftext($this->im, (int)$this->fontSize, $angle, (int)$x, (int)$y, $this->color, $fontttf, $char);
} }
ob_start(); ob_start();
@ -257,30 +257,30 @@ class Captcha
$px = $py = 0; $px = $py = 0;
// 曲线前部分 // 曲线前部分
$A = mt_rand(1, intval($this->imageH / 2)); // 振幅 $A = mt_rand(1, (int)($this->imageH / 2)); // 振幅
$b = mt_rand(intval(-$this->imageH / 4), intval($this->imageH / 4)); // Y轴方向偏移量 $b = mt_rand((int)(-$this->imageH / 4), (int)($this->imageH / 4)); // Y轴方向偏移量
$f = mt_rand(intval(-$this->imageH / 4), intval($this->imageH / 4)); // X轴方向偏移量 $f = mt_rand((int)(-$this->imageH / 4), (int)($this->imageH / 4)); // X轴方向偏移量
$T = mt_rand($this->imageH, $this->imageW * 2); // 周期 $T = mt_rand((int)$this->imageH, (int)$this->imageW * 2); // 周期
$w = (2 * M_PI) / $T; $w = (2 * M_PI) / $T;
$px1 = 0; // 曲线横坐标起始位置 $px1 = 0; // 曲线横坐标起始位置
$px2 = mt_rand($this->imageW / 2, $this->imageW * 0.8); // 曲线横坐标结束位置 $px2 = mt_rand((int)($this->imageW / 2), (int)($this->imageW * 0.8)); // 曲线横坐标结束位置
for ($px = $px1; $px <= $px2; $px = $px + 1) { for ($px = $px1; $px <= $px2; $px = $px + 1) {
if (0 != $w) { if (0 != $w) {
$py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b $py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b
$i = (int) ($this->fontSize / 5); $i = (int) ($this->fontSize / 5);
while ($i > 0) { while ($i > 0) {
imagesetpixel($this->im, intval($px + $i), intval($py + $i), $this->color); // 这里(while)循环画像素点比imagettftext和imagestring用字体大小一次画出不用这while循环性能要好很多 imagesetpixel($this->im, (int)($px + $i), (int)($py + $i), $this->color); // 这里(while)循环画像素点比imagettftext和imagestring用字体大小一次画出不用这while循环性能要好很多
$i--; $i--;
} }
} }
} }
// 曲线后部分 // 曲线后部分
$A = mt_rand(1, intval($this->imageH / 2)); // 振幅 $A = mt_rand(1, (int)($this->imageH / 2)); // 振幅
$f = mt_rand(intval(-$this->imageH / 4), intval($this->imageH / 4)); // X轴方向偏移量 $f = mt_rand((int)(-$this->imageH / 4), (int)($this->imageH / 4)); // X轴方向偏移量
$T = mt_rand($this->imageH, $this->imageW * 2); // 周期 $T = mt_rand((int)$this->imageH, (int)$this->imageW * 2); // 周期
$w = (2 * M_PI) / $T; $w = (2 * M_PI) / $T;
$b = $py - $A * sin($w * $px + $f) - $this->imageH / 2; $b = $py - $A * sin($w * $px + $f) - $this->imageH / 2;
$px1 = $px2; $px1 = $px2;
@ -291,7 +291,7 @@ class Captcha
$py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b $py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b
$i = (int) ($this->fontSize / 5); $i = (int) ($this->fontSize / 5);
while ($i > 0) { while ($i > 0) {
imagesetpixel($this->im, intval($px + $i), intval($py + $i), $this->color); imagesetpixel($this->im, (int)($px + $i), (int)($py + $i), $this->color);
$i--; $i--;
} }
} }
@ -310,7 +310,7 @@ class Captcha
$noiseColor = imagecolorallocate($this->im, mt_rand(150, 225), mt_rand(150, 225), mt_rand(150, 225)); $noiseColor = imagecolorallocate($this->im, mt_rand(150, 225), mt_rand(150, 225), mt_rand(150, 225));
for ($j = 0; $j < 5; $j++) { for ($j = 0; $j < 5; $j++) {
// 绘杂点 // 绘杂点
imagestring($this->im, 5, mt_rand(-10, $this->imageW), mt_rand(-10, $this->imageH), $codeSet[mt_rand(0, 29)], $noiseColor); imagestring($this->im, 5, mt_rand(-10, (int)$this->imageW), mt_rand(-10, (int)$this->imageH), $codeSet[mt_rand(0, 29)], $noiseColor);
} }
} }
} }
@ -337,7 +337,7 @@ class Captcha
list($width, $height) = @getimagesize($gb); list($width, $height) = @getimagesize($gb);
// Resample // Resample
$bgImage = @imagecreatefromjpeg($gb); $bgImage = @imagecreatefromjpeg($gb);
@imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height); @imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, (int)$this->imageW, (int)$this->imageH, $width, $height);
@imagedestroy($bgImage); @imagedestroy($bgImage);
} }
} }

View File

@ -769,16 +769,20 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
$pk = $this->getPk(); $pk = $this->getPk();
if (is_string($pk) && $replace) {
$auto = true;
}
$result = []; $result = [];
$suffix = $this->getSuffix(); $suffix = $this->getSuffix();
foreach ($dataSet as $key => $data) { foreach ($dataSet as $key => $data) {
if ($this->exists || (!empty($auto) && isset($data[$pk]))) { if ($replace) {
$exists = true;
foreach ((array) $pk as $field) {
if (!isset($data[$field])) {
$exists = false;
}
}
}
if ($replace && !empty($exists)) {
$result[$key] = static::update($data, [], [], $suffix); $result[$key] = static::update($data, [], [], $suffix);
} else { } else {
$result[$key] = static::create($data, $this->field, $this->replace, $suffix); $result[$key] = static::create($data, $this->field, $this->replace, $suffix);

View File

@ -770,10 +770,9 @@ abstract class BaseQuery
* @param mixed $key 缓存key * @param mixed $key 缓存key
* @param integer|\DateTime $expire 缓存有效期 * @param integer|\DateTime $expire 缓存有效期
* @param string|array $tag 缓存标签 * @param string|array $tag 缓存标签
* @param bool $always 始终缓存
* @return $this * @return $this
*/ */
public function cache($key = true, $expire = null, $tag = null, bool $always = false) public function cache($key = true, $expire = null, $tag = null)
{ {
if (false === $key || !$this->getConnection()->getCache()) { if (false === $key || !$this->getConnection()->getCache()) {
return $this; return $this;
@ -784,8 +783,7 @@ abstract class BaseQuery
$key = true; $key = true;
} }
$this->options['cache'] = [$key, $expire, $tag]; $this->options['cache'] = [$key, $expire, $tag ?: $this->getTable()];
$this->options['cache_always'] = $always;
return $this; return $this;
} }
@ -800,7 +798,23 @@ abstract class BaseQuery
*/ */
public function cacheAlways($key = true, $expire = null, $tag = null) public function cacheAlways($key = true, $expire = null, $tag = null)
{ {
return $this->cache($key, $expire, $tag, true); $this->options['cache_always'] = true;
return $this->cache($key, $expire, $tag);
}
/**
* 强制更新缓存
*
* @param mixed $key 缓存key
* @param int|\DateTime $expire 缓存有效期
* @param string|array $tag 缓存标签
*
* @return $this
*/
public function cacheForce($key = true, $expire = null, $tag = null)
{
$this->options['force_cache'] = true;
return $this->cache($key, $expire, $tag);
} }
/** /**
@ -1026,6 +1040,23 @@ abstract class BaseQuery
return $this->connection->insertAll($this, $dataSet, $limit); return $this->connection->insertAll($this, $dataSet, $limit);
} }
/**
* 批量插入记录
* @access public
* @param array $keys 键值
* @param array $values 数据
* @param integer $limit 每次写入数据限制
* @return integer
*/
public function insertAllByKeys(array $keys, array $values, int $limit = 0): int
{
if (empty($limit) && !empty($this->options['limit']) && is_numeric($this->options['limit'])) {
$limit = (int) $this->options['limit'];
}
return $this->connection->insertAllByKeys($this, $keys, $values, $limit);
}
/** /**
* 通过Select方式插入记录 * 通过Select方式插入记录
* @access public * @access public

View File

@ -1238,6 +1238,53 @@ abstract class Builder
); );
} }
/**
* 生成insertall SQL
* @access public
* @param Query $query 查询对象
* @param array $keys 字段名
* @param array $datas 数据
* @return string
*/
public function insertAllByKeys(Query $query, array $keys, array $datas): string
{
$options = $query->getOptions();
// 获取绑定信息
$bind = $query->getFieldsBindType();
$fields = [];
$values = [];
foreach ($keys as $field) {
$fields[] = $this->parseKey($query, $field);
}
foreach ($datas as $data) {
foreach ($data as $key => &$val) {
if (!$query->isAutoBind()) {
$val = PDO::PARAM_STR == $bind[$keys[$key]] ? '\'' . $val . '\'' : $val;
} else {
$val = $this->parseDataBind($query, $keys[$key], $val, $bind);
}
}
$values[] = 'SELECT ' . implode(',', $data);
}
return str_replace(
['%INSERT%', '%TABLE%', '%EXTRA%', '%FIELD%', '%DATA%', '%COMMENT%'],
[
!empty($options['replace']) ? 'REPLACE' : 'INSERT',
$this->parseTable($query, $options['table']),
$this->parseExtra($query, $options['extra']),
implode(' , ', $fields),
implode(' UNION ALL ', $values),
$this->parseComment($query, $options['comment']),
],
$this->insertAllSql
);
}
/** /**
* 生成slect insert SQL * 生成slect insert SQL
* @access public * @access public

View File

@ -622,15 +622,14 @@ abstract class PDOConnection extends Connection
* @access public * @access public
* @param BaseQuery $query 查询对象 * @param BaseQuery $query 查询对象
* @param string $sql sql指令 * @param string $sql sql指令
* @param array $bind 参数绑定
* @param Model|null $model 模型对象实例 * @param Model|null $model 模型对象实例
* @param null $condition 查询条件 * @param null $condition 查询条件
* @return \Generator * @return \Generator
* @throws DbException * @throws DbException
*/ */
public function getCursor(BaseQuery $query, string $sql, array $bind = [], $model = null, $condition = null) public function getCursor(BaseQuery $query, string $sql, $model = null, $condition = null)
{ {
$this->queryPDOStatement($query, $sql, $bind); $this->queryPDOStatement($query, $sql);
// 返回结果集 // 返回结果集
while ($result = $this->PDOStatement->fetch($this->fetchType)) { while ($result = $this->PDOStatement->fetch($this->fetchType)) {
@ -653,7 +652,7 @@ abstract class PDOConnection extends Connection
*/ */
public function query(string $sql, array $bind = [], bool $master = false): array public function query(string $sql, array $bind = [], bool $master = false): array
{ {
return $this->pdoQuery($this->newQuery(), $sql, $bind, $master); return $this->pdoQuery($this->newQuery()->bind($bind), $sql, $master);
} }
/** /**
@ -666,7 +665,7 @@ abstract class PDOConnection extends Connection
*/ */
public function execute(string $sql, array $bind = []): int public function execute(string $sql, array $bind = []): int
{ {
return $this->pdoExecute($this->newQuery(), $sql, $bind, true); return $this->pdoExecute($this->newQuery()->bind($bind), $sql, true);
} }
/** /**
@ -674,25 +673,27 @@ abstract class PDOConnection extends Connection
* @access protected * @access protected
* @param BaseQuery $query 查询对象 * @param BaseQuery $query 查询对象
* @param mixed $sql sql指令 * @param mixed $sql sql指令
* @param array $bind 参数绑定
* @param bool $master 主库读取 * @param bool $master 主库读取
* @return array * @return array
* @throws DbException * @throws DbException
*/ */
protected function pdoQuery(BaseQuery $query, $sql, array $bind = [], bool $master = null): array protected function pdoQuery(BaseQuery $query, $sql, bool $master = null): array
{ {
// 分析查询表达式 // 分析查询表达式
$query->parseOptions(); $query->parseOptions();
$bind = $query->getBind();
if ($query->getOptions('cache')) { if ($query->getOptions('cache')) {
// 检查查询缓存 // 检查查询缓存
$cacheItem = $this->parseCache($query, $query->getOptions('cache')); $cacheItem = $this->parseCache($query, $query->getOptions('cache'));
$key = $cacheItem->getKey(); if (!$query->getOptions('force_cache')) {
$key = $cacheItem->getKey();
$data = $this->cache->get($key); $data = $this->cache->get($key);
if (null !== $data) { if (null !== $data) {
return $data; return $data;
}
} }
} }
@ -730,11 +731,10 @@ abstract class PDOConnection extends Connection
*/ */
public function pdo(BaseQuery $query): PDOStatement public function pdo(BaseQuery $query): PDOStatement
{ {
$bind = $query->getBind();
// 生成查询SQL // 生成查询SQL
$sql = $this->builder->select($query); $sql = $this->builder->select($query);
return $this->queryPDOStatement($query, $sql, $bind); return $this->queryPDOStatement($query, $sql);
} }
/** /**
@ -806,18 +806,17 @@ abstract class PDOConnection extends Connection
* @access protected * @access protected
* @param BaseQuery $query 查询对象 * @param BaseQuery $query 查询对象
* @param string $sql sql指令 * @param string $sql sql指令
* @param array $bind 参数绑定
* @param bool $origin 是否原生查询 * @param bool $origin 是否原生查询
* @return int * @return int
* @throws DbException * @throws DbException
*/ */
protected function pdoExecute(BaseQuery $query, string $sql, array $bind = [], bool $origin = false): int protected function pdoExecute(BaseQuery $query, string $sql, bool $origin = false): int
{ {
if ($origin) { if ($origin) {
$query->parseOptions(); $query->parseOptions();
} }
$this->queryPDOStatement($query->master(true), $sql, $bind); $this->queryPDOStatement($query->master(true), $sql);
if (!$origin && !empty($this->config['deploy']) && !empty($this->config['read_master'])) { if (!$origin && !empty($this->config['deploy']) && !empty($this->config['read_master'])) {
$this->readMaster = true; $this->readMaster = true;
@ -844,13 +843,13 @@ abstract class PDOConnection extends Connection
/** /**
* @param BaseQuery $query * @param BaseQuery $query
* @param string $sql * @param string $sql
* @param array $bind
* @return PDOStatement * @return PDOStatement
* @throws DbException * @throws DbException
*/ */
protected function queryPDOStatement(BaseQuery $query, string $sql, array $bind = []): PDOStatement protected function queryPDOStatement(BaseQuery $query, string $sql): PDOStatement
{ {
$options = $query->getOptions(); $options = $query->getOptions();
$bind = $query->getBind();
$master = !empty($options['master']) ? true : false; $master = !empty($options['master']) ? true : false;
$procedure = !empty($options['procedure']) ? true : in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); $procedure = !empty($options['procedure']) ? true : in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']);
@ -898,7 +897,7 @@ abstract class PDOConnection extends Connection
$condition = $options['where']['AND'] ?? null; $condition = $options['where']['AND'] ?? null;
// 执行查询操作 // 执行查询操作
return $this->getCursor($query, $sql, $query->getBind(), $query->getModel(), $condition); return $this->getCursor($query, $sql, $query->getModel(), $condition);
} }
/** /**
@ -938,7 +937,7 @@ abstract class PDOConnection extends Connection
$sql = $this->builder->insert($query); $sql = $this->builder->insert($query);
// 执行操作 // 执行操作
$result = '' == $sql ? 0 : $this->pdoExecute($query, $sql, $query->getBind()); $result = '' == $sql ? 0 : $this->pdoExecute($query, $sql);
if ($result) { if ($result) {
$sequence = $options['sequence'] ?? null; $sequence = $options['sequence'] ?? null;
@ -977,13 +976,12 @@ abstract class PDOConnection extends Connection
*/ */
public function insertAll(BaseQuery $query, array $dataSet = [], int $limit = 0): int public function insertAll(BaseQuery $query, array $dataSet = [], int $limit = 0): int
{ {
$query->parseOptions();
if (!is_array(reset($dataSet))) { if (!is_array(reset($dataSet))) {
return 0; return 0;
} }
$options = $query->parseOptions();
$replace = !empty($options['replace']);
if (0 === $limit && count($dataSet) >= 5000) { if (0 === $limit && count($dataSet) >= 5000) {
$limit = 1000; $limit = 1000;
} }
@ -997,8 +995,8 @@ abstract class PDOConnection extends Connection
$count = 0; $count = 0;
foreach ($array as $item) { foreach ($array as $item) {
$sql = $this->builder->insertAll($query, $item, $replace); $sql = $this->builder->insertAll($query, $item);
$count += $this->pdoExecute($query, $sql, $query->getBind()); $count += $this->pdoExecute($query, $sql);
} }
// 提交事务 // 提交事务
@ -1011,9 +1009,56 @@ abstract class PDOConnection extends Connection
return $count; return $count;
} }
$sql = $this->builder->insertAll($query, $dataSet, $replace); $sql = $this->builder->insertAll($query, $dataSet);
return $this->pdoExecute($query, $sql, $query->getBind()); return $this->pdoExecute($query, $sql);
}
/**
* 批量插入记录
* @access public
* @param BaseQuery $query 查询对象
* @param array $keys 键值
* @param array $values 数据
* @param integer $limit 每次写入数据限制
* @return integer
* @throws \Exception
* @throws \Throwable
*/
public function insertAllByKeys(BaseQuery $query, array $keys, array $values, int $limit = 0): int
{
$query->parseOptions();
if (0 === $limit && count($values) >= 5000) {
$limit = 1000;
}
if ($limit) {
// 分批写入 自动启动事务支持
$this->startTrans();
try {
$array = array_chunk($values, $limit, true);
$count = 0;
foreach ($array as $item) {
$sql = $this->builder->insertAllByKeys($query, $keys, $item);
$count += $this->pdoExecute($query, $sql);
}
// 提交事务
$this->commit();
} catch (\Exception | \Throwable $e) {
$this->rollback();
throw $e;
}
return $count;
}
$sql = $this->builder->insertAllByKeys($query, $keys, $values);
return $this->pdoExecute($query, $sql);
} }
/** /**
@ -1032,7 +1077,7 @@ abstract class PDOConnection extends Connection
$sql = $this->builder->selectInsert($query, $fields, $table); $sql = $this->builder->selectInsert($query, $fields, $table);
return $this->pdoExecute($query, $sql, $query->getBind()); return $this->pdoExecute($query, $sql);
} }
/** /**
@ -1050,7 +1095,7 @@ abstract class PDOConnection extends Connection
$sql = $this->builder->update($query); $sql = $this->builder->update($query);
// 执行操作 // 执行操作
$result = '' == $sql ? 0 : $this->pdoExecute($query, $sql, $query->getBind()); $result = '' == $sql ? 0 : $this->pdoExecute($query, $sql);
if ($result) { if ($result) {
$this->db->trigger('after_update', $query); $this->db->trigger('after_update', $query);
@ -1075,7 +1120,7 @@ abstract class PDOConnection extends Connection
$sql = $this->builder->delete($query); $sql = $this->builder->delete($query);
// 执行操作 // 执行操作
$result = $this->pdoExecute($query, $sql, $query->getBind()); $result = $this->pdoExecute($query, $sql);
if ($result) { if ($result) {
$this->db->trigger('after_delete', $query); $this->db->trigger('after_delete', $query);
@ -1109,10 +1154,13 @@ abstract class PDOConnection extends Connection
if (!empty($options['cache'])) { if (!empty($options['cache'])) {
$cacheItem = $this->parseCache($query, $options['cache'], 'value'); $cacheItem = $this->parseCache($query, $options['cache'], 'value');
$key = $cacheItem->getKey();
if ($this->cache->has($key)) { if (!$query->getOptions('force_cache')) {
return $this->cache->get($key); $key = $cacheItem->getKey();
if ($this->cache->has($key)) {
return $this->cache->get($key);
}
} }
} }
@ -1208,10 +1256,12 @@ abstract class PDOConnection extends Connection
if (!empty($options['cache'])) { if (!empty($options['cache'])) {
// 判断查询缓存 // 判断查询缓存
$cacheItem = $this->parseCache($query, $options['cache'], 'column'); $cacheItem = $this->parseCache($query, $options['cache'], 'column');
$name = $cacheItem->getKey(); if (!$query->getOptions('force_cache')) {
$name = $cacheItem->getKey();
if ($this->cache->has($name)) { if ($this->cache->has($name)) {
return $this->cache->get($name); return $this->cache->get($name);
}
} }
} }
@ -1545,17 +1595,16 @@ abstract class PDOConnection extends Connection
* @access public * @access public
* @param BaseQuery $query 查询对象 * @param BaseQuery $query 查询对象
* @param array $sqlArray SQL批处理指令 * @param array $sqlArray SQL批处理指令
* @param array $bind 参数绑定
* @return bool * @return bool
*/ */
public function batchQuery(BaseQuery $query, array $sqlArray = [], array $bind = []): bool public function batchQuery(BaseQuery $query, array $sqlArray = []): bool
{ {
// 自动启动事务支持 // 自动启动事务支持
$this->startTrans(); $this->startTrans();
try { try {
foreach ($sqlArray as $sql) { foreach ($sqlArray as $sql) {
$this->pdoExecute($query, $sql, $bind); $this->pdoExecute($query, $sql);
} }
// 提交事务 // 提交事务
$this->commit(); $this->commit();

View File

@ -111,8 +111,6 @@ class Mongo
$result[$item] = $val; $result[$item] = $val;
} elseif (isset($val[0]) && 'exp' == $val[0]) { } elseif (isset($val[0]) && 'exp' == $val[0]) {
$result[$item] = $val[1]; $result[$item] = $val[1];
} elseif (is_null($val)) {
$result[$item] = 'NULL';
} else { } else {
$result[$item] = $this->parseValue($query, $val, $key); $result[$item] = $this->parseValue($query, $val, $key);
} }

View File

@ -12,6 +12,7 @@ declare (strict_types = 1);
namespace think\db\builder; namespace think\db\builder;
use PDO;
use think\db\Builder; use think\db\Builder;
use think\db\exception\DbException as Exception; use think\db\exception\DbException as Exception;
use think\db\Query; use think\db\Query;
@ -146,10 +147,9 @@ class Mysql extends Builder
* @access public * @access public
* @param Query $query 查询对象 * @param Query $query 查询对象
* @param array $dataSet 数据集 * @param array $dataSet 数据集
* @param bool $replace 是否replace
* @return string * @return string
*/ */
public function insertAll(Query $query, array $dataSet, bool $replace = false): string public function insertAll(Query $query, array $dataSet): string
{ {
$options = $query->getOptions(); $options = $query->getOptions();
@ -183,7 +183,55 @@ class Mysql extends Builder
return str_replace( return str_replace(
['%INSERT%', '%EXTRA%', '%TABLE%', '%PARTITION%', '%FIELD%', '%DATA%', '%DUPLICATE%', '%COMMENT%'], ['%INSERT%', '%EXTRA%', '%TABLE%', '%PARTITION%', '%FIELD%', '%DATA%', '%DUPLICATE%', '%COMMENT%'],
[ [
$replace ? 'REPLACE' : 'INSERT', !empty($options['replace']) ? 'REPLACE' : 'INSERT',
$this->parseExtra($query, $options['extra']),
$this->parseTable($query, $options['table']),
$this->parsePartition($query, $options['partition']),
implode(' , ', $fields),
implode(' , ', $values),
$this->parseDuplicate($query, $options['duplicate']),
$this->parseComment($query, $options['comment']),
],
$this->insertAllSql
);
}
/**
* 生成insertall SQL
* @access public
* @param Query $query 查询对象
* @param array $keys 键值
* @param array $values 数据
* @return string
*/
public function insertAllByKeys(Query $query, array $keys, array $datas): string
{
$options = $query->getOptions();
// 获取绑定信息
$bind = $query->getFieldsBindType();
$fields = [];
$values = [];
foreach ($keys as $field) {
$fields[] = $this->parseKey($query, $field);
}
foreach ($datas as $data) {
foreach ($data as $key => &$val) {
if (!$query->isAutoBind()) {
$val = PDO::PARAM_STR == $bind[$keys[$key]] ? '\'' . $val . '\'' : $val;
} else {
$val = $this->parseDataBind($query, $keys[$key], $val, $bind);
}
}
$values[] = '( ' . implode(',', $data) . ' )';
}
return str_replace(
['%INSERT%', '%EXTRA%', '%TABLE%', '%PARTITION%', '%FIELD%', '%DATA%', '%DUPLICATE%', '%COMMENT%'],
[
!empty($options['replace']) ? 'REPLACE' : 'INSERT',
$this->parseExtra($query, $options['extra']), $this->parseExtra($query, $options['extra']),
$this->parseTable($query, $options['table']), $this->parseTable($query, $options['table']),
$this->parsePartition($query, $options['partition']), $this->parsePartition($query, $options['partition']),

View File

@ -49,12 +49,21 @@ trait AggregateQuery
} }
$options = $this->getOptions(); $options = $this->getOptions();
$subSql = $this->options($options) if (isset($options['cache'])) {
$cache = $options['cache'];
unset($options['cache']);
}
$subSql = $this->options($options)
->field('count(' . $field . ') AS think_count') ->field('count(' . $field . ') AS think_count')
->bind($this->bind) ->bind($this->bind)
->buildSql(); ->buildSql();
$query = $this->newQuery()->table([$subSql => '_group_count_']); $query = $this->newQuery();
if (isset($cache)) {
$query->setOption('cache', $cache);
}
$query->table([$subSql => '_group_count_']);
$count = $query->aggregate('COUNT', '*'); $count = $query->aggregate('COUNT', '*');
} else { } else {

View File

@ -50,15 +50,15 @@ class ServerSentEvents
if (isset($data['event'])) { if (isset($data['event'])) {
$buffer .= "event: {$data['event']}\n"; $buffer .= "event: {$data['event']}\n";
} }
if (isset($data['data'])) {
$buffer .= 'data: ' . \str_replace("\n", "\ndata: ", $data['data']) . "\n\n";
}
if (isset($data['id'])) { if (isset($data['id'])) {
$buffer .= "id: {$data['id']}\n"; $buffer .= "id: {$data['id']}\n";
} }
if (isset($data['retry'])) { if (isset($data['retry'])) {
$buffer .= "retry: {$data['retry']}\n"; $buffer .= "retry: {$data['retry']}\n";
} }
return $buffer; if (isset($data['data'])) {
$buffer .= 'data: ' . str_replace("\n", "\ndata: ", $data['data']) . "\n";
}
return $buffer . "\n";
} }
} }

View File

@ -274,7 +274,7 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface
if (\strlen($connection->context->tmpWebsocketData) > $connection->maxSendBufferSize) { if (\strlen($connection->context->tmpWebsocketData) > $connection->maxSendBufferSize) {
if ($connection->onError) { if ($connection->onError) {
try { try {
($connection->onError)($connection, ConnectionInterface::SEND_FAIL, 'send buffer full and drop package'); ($connection->onError)($connection, WORKERMAN_SEND_FAIL, 'send buffer full and drop package');
} catch (\Throwable $e) { } catch (\Throwable $e) {
Worker::stopAll(250, $e); Worker::stopAll(250, $e);
} }

View File

@ -243,7 +243,7 @@ class Ws
if (\strlen($connection->context->tmpWebsocketData) > $connection->maxSendBufferSize) { if (\strlen($connection->context->tmpWebsocketData) > $connection->maxSendBufferSize) {
if ($connection->onError) { if ($connection->onError) {
try { try {
($connection->onError)($connection, ConnectionInterface::SEND_FAIL, 'send buffer full and drop package'); ($connection->onError)($connection, WORKERMAN_SEND_FAIL, 'send buffer full and drop package');
} catch (\Throwable $e) { } catch (\Throwable $e) {
Worker::stopAll(250, $e); Worker::stopAll(250, $e);
} }

View File

@ -34,7 +34,7 @@ class Worker
* *
* @var string * @var string
*/ */
const VERSION = '4.1.9'; const VERSION = '4.1.10';
/** /**
* Status starting. * Status starting.
@ -1473,7 +1473,7 @@ class Worker
\restore_error_handler(); \restore_error_handler();
// Display UI. // Display UI.
static::safeEcho(\str_pad($worker->name, 21) . \str_pad($worker->getSocketName(), 36) . \str_pad((string)$worker->count, 10) . "[ok]\n"); static::safeEcho(\str_pad($worker->name, 21) . \str_pad($worker->getSocketName(), 36) . \str_pad('1', 10) . "[ok]\n");
$worker->listen(); $worker->listen();
$worker->run(); $worker->run();
static::$globalEvent->loop(); static::$globalEvent->loop();

View File

@ -17,38 +17,53 @@
<div class="layui-row layui-col-space15"> <div class="layui-row layui-col-space15">
<div class="layui-col-md8"> <div class="layui-col-md8">
<div class="fly-panel" style="margin-bottom: 0;"> <div class="fly-panel" style="margin-bottom: 0;">
<ul class="fly-list">
{volist name="artList['data']" id="art"}
<li> <section id="main" class="list-home list-grid list-grid-padding">
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" class="fly-avatar"><img src="{$Request.domain}{$art.user.user_img}" alt="{$art.user.name}"></a> {article:list}
<h2><a href="{$Request.domain}{$art.url}" style="color:{$art.title_color ?? '#333'};">{$art.title}</a></h2> <article class="list-item block card-plain">
<div class="fly-list-info"> {if getOnepic($article.content)}
{if config('taoler.config.cate_show') == 1} <figure class="media media-3x2 col-4 col-md-4 d-none d-md-block">
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a> <a class="media-content" href="{article:link /}" title="{article:title /}">
{/if} <img src="{:getOnepic($article.content)}" width="233" height="155" alt="{article:title /}">
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
<cite>{$art.user.nickname ?: $art.user.name}</cite>
<i>{$art.create_time|date='Y-m-d'}</i>
</a> </a>
<span> </figure>
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'} {/if}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'} <div class="list-width list-content">
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'} <div class="list-body">
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'} <h3>
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'} <a href="{article:link /}" title="{article:title /}" class="list-title fanpian">{article:title /}</a>
</span> </h3>
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span> <div class="list-desc d-block d-md-block text-sm text-secondary my-3">
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}</span> <p class="h-3x">{:getArtContent($article.content)}</p>
</div>
</div>
<div class="list-footer">
<div class="d-flex flex-fill align-items-center text-muted text-xs">
<time class="d-inline-block" datetime="{$article.create_time|date='Y-m-d'}">{$article.create_time|date='Y-m-d'}</time>
<div class="d-inline-block mx-1 mx-md-2">
<i class="text-primary">·</i>
</div>
<div class="d-inline-block">
<a href="{article:user name='link' /}" class="text-muted" title="发布于{article:auther /}" rel="category">{article:auther /}</a>
{$article.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$article.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$article.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$article.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$article.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {article:pv}</span>
<span class=""><i class="iconfont icon-pinglun1" title="回答"></i> {article:comment_num}</span>
</div>
<div class="flex-fill"></div>
<div class="mx-1">
<a href="{article:link /}" class="text-muted">阅读全文</a>
</div>
</div>
</div>
</div> </div>
<div class="fly-list-badge"> </article>
{if ($art.is_hot == 1)} {/article:list}
<i class="layui-icon layui-icon-fire layui-hide-md" style="font-size: 20px; color: #FF5722;"></i> </section>
<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 style="text-align: center" id="pages"></div>
</div> </div>
</div> </div>

View File

@ -18,7 +18,7 @@
<div class="layui-col-md12 content detail"> <div class="layui-col-md12 content detail">
<div class="fly-panel detail-box"> <div class="fly-panel detail-box">
{//标题} {//标题}
<h1 align="center" style="color:{$article.title_color ?: '#333'}; margin:10px 5px 15px 5px;">{$article.title}</h1> <h1 style="color:{$article.title_color ?: '#333'}; margin:10px 5px 15px 5px; text-align: center;">{$article.title}</h1>
{//作者} {//作者}
<div class="detail-about" align="center"> <div class="detail-about" align="center">

View File

@ -7,7 +7,10 @@
{block name="ogdescription"}<meta property="og:description" content="{$sysInfo.descript}" />{/block} {block name="ogdescription"}<meta property="og:description" content="{$sysInfo.descript}" />{/block}
{block name="ogimage"}<meta property="og:image" content="{$Request.domain}{$sysInfo.logo}" />{/block} {block name="ogimage"}<meta property="og:image" content="{$Request.domain}{$sysInfo.logo}" />{/block}
{block name="meta"}{/block} {block name="meta"}{/block}
{block name="link"}
<!-- 特效丶样式 -->
{/block}
{block name="column"}{include file="public/column" /}{/block} {block name="column"}{include file="public/column" /}{/block}
{block name="content"} {block name="content"}
<div class="layui-container"> <div class="layui-container">
@ -16,24 +19,66 @@
<!--首页幻灯--> <!--首页幻灯-->
{:hook('ads_slider')} {:hook('ads_slider')}
<!--置顶文章--> <!--置顶文章-->
<div class="fly-panel">
<div class="fly-panel">
<div class="fly-panel-title fly-filter"> <div class="fly-panel-title fly-filter">
<a>{:lang('top')}</a> <a>{:lang('top')}</a>
<a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin" style="color: #FF5722;">{:lang('go sign')}</a> <a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin" style="color: #FF5722;">{:lang('go sign')}</a>
</div> </div>
<ul class="fly-list"> <ul class="fly-list">
{volist name="artTop" id="top"} {volist name="artTop" id="top"}
{include file="public/index-topforum" /} {include file="public/index-topforum" /}
{/volist} {/volist}
</ul> </ul>
</div> </div>
<!--文章列表--> <!--文章列表-->
<div class="fly-panel" style="margin-bottom: 0;">
<ul class="fly-list"> <section id="main" class="list-home list-grid list-grid-padding">
{volist name="artList" id="art"} {volist name="artList" id="article"}
{include file="public/index-forumlist" /} <article class="list-item block card-plain">
{if getOnepic($article.content)}
<figure class="media media-3x2 col-4 col-md-4 d-none d-md-block">
<a class="media-content" href="{article:link /}" title="{article:title /}">
<img src="{:getOnepic($article.content)}" alt="{article:title /}">
</a>
</figure>
{/if}
<div class="list-width list-content">
<div class="list-body">
<h3>
<a href="{article:link /}" title="{article:title /}" class="list-title fanpian">{article:title /}</a>
</h3>
<div class="list-desc d-block d-md-block text-sm text-secondary my-3">
<p class="h-3x">{:getArtContent($article.content)}</p>
</div>
</div>
<div class="list-footer">
<div class="d-flex flex-fill align-items-center text-muted text-xs">
<time class="d-inline-block" datetime="{$article.create_time}">{$article.create_time|date='Y-m-d'}</time>
<div class="d-inline-block mx-1 mx-md-2">
<a href="{:url('cate',['ename'=>$article.cate.ename])}" class="text-muted">{$article.cate.catename}</a>
</div>
<div class="d-inline-block">
<a href="{article:user name='link' /}" class="text-muted" title="发布于{article:auther /}" rel="category">{article:auther /}</a>
{$article.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$article.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$article.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$article.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$article.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
</div>
<div class="flex-fill"></div>
<div class="mx-1">
<span class="text-muted"><i class="iconfont icon-pinglun1" title="回答"></i> {$article.comments_count}</span>
</div>
</div>
</div>
</div>
</article>
{/volist} {/volist}
</ul> </section>
<div class="fly-panel" style="margin-bottom: 0;">
<div style="text-align: center"> <div style="text-align: center">
<div class="laypage-main"> <div class="laypage-main">
<a href="{$Request.domain}{:url('cate',['ename'=>'all'])}" class="laypage-next">{:lang('more post')}</a> <a href="{$Request.domain}{:url('cate',['ename'=>'all'])}" class="laypage-next">{:lang('more post')}</a>
@ -83,4 +128,18 @@
{/block} {/block}
{block name="script"}{/block} {block name="script"}
<script>
layui.use(['util','laytpl'], function(){
let util = layui.util;
//tpl模板给发布时间赋值
$("time").each(function () {
var othis = $(this);
var datetime = othis.attr("datetime");
var posttime = layui.util.timeAgo(datetime, 30);
othis.text(posttime);
});
});
</script>
{/block}

View File

@ -1,14 +1,15 @@
<div class="fly-panel fly-column layui-hide-xs"> <div class="fly-panel fly-column layui-hide-xs">
<div class="layui-container"> <div class="layui-container fly-nav-sub">
<ul class="layui-clear"> <ul class="layui-clear">
<li class="layui-hide-xs {if ($Request.param.ename =='' && $Request.param.id =='')} layui-this {/if}" > <li class="layui-hide-xs {if ($Request.param.ename =='' && $Request.param.id =='')} layui-this {/if}" >
<a href="{$Request.domain}">{:lang('home page')}</a> <a href="{$Request.domain}">{:lang('home page')}</a>
</li> </li>
{volist name="subcatelist" id="vo"} {volist name="subcatelist" id="vo"}
<li class="{if($vo.ename eq $Request.param.ename)}layui-this{/if}"> <li {if($vo.ename eq $Request.param.ename)} class='layui-this' {/if}>
<a href="{$Request.domain}{:url('cate',['ename' => $vo.ename])}">{:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}</a> <span style="color: #8d8d8d">></span>
</li> <a href="{$Request.domain}{:url('cate',['ename' => $vo.ename])}">{:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}</a>
{/volist} </li>
{/volist}
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li> <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>
{if session('?user_id')} {if session('?user_id')}
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="{:url('user/post')}">{:lang('my post')}</a></li> <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="{:url('user/post')}">{:lang('my post')}</a></li>

View File

@ -10,11 +10,11 @@
{//导航nav} {//导航nav}
{taoler:nav} {taoler:nav}
<li class="layui-nav-item {if condition='$nav.ename eq $Request.param.ename'} layui-this {/if}" > <li class="layui-nav-item {if condition='$nav.ename eq $Request.param.ename'} layui-this {/if}" >
<a href="{nav:link}">{nav:title} {if condition="$nav.is_hot eq 1"} <span class="layui-badge-dot"></span> {/if}</a> <a href="{nav:link /}">{nav:title} {if condition="$nav.is_hot eq 1"} <span class="layui-badge-dot"></span> {/if}</a>
{notempty name="nav.children"} {notempty name="nav.children"}
<dl class="layui-nav-child"> <!-- 二级菜单 --> <dl class="layui-nav-child"> <!-- 二级菜单 -->
{taoler:snav} {taoler:snav}
<dd><a href="{snav:link}">{snav:name}</a></dd> <dd><a href="{snav:link /}">{snav:name /}</a></dd>
{/taoler:snav} {/taoler:snav}
</dl> </dl>
{/notempty} {/notempty}
@ -27,10 +27,14 @@
{//头部右栏} {//头部右栏}
<ul class="layui-nav fly-nav-user" msg-url="{:url('message/nums')}" readMsg-url="{:url('Message/read')}" userlogin="{:url('user_login')}"> <ul class="layui-nav fly-nav-user" msg-url="{:url('message/nums')}" readMsg-url="{:url('Message/read')}" userlogin="{:url('user_login')}">
<span class="fly-search layui-hide-xs" data-url="{:url('user_search')}"><i class="layui-icon">&#xe615;</i></span> <li class="layui-nav-item">
<span class="fly-search layui-hide-xs" data-url="{:url('user_search')}"><i class="layui-icon">&#xe615;</i></span>
</li>
<!-- 登录 --> <!-- 登录 -->
{if session('?user_id')} {if session('?user_id')}
{if ($Request.action=='user')}<li class="layui-nav-item"><a href="{$Request.domain}">{:lang('home page')}</a></li>{/if} {if ($Request.action=='user')}
<li class="layui-nav-item"><a href="{$Request.domain}">{:lang('home page')}</a></li>
{/if}
<li class="layui-nav-item"> <li class="layui-nav-item">
<a class="fly-nav-avatar" href="javascript:;"><cite class="layui-hide-xs">{$user.name}</cite><img src="{$Request.domain}{$user.user_img}"></a> <a class="fly-nav-avatar" href="javascript:;"><cite class="layui-hide-xs">{$user.name}</cite><img src="{$Request.domain}{$user.user_img}"></a>
<dl class="layui-nav-child"> <dl class="layui-nav-child">

View File

@ -1,27 +1,32 @@
<li> <ul class="fly-list">
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user_id])}" class="fly-avatar"> {volist name="artList" id="art"}
<img src="{$Request.domain}{$art.user.user_img}" alt="{$art.user.name}"> <li>
</a> <a href="{$Request.domain}{:url('user/home',['id'=>$art.user_id])}" class="fly-avatar">
<h2><a href="{$Request.domain}{$art.url}" style="color:{$art.title_color ?? ''};">{$art.title}</a></h2> <img src="{$Request.domain}{$art.user.user_img}" alt="{$art.user.name}">
<div class="fly-list-info">
{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="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
<cite>{$art.user.nickname ?: $art.user.name}</cite>
</a> </a>
<i>{$art.create_time|date='Y-m-d'}</i> <h2><a href="{$Request.domain}{$art.url}" style="color:{$art.title_color ?? ''};">{$art.title}</a></h2>
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'} <div class="fly-list-info">
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'} {if config('taoler.config.cate_show') == 1}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'} <a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'} {/if}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'} <a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span> <cite>{$art.user.nickname ?: $art.user.name}</cite>
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i>{$art.comments_count}</span> </a>
</div> <i>{$art.create_time|date='Y-m-d'}</i>
<div class="fly-list-badge"> {$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{if ($art.is_hot == 1)} {$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
<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> {$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{/if} {$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
</div> {$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
</li> <span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</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>

View File

@ -52,12 +52,8 @@
</dd> </dd>
{/volist} {/volist}
</dl> </dl>
<!--自定义--> <!--自定义广告-->
<div class="fly-panel" style="padding: 5px 0; text-align: center;"> {:hook('ads_index_rimg')}
{volist name="ad_comm" id="vo"}
<a href="{$Request.domain}{$vo.slid_href}" target="_blank"><img src="{$Request.domain}{$vo.slid_img}" style="max-width: 100%;"></a>
{/volist}
</div>
</div> </div>
</div> </div>
</div> </div>