diff --git a/app/BaseController.php b/app/BaseController.php index 081e41b..4e63b2d 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -318,22 +318,23 @@ abstract class BaseController */ public function uploadFiles($type) { + $max_file_seze = $this->getSystem()['upsize']; $uploads = new Uploads(); switch ($type){ case 'image': - $upRes = $uploads->put('file','article_pic',2048,'image'); + $upRes = $uploads->put('file','article_pic',$max_file_seze,'image'); break; case 'zip': - $upRes = $uploads->put('file','article_zip',1024,'application|image'); + $upRes = $uploads->put('file','article_zip',$max_file_seze,'application|image'); break; case 'video': - $upRes = $uploads->put('file','article_video',102400,'video|audio'); + $upRes = $uploads->put('file','article_video',$max_file_seze,'video|audio'); break; case 'audio': - $upRes = $uploads->put('file','article_audio',102400,'audio'); + $upRes = $uploads->put('file','article_audio',$max_file_seze,'audio'); break; default: - $upRes = $uploads->put('file','article_file',2048,'image'); + $upRes = $uploads->put('file','article_file',$max_file_seze,'image'); break; } return $upRes; diff --git a/app/admin/view/user/user/add.html b/app/admin/view/user/user/add.html index d33d51c..f53e124 100644 --- a/app/admin/view/user/user/add.html +++ b/app/admin/view/user/user/add.html @@ -12,15 +12,13 @@
- +
- +
@@ -33,15 +31,13 @@
- +
- +
@@ -55,8 +51,7 @@
- diff --git a/app/admin/view/user/user/edit.html b/app/admin/view/user/user/edit.html index 17b0ca4..534d55d 100644 --- a/app/admin/view/user/user/edit.html +++ b/app/admin/view/user/user/edit.html @@ -90,8 +90,8 @@ icon: 1, time: 1000 }, function() { - parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页 parent.layui.table.reload("user-table"); + parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页 }); } else { layer.msg(result.msg, { diff --git a/app/admin/view/user/user/index.html b/app/admin/view/user/user/index.html index f0bcc0c..60c007c 100644 --- a/app/admin/view/user/user/index.html +++ b/app/admin/view/user/user/index.html @@ -13,13 +13,13 @@
- +
- +
- +
@@ -35,7 +35,7 @@
- +
@@ -100,9 +100,9 @@ @@ -148,7 +148,7 @@ templet: '#imgTpl' }, { - title: '账号', + title: '用户', field: 'username', align: 'center', width: 100 @@ -191,7 +191,7 @@ align: 'center' }, { - title: '启用', + title: '状态', field: 'check', align: 'center', width: 95, diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index 4975ba2..4a44814 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -84,9 +84,9 @@ class BaseController extends BaseCtrl // dump($this->showNav()); //1.查询父分类id $pCate = Db::name('cate')->field('id,pid,ename,catename,is_hot')->where(['ename'=>input('ename'),'status'=>1,'delete_time'=>0])->find(); - + if(empty($pCate)) { // 没有点击任何分类,点击首页获取全部分类信息 - $subCateList = $this->showNav(); + $subCateList = []; } else { // 点击分类,获取子分类信息 $parentId = $pCate['id']; $subCate = Db::name('cate')->field('id,ename,catename,is_hot,pid')->where(['pid'=>$parentId,'status'=>1,'delete_time'=>0])->select()->toArray(); diff --git a/app/common/model/Article.php b/app/common/model/Article.php index c971398..4559d81 100644 --- a/app/common/model/Article.php +++ b/app/common/model/Article.php @@ -111,7 +111,7 @@ class Article extends Model { 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]]) ->with([ 'cate' => function ($query) { @@ -140,7 +140,7 @@ class Article extends Model public function getArtList(int $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([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename,ename,detpl'); diff --git a/app/index/config/view.php b/app/index/config/view.php index b135fc9..c2ce0d0 100644 --- a/app/index/config/view.php +++ b/app/index/config/view.php @@ -15,26 +15,25 @@ use think\facade\Cache; $taglib_pre_load = Cache::remember('taglib', function(){ $tagsArr = []; - //获取app/common/taglib + //获取应用公共标签app/common/taglib $common_taglib = Files::getAllFile(root_path().'app/common/taglib'); foreach ($common_taglib as $t) { $tagsArr[] = str_replace('/','\\',strstr(strstr($t, 'app/'), '.php', true)); } - //获取addons/taglib文件 + //获取插件下标签 addons/taglib文件 $localAddons = Files::getDirName('../addons/'); foreach($localAddons as $v) { $dir = root_path(). 'addons'. DIRECTORY_SEPARATOR . $v . DIRECTORY_SEPARATOR .'taglib'; if(!file_exists($dir)) continue; $addons_taglib = Files::getAllFile($dir); 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 [ // 模板引擎类型使用Think 'type' => 'Think', diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index c16d8b2..7733ee8 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -32,7 +32,7 @@ class Index extends BaseController //置顶文章 $artTop = Article::getArtTop(5); //首页文章列表,显示20个 - $artList = Article::getArtList(22); + $artList = Article::getArtList(15); //热议文章 $artHot = Article::getArtHot(10); diff --git a/app/index/controller/Search.php b/app/index/controller/Search.php index 6cde0f1..00d074d 100644 --- a/app/index/controller/Search.php +++ b/app/index/controller/Search.php @@ -15,7 +15,6 @@ use app\common\controller\BaseController; use think\facade\View; use think\facade\Request; use app\facade\Article; -use app\common\model\Slider; class Search extends BaseController { @@ -25,9 +24,6 @@ class Search extends BaseController $ser = Request::only(['keywords']); $artList = Article::getSearchKeyWord($ser['keywords']); $counts = $artList->count(); - $slider = new Slider(); - //首页右栏 - $ad_comm = $slider->getSliderList(2); // 查询热议 $artHot = Article::getArtHot(10); @@ -35,7 +31,6 @@ class Search extends BaseController 'artList' => $artList, 'keywords' => $ser['keywords'], 'counts' => $counts, - 'ad_comm'=>$ad_comm, 'artHot'=>$artHot, 'jspage'=>'' ]; diff --git a/composer.lock b/composer.lock index 1e622c6..4d58243 100644 --- a/composer.lock +++ b/composer.lock @@ -2687,16 +2687,16 @@ }, { "name": "topthink/think-captcha", - "version": "v3.0.8", + "version": "v3.0.9", "source": { "type": "git", "url": "https://github.com/top-think/think-captcha.git", - "reference": "52fba122c953995bec3013c635025172491ae299" + "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-captcha/zipball/52fba122c953995bec3013c635025172491ae299", - "reference": "52fba122c953995bec3013c635025172491ae299", + "url": "https://api.github.com/repos/top-think/think-captcha/zipball/b1ef360670578214edeebcf824aaf6ab7ee0528b", + "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b", "shasum": "", "mirrors": [ { @@ -2706,7 +2706,7 @@ ] }, "require": { - "topthink/framework": "^6.0" + "topthink/framework": "^6.0|^8.0" }, "type": "library", "extra": { @@ -2740,9 +2740,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.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", @@ -2963,16 +2963,16 @@ }, { "name": "topthink/think-orm", - "version": "v2.0.60", + "version": "v2.0.61", "source": { "type": "git", "url": "https://github.com/top-think/think-orm.git", - "reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46" + "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", - "reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/10528ebf4a5106b19c3bac9c6deae7a67ff49de6", + "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6", "shasum": "", "mirrors": [ { @@ -3018,9 +3018,9 @@ ], "support": { "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", @@ -3263,16 +3263,16 @@ }, { "name": "workerman/workerman", - "version": "v4.1.9", + "version": "v4.1.10", "source": { "type": "git", "url": "https://github.com/walkor/workerman.git", - "reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7" + "reference": "e967b79f95b9251a72acb971be05623ec1a51e83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/walkor/workerman/zipball/1f92d02c26106b5fbe6f61ea776198aad6e426f7", - "reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7", + "url": "https://api.github.com/repos/walkor/workerman/zipball/e967b79f95b9251a72acb971be05623ec1a51e83", + "reference": "e967b79f95b9251a72acb971be05623ec1a51e83", "shasum": "", "mirrors": [ { @@ -3328,7 +3328,7 @@ "type": "patreon" } ], - "time": "2023-03-10T13:59:12+00:00" + "time": "2023-05-01T02:12:20+00:00" }, { "name": "yansongda/pay", diff --git a/config/taoler.php b/config/taoler.php index 33beff5..c763bf0 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -16,7 +16,7 @@ return [ // 应用名,此项不可更改 'appname' => 'TaoLer', // 版本配置 - 'version' => '2.3.3', + 'version' => '2.3.4', // 加盐 'salt' => 'taoler', // 数据库备份目录 diff --git a/public/static/res/css/global.css b/public/static/res/css/global.css index e8648b5..534b44b 100644 --- a/public/static/res/css/global.css +++ b/public/static/res/css/global.css @@ -1,9 +1,4 @@ -/** - @Name: Fly社区 - @Author: 贤心 - @Site: fly.layui.com - */ - + /* 全局 */ html,body{overflow-x: hidden;} 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-logo{position: absolute; left: 15px; top: 11px;} -.fly-logo-m{position: absolute; left:calc(50% - 45px); top: 11px;} -.fly-nav{margin-left: 200px;} +.fly-header .layui-container{position: relative; height: 100%; line-height: 60px; text-align: center;} +.fly-logo{position: absolute; left: 15px;} +.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 .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-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-header .layui-nav{padding: 0; background: none;} @@ -212,19 +208,9 @@ pre{overflow-y: auto; .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-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: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;} @@ -882,4 +868,190 @@ blockquote { /* 右下角固定栏*/ .layui-fixbar li { border-radius:100%; -} \ No newline at end of file +} + +/*列表新增*/ +.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;} + } + + diff --git a/public/static/res/mods/index.js b/public/static/res/mods/index.js index 368d94d..704515b 100644 --- a/public/static/res/mods/index.js +++ b/public/static/res/mods/index.js @@ -704,7 +704,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'], var ins = carousel.render({ elem: '#FLY_topline' ,width: '100%' - ,height: '172px' + ,height: '250px' ,anim: 'fade' }); @@ -712,11 +712,11 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'], var width = $(this).prop('innerWidth'); if(width >= 1200){ ins.reload({ - height: '172px' + height: '250px' }); } else if(width >= 992){ ins.reload({ - height: '141px' + height: '250px' }); } else if(width >= 768){ ins.reload({ diff --git a/public/static/res/mods/user.js b/public/static/res/mods/user.js index a6493e2..e6e1efb 100644 --- a/public/static/res/mods/user.js +++ b/public/static/res/mods/user.js @@ -294,7 +294,7 @@ layui.define(['laypage', 'fly', 'element', 'flow', 'imgcom'], function(exports){ //我的消息 gather.minemsg = function(){ var delAll = $('#LAY_delallmsg') - ,tpl = '{{# var len = d.rows.length;\ + ,tpl = '{{# var len = d.rows.length;\ if(len === 0){ }}\
您暂时没有最新消息
\ {{# } else { }}\ diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 94b6426..2649037 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2678,23 +2678,29 @@ }, { "name": "topthink/think-captcha", - "version": "v3.0.8", - "version_normalized": "3.0.8.0", + "version": "v3.0.9", + "version_normalized": "3.0.9.0", "source": { "type": "git", "url": "https://github.com/top-think/think-captcha.git", - "reference": "52fba122c953995bec3013c635025172491ae299" + "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-captcha/zipball/52fba122c953995bec3013c635025172491ae299", - "reference": "52fba122c953995bec3013c635025172491ae299", - "shasum": "" + "url": "https://api.github.com/repos/top-think/think-captcha/zipball/b1ef360670578214edeebcf824aaf6ab7ee0528b", + "reference": "b1ef360670578214edeebcf824aaf6ab7ee0528b", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "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", "extra": { "think": { @@ -2728,7 +2734,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.8" + "source": "https://github.com/top-think/think-captcha/tree/v3.0.9" }, "install-path": "../topthink/think-captcha" }, @@ -2963,17 +2969,17 @@ }, { "name": "topthink/think-orm", - "version": "v2.0.60", - "version_normalized": "2.0.60.0", + "version": "v2.0.61", + "version_normalized": "2.0.61.0", "source": { "type": "git", "url": "https://github.com/top-think/think-orm.git", - "reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46" + "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", - "reference": "8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/10528ebf4a5106b19c3bac9c6deae7a67ff49de6", + "reference": "10528ebf4a5106b19c3bac9c6deae7a67ff49de6", "shasum": "", "mirrors": [ { @@ -2993,7 +2999,7 @@ "require-dev": { "phpunit/phpunit": "^7|^8|^9.5" }, - "time": "2023-03-19T04:51:56+00:00", + "time": "2023-04-20T14:27:51+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -3021,7 +3027,7 @@ ], "support": { "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" }, @@ -3337,17 +3343,17 @@ }, { "name": "workerman/workerman", - "version": "v4.1.9", - "version_normalized": "4.1.9.0", + "version": "v4.1.10", + "version_normalized": "4.1.10.0", "source": { "type": "git", "url": "https://github.com/walkor/workerman.git", - "reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7" + "reference": "e967b79f95b9251a72acb971be05623ec1a51e83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/walkor/workerman/zipball/1f92d02c26106b5fbe6f61ea776198aad6e426f7", - "reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7", + "url": "https://api.github.com/repos/walkor/workerman/zipball/e967b79f95b9251a72acb971be05623ec1a51e83", + "reference": "e967b79f95b9251a72acb971be05623ec1a51e83", "shasum": "", "mirrors": [ { @@ -3362,7 +3368,7 @@ "suggest": { "ext-event": "For better performance. " }, - "time": "2023-03-10T13:59:12+00:00", + "time": "2023-05-01T02:12:20+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index f663b46..8b12886 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'taoser/taoler', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '2aa133f33d26cc3d1dba9eb687b1744690f4026c', + 'reference' => '0c8ebe8290a2eb8d8b043782f0d3ce7bbb3b71c7', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -349,7 +349,7 @@ 'taoser/taoler' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '2aa133f33d26cc3d1dba9eb687b1744690f4026c', + 'reference' => '0c8ebe8290a2eb8d8b043782f0d3ce7bbb3b71c7', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -401,9 +401,9 @@ 'dev_requirement' => false, ), 'topthink/think-captcha' => array( - 'pretty_version' => 'v3.0.8', - 'version' => '3.0.8.0', - 'reference' => '52fba122c953995bec3013c635025172491ae299', + 'pretty_version' => 'v3.0.9', + 'version' => '3.0.9.0', + 'reference' => 'b1ef360670578214edeebcf824aaf6ab7ee0528b', 'type' => 'library', 'install_path' => __DIR__ . '/../topthink/think-captcha', 'aliases' => array(), @@ -446,9 +446,9 @@ 'dev_requirement' => false, ), 'topthink/think-orm' => array( - 'pretty_version' => 'v2.0.60', - 'version' => '2.0.60.0', - 'reference' => '8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46', + 'pretty_version' => 'v2.0.61', + 'version' => '2.0.61.0', + 'reference' => '10528ebf4a5106b19c3bac9c6deae7a67ff49de6', 'type' => 'library', 'install_path' => __DIR__ . '/../topthink/think-orm', 'aliases' => array(), @@ -509,9 +509,9 @@ 'dev_requirement' => false, ), 'workerman/workerman' => array( - 'pretty_version' => 'v4.1.9', - 'version' => '4.1.9.0', - 'reference' => '1f92d02c26106b5fbe6f61ea776198aad6e426f7', + 'pretty_version' => 'v4.1.10', + 'version' => '4.1.10.0', + 'reference' => 'e967b79f95b9251a72acb971be05623ec1a51e83', 'type' => 'library', 'install_path' => __DIR__ . '/../workerman/workerman', 'aliases' => array(), diff --git a/vendor/services.php b/vendor/services.php index 98eb61c..9db5bf1 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'taoser\\addons\\Service', diff --git a/vendor/topthink/think-captcha/composer.json b/vendor/topthink/think-captcha/composer.json index b34e19f..a20b7d0 100644 --- a/vendor/topthink/think-captcha/composer.json +++ b/vendor/topthink/think-captcha/composer.json @@ -9,7 +9,7 @@ ], "license": "Apache-2.0", "require": { - "topthink/framework": "^6.0" + "topthink/framework": "^6.0|^8.0" }, "autoload": { "psr-4": { diff --git a/vendor/topthink/think-captcha/src/Captcha.php b/vendor/topthink/think-captcha/src/Captcha.php index 9af336b..80844db 100644 --- a/vendor/topthink/think-captcha/src/Captcha.php +++ b/vendor/topthink/think-captcha/src/Captcha.php @@ -117,7 +117,7 @@ class Captcha } 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'); @@ -178,11 +178,11 @@ class Captcha // 图片高(px) $this->imageH || $this->imageH = $this->fontSize * 2.5; - $this->imageW = intval($this->imageW); - $this->imageH = intval($this->imageH); + $this->imageW = (int)$this->imageW; + $this->imageH = (int)$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]); @@ -196,7 +196,7 @@ class Captcha $dir = dir($ttfPath); $ttfs = []; 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; } } @@ -228,7 +228,7 @@ class Captcha $y = $this->fontSize + mt_rand(10, 20); $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(); @@ -257,30 +257,30 @@ class Captcha $px = $py = 0; // 曲线前部分 - $A = mt_rand(1, intval($this->imageH / 2)); // 振幅 - $b = mt_rand(intval(-$this->imageH / 4), intval($this->imageH / 4)); // Y轴方向偏移量 - $f = mt_rand(intval(-$this->imageH / 4), intval($this->imageH / 4)); // X轴方向偏移量 - $T = mt_rand($this->imageH, $this->imageW * 2); // 周期 + $A = mt_rand(1, (int)($this->imageH / 2)); // 振幅 + $b = mt_rand((int)(-$this->imageH / 4), (int)($this->imageH / 4)); // Y轴方向偏移量 + $f = mt_rand((int)(-$this->imageH / 4), (int)($this->imageH / 4)); // X轴方向偏移量 + $T = mt_rand((int)$this->imageH, (int)$this->imageW * 2); // 周期 $w = (2 * M_PI) / $T; $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) { if (0 != $w) { $py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b $i = (int) ($this->fontSize / 5); 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--; } } } // 曲线后部分 - $A = mt_rand(1, intval($this->imageH / 2)); // 振幅 - $f = mt_rand(intval(-$this->imageH / 4), intval($this->imageH / 4)); // X轴方向偏移量 - $T = mt_rand($this->imageH, $this->imageW * 2); // 周期 + $A = mt_rand(1, (int)($this->imageH / 2)); // 振幅 + $f = mt_rand((int)(-$this->imageH / 4), (int)($this->imageH / 4)); // X轴方向偏移量 + $T = mt_rand((int)$this->imageH, (int)$this->imageW * 2); // 周期 $w = (2 * M_PI) / $T; $b = $py - $A * sin($w * $px + $f) - $this->imageH / 2; $px1 = $px2; @@ -291,7 +291,7 @@ class Captcha $py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b $i = (int) ($this->fontSize / 5); 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--; } } @@ -310,7 +310,7 @@ class Captcha $noiseColor = imagecolorallocate($this->im, mt_rand(150, 225), mt_rand(150, 225), mt_rand(150, 225)); 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); // Resample $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); } } diff --git a/vendor/topthink/think-orm/src/Model.php b/vendor/topthink/think-orm/src/Model.php index 761f780..a8332e9 100644 --- a/vendor/topthink/think-orm/src/Model.php +++ b/vendor/topthink/think-orm/src/Model.php @@ -769,16 +769,20 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab $pk = $this->getPk(); - if (is_string($pk) && $replace) { - $auto = true; - } - $result = []; - $suffix = $this->getSuffix(); 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); } else { $result[$key] = static::create($data, $this->field, $this->replace, $suffix); diff --git a/vendor/topthink/think-orm/src/db/BaseQuery.php b/vendor/topthink/think-orm/src/db/BaseQuery.php index d05905c..60aa21e 100644 --- a/vendor/topthink/think-orm/src/db/BaseQuery.php +++ b/vendor/topthink/think-orm/src/db/BaseQuery.php @@ -770,10 +770,9 @@ abstract class BaseQuery * @param mixed $key 缓存key * @param integer|\DateTime $expire 缓存有效期 * @param string|array $tag 缓存标签 - * @param bool $always 始终缓存 * @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()) { return $this; @@ -784,8 +783,7 @@ abstract class BaseQuery $key = true; } - $this->options['cache'] = [$key, $expire, $tag]; - $this->options['cache_always'] = $always; + $this->options['cache'] = [$key, $expire, $tag ?: $this->getTable()]; return $this; } @@ -800,7 +798,23 @@ abstract class BaseQuery */ 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); } + /** + * 批量插入记录 + * @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方式插入记录 * @access public diff --git a/vendor/topthink/think-orm/src/db/Builder.php b/vendor/topthink/think-orm/src/db/Builder.php index a88c503..2bde77c 100644 --- a/vendor/topthink/think-orm/src/db/Builder.php +++ b/vendor/topthink/think-orm/src/db/Builder.php @@ -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 * @access public diff --git a/vendor/topthink/think-orm/src/db/PDOConnection.php b/vendor/topthink/think-orm/src/db/PDOConnection.php index 54dd9d3..8f89fe3 100644 --- a/vendor/topthink/think-orm/src/db/PDOConnection.php +++ b/vendor/topthink/think-orm/src/db/PDOConnection.php @@ -622,15 +622,14 @@ abstract class PDOConnection extends Connection * @access public * @param BaseQuery $query 查询对象 * @param string $sql sql指令 - * @param array $bind 参数绑定 * @param Model|null $model 模型对象实例 * @param null $condition 查询条件 * @return \Generator * @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)) { @@ -653,7 +652,7 @@ abstract class PDOConnection extends Connection */ 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 { - 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 * @param BaseQuery $query 查询对象 * @param mixed $sql sql指令 - * @param array $bind 参数绑定 * @param bool $master 主库读取 * @return array * @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(); + $bind = $query->getBind(); if ($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) { - return $data; + if (null !== $data) { + return $data; + } } } @@ -730,11 +731,10 @@ abstract class PDOConnection extends Connection */ public function pdo(BaseQuery $query): PDOStatement { - $bind = $query->getBind(); // 生成查询SQL $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 * @param BaseQuery $query 查询对象 * @param string $sql sql指令 - * @param array $bind 参数绑定 * @param bool $origin 是否原生查询 * @return int * @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) { $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'])) { $this->readMaster = true; @@ -844,13 +843,13 @@ abstract class PDOConnection extends Connection /** * @param BaseQuery $query * @param string $sql - * @param array $bind * @return PDOStatement * @throws DbException */ - protected function queryPDOStatement(BaseQuery $query, string $sql, array $bind = []): PDOStatement + protected function queryPDOStatement(BaseQuery $query, string $sql): PDOStatement { $options = $query->getOptions(); + $bind = $query->getBind(); $master = !empty($options['master']) ? true : false; $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; // 执行查询操作 - 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); // 执行操作 - $result = '' == $sql ? 0 : $this->pdoExecute($query, $sql, $query->getBind()); + $result = '' == $sql ? 0 : $this->pdoExecute($query, $sql); if ($result) { $sequence = $options['sequence'] ?? null; @@ -977,13 +976,12 @@ abstract class PDOConnection extends Connection */ public function insertAll(BaseQuery $query, array $dataSet = [], int $limit = 0): int { + $query->parseOptions(); + if (!is_array(reset($dataSet))) { return 0; } - $options = $query->parseOptions(); - $replace = !empty($options['replace']); - if (0 === $limit && count($dataSet) >= 5000) { $limit = 1000; } @@ -997,8 +995,8 @@ abstract class PDOConnection extends Connection $count = 0; foreach ($array as $item) { - $sql = $this->builder->insertAll($query, $item, $replace); - $count += $this->pdoExecute($query, $sql, $query->getBind()); + $sql = $this->builder->insertAll($query, $item); + $count += $this->pdoExecute($query, $sql); } // 提交事务 @@ -1011,9 +1009,56 @@ abstract class PDOConnection extends Connection 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); - 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); // 执行操作 - $result = '' == $sql ? 0 : $this->pdoExecute($query, $sql, $query->getBind()); + $result = '' == $sql ? 0 : $this->pdoExecute($query, $sql); if ($result) { $this->db->trigger('after_update', $query); @@ -1075,7 +1120,7 @@ abstract class PDOConnection extends Connection $sql = $this->builder->delete($query); // 执行操作 - $result = $this->pdoExecute($query, $sql, $query->getBind()); + $result = $this->pdoExecute($query, $sql); if ($result) { $this->db->trigger('after_delete', $query); @@ -1109,10 +1154,13 @@ abstract class PDOConnection extends Connection if (!empty($options['cache'])) { $cacheItem = $this->parseCache($query, $options['cache'], 'value'); - $key = $cacheItem->getKey(); - if ($this->cache->has($key)) { - return $this->cache->get($key); + if (!$query->getOptions('force_cache')) { + $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'])) { // 判断查询缓存 $cacheItem = $this->parseCache($query, $options['cache'], 'column'); - $name = $cacheItem->getKey(); + if (!$query->getOptions('force_cache')) { + $name = $cacheItem->getKey(); - if ($this->cache->has($name)) { - return $this->cache->get($name); + if ($this->cache->has($name)) { + return $this->cache->get($name); + } } } @@ -1545,17 +1595,16 @@ abstract class PDOConnection extends Connection * @access public * @param BaseQuery $query 查询对象 * @param array $sqlArray SQL批处理指令 - * @param array $bind 参数绑定 * @return bool */ - public function batchQuery(BaseQuery $query, array $sqlArray = [], array $bind = []): bool + public function batchQuery(BaseQuery $query, array $sqlArray = []): bool { // 自动启动事务支持 $this->startTrans(); try { foreach ($sqlArray as $sql) { - $this->pdoExecute($query, $sql, $bind); + $this->pdoExecute($query, $sql); } // 提交事务 $this->commit(); diff --git a/vendor/topthink/think-orm/src/db/builder/Mongo.php b/vendor/topthink/think-orm/src/db/builder/Mongo.php index 823156b..85ee551 100644 --- a/vendor/topthink/think-orm/src/db/builder/Mongo.php +++ b/vendor/topthink/think-orm/src/db/builder/Mongo.php @@ -111,8 +111,6 @@ class Mongo $result[$item] = $val; } elseif (isset($val[0]) && 'exp' == $val[0]) { $result[$item] = $val[1]; - } elseif (is_null($val)) { - $result[$item] = 'NULL'; } else { $result[$item] = $this->parseValue($query, $val, $key); } diff --git a/vendor/topthink/think-orm/src/db/builder/Mysql.php b/vendor/topthink/think-orm/src/db/builder/Mysql.php index d70fb90..7dda33a 100644 --- a/vendor/topthink/think-orm/src/db/builder/Mysql.php +++ b/vendor/topthink/think-orm/src/db/builder/Mysql.php @@ -12,6 +12,7 @@ declare (strict_types = 1); namespace think\db\builder; +use PDO; use think\db\Builder; use think\db\exception\DbException as Exception; use think\db\Query; @@ -146,10 +147,9 @@ class Mysql extends Builder * @access public * @param Query $query 查询对象 * @param array $dataSet 数据集 - * @param bool $replace 是否replace * @return string */ - public function insertAll(Query $query, array $dataSet, bool $replace = false): string + public function insertAll(Query $query, array $dataSet): string { $options = $query->getOptions(); @@ -183,7 +183,55 @@ class Mysql extends Builder return str_replace( ['%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->parseTable($query, $options['table']), $this->parsePartition($query, $options['partition']), diff --git a/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php b/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php index 0eab363..d137d05 100644 --- a/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php +++ b/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php @@ -49,12 +49,21 @@ trait AggregateQuery } $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') ->bind($this->bind) ->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', '*'); } else { diff --git a/vendor/workerman/workerman/Protocols/Http/ServerSentEvents.php b/vendor/workerman/workerman/Protocols/Http/ServerSentEvents.php index 7aeafc7..a6e9e0d 100644 --- a/vendor/workerman/workerman/Protocols/Http/ServerSentEvents.php +++ b/vendor/workerman/workerman/Protocols/Http/ServerSentEvents.php @@ -50,15 +50,15 @@ class ServerSentEvents if (isset($data['event'])) { $buffer .= "event: {$data['event']}\n"; } - if (isset($data['data'])) { - $buffer .= 'data: ' . \str_replace("\n", "\ndata: ", $data['data']) . "\n\n"; - } if (isset($data['id'])) { $buffer .= "id: {$data['id']}\n"; } if (isset($data['retry'])) { $buffer .= "retry: {$data['retry']}\n"; } - return $buffer; + if (isset($data['data'])) { + $buffer .= 'data: ' . str_replace("\n", "\ndata: ", $data['data']) . "\n"; + } + return $buffer . "\n"; } } \ No newline at end of file diff --git a/vendor/workerman/workerman/Protocols/Websocket.php b/vendor/workerman/workerman/Protocols/Websocket.php index 4136e4c..0f94de6 100644 --- a/vendor/workerman/workerman/Protocols/Websocket.php +++ b/vendor/workerman/workerman/Protocols/Websocket.php @@ -274,7 +274,7 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface if (\strlen($connection->context->tmpWebsocketData) > $connection->maxSendBufferSize) { if ($connection->onError) { 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) { Worker::stopAll(250, $e); } diff --git a/vendor/workerman/workerman/Protocols/Ws.php b/vendor/workerman/workerman/Protocols/Ws.php index 5ad8789..3db887e 100644 --- a/vendor/workerman/workerman/Protocols/Ws.php +++ b/vendor/workerman/workerman/Protocols/Ws.php @@ -243,7 +243,7 @@ class Ws if (\strlen($connection->context->tmpWebsocketData) > $connection->maxSendBufferSize) { if ($connection->onError) { 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) { Worker::stopAll(250, $e); } diff --git a/vendor/workerman/workerman/Worker.php b/vendor/workerman/workerman/Worker.php index a389d74..a0f926d 100644 --- a/vendor/workerman/workerman/Worker.php +++ b/vendor/workerman/workerman/Worker.php @@ -34,7 +34,7 @@ class Worker * * @var string */ - const VERSION = '4.1.9'; + const VERSION = '4.1.10'; /** * Status starting. @@ -1473,7 +1473,7 @@ class Worker \restore_error_handler(); // 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->run(); static::$globalEvent->loop(); diff --git a/view/taoler/index/article/news/cate.html b/view/taoler/index/article/news/cate.html index 7e14edd..9d23d15 100644 --- a/view/taoler/index/article/news/cate.html +++ b/view/taoler/index/article/news/cate.html @@ -17,38 +17,53 @@
- + + {/article:list} +
diff --git a/view/taoler/index/article/news/detail.html b/view/taoler/index/article/news/detail.html index 9dc5aa6..998ae2e 100644 --- a/view/taoler/index/article/news/detail.html +++ b/view/taoler/index/article/news/detail.html @@ -18,7 +18,7 @@
{//标题} -

{$article.title}

+

{$article.title}

{//作者}
diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index a878c30..4f2a4d4 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -7,7 +7,10 @@ {block name="ogdescription"}{/block} {block name="ogimage"}{/block} {block name="meta"}{/block} +{block name="link"} + +{/block} {block name="column"}{include file="public/column" /}{/block} {block name="content"}
@@ -16,24 +19,66 @@ {:hook('ads_slider')} -
+ +
    - {volist name="artTop" id="top"} - {include file="public/index-topforum" /} - {/volist} + {volist name="artTop" id="top"} + {include file="public/index-topforum" /} + {/volist}
-
+
-
-
    - {volist name="artList" id="art"} - {include file="public/index-forumlist" /} + +
    + {volist name="artList" id="article"} +
    + {if getOnepic($article.content)} +
    + + {article:title /} + +
    + {/if} +
    +
    +

    + {article:title /} +

    +
    +

    {:getArtContent($article.content)}

    +
    +
    + +
    +
    {/volist} -
+ + + +
{:lang('more post')} @@ -83,4 +128,18 @@ {/block} -{block name="script"}{/block} \ No newline at end of file +{block name="script"} + +{/block} \ No newline at end of file diff --git a/view/taoler/index/public/column.html b/view/taoler/index/public/column.html index 088afd9..aca5480 100644 --- a/view/taoler/index/public/column.html +++ b/view/taoler/index/public/column.html @@ -1,14 +1,15 @@
-
+