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)
{
$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;

View File

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

View File

@ -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, {

View File

@ -13,13 +13,13 @@
<div class="layui-form-item layui-inline">
<label class="layui-form-label">ID</label>
<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 class="layui-form-item layui-inline">
<label class="layui-form-label">用户</label>
<label class="layui-form-label">用户</label>
<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 class="layui-form-item layui-inline">
@ -35,7 +35,7 @@
<div class="layui-form-item layui-inline">
<label class="layui-form-label">邮箱</label>
<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 class="layui-form-item layui-inline">
@ -100,9 +100,9 @@
</script>
<script type="text/html" id="user-sex">
{{#if (d.sex == 1) { }}
{{#if (d.sex == 0) { }}
<span></span>
{{# }else if(d.sex == 2){ }}
{{# }else if(d.sex == 1){ }}
<span></span>
{{# } }}
</script>
@ -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,

View File

@ -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();

View File

@ -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');

View File

@ -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',

View File

@ -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);

View File

@ -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'=>''
];

36
composer.lock generated
View File

@ -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",

View File

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

View File

@ -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%;
}
}
/*列表新增*/
.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({
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({

View File

@ -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){ }}\
<div class="fly-none">您暂时没有最新消息</div>\
{{# } else { }}\

View File

@ -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": {

View File

@ -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(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?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);
return array (
0 => 'taoser\\addons\\Service',

View File

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

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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

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
* @access public

View File

@ -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();

View File

@ -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);
}

View File

@ -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']),

View File

@ -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 {

View File

@ -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";
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();

View File

@ -17,38 +17,53 @@
<div class="layui-row layui-col-space15">
<div class="layui-col-md8">
<div class="fly-panel" style="margin-bottom: 0;">
<ul class="fly-list">
{volist name="artList['data']" id="art"}
<li>
<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>
<h2><a href="{$Request.domain}{$art.url}" style="color:{$art.title_color ?? '#333'};">{$art.title}</a></h2>
<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>
<i>{$art.create_time|date='Y-m-d'}</i>
<section id="main" class="list-home list-grid list-grid-padding">
{article:list}
<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)}" width="233" height="155" alt="{article:title /}">
</a>
<span>
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
</span>
<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>
</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|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 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>
</article>
{/article:list}
</section>
<div style="text-align: center" id="pages"></div>
</div>
</div>

View File

@ -18,7 +18,7 @@
<div class="layui-col-md12 content detail">
<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">

View File

@ -7,7 +7,10 @@
{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="meta"}{/block}
{block name="link"}
<!-- 特效丶样式 -->
{/block}
{block name="column"}{include file="public/column" /}{/block}
{block name="content"}
<div class="layui-container">
@ -16,24 +19,66 @@
<!--首页幻灯-->
{:hook('ads_slider')}
<!--置顶文章-->
<div class="fly-panel">
<div class="fly-panel">
<div class="fly-panel-title fly-filter">
<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>{: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>
</div>
<ul class="fly-list">
{volist name="artTop" id="top"}
{include file="public/index-topforum" /}
{/volist}
{volist name="artTop" id="top"}
{include file="public/index-topforum" /}
{/volist}
</ul>
</div>
</div>
<!--文章列表-->
<div class="fly-panel" style="margin-bottom: 0;">
<ul class="fly-list">
{volist name="artList" id="art"}
{include file="public/index-forumlist" /}
<section id="main" class="list-home list-grid list-grid-padding">
{volist name="artList" id="article"}
<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}
</ul>
</section>
<div class="fly-panel" style="margin-bottom: 0;">
<div style="text-align: center">
<div class="laypage-main">
<a href="{$Request.domain}{:url('cate',['ename'=>'all'])}" class="laypage-next">{:lang('more post')}</a>
@ -83,4 +128,18 @@
{/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="layui-container">
<div class="layui-container fly-nav-sub">
<ul class="layui-clear">
<li class="layui-hide-xs {if ($Request.param.ename =='' && $Request.param.id =='')} layui-this {/if}" >
<a href="{$Request.domain}">{:lang('home page')}</a>
</li>
<a href="{$Request.domain}">{:lang('home page')}</a>
</li>
{volist name="subcatelist" id="vo"}
<li class="{if($vo.ename eq $Request.param.ename)}layui-this{/if}">
<a href="{$Request.domain}{:url('cate',['ename' => $vo.ename])}">{:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}</a>
</li>
{/volist}
<li {if($vo.ename eq $Request.param.ename)} class='layui-this' {/if}>
<span style="color: #8d8d8d">></span>
<a href="{$Request.domain}{:url('cate',['ename' => $vo.ename])}">{:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}</a>
</li>
{/volist}
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>
{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>

View File

@ -10,11 +10,11 @@
{//导航nav}
{taoler:nav}
<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"}
<dl class="layui-nav-child"> <!-- 二级菜单 -->
{taoler:snav}
<dd><a href="{snav:link}">{snav:name}</a></dd>
<dd><a href="{snav:link /}">{snav:name /}</a></dd>
{/taoler:snav}
</dl>
{/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')}">
<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 ($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">
<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">

View File

@ -1,27 +1,32 @@
<li>
<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>
<h2><a href="{$Request.domain}{$art.url}" style="color:{$art.title_color ?? ''};">{$art.title}</a></h2>
<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>
<ul class="fly-list">
{volist name="artList" id="art"}
<li>
<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>
<i>{$art.create_time|date='Y-m-d'}</i>
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.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> {$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>
<h2><a href="{$Request.domain}{$art.url}" style="color:{$art.title_color ?? ''};">{$art.title}</a></h2>
<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>
<i>{$art.create_time|date='Y-m-d'}</i>
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.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> {$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>
{/volist}
</dl>
<!--自定义-->
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
{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>
<!--自定义广告-->
{:hook('ads_index_rimg')}
</div>
</div>
</div>