Compare commits

...

9 Commits

Author SHA1 Message Date
taoser
78a9655d10 2.3.10 2023-08-02 19:41:11 +08:00
taoser
0c2f0154a8 修复内容加密泄露 2023-07-03 12:56:37 +08:00
taoser
74ab2ac512 comment level 2023-07-03 12:54:48 +08:00
taoser
868797f0bb nav&top 2023-07-03 12:52:34 +08:00
taoser
ac854d627d comment 2023-07-03 12:50:57 +08:00
taoser
6a735f6fc8 upload 2023-07-03 12:49:15 +08:00
taoser
d3bfb9b3c3 2.3.4 2023-05-05 12:09:57 +08:00
taoser
0c8ebe8290 2.3.3 2023-05-05 12:08:35 +08:00
taoser
0dc8798850 2.3.2 2023-05-05 12:07:11 +08:00
200 changed files with 8096 additions and 5249 deletions

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="fly,layui,前端社区">
<meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区致力于为web开发提供强劲动力">
<link rel="stylesheet" href="/static/layui/css/layui.css">
<link rel="stylesheet" href="/layui-1/css/layui.css">
<link rel="stylesheet" href="/static/res/css/global.css" charset="utf-8">
</head>
<body>
@ -22,8 +22,8 @@
</div>
<include file="./footer" />
<script src="/static/layui/jquery.min.js" charset="utf-8"></script>
<script src="/static/layui/layui.js" charset="utf-8"></script>
<script src="/layui-1/jquery.min.js" charset="utf-8"></script>
<script src="/layui-1/layui.js" charset="utf-8"></script>
<script>
layui.cache.user = {

View File

@ -168,148 +168,6 @@ abstract class BaseController
return $domain . $articleUrl;
}
/**
* 关键词
* 通过百度分词接口获取关键词或者标签
* flag 1.为word时获取分词2.为tag时获取标签
*
* @return array
*/
public function setKeywords($data)
{
$keywords = [];
// 百度分词自动生成关键词
if(!empty(config('taoler.baidu.client_id')) == true) {
//headers数组内的格式
$headers = array();
$headers[] = "Content-Type:application/json";
switch($data['flag']) {
//分词
case 'word':
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
$body = ["text" => $data['keywords']];
break;
//标签
case 'tag':
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/keyword?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
$body = ['title' => $data['keywords'], 'content'=>$data['content']];
break;
default:
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
$body = ["text" => $data['keywords']];
}
$postBody = json_encode($body);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);//设置请求头
curl_setopt($curl, CURLOPT_POSTFIELDS, $postBody);//设置请求体
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');//使用一个自定义的请求信息来代替"GET"或"HEAD"作为HTTP请求。(这个加不加没啥影响)
$datas = curl_exec($curl);
if($datas == false) {
echo '接口无法链接';
} else {
$res = stripos($datas,'error_code');
// 接收返回的数据
$dataItem = json_decode($datas);
if($res == false) {
// 数据正常
$items = $dataItem->items;
foreach($items as $item) {
switch($data['flag']) {
case 'word':
if($item->pos == 'n' && !in_array($item->item,$keywords)){
$keywords[] = $item->item;
}
break;
case 'tag':
if(!in_array($item->tag,$keywords)){
$keywords[] = $item->tag;
}
break;
default:
if($item->pos == 'n' && !in_array($item->item,$keywords)){
$keywords[] = $item->item;
}
}
}
} else {
// 接口正常但获取数据失败可能参数错误重新获取token
$url = 'https://aip.baidubce.com/oauth/2.0/token';
$post_data['grant_type'] = config('taoler.baidu.grant_type');;
$post_data['client_id'] = config('taoler.baidu.client_id');
$post_data['client_secret'] = config('taoler.baidu.client_secret');
$o = "";
foreach ( $post_data as $k => $v )
{
$o.= "$k=" . urlencode( $v ). "&" ;
}
$post_data = substr($o,0,-1);
$res = $this->request_post($url, $post_data);
// 写入token
SetArr::name('taoler')->edit([
'baidu'=> [
'access_token' => json_decode($res)->access_token,
]
]);
echo 'api接口数据错误 - ';
echo $dataItem->error_msg;
}
}
}
return $keywords;
}
// api_post接口
function request_post($url = '', $param = '')
{
if (empty($url) || empty($param)) {
return false;
}
$postUrl = $url;
$curlPost = $param;
$curl = curl_init();//初始化curl
curl_setopt($curl, CURLOPT_URL,$postUrl);//抓取指定网页
curl_setopt($curl, CURLOPT_HEADER, 0);//设置header
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($curl, CURLOPT_POST, 1);//post提交方式
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($curl);//运行curl
curl_close($curl);
return $data;
}
/**
* 标题调用百度关键词词条
*
* @return Json
*/
public function getBdiduSearchWordList($words)
{
if(empty($words)) return json(['code'=>-1,'msg'=>'null']);
$url = 'https://www.baidu.com/sugrec?prod=pc&from=pc_web&wd='.$words;
//$result = Api::urlGet($url);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$datas = curl_exec($curl);
curl_close($curl);
$data = json_decode($datas,true);
if(isset($data['g'])) {
return json(['code'=>0,'msg'=>'success','data'=>$data['g']]);
} else {
return json(['code'=>-1,'msg'=>'null']);
}
}
/**
* 上传接口
@ -318,22 +176,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;
@ -355,7 +214,6 @@ abstract class BaseController
}
//下载远程图片
private function downloadImage($url)
{
@ -470,4 +328,17 @@ abstract class BaseController
return $array;
}
/**
* 过滤字符串中表情
* @param $str string 字符串内容
* @return string
*/
public function filterEmoji(string $str): string
{
$str = preg_replace_callback('/./u', function (array $match) {
return strlen($match[0]) >= 4 ? '' : $match[0];
}, $str);
return $str;
}
}

View File

@ -337,13 +337,15 @@ class Addons extends AdminController
* @return string|Json
* @throws \Exception
*/
public function config($name)
public function config()
{
$name = input('name');
$config = get_addons_config($name);
// halt($config);
if(empty($config)) return json(['code'=>-1,'msg'=>'无配置项!无需操作']);
if(Request::isAjax()){
$params = Request::param('params/a',[],'trim');
// halt($params);
if ($params) {
foreach ($config as $k => &$v) {
if (isset($params[$k])) {
@ -369,7 +371,7 @@ class Addons extends AdminController
}
return json(['code'=>0,'msg'=>'配置成功!']);
}
//halt($config);
//模板引擎初始化
$view = ['formData'=>$config,'title'=>'title'];
View::assign($view);

View File

@ -140,14 +140,14 @@ class Comment extends AdminController
public function delete($id)
{
if(Request::isAjax()){
$arr = explode(",",$id);
foreach($arr as $v){
$comm = CommentModel::find($v);
$result = $comm->delete();
}
if($result){
try {
$arr = explode(",",$id);
foreach($arr as $v){
$comm = CommentModel::find($v);
$comm->delete();
}
return json(['code'=>0,'msg'=>'删除成功']);
}else{
} catch (\Exception $e) {
return json(['code'=>-1,'msg'=>'删除失败']);
}
}

View File

@ -12,6 +12,7 @@ namespace app\admin\controller\content;
use app\common\controller\AdminController;
use app\common\model\Article;
use app\facade\Cate;
use think\App;
use think\facade\View;
use think\facade\Request;
@ -43,7 +44,7 @@ class Forum extends AdminController
public function list()
{
$data = Request::only(['id','name','title','sec']);
$data = Request::only(['id','name','title','sec','cate_id']);
$where = [];
if (!empty($data['sec'])) {
switch ($data['sec']) {
@ -73,13 +74,17 @@ class Forum extends AdminController
$where[] = ['id', '=', $data['id']];
}
if(!empty($data['cate_id'])){
$where[] = ['cate_id', '=', $data['cate_id']];
}
if(!empty($data['name'])){
$userId = Db::name('user')->where('name',$data['name'])->value('id');
$where[] = ['user_id', '=', $userId];
}
if(!empty($data['title'])){
$where[] = ['title', 'like', $data['title'].'%'];
$where[] = ['title', 'like', '%'.$data['title'].'%'];
}
$list = $this->model->getList($where, input('limit'), input('page'));
@ -91,6 +96,7 @@ class Forum extends AdminController
'poster' => $v['user']['name'],
'avatar' => $v['user']['user_img'],
'title' => htmlspecialchars($v['title']),
'cate' => $v['cate']['catename'],
'url' => $this->getArticleUrl($v['id'], 'index', $v['cate']['ename']),
'content' => strip_tags($v['content']),
'posttime' => $v['update_time'],
@ -131,9 +137,9 @@ class Forum extends AdminController
$data['content'] = $this->downUrlPicsReaplace($data['content']);
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
$data['description'] = strip_tags($this->filterEmoji($data['description']));
// 获取分类ename,appname
$cateName = $this->model->field('ename,appname')->find($data['cate_id']);
$cateEname = Db::name('cate')->where('id',$data['cate_id'])->value('ename');
$result = $this->model->add($data);
if ($result['code'] == 1) {
@ -152,7 +158,7 @@ class Forum extends AdminController
// 清除文章tag缓存
Cache::tag('tagArtDetail')->clear();
$link = $this->getArticleUrl((int)$aid, 'index', $cateName['ename']);
$link = $this->getArticleUrl((int)$aid, 'index', $cateEname);
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
@ -163,11 +169,6 @@ class Forum extends AdminController
}
return $res;
}
//1.查询分类表获取所有分类
$cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order('sort','asc')->cache('catename',3600)->select();
//2.将catelist变量赋给模板 公共模板nav.html
View::assign('cateList',$cateList);
return View::fetch('add');
}
@ -201,7 +202,7 @@ class Forum extends AdminController
$data['content'] = $this->downUrlPicsReaplace($data['content']);
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
$data['description'] = strip_tags($this->filterEmoji($data['description']));
$result = $article->edit($data);
if($result == 1) {
//处理标签
@ -228,7 +229,7 @@ class Forum extends AdminController
}
//删除原有缓存显示编辑后内容
Cache::delete('article_'.$id);
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
$link = $this->getArticleUrl((int) $id, 'index', $article->cate->ename);
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
return Msgres::success('edit_success',$link);
}
@ -236,31 +237,24 @@ class Forum extends AdminController
}
View::assign(['article'=>$article]);
//1.查询分类表获取所有分类
$cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order('sort','asc')->cache('catename',3600)->select();
//2.将catelist变量赋给模板 公共模板nav.html
View::assign('cateList',$cateList);
return View::fetch();
}
//删除帖子
//删除帖子 多选和单独
public function delete($id)
{
if(Request::isAjax()){
$arr = explode(",",$id);
foreach($arr as $v){
$article = Article::find($v);
$result = $article->together(['comments'])->delete();
}
if($result){
return json(['code'=>0,'msg'=>'删除成功']);
}else{
return json(['code'=>-1,'msg'=>'删除失败']);
}
try {
$arr = explode(",",$id);
foreach($arr as $v){
$article = Article::find($v);
$article->together(['comments'])->delete();
}
return json(['code'=>0,'msg'=>'删除成功']);
} catch (\Exception $e) {
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}
@ -294,29 +288,6 @@ class Forum extends AdminController
return $this->uploadFiles($type);
}
/**
* 调用百度关键词
*
* @return json
*/
public function getKeywords()
{
$data = Request::only(['flag','keywords','content']);
$keywords = $this->setKeywords($data);
return json(['code'=>0, 'msg' => 'ok', 'data'=> $keywords]);
}
/**
* 标题调用百度关键词词条
* @return Json
*/
public function getWordList()
{
$title = input('title');
return $this->getBdiduSearchWordList($title);
}
/**
* 内容中是否有图片视频音频插入
*
@ -338,21 +309,9 @@ class Forum extends AdminController
return $data;
}
/**
* 获取描述过滤html
*
* @return void
*/
public function getDescription()
{
$data = Request::only(['content']);
$description = getArtContent($data['content']);
return json(['code'=>0,'data'=>$description]);
}
/**
* 分类
* 分类树
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
@ -374,6 +333,28 @@ class Forum extends AdminController
return json($tree);
}
/**
* 分类
* @return \think\response\Json
*/
public function getCateList()
{
$cateList = Cate::field('id,pid,catename,sort')->where(['status' => 1])->select()->toArray();
// 排序
$cmf_arr = array_column($cateList, 'sort');
array_multisort($cmf_arr, SORT_ASC, $cateList);
$list = getTree($cateList);
$count = count($list);
$tree = [];
if($count){
$tree = ['code'=>0, 'msg'=>'ok','count'=>$count];
$tree['data'] = $list;
}
return json($tree);
}
//array_filter过滤函数
protected function filtr($arr){
if($arr === '' || $arr === null){

View File

@ -16,6 +16,8 @@ use think\facade\Request;
use think\facade\Db;
use app\common\model\User as UserModel;
use app\common\lib\Uploads;
use app\common\validate\User as userValidate;
use think\exception\ValidateException;
class User extends AdminController
@ -79,6 +81,14 @@ class User extends AdminController
//
if(Request::isAjax()){
$data = Request::only(['name','email','user_img','password','phone','sex']);
try{
validate(userValidate::class)
->scene('userReg')
->check($data);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return json(['code'=>-1,'msg'=>$e->getError()]);
}
$data['create_time'] = time();
$salt = substr(md5($data['create_time']),-6);
// 密码
@ -100,9 +110,13 @@ class User extends AdminController
{
if(Request::isAjax()){
$data = Request::only(['id','name','email','user_img','password','phone','sex']);
$user = Db::name('user')->field('create_time')->find($data['id']);
$salt = substr(md5($user['create_time']),-6);
$data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6)); // 密码
if(empty($data['password'])) {
unset($data['password']);
} else {
$user = Db::name('user')->field('create_time')->find($data['id']);
$salt = substr(md5($user['create_time']),-6);
$data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6)); // 密码
}
try{
Db::name('user')->update($data);
return json(['code'=>0,'msg'=>'编辑成功']);

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>新增管理员</title>
<title>表单配置</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
@ -24,10 +24,10 @@
{:form_radio($name,$vo.content,['label'=>$vo.title,'tips'=>$vo.tips],$vo.value)}
{/case}
{case value="checkbox"}
{:form_checkbox($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])};
{:form_checkbox($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])}
{/case}
{case value="switch"}
{:form_switch($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])};
{:form_switch($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])}
{/case}
{case value="select"}
{:form_select($name,$vo.content,['label'=>$vo.title,'verify'=>$vo.rule,'tips'=>$vo.tips,'search'=>1] ,[],$vo.value)}
@ -66,7 +66,7 @@
<script>
layui.use(['upload','toast'], function(){
var $ = layui.$,upload = layui.upload,form = layui.form,notify=layui.notify;
//上传头像
//上传
upload.render({
elem: '.upload-select'
,url: "{:url('addon.addons/uploads')}"

View File

@ -1,11 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>修改页面</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
{extend name="public:admin_form" /}
{block name="body"}
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container">
@ -21,14 +16,20 @@
<div class="layui-input-block">
<input type="text" name="catename" lay-verify="required" placeholder="分类名*" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">EN别名</label>
<div class="layui-input-block">
<input type="text" name="ename" lay-verify="required" placeholder="英文名*" autocomplete="off" 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="icon" placeholder="图标*" id="iconPicker" lay-filter="iconPicker" style="display:none;" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">详情页模板</label>
<div class="layui-input-block">
<select name="detpl" id="tpl" lay-verify="required">
@ -37,10 +38,14 @@
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<input type="text" name="desc" lay-verify="required" placeholder="描述*" autocomplete="off" class="layui-input">
<textarea type="text" name="desc" lay-verify="required" placeholder="描述*" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-block">
<input type="text" name="sort" lay-verify="number|required" placeholder="请填数字" autocomplete="off" class="layui-input">
@ -61,8 +66,9 @@
</div>
</div>
</form>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
{/block}
{block name="js"}
<script>
layui.use(['form', 'iconPicker', 'xmSelect',], function(){
var $ = layui.jquery
@ -98,9 +104,9 @@
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layui.table.reload("cate-table");
// parent.layui.table.reload("cate-table");
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
window.parent.location.reload();
});
} else {
layer.msg(result.msg, {
@ -201,5 +207,4 @@
})
</script>
</body>
</html>
{/block}

View File

@ -1,11 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>修改页面</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
{extend name="public:admin_form" /}
{block name="body"}
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container">
@ -47,7 +42,7 @@
<div class="layui-form-item">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<input type="text" name="desc" lay-verify="required" value="{$cate.desc}" placeholder="描述*" autocomplete="off" class="layui-input">
<textarea type="text" name="desc" lay-verify="required" value="{$cate.desc}" placeholder="描述*" autocomplete="off" class="layui-textarea">{$cate.desc}</textarea>
</div>
</div>
<div class="layui-form-item">
@ -74,8 +69,9 @@
</div>
</div>
</form>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
{/block}
{block name="js"}
<script>
layui.use(['form', 'iconPicker', 'xmSelect',], function(){
var $ = layui.jquery
@ -83,8 +79,7 @@
var iconPicker = layui.iconPicker;
var xmSelect = layui.xmSelect;
var initPid = "{$cate.pid}";
let ADD_EDIT = "{:url('content.cate/addEdit')}";
let ADD_EDIT = "{:url('content.cate/addEdit')}";
//初始化图标选择
iconPicker.render({
@ -111,9 +106,8 @@
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layui.table.reload("cate-table");
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
window.parent.location.reload();
});
} else {
layer.msg(result.msg, {
@ -166,5 +160,4 @@
})
</script>
</body>
</html>
{/block}

View File

@ -146,7 +146,7 @@
type: 2,
title: '新增',
shade: 0.1,
area: ['450px', '500px'],
area: ['550px', '650px'],
content: 'addEdit.html'
});
}
@ -156,7 +156,7 @@
type: 2,
title: '修改',
shade: 0.1,
area: ['450px', '500px'],
area: ['550px', '650px'],
content: 'addEdit.html?id=' + obj.data.id
});
}

View File

@ -130,7 +130,10 @@
form.on('submit(comment-query)', function(data) {
table.reload('comment-table', {
where: data.field
where: data.field,
page: {
curr: 1 //重新从第 1 页开始
}
})
return false;
});
@ -148,7 +151,7 @@
data:{id:data.id,status:status},
dataType:'json',
success:function(res){
if(res.code == 0){
if(res.code === 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
@ -225,7 +228,7 @@
data:{"id":checkIds},
success: function(result) {
layer.close(loading);
if (result.success) {
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
@ -244,7 +247,7 @@
}
window.refresh = function(param) {
table.reload('user-table');
table.reload('comment-table');
}

View File

@ -4,6 +4,12 @@
<meta charset="UTF-8">
<title>新增帖子</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
<style>
#L_title {position: relative;}
.bdsug {height: auto; position: absolute; left: 0; top: 30px; z-index: 100; background: #fff; border-radius: 0 0 10px 10px; border: 1px solid #dadade!important; border-top: 0!important; box-shadow: none;}
.bdsug ul{display: block;margin: 5px 2px 0; padding: 5px 0 7px; background: 0 0; border-top: 0px solid #f5f5f6;}
.bdsug ul>li{margin-top: 0;height:30px;line-height: 25px;}
</style>
</head>
<body>
<form class="layui-form" action="">
@ -13,12 +19,7 @@
<div class="layui-col-md3">
<label class="layui-form-label">{:lang('special column')}</label>
<div class="layui-input-block">
<select lay-verify="required" name="cate_id" lay-filter="column">
<option></option>
{volist name="cateList" id="cate"}
<option value="{$cate.id}" {if ($Request.param.cate == $cate.ename)} selected {/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
{/volist}
</select>
<div id="CateId" class="xm-select-demo"></div>
</div>
</div>
<div class="layui-col-md8">
@ -26,10 +27,6 @@
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" style="position:relative;" value=""/>
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" />
<div class="layui-input bdsug layui-hide">
<ul class="wordlist">
</ul>
</div>
</div>
</div>
<div class="layui-col-md1">
@ -39,7 +36,7 @@
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="" placeholder="{:lang('please input the content')}" class="layui-textarea"> </textarea>
<textarea id="L_content" name="content" lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea taonyeditor"> </textarea>
</div>
</div>
<div class="layui-form-item layui-inline">
@ -88,38 +85,40 @@
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/static/xm-select.js"></script>
<script>
layui.extend({
editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
}).use(["form", "colorpicker", "upload",'editor','xmSelect'], function () {
layui.use(["form", "colorpicker", "upload",'xmSelect'], function () {
var $ = layui.jquery, form = layui.form, colorpicker = layui.colorpicker, upload = layui.upload;
var editor = layui.editor;
var xmSelect = layui.xmSelect;
editor.render({
selector: 'textarea#L_content',
uploadUrl: "{:url('content.forum/uploads')}",
imagePrependUrl: "{$domain}"
// 分类选择
$.get("{:url('content.forum/getCateList')}",function(res){
// 渲染下拉树
xmSelect.render({
el: '#CateId',
name: 'cate_id',
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: res.data,
initValue: [res.data[0].id],
model: {label: {type: 'text'}},
prop: {
name: 'catename',
value: 'id'
},
radio: true,
clickClose: true,
tree: {
show: true,
indent: 15,
strict: false,
expandedKeys: true
},
tips: '请选择'
});
});
//获取百度标签标志tag或者word;
var flag = 'word';
// 从详情页自动调用端口过滤,获取描述信息
tinymce.get('L_content').on('mouseleave', function() {
var content = tinymce.get('L_content').getContent({format: 'text'});
content = content.replace(/[\r\n]/g,"").replace(/\n/g, '').replace(/\s/g, '').replace(/\t/g, '');
if(content.length >200) {
content = content.substring(0,200);
}
// var test = tinymce.activeEditor.getContent({format: 'text'});
$('[name="description"]').val(content);
});
// tag标签
$(function(){
//1.渲染标签
@ -143,70 +142,17 @@
});
})
// 通过接口自动获取tag的内容
var conf = "{:empty(config('taoler.baidu.client_id'))}";
if (conf !== "1") {
$("#L_title").on("blur", function () {
var title = $(this).val();
var content = $("#L_content").val();
$.ajax({
type: "post",
url: "{:url('content.forum/getKeywords')}",
data: { keywords: title, content:content, flag: flag },
daType: "json",
success: function (data) {
if (data.code === 0) {
$("input[name='keywords']").val(data.data.join(','));
}
},
});
});
}
// 百度词条
var baidu_title_switch = "{:config('taoler.config.baidu_title_switch')}";
if(baidu_title_switch === 1) {
$("#L_title").bind('input propertychange',function () {
var title = $(this).val();
var str = '';
if(title.length > 0 ) {
$.post("{:url('content.forum/getWordList')}",{title:title},function(res){
// 动态生成ur>li内容
if (res.code === 0) {
// 显示动态框
$(".bdsug").removeClass('layui-hide');
for (var i = 0; i < res.data.length; i++) {
//str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q.replace(title,'') + '</b></li>';
str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q + '</b></li>';
}
// 清空ul并追加li
$('.wordlist').empty().append(str);
// 点击李获取li值并复制给#L_title input的value
$(".bdsug li").on('click',function(){
var word = $(this).attr('data-key');
var words = title + '(' + word + ')';
$("#L_title").val(words);
// 关闭动态框
$(".bdsug").addClass('layui-hide');
});
} else {
$(".bdsug").addClass('layui-hide');
}
});
} else {
$(".bdsug").addClass('layui-hide');
}
});
}
//上传附件
upload.render({
elem: "#zip-button",
url: "{:url('content.forum/uploads')}", //改成您自己的上传接口
data: { type: "zip" },
accept: "file", //普通文件
accept: "file",
before: function(obj){
layer.load();
},
done: function (res) {
layer.closeAll('loading');
if (res.status === 0) {
$('input[name="upzip"]').val(res.url);
layer.msg("上传成功");
@ -241,9 +187,8 @@
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layui.table.reload("user-table");
parent.layui.table.reload("forum-table");
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
});
} else {
layer.msg(result.msg, {
@ -258,5 +203,10 @@
});
</script>
{:hook('taonyeditor')}
{// 百度标题词条}
{:hook('seoBaiduTitle')}
{// 百度关键词}
{:hook('seoBaiduKeywords')}
</body>
</html>

View File

@ -4,6 +4,12 @@
<meta charset="UTF-8">
<title>修改页面</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
<style>
#L_title {position: relative;}
.bdsug {height: auto; position: absolute; left: 0; top: 30px; z-index: 100; background: #fff; border-radius: 0 0 10px 10px; border: 1px solid #dadade!important; border-top: 0!important; box-shadow: none;}
.bdsug ul{display: block;margin: 5px 2px 0; padding: 5px 0 7px; background: 0 0; border-top: 0px solid #f5f5f6;}
.bdsug ul>li{margin-top: 0;height:30px;line-height: 25px;}
</style>
</head>
<body>
<form class="layui-form" action="">
@ -14,12 +20,7 @@
<div class="layui-col-md3">
<label class="layui-form-label">{:lang('special column')}</label>
<div class="layui-input-block">
<select lay-verify="required" name="cate_id" lay-filter="column">
<option></option>
{volist name="cateList" id="cate"}
<option value="{$cate.id}" {if $article.cate_id == $cate.id} selected {/if}> {:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
{/volist}
</select>
<div id="CateId" class="xm-select-demo"></div>
</div>
</div>
<div class="layui-col-md8">
@ -37,7 +38,7 @@
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea">{$article.content}</textarea>
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea taonyeditor">{$article.content}</textarea>
</div>
</div>
<div class="layui-form-item">
@ -89,27 +90,15 @@
</form>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/static/xm-select.js"></script>
<script>
layui.extend({
editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
}).use(['colorpicker','form','upload', 'editor'], function(){
layui.use(['colorpicker','form','upload','xmSelect'], function(){
var $ = layui.jquery
,colorpicker = layui.colorpicker
,form = layui.form
,upload = layui.upload;
var artId = "{$article.id}";
var editor = layui.editor;
// 初始化编辑器
editor.render({
selector: 'textarea#L_content',
uploadUrl: "{:url('content.forum/uploads')}",
imagePrependUrl: "{$domain}"
});
var xmSelect = layui.xmSelect;
$(function(){
//1.渲染标签
@ -141,54 +130,35 @@
});
})
// 从详情页自动调用端口过滤,获取描述信息
tinymce.get('L_content').on('mouseleave', function() {
var content = tinymce.get('L_content').getContent({format: 'text'});
content = content.replace(/[\r\n]/g,"").replace(/\n/g, '').replace(/\s/g, '').replace(/\t/g, '');
if(content.length >200) {
content = content.substring(0,200);
}
// var test = tinymce.activeEditor.getContent({format: 'text'});
$('[name="description"]').val(content);
});
// 获取描述的内容
$("#L_content").bind('input propertychange', function(){
var content = $(this).val()
$.ajax({
type:"post",
url:"{:url('content.forum/getDescription')}",
data:{"content":content},
daType:"json",
success:function (data){
if (data.code == 0) {
$('[name="description"]').val(data.data);
}
}
// 分类选择
$.get("{:url('content.forum/getCateList')}",function(res){
var INITCID = "{$article.cate_id}";
// 渲染下拉树
xmSelect.render({
el: '#CateId',
name: 'cate_id',
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: res.data,
initValue: [INITCID],
model: {label: {type: 'text'}},
prop: {
name: 'catename',
value: 'id'
},
radio: true,
clickClose: true,
tree: {
show: true,
indent: 15,
strict: false,
expandedKeys: true
},
tips: '请选择'
});
return false;
})
// 获取tag的内容
var conf = "{:empty(config('taoler.baidu.client_id'))}";
if(conf !== '1'){
$("#L_title").on('blur', function(){
var title = $(this).val();
var flag = 'on';
$.ajax({
type:"post",
url:"{:url('content.forum/getKeywords')}",
data:{"keywords":keywords,"flag":flag},
daType:"json",
success:function (data){
if (data.code === 0) {
$("input[name='keywords']").val("");
}
}
});
return false;
})
}
});
//预定义颜色项
colorpicker.render({
@ -208,8 +178,12 @@
elem: '#zip-button'
,url: "{:url('content.forum/uploads')}" //改成您自己的上传接口
,data: {type:'zip'}
,accept: 'file' //普通文件
,done: function(res){
,accept: 'file',
before: function(obj){
layer.load();
},
done: function(res){
layer.closeAll('loading');
if(res.status === 0){
$('input[name="upzip"]').val(res.url);
layer.msg('上传成功');
@ -232,9 +206,8 @@
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layui.table.reload("user-table");
parent.layui.table.reload("forum-table");
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
});
} else {
layer.msg(result.msg, {
@ -249,5 +222,10 @@
});
</script>
{:hook('taonyeditor')}
{// 百度标题词条}
{:hook('seoBaiduTitle')}
{// 百度关键词}
{:hook('seoBaiduKeywords')}
</body>
</html>

View File

@ -9,26 +9,32 @@
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-form-item layui-inline">
<div class="layui-row layui-col-space15 ">
<div class="layui-col-md3">
<label class="layui-form-label">选择类目</label>
<div class="layui-input-block">
<div id="CateId" class="xm-select-demo"></div>
</div>
</div>
<div class="layui-col-md3">
<label class="layui-form-label">帖子ID</label>
<div class="layui-input-block">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<div class="layui-col-md3">
<label class="layui-form-label">发帖人</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<div class="layui-col-md3">
<label class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<div class="layui-col-md3">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<select name="sec">
@ -42,7 +48,7 @@
</select>
</div>
</div>
<div class="layui-form-item layui-inline">
<div class="layui-col-md3">
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="forum-query">
<i class="layui-icon layui-icon-search"></i>
查询
@ -100,12 +106,13 @@
<script>
const FORUM_List = "{:url('content.forum/list')}";
layui.use(['toast','jquery','form', 'table','common'], function(){
layui.use(['toast','jquery','form', 'table','common','xmSelect'], function(){
var $ = layui.jquery
,form = layui.form
,table = layui.table;
let common = layui.common;
var toast = layui.toast;
var xmSelect = layui.xmSelect;
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
@ -120,6 +127,7 @@
,{field: 'avatar', title: '头像', width: 60, templet: '#avatarTpl'}
,{field: 'poster', title: '账号',width: 80}
,{field: 'title', title: '标题', minWidth: 180,templet: '<div><a href="{{- d.url }}" target="_blank">{{- d.title }}</a></div>'}
,{field: 'cate', title: '类别', width: 120}
,{field: 'content', title: '内容', 'escape':false, minWidth: 200}
,{field: 'posttime', title: '时间',width: 120, sort: true}
,{field: 'top', title: '置顶', templet: '#forum-istop', width: 80, align: 'center'}
@ -144,6 +152,38 @@
}, 'filter', 'print', 'exports']
});
// 动态分类
function getSelectCate() {
// 分类选择
$.get("{:url('content.forum/getCateList')}", function(res){
// 渲染下拉树
xmSelect.render({
el: '#CateId',
name: 'cate_id',
height: '250px',
layVerify: '',
layVerType: 'tips',
data: res.data,
initValue: [],
model: {label: {type: 'text'}},
prop: {
name: 'catename',
value: 'id'
},
radio: true,
clickClose: true,
tree: {
show: true,
indent: 15,
strict: false,
expandedKeys: true
},
tips: '请选择'
});
});
}
getSelectCate();
table.on('tool(forum-table)', function(obj) {
if (obj.event === 'remove') {
window.remove(obj);
@ -164,7 +204,10 @@
form.on('submit(forum-query)', function(data) {
table.reload('forum-table', {
where: data.field
where: data.field,
page: {
curr: 1 //重新从第 1 页开始
}
})
return false;
});
@ -269,9 +312,7 @@
}
window.batchRemove = function(obj) {
var checkIds = common.checkField(obj,'id');
if (checkIds === "") {
layer.msg("未选中数据", {
icon: 3,
@ -280,25 +321,25 @@
return false;
}
layer.confirm('确定要删除这些用户', {
layer.confirm('确定要删除?', {
icon: 3,
title: '提示'
}, function(index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "{:url('system.admin/delete')}",
url: "{:url('content.forum/delete')}?id=" + checkIds,
dataType: 'json',
type: 'delete',
data:{"id":checkIds},
success: function(result) {
layer.close(loading);
if (result.success) {
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
table.reload('user-table');
table.reload('forum-table');
});
} else {
layer.msg(result.msg, {
@ -312,7 +353,7 @@
}
window.refresh = function(param) {
table.reload('user-table');
table.reload('forum-table');
}
});

View File

@ -82,8 +82,8 @@
table.reload('tag-link', {
where: {tag: data.value}
,page: {
curr: 1 //重新从第 1 页开始
}
curr: 1 //重新从第 1 页开始
}
});
});

File diff suppressed because it is too large Load Diff

View File

@ -108,7 +108,7 @@
<div class="layui-col-md6 layui-col-sm6 layui-col-xs6">
<div class="pear-card2">
<div class="title">待审文章</div>
<div class="count pear-text">14</div>
<div class="count pear-text">0</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6 layui-col-xs6">

View File

@ -98,13 +98,13 @@
<li class="layui-col-xs6">
<a lay-href="javascript:;" class="layadmin-backlog-body">
<h3>待审商品</h3>
<p><cite>99</cite></p>
<p><cite>0</cite></p>
</a>
</li>
<li class="layui-col-xs6">
<a href="javascript:;" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
<h3>待发货</h3>
<p><cite>20</cite></p>
<p><cite>0</cite></p>
</a>
</li>
</ul>

View File

@ -243,11 +243,18 @@
</div>
<hr>
<div class="layui-form-item">
<label class="layui-form-label">百度词条</label>
<label class="layui-form-label">菜单位置</label>
<div class="layui-input-inline" style="width: 60px;">
<input type="checkbox" name="baidu_title_switch" lay-skin="switch" lay-text="开启|关闭" value=1 {if config('taoler.config.baidu_title_switch') == 1} checked {/if}>
<input type="checkbox" name="nav_top" lay-skin="switch" lay-text="顶部|子栏" value=1 {if config('taoler.config.nav_top') == 1} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">发文章标题引用百度词条</div>
<div class="layui-form-mid layui-word-aux">导航菜单在顶部或第二栏显示</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">置顶模式:</label>
<div class="layui-input-inline" style="width: 60px;">
<input type="checkbox" name="top_show" lay-skin="switch" lay-text="列表|滚动" value=1 {if config('taoler.config.top_show') == 1} checked {/if}>
</div>
<div class="layui-form-mid layui-word-aux">置顶帖子列表或滚动显示</div>
</div>
<hr>
{if hook('mailserveractivehook')}
@ -412,8 +419,6 @@
}
});
// 获取描述的内容
$("input[name='article_as']").bind('input propertychange', function(){
var content = $(this).val()

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>
@ -90,8 +85,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

@ -76,6 +76,7 @@
layui.use(['form', 'jquery'], function() {
let form = layui.form;
let $ = layui.jquery;
let upload = layui.upload;
form.on('submit(user-save)', function(data) {
$.ajax({
@ -90,8 +91,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, {
@ -103,6 +104,33 @@
})
return false;
});
//上传头像
upload.render({
elem: '#layuiadmin-upload-useradmin'
,url: "{:url('user.user/uploadImg')}"
,data: {type:'image'}
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.src);
if(res.code === 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
})
</script>
<script>

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,
@ -212,8 +212,7 @@
{
title: '注册',
field: 'jointime',
align: 'center',
templet: '#user-createTime'
align: 'center'
},
{
title: '操作',

View File

@ -79,12 +79,14 @@ if(!function_exists('getUserImg'))
function getArtContent($content)
{
//过滤html标签
$content = strip_tags($content);
// $content = strip_tags($content);
// 去除所有& nbsp和html标签
$content = preg_replace("/(\s|\&nbsp\;|\&ldquo\;|\&rdquo\;| |\xc2\xa0)/", "", strip_tags($content));
// 过滤音视频图片
$content = preg_replace('/(?:img|audio|video)(\(\S+\))?\[\S+\]/','',$content);
$content = preg_replace('/\s*/','',$content);
$content = preg_replace('/\[[^\]]+\]/','',$content);
return mb_substr(strip_tags($content),0,150).'...';
return mb_substr($content,0,150).'...';
}
//根据帖子收藏主键ID查询帖子名称
@ -251,42 +253,66 @@ function getSpaceNmu($level)
return str_repeat('---',$level);
}
//链接投放开关,有设置则打开
function showSlider($type)
{
$sliders = new \app\common\model\Slider();
$sliderArr = $sliders->getSliderList($type);
if(!empty($sliderArr)) {
return true;
} else {
return false;
}
}
//提取内容第一张图片
function getOnepic($str)
{
//匹配格式为 <img src="http://img.com" />
$pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern,$str,$matchContent);
if(isset($matchContent[1][0])){
$img = $matchContent[1][0];
} else {
//$temp="./images/no-image.jpg";//在相应位置放置一张命名为no-image的jpg图片
preg_match($pattern,$str,$matchContent);
if(isset($matchContent[1])){
$img = $matchContent[1];
} else {
//$temp="./images/no-image.jpg";//在相应位置放置一张命名为no-image的jpg图片
//匹配格式为 img[/storage/1/article_pic/20220428/6c2647d24d5ca2c179e4a5b76990c00c.jpg]
$pattern = "/(?<=img\[)[^\]]*(?=\])/";
preg_match($pattern,$str,$matchContent);
if(isset($matchContent[0])){
$img = $matchContent[0];
}else{
return false;
}
//匹配格式为 img[/storage/1/article_pic/20220428/6c2647d24d5ca2c179e4a5b76990c00c.jpg]
$pattern = "/(?<=img\[)[^\]]*(?=\])/";
preg_match($pattern,$str,$matchContent);
if(isset($matchContent[0])){
$img = $matchContent[0];
}else{
return false;
}
}
return $img;
}
if (!function_exists('get_all_img')) {
/**
* 提取字符串中所有图片
* @param $str
* @return array
*/
function get_all_img($str)
{
//匹配格式为 <img src="http://img.com" />的图片
$pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern, $str,$matchContent);
if(isset($matchContent[1][0])) {
return array_unique($matchContent[1]);
}
return [];
}
}
if (!function_exists('get_all_video')) {
/**
* 提取字符串中所有图片
* @param $str
* @return array
*/
function get_all_video($str)
{
//匹配格式为 <video src="http://img.com" > </video> 的视频
$pattern = "/<[video|VIDEO][\s\S]*src=[\'|\"](.*?(?:[\.mp4|\.mkv|\.flv|\.avi]))[\'|\"].*?[<\/video]>/";
preg_match_all($pattern, $str,$matchs);
if(isset($matchs[1][0])) {
return array_unique($matchs[1]);
}
return [];
}
}
//判断蜘蛛函数
function find_spider(){
$useragent = strtolower(empty($useragent) ? Request::header('USER_AGENT') : '');

View File

@ -17,9 +17,7 @@ use think\facade\View;
use think\facade\Db;
use think\facade\Session;
use think\facade\Cache;
use app\facade\Article;
use app\BaseController as BaseCtrl;
use app\common\model\Cate;
/**
* 控制器基础类
@ -40,8 +38,6 @@ class BaseController extends BaseCtrl
//变量赋给模板
View::assign([
//显示分类导航
'cateList' => $this->showNav(),
//显示子分类导航
'subcatelist' => $this->showSubnav(),
//当前登录用户
@ -66,28 +62,14 @@ class BaseController extends BaseCtrl
}
}
// 显示导航nav
protected function showNav()
{
//1.查询分类表获取所有分类
$cate = new Cate();
$cateList = $cate->menu();
$list = getTree($cateList);
// 排序
$cmf_arr = array_column($list, 'sort');
array_multisort($cmf_arr, SORT_ASC, $list);
return $list;
}
// 显示子导航subnav
protected function showSubnav()
{
// 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();
@ -146,21 +128,11 @@ class BaseController extends BaseCtrl
{
//1.查询分类表获取所有分类
$sysInfo = $this->getSystem();
$slider = new \app\common\model\Slider();
//头部链接
$head_links = $slider->getSliderList(10);
//页脚链接
$foot_links = $slider->getSliderList(11);
//友情链接
$friend_links = $slider->getSliderList(9);
//获取热门标签
$hotTag = $this->getHotTag();
$assign = [
'sysInfo' => $sysInfo,
'headlinks' => $head_links,
'footlinks' => $foot_links,
'flinks' => $friend_links,
'hotTag' => $hotTag,
'host' => Request::domain() . '/'
];

View File

@ -68,9 +68,18 @@ class Arts
*/
public function setKeywords(string $flag,string $title,string $content) :array
{
// 获取seo插件配置
$conf = get_addons_config('seo');
$keywords = [];
// seo插件配置
$addon = get_addons_instance('seo');
$config = $addon->getConfig();
$seo_token = $config['baidufenci']['access_token'];
// 百度分词自动生成关键词
if(!empty(config('taoler.baidu.client_id'))) {
if(!empty($seo_token)) {
//headers数组内的格式
$headers = [];
$headers[] = "Content-Type:application/json";
@ -78,16 +87,16 @@ class Arts
switch($flag) {
//分词
case 'word':
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.$seo_token;
$body = ["text" => $title];
break;
//标签
case 'tag':
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/keyword?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/keyword?charset=UTF-8&access_token='.$seo_token;
$body = ['title' => $title, 'content' => $content];
break;
default:
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.$seo_token;
$body = ["text" => $title];
}
@ -131,9 +140,9 @@ class Arts
} else {
// 接口正常但获取数据失败可能参数错误重新获取token
$url = 'https://aip.baidubce.com/oauth/2.0/token';
$post_data['grant_type'] = config('taoler.baidu.grant_type');;
$post_data['client_id'] = config('taoler.baidu.client_id');
$post_data['client_secret'] = config('taoler.baidu.client_secret');
$post_data['grant_type'] = $config['baidufenci']['grant_type'];;
$post_data['client_id'] = $config['baidufenci']['client_id'];
$post_data['client_secret'] = $config['baidufenci']['client_secret'];
$o = "";
foreach ( $post_data as $k => $v )
@ -142,12 +151,11 @@ class Arts
}
$post_data = substr($o,0,-1);
$res = $this->request_post($url, $post_data);
// 写入token
SetArr::name('taoler')->edit([
'baidu'=> [
'access_token' => json_decode($res)->access_token,
]
]);
// 保存token
$conf['baidufenci']['value']['access_token'] = json_decode($res)->access_token;
set_addons_config('seo', $conf);
echo 'api接口数据错误 - ';
echo $dataItem->error_msg;
}
@ -210,8 +218,11 @@ class Arts
*/
public function baiduPushUrl(string $link)
{
// seo插件配置
$addon = get_addons_instance('seo');
$config = $addon->getConfig();
// baidu 接口
$api = config('taoler.baidu.push_api');
$api = $config['baidupush']['push_api'];
if(!empty($api)) {
$url[] = $link;
$ch = curl_init();

View File

@ -4,6 +4,7 @@ declare (strict_types = 1);
namespace app\common\lib;
use think\facade\Lang;
use think\Response;
class Msgres
{
@ -66,13 +67,13 @@ class Msgres
}
/**
* 成功提示
* @param string $strMsg
* @param string|null $url
* @param string $data
* @return string|\think\response\Json
* @param array|$data
* @return Response
*/
public static function success(string $strMsg = '',string $url = null, $data = '') {
public static function success(string $strMsg = '',string $url = null, array $data = []): Response
{
$result = [
'code' => self::getCode('success'),
'msg' => self::getMsg($strMsg),

View File

@ -93,7 +93,7 @@ class Uploads
}
// 解析存储位置 SYS_开头为系统位置
$isSys = stripos($dirName, 'SYS_');
if($isSys !== false) {
if($isSys) {
$disk = 'sys';
$dirName = substr($dirName,4);
$uploadDir = Config::get('filesystem.disks.sys.url');
@ -105,7 +105,7 @@ class Uploads
$rules = ['md5','date','sha1','uniqid'];
// 解析是否自定义文件名
if(!in_array($rule, $rules) && !is_null($rule)) {
if(stripos($rule, '.') == false) {
if(!stripos($rule, '.')) {
$rule = $file->getOriginalName();
}
$savename = Filesystem::disk($disk)->putFileAs($dirName, $file, $rule);
@ -160,7 +160,7 @@ class Uploads
// 解析存储位置 SYS_开头为系统位置
$isSys = stripos($dirName, 'SYS_');
if($isSys !== false) {
if($isSys) {
$disk = 'sys';
$dirName = substr($dirName,4);
$uploadDir = Config::get('filesystem.disks.sys.url');

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,read_type,art_pass')
->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,art_pass')
->with([
'cate' => function($query){
$query->where('delete_time',0)->field('id,catename,ename,detpl');
@ -247,7 +247,7 @@ class Article extends Model
$where[] = ['status', '=', 1];
return Cache::remember('cate_list_'.$ename.$type.$page, function() use($where,$page){
return $this::field('id,cate_id,user_id,title,content,title_color,create_time,is_top,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type')
return $this::field('id,cate_id,user_id,title,content,title_color,create_time,is_top,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type,art_pass')
->with([
'cate' => function($query) {
$query->field('id,catename,ename');
@ -383,14 +383,17 @@ class Article extends Model
// 获取所有帖子内容
public function getList(array $where, int $limit, int $page)
{
return $this::field('id,user_id,cate_id,title,content,is_top,is_hot,is_reply,status,update_time')->with([
return $this::field('id,user_id,cate_id,title,content,is_top,is_hot,is_reply,status,update_time,read_type,art_pass')
->with([
'user' => function($query){
$query->field('id,name,user_img');
},
'cate' => function($query){
$query->field('id,ename');
$query->field('id,ename,catename');
}
])->where($where)
])
->where(['status' => 1])
->where($where)
->order('create_time', 'desc')
->paginate([
'list_rows' => $limit,
@ -408,5 +411,15 @@ class Article extends Model
return (string) url('article_detail',['id' => $data['id']]);
}
// 内容是否加密
public function getContentAttr($value, $data)
{
//解密
if($data['read_type'] == 1 && (session('art_pass_'.$data['id']) !== $data['art_pass'])) {
return '内容已加密!请输入正确密码查看!';
}
return $value;
}
}

View File

@ -46,6 +46,12 @@ class Cate extends Model
return $this->field('ename,catename')->where('pid', $this::where('ename', $ename)->value('id'))->select();
}
// 查询兄弟分类
public function getBrotherCate(string $ename)
{
return $this->field('id,ename,catename')->where('pid', $this::where('ename', $ename)->value('pid'))->append(['url'])->order('sort asc')->select();
}
/**
* 删除分类
* @param $id
@ -93,6 +99,24 @@ class Cate extends Model
}
// 分类导航菜单
public function getNav()
{
try {
$cateList = $this->where(['status' => 1])
->cache('catename', 3600)
->append(['url'])
->select()
->toArray();
// 排序
$cmf_arr = array_column($cateList, 'sort');
array_multisort($cmf_arr, SORT_ASC, $cateList);
return getTree($cateList);
} catch (DbException $e) {
return $e->getMessage();
}
}
// 获取url
public function getUrlAttr($value,$data)
{

View File

@ -35,11 +35,36 @@ class Comment extends Model
//获取评论
public function getComment($id, $page)
{
return $this::with(['user'])
$comment = $this::withTrashed()->with(['user'=>function($query){
$query->field('id,name,user_img,sign,city,vip');
}])
->where(['article_id'=>(int)$id,'status'=>1])
->order(['cai'=>'asc','create_time'=>'asc'])
->paginate(['list_rows'=>10, 'page'=>$page])
// ->paginate(['list_rows'=>10, 'page'=>$page])
->append(['touser'])
->select()
->toArray();
foreach ($comment as $k => $v)
{
if(empty($v['content'])){
unset($comment[$k]);
}
}
if(count($comment)) {
$data['data'] = getTree($comment);
$data['total'] = count($data['data']);
$arr = array_chunk($data['data'], 10);
//当前页
$page = $page - 1;
return ['total' => $data['total'], 'data' => $arr[$page]];
} else {
return ['total' => 0, 'data' => ''];
}
}
//回帖榜
@ -155,4 +180,35 @@ class Comment extends Model
}
}
// 获取to_user_id
public function getTouserAttr($value,$data)
{
if(isset($data['to_user_id'])) {
return User::where('id', $data['to_user_id'])->value('name');
}
return '';
}
/**
* 评论没有被删除正常显示
* 评论被删除,但它下面有跟评时自身会显示为“评论已删除”,跟评会显示,无跟评且已删除则不显示
* @param $value
* @param $data
* @return string
*/
public function getContentAttr($value,$data)
{
if($data['delete_time'] == 0) {
return $value;
} else {
if($this::getByPid($data['id'])) {
return '<span style="text-decoration:line-through;">评论已删除</span>';
} else {
return '';
}
}
}
}

View File

@ -51,9 +51,9 @@ class User extends Model
public function login($data)
{
//查询使用邮箱或者用户名登陆
$user = $this::whereOr('email',$data['name'])->whereOr('name',$data['name'])->findOrEmpty();
$user = $this::whereOr('phone',$data['name'])->whereOr('email',$data['name'])->whereOr('name',$data['name'])->findOrEmpty();
if(!($user->isEmpty())){
if(!$user->isEmpty()){
//被禁用和待审核
if($user['status'] == -1){
return Lang::get('Account disabled');

View File

@ -11,34 +11,27 @@
namespace app\common\model;
use think\Model;
//use think\model\concern\SoftDelete;
class UserZan extends Model
{
protected $autoWriteTimestamp = true; //开启自动时间戳
protected $createTime = 'create_time';
//软删除
//use SoftDelete;
//protected $deleteTime = 'delete_time';
//protected $defaultSoftDelete = 0;
public function comment()
{
//评论关联文章
//关联评论
return $this->belongsTo('Comment','comment_id','id');
}
public function user()
{
//评论关联用户
//关联用户
return $this->belongsTo('User','user_id','id');
}
public function article()
{
//评论关联用户
//关联文章
return $this->belongsTo(Article::class);
}

View File

@ -8,12 +8,11 @@
* @FilePath: \TaoLer\app\common\taglib\Article.php
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
*/
//declare (strict_types = 1);
declare (strict_types = 1);
namespace app\common\taglib;
use think\template\TagLib;
use app\common\model\Article as ArticleModel;
class Article extends TagLib
{
@ -29,16 +28,21 @@ class Article extends TagLib
'comment_num' => ['attr' => '', 'close' => 0],
'keywords' => ['attr' => '', 'close' => 0],
'description' => ['attr' => '', 'close' => 0],
'link' => ['attr' => '', 'close' => 0],
'time' => ['attr' => '', 'close' => 0],
'cate' => ['attr' => 'name', 'close' => 0],
'user' => ['attr' => 'name', 'close' => 0],
'list' => ['attr' => '', 'close' => 1],
'comment' => ['attr' => '', 'close' => 1],
'istop' => ['attr' => '', 'close' => 0],
'detail' => ['attr' => 'name', 'close' => 0],
// 'detail' => ['attr' => '', 'close' => 0],
];
@ -88,6 +92,16 @@ class Article extends TagLib
return '{$article.description}';
}
public function tagLink(): string
{
return '{$article.url}';
}
public function tagTime(): string
{
return '{$article.create_time}';
}
// 详情分类
public function tagCate($tag): string
{
@ -106,12 +120,17 @@ class Article extends TagLib
return '{$article.cate_id}';
}
if($tag['name'] == 'link')
{
return '{:url(\'cate\',[\'ename\'=>$article.cate.ename])}';
}
return '';
}
public function tagUser($tag)
{
if($tag['name'] == 'user_link') {
if($tag['name'] == 'link') {
return '{:url("user/home",["id"=>'.'$'.'article.user.id'.'])->domain(true)}';
}
return '{$article.user.' . $tag['name'] . '}';
@ -127,12 +146,24 @@ class Article extends TagLib
return '{$article.cate.id}';
}
// 详情
// public function tagDetail($tag)
// {
// return '{$article.' . $tag['name'] . '}';
// }
// 详情
public function tagDetail($tag)
{
return '{$article.' . $tag['name'] . '}';
$parseStr = '{assign name="id" value="$Request.param.id" /}';
$parseStr .= '<?php ';
$parseStr .= '$__article__ = \app\facade\Article::find($id);';
$parseStr .= ' ?>';
$parseStr .= '{$__article__.'. $tag['name'] .'}';
return $parseStr;
}
public function tagIstop($tag): string
{
//dump($this->article);
@ -145,14 +176,34 @@ class Article extends TagLib
}
// 评论
public function tagComment($tag, $content): string
public function tagComment2($tag, $content): string
{
$parse = '<?php ';
$parse .= ' ?>';
$parse .= '{volist name="comments['.'\'data\''.']" id="comment" empty= "还没有内容"}';
$parse .= '{volist name="comments" id="comment" empty= "还没有内容"}';
$parse .= $content;
$parse .= '{/volist}';
return $parse;
}
// 评论
public function tagComment($tag, $content): string
{
$parse = '<?php ';
$parse .= ' ?>';
$parse .= '{volist name="comments['.'\'data\''.']" id="comment" empty= "还没有内容"}';
$parse .= $content;
$parse .= '{/volist}';
return $parse;
}
// 分类列表
public function tagList($tag, $content): string
{
$parse = '{volist name="artList['.'\'data\''.']" id="article" empty= "还没有内容"}';
$parse .= $content;
$parse .= '{/volist}';
return $parse;
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* @Program: table.css 2023/4/17
* @FilePath: app\common\taglib\Cate.php
* @Description: Cate.php
* @LastEditTime: 2023-04-17 21:19:59
* @Author: Taoker <317927823@qq.com>
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
*/
namespace app\common\taglib;
use think\template\TagLib;
class Cate extends TagLib
{
protected $tags = [
'brother' => ['attr' => '', 'close' => 1],
'bro_name' => ['attr' => '', 'close' => 0],
'bro_ename' => ['attr' => '', 'close' => 0],
'bro_url' => ['attr' => '', 'close' => 0],
'list' => ['attr' => '', 'close' => 1]
];
public function tagBrother($tag, $content): string
{
$parse = '{assign name="ename" value="$Request.param.ename" /}';
$parse .= '{php}$__brotherCate__ = \app\facade\Cate::getBrotherCate($ename);{/php}';
$parse .= '{volist name="__brotherCate__" id="brother"}';
$parse .= $content;
$parse .= '{/volist}';
return $parse;
}
public function tagBro_name($tag): string
{
return '{$brother.catename}';
}
public function tagBro_ename($tag): string
{
return '{$brother.ename}';
}
public function tagBro_url($tag): string
{
return '{$brother.url}';
}
public function tagList($tag, $content): string
{
//$paras = ;
}
}

View File

@ -0,0 +1,95 @@
<?php
/**
* @Program: table.css 2023/4/17
* @FilePath: app\common\taglib\Gnav.php
* @Description: Gnav.php
* @LastEditTime: 2023-04-17 15:37:40
* @Author: Taoker <317927823@qq.com>
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
*/
namespace app\common\taglib;
use think\template\TagLib;
class Gnav extends TagLib
{
protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合0 或者1 默认1 alias 标签别名 level 嵌套层次
//'nav' => ['attr' => '', 'close' => 1],
'id' => ['attr' => '', 'close' => 0],
'pid' => ['attr' => '', 'close' => 0],
'icon' => ['attr' => '', 'close' => 0],
'name' => ['attr' => '', 'close' => 0],
'ename' => ['attr' => '', 'close' => 0],
'title' => ['attr' => '', 'close' => 0],
'detpl' => ['attr' => '', 'close' => 0],
'sort' => ['attr' => '', 'close' => 0],
'desc' => ['attr' => '', 'close' => 0],
'is_hot' => ['attr' => '', 'close' => 0],
'link' => ['attr' => '', 'close' => 0],
'children' => ['attr' => '', 'close' => 0],
];
public function tagId(): string
{
return '{$gnav.id}';
}
public function tagPid(): string
{
return '{$gnav.pid}';
}
public function tagIcon(): string
{
return '{$gnav.icon}';
}
public function tagName($tag): string
{
return '{$gnav.catename}';
}
public function tagEname(): string
{
return '{$gnav.ename}';
}
public function tagTitle(): string
{
return '{:cookie(\'think_lang\') == \'en-us\' ? $gnav.ename : $gnav.catename}';
}
public function tagDetpl(): string
{
return '{$gnav.detpl}';
}
public function tagSort(): string
{
return '{$gnav.sort}';
}
public function tagDesc(): string
{
return '{$gnav.desc}';
}
public function tagIs_hot(): string
{
return '{$gnav.is_hot}';
}
public function tagLink(): string
{
return '{$gnav.url}';
}
public function tagChildren(): string
{
return '{$gnav.children}';
}
}

96
app/common/taglib/Nav.php Normal file
View File

@ -0,0 +1,96 @@
<?php
/**
* @Program: table.css 2023/4/17
* @FilePath: app\common\taglib\Nav.php
* @Description: Nav.php
* @LastEditTime: 2023-04-17 14:25:08
* @Author: Taoker <317927823@qq.com>
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
*/
namespace app\common\taglib;
use think\template\TagLib;
class Nav extends TagLib
{
protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合0 或者1 默认1 alias 标签别名 level 嵌套层次
//'nav' => ['attr' => '', 'close' => 1],
'id' => ['attr' => '', 'close' => 0],
'pid' => ['attr' => '', 'close' => 0],
'icon' => ['attr' => '', 'close' => 0],
'name' => ['attr' => '', 'close' => 0],
'ename' => ['attr' => '', 'close' => 0],
'title' => ['attr' => '', 'close' => 0],
'detpl' => ['attr' => '', 'close' => 0],
'sort' => ['attr' => '', 'close' => 0],
'desc' => ['attr' => '', 'close' => 0],
'is_hot' => ['attr' => '', 'close' => 0],
'link' => ['attr' => '', 'close' => 0],
'children' => ['attr' => '', 'close' => 0],
];
public function tagId(): string
{
return '{$nav.id}';
}
public function tagPid(): string
{
return '{$nav.pid}';
}
public function tagIcon(): string
{
return '{$nav.icon}';
}
public function tagName($tag): string
{
return '{$nav.catename}';
}
public function tagEname(): string
{
return '{$nav.ename}';
}
public function tagTitle(): string
{
return '{:cookie(\'think_lang\') == \'en-us\' ? $nav.ename : $nav.catename}';
}
public function tagDetpl(): string
{
return '{$nav.detpl}';
}
public function tagSort(): string
{
return '{$nav.sort}';
}
public function tagDesc(): string
{
return '{$nav.desc}';
}
public function tagIs_hot(): string
{
return '{$nav.is_hot}';
}
public function tagLink(): string
{
return '{$nav.url}';
}
public function tagChildren(): string
{
return '{$nav.children}';
}
}

View File

@ -0,0 +1,95 @@
<?php
/**
* @Program: table.css 2023/4/17
* @FilePath: app\common\taglib\Snav.php
* @Description: Snav.php
* @LastEditTime: 2023-04-17 15:37:30
* @Author: Taoker <317927823@qq.com>
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
*/
namespace app\common\taglib;
use think\template\TagLib;
class Snav extends TagLib
{
protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合0 或者1 默认1 alias 标签别名 level 嵌套层次
//'nav' => ['attr' => '', 'close' => 1],
'id' => ['attr' => '', 'close' => 0],
'pid' => ['attr' => '', 'close' => 0],
'icon' => ['attr' => '', 'close' => 0],
'name' => ['attr' => '', 'close' => 0],
'ename' => ['attr' => '', 'close' => 0],
'title' => ['attr' => '', 'close' => 0],
'detpl' => ['attr' => '', 'close' => 0],
'sort' => ['attr' => '', 'close' => 0],
'desc' => ['attr' => '', 'close' => 0],
'is_hot' => ['attr' => '', 'close' => 0],
'link' => ['attr' => '', 'close' => 0],
'children' => ['attr' => '', 'close' => 0],
];
public function tagId(): string
{
return '{$snav.id}';
}
public function tagPid(): string
{
return '{$snav.pid}';
}
public function tagIcon(): string
{
return '{$snav.icon}';
}
public function tagName($tag): string
{
return '{$snav.catename}';
}
public function tagEname(): string
{
return '{$snav.ename}';
}
public function tagTitle(): string
{
return '{:cookie(\'think_lang\') == \'en-us\' ? $snav.ename : $snav.catename}';
}
public function tagDetpl(): string
{
return '{$snav.detpl}';
}
public function tagSort(): string
{
return '{$snav.sort}';
}
public function tagDesc(): string
{
return '{$snav.desc}';
}
public function tagIs_hot(): string
{
return '{$snav.is_hot}';
}
public function tagLink(): string
{
return '{$snav.url}';
}
public function tagChildren(): string
{
return '{$snav.children}';
}
}

View File

@ -0,0 +1,120 @@
<?php
/**
* @Program: table.css 2023/5/16
* @FilePath: app\common\taglib\System.php
* @Description: System.php
* @LastEditTime: 2023-05-16 21:34:18
* @Author: Taoker <317927823@qq.com>
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
*/
namespace app\common\taglib;
use think\template\TagLib;
class System extends TagLib
{
protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合0 或者1 默认1 alias 标签别名 level 嵌套层次
'webname' => ['attr' => '', 'close' => 0],
'webtitle' => ['attr' => '', 'close' => 0],
'domain' => ['attr' => '', 'close' => 0],
'template' => ['attr' => '', 'close' => 0],
'logo' => ['attr' => '', 'close' => 0],
'm_logo' => ['attr' => '', 'close' => 0],
'cache' => ['attr' => '', 'close' => 0],
'upsize' => ['attr' => '', 'close' => 0],
'uptype' => ['attr' => '', 'close' => 0],
'copyright' => ['attr' => '', 'close' => 0],
'keywords' => ['attr' => '', 'close' => 0],
'descript' => ['attr' => '', 'close' => 0],
'state' => ['attr' => '', 'close' => 0],
'is_open' => ['attr' => '', 'close' => 0],
'is_comment' => ['attr' => '', 'close' => 0],
'is_reg' => ['attr' => '', 'close' => 0],
'icp' => ['attr' => '', 'close' => 0],
'showlist' => ['attr' => '', 'close' => 0],
'blackname' => ['attr' => '', 'close' => 0],
'sys_version_num'=> ['attr' => '', 'close' => 0],
'key' => ['attr' => '', 'close' => 0],
'clevel' => ['attr' => '', 'close' => 0],
'api_url' => ['attr' => '', 'close' => 0],
'base_url' => ['attr' => '', 'close' => 0],
'upcheck_url' => ['attr' => '', 'close' => 0],
'upgrade_url' => ['attr' => '', 'close' => 0],
'create_time' => ['attr' => '', 'close' => 0],
'update_time' => ['attr' => '', 'close' => 0]
];
public function tagWebname(): string
{
return '{$sysInfo.webname}';
}
public function tagWebtitle(): string
{
return '{$sysInfo.webtitle}';
}
public function tagDomain(): string
{
return '{$sysInfo.domain}';
}
public function tagTemplate(): string
{
return '{$sysInfo.template}';
}
public function tagLogo(): string
{
return '{$sysInfo.logo}';
}
public function tagMlogo(): string
{
return '{$sysInfo.m_logo}';
}
public function tagCopyright(): string
{
return '{$sysInfo.copyright}';
}
public function tagKeywords(): string
{
return '{$sysInfo.keywords}';
}
public function tagDescript(): string
{
return '{$sysInfo.descript}';
}
public function tagState(): string
{
return '{$sysInfo.state}';
}
public function tagIcp(): string
{
return '{$sysInfo.icp}';
}
public function tagSys_version(): string
{
return '{$sysInfo.sys_version_num}';
}
public function tagKey(): string
{
return '{$sysInfo.key}';
}
public function tagCreate_time(): string
{
return '{$sysInfo.create_time}';
}
}

View File

@ -16,12 +16,57 @@ class Taoler extends TagLib
{
protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合0 或者1 默认1 alias 标签别名 level 嵌套层次
'content' => ['attr' => 'name', 'close' => 0],
'nav' => ['attr' => '', 'close' => 1],
'snav' => ['attr' => '', 'close' => 1],
'gnav' => ['attr' => '', 'close' => 1],
'if' => ['condition', 'expression' => true, 'close' => 1],
];
public function tagContent($tag)
public function tagNav($tag, $content): string
{
return '{$article.' . $tag['name'] . '}';
$id = $tag['id'] ?? 'nav';
$parse = '{php}$__cate__ = \app\facade\Cate::getNav();{/php}';
$parse .= '{volist name="__cate__" id="'.$id.'"}';
$parse .= $content;
$parse .= '{/volist}';
return $parse;
}
public function tagSnav($tag, $content): string
{
$id = $tag['id'] ?? 'snav';
$parse = '{notempty name="nav.children"}';
$parse .= '{volist name="nav.children" id="'.$id.'"}';
$parse .= $content;
$parse .= '{/volist}';
$parse .= '{/notempty}';
return $parse;
}
public function tagGnav($tag, $content): string
{
$id = $tag['id'] ?? 'gnav';
$parse = '{notempty name="snav.children"}';
$parse .= '{volist name="snav.children" id="'.$id.'"}';
$parse .= $content;
$parse .= '{/volist}';
$parse .= '{/notempty}';
return $parse;
}
public function tagIf($tag, $content): string
{
$condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition'];
$condition = $this->parseCondition($condition);
$parseStr = '<?php if(' . $condition . '): ?>' . $content . '<?php endif; ?>';
return $parseStr;
// return '{if'.$tag.'}} '.$content.' {/if}';
}
}

View File

@ -17,6 +17,7 @@ class User extends Validate
protected $rule = [
'name|用户名' => 'require|min:2|max:18|chsDash|unique:user',
'email|邮箱' => 'require|email|unique:user',
'phone|手机号' => 'require|mobile|unique:user',
'password|密码' => 'require|min:6|max:20',
'repassword|确认密码'=>'require|confirm:password',
'nickname|昵称' => 'require|min:2|max:20',
@ -48,11 +49,23 @@ class User extends Validate
->remove('email', 'unique');
}
//注册验证场景
//phone登陆验证场景
public function sceneLoginPhone()
{
return $this->only(['phone','password'])
->remove('phone', 'unique');
}
//注册验证场景
public function sceneReg()
{
return $this->only(['name','email','password','repassword']);
}
//后台注册验证场景
public function sceneUserReg()
{
return $this->only(['name','email','phone','password']);
}
//密码找回

View File

@ -3,13 +3,37 @@
// | 模板设置
// +----------------------------------------------------------------------
use think\facade\Db;
use taoler\com\Files;
use think\facade\Cache;
//如果网站安装从数据库查询选择的模板
if(file_exists('./install.lock')){
$template = Db::name('system')->where('id',1)->value('template');
$template = Db::name('system')->where('id',1)->cache(true)->value('template');
} else {
$template = '';
}
$taglib_pre_load = Cache::remember('taglib', function(){
$tagsArr = [];
//获取应用公共标签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文件
$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));
}
}
return implode(',', $tagsArr);
});
return [
// 模板引擎类型使用Think
'type' => 'Think',
@ -19,8 +43,10 @@ return [
'view_dir_name' => 'view' . DIRECTORY_SEPARATOR . $template,
// 模板后缀
'view_suffix' => 'html',
// 定义内置标签
//'taglib_build_in' => 'app\common\taglib\Article',
// 预先加载的标签库
'taglib_pre_load' => 'app\common\taglib\Article,app\common\taglib\Taoler,app\common\taglib\Comment',
'taglib_pre_load' => $taglib_pre_load,
// 模板文件名分隔符
'view_depr' => DIRECTORY_SEPARATOR,
// 模板引擎普通标签开始标记

View File

@ -1 +1,2 @@
Api.php
Works.php

View File

@ -12,8 +12,6 @@ use think\facade\Session;
use think\facade\Config;
use app\common\model\Cate;
use app\common\model\Comment;
use app\common\model\Article as ArticleModel;
use app\common\model\Slider;
use app\common\model\UserZan;
use app\common\model\PushJscode;
use taoler\com\Message;
@ -30,15 +28,13 @@ class Article extends BaseController
public function __construct(App $app)
{
parent::__construct($app);
$this->model = new ArticleModel();
$this->model = new \app\common\model\Article();
}
//文章分类
public function cate()
{
$cate = new Cate();
$ad = new Slider();
$article = new ArticleModel();
//动态参数
$ename = Request::param('ename');
$type = Request::param('type','all');
@ -53,13 +49,10 @@ class Article extends BaseController
$path = substr($url,0,strrpos($url,"/"));
//分类列表
$artList = $article->getCateList($ename,$type,$page);
$artList = $this->model->getCateList($ename,$type,$page);
// 热议文章
$artHot = $article->getArtHot(10);
//分类图片
$ad_cateImg = $ad->getSliderList(3);
//分类钻展赞助
$ad_comm = $ad->getSliderList(6);
$artHot = $this->model->getArtHot(10);
$assignArr = [
'ename'=>$ename,
@ -67,8 +60,6 @@ class Article extends BaseController
'type'=>$type,
'artList'=>$artList,
'artHot'=>$artHot,
'ad_cateImg'=>$ad_cateImg,
'ad_comm'=>$ad_comm,
'path'=>$path,
'jspage'=>'jie'
];
@ -85,22 +76,11 @@ class Article extends BaseController
$page = input('page',1);
//输出内容
$artDetail = $this->model->getArtDetail($id);
if($artDetail->read_type == 1 && session('art_pass_'.$id) != $artDetail->art_pass) {
$artDetail->content = '本文已加密!请输入正确密码查看!';
if(is_null($artDetail)){
throw new \think\exception\HttpException(404, '无内容');
}
if(is_null($artDetail)){
// 抛出 HTTP 异常
throw new \think\exception\HttpException(404, '无内容');
}
//用户个人tag标签
$userTags = $this->model->where(['user_id' => $artDetail['user_id'],'status'=>1])->where('keywords','<>','')->column('keywords');
//转换为字符串
$tagStr = implode(",",$userTags);
//转换为数组并去重
$tagArr = array_unique(explode(",",$tagStr));
$userTagCount = count($tagArr);
//被赞
$zanCount = Db::name('user_zan')->where('user_id', $artDetail['user_id'])->count('id');
//赞列表
$userZanList = [];
@ -155,12 +135,6 @@ class Article extends BaseController
$lrDate_time = Db::name('comment')->where('article_id', $id)->max('update_time',false) ?? time();
// 热议文章
$artHot = $this->model->getArtHot(10);
//广告
$ad = new Slider();
//分类图片
$ad_artImg = $ad->getSliderList(4);
//分类钻展赞助
$ad_comm = $ad->getSliderList(7);
//push
$push_js = Db::name('push_jscode')->where(['delete_time'=>0,'type'=>1])->cache(true)->select();
@ -168,8 +142,6 @@ class Article extends BaseController
'article' => $artDetail,
'pv' => $pv,
'artHot' => $artHot,
'ad_art' => $ad_artImg,
'ad_comm' => $ad_comm,
'tags' => $tags,
'relationArticle' => $relationArticle,
'previous' => $previous,
@ -180,9 +152,9 @@ class Article extends BaseController
'cid' => $id,
'lrDate_time' => $lrDate_time,
'userZanList' => $userZanList,
'userTagCount'=> $userTagCount,
'jspage' => 'jie',
'passJieMi' => session('art_pass_'.$id),
'zanCount' => $zanCount,
'jspage' => 'jie',
'passJieMi' => session('art_pass_'.$id),
$download,
]);
@ -204,8 +176,10 @@ class Article extends BaseController
if (Request::isAjax()){
//获取评论
$data = Request::only(['content','article_id','user_id']);
$data = Request::only(['content','article_id','pid','to_user_id']);
$data['user_id'] = $this->uid;
$sendId = $data['user_id'];
// halt($data);
$art = Db::name('article')->field('id,status,is_reply,delete_time')->find($data['article_id']);
if($art['delete_time'] != 0 || $art['status'] != 1 || $art['is_reply'] != 1){
@ -282,13 +256,11 @@ class Article extends BaseController
$data['content'] = $this->downUrlPicsReaplace($data['content']);
// 把中文,转换为英文,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
$data['description'] = strip_tags($this->filterEmoji($data['description']));
// 获取分类ename,appname
$cateName = Db::name('cate')->field('ename,appname')->find($data['cate_id']);
$article = new ArticleModel();
$result = $article->add($data);
$result = $this->model->add($data);
if ($result['code'] == 1) {
// 获取到的最新ID
$aid = $result['data']['id'];
@ -350,7 +322,7 @@ class Article extends BaseController
*/
public function edit($id)
{
$article = ArticleModel::find($id);
$article = $this->model->find($id);
if(Request::isAjax()){
$data = Request::only(['id','cate_id','title','title_color','read_type','art_pass','content','upzip','keywords','description','captcha']);
@ -377,7 +349,7 @@ class Article extends BaseController
$data['content'] = $this->downUrlPicsReaplace($data['content']);
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
$data['description'] = strip_tags($this->filterEmoji($data['description']));
$result = $article->edit($data);
if($result == 1) {
@ -436,7 +408,7 @@ class Article extends BaseController
*/
public function delete()
{
$article = ArticleModel::find(input('id'));
$article = $this->model->find(input('id'));
$result = $article->together(['comments'])->delete();
if($result) {
return Msgres::success('delete_success');
@ -471,45 +443,11 @@ class Article extends BaseController
return download($zip,'my');
}
/**
* 获取描述过滤html
*
* @return void
*/
public function getDescription()
{
$data = Request::only(['content']);
$description = getArtContent($data['content']);
return json(['code'=>0,'data'=>$description]);
}
/**
* 标题调用百度关键词词条
*
* @return void
*/
public function getWordList()
{
$title = input('title');
return $this->getBdiduSearchWordList($title);
}
/**
* 关键词
* @return \think\response\Json
*/
public function keywords()
{
$data = Request::only(['flag','keywords','content']);
$keywords = $this->setKeywords($data);
return json(['code'=>0, 'msg' => 'ok', 'data'=> $keywords]);
}
// 文章置顶、加精、评论状态
public function jieset()
{
$data = Request::param();
$article = ArticleModel::field('id,is_top,is_hot,is_reply')->find($data['id']);
$article = $this->model->field('id,is_top,is_hot,is_reply')->find($data['id']);
switch ($data['field']){
case 'top':
if($data['rank']==1){
@ -549,7 +487,7 @@ class Article extends BaseController
public function titleColor()
{
$data = Request::param();
$result = ArticleModel::update($data);
$result = $this->model->update($data);
if($result){
//清除文章缓存
Cache::tag(['tagArt','tagArtDetail'])->clear();
@ -636,15 +574,22 @@ class Article extends BaseController
/**
* 分类树
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getCateTree()
{
$data = $this->showNav();
$count = count($data);
$cateList = Cate::field('id,pid,catename,sort')->where(['status' => 1])->select()->toArray();
$list = getTree($cateList);
// 排序
$cmf_arr = array_column($list, 'sort');
array_multisort($cmf_arr, SORT_ASC, $list);
$count = count($list);
$tree = [];
if($count){
$tree = ['code'=>0, 'msg'=>'ok','count'=>$count];
$tree['data'] = $data;
$tree['data'] = $list;
}
return json($tree);

View File

@ -35,9 +35,8 @@ class Comment extends BaseController
//删除评论
public function jiedaDelete()
{
if(!session('?user_id')) return json(['code'=>-1,'msg'=>'未登录']);
$id = input('id');
//$arid = intval($id);
$comms = CommentModel::find($id);
$result = $comms->delete();
if($result){
@ -52,7 +51,7 @@ class Comment extends BaseController
public function getDa()
{
//获取原评论
$this->isLogin();
if(!session('?user_id')) return json(['code'=>-1,'msg'=>'未登录']);
$id = input('id');
$comms = CommentModel::find($id);
$res['rows'] = [];
@ -66,7 +65,7 @@ class Comment extends BaseController
//更新评论
public function updateDa()
{
$this->isLogin();
if(!session('?user_id')) return json(['code'=>-1,'msg'=>'未登录']);
$id = input('id');
$content = input('content');
$comms = CommentModel::find($id);
@ -83,6 +82,7 @@ class Comment extends BaseController
//更新评论
public function edit()
{
if(!session('?user_id')) return json(['code'=>-1,'msg'=>'未登录']);
if(Request::isAjax()) {
$param = Request::param();
// halt($param);
@ -101,7 +101,7 @@ class Comment extends BaseController
//评论点赞
public function jiedaZan()
{
$this->isLogin();
if(!session('?user_id')) return json(['code'=>-1,'msg'=>'未登录']);
$data['comment_id'] = input('post.id');
$data['user_id'] = session('user_id');
//查询是否已存在点赞

View File

@ -11,11 +11,11 @@
namespace app\index\controller;
use app\common\controller\BaseController;
use app\common\lib\facade\HttpHelper;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use app\facade\Article;
use app\common\model\Slider;
use app\common\lib\Msgres;
class Index extends BaseController
@ -30,39 +30,18 @@ class Index extends BaseController
public function index()
{
$types = input('type');
$slider = new Slider();
//幻灯
$sliders = Request::isMobile() ? $slider->getSliderList(12) : $slider->getSliderList(1);
//置顶文章
$artTop = Article::getArtTop(5);
//首页文章列表,显示20个
$artList = Article::getArtList(22);
//首页文章列表,显示10个
$artList = Article::getArtList(15);
//热议文章
$artHot = Article::getArtHot(10);
//首页广告
$indexAd = $slider->getSliderList(13);
//温馨通道
$fast_links = $slider->getSliderList(8);
//首页赞助
$ad_index = $slider->getSliderList(5);
//首页右栏图片
$ad_comm = $slider->getSliderList(2);
//友情链接申请
$adminEmail = Db::name('user')->where('id',1)->cache(true)->value('email');
$vs = [
'slider' => $sliders,
'artTop' => $artTop,
'artList' => $artList,
'artHot' => $artHot,
'ad_index_r'=> $indexAd,
'type' => $types,
'ad_index' => $ad_index,
'ad_comm' => $ad_comm,
'fastlinks' => $fast_links,
'adminEmail' => $adminEmail,
'jspage' => '',
];
View::assign($vs);

View File

@ -54,8 +54,24 @@ class Login extends BaseController
//邮箱正则表达式
$pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
//判断输入的是邮箱还是用户名
if (preg_match($pattern, $data['name'])){
if(preg_match("/^1[34578]\d{9}$/",$data['name']))
{
//手机验证登录
$data['phone'] = $data['name'];
unset($data['name']);
try{
validate(userValidate::class)
->scene('loginPhone')
->check($data);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return json(['code'=>-1,'msg'=>$e->getError()]);
}
$data['name'] = $data['phone'];
unset($data['phone']);
} elseif (preg_match($pattern, $data['name'])){
//输入邮箱email登陆验证
$data['email'] = $data['name'];
unset($data['name']);

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

View File

@ -133,7 +133,7 @@ class User extends BaseController
$validate = new userValidate;
$result = $validate->scene('Set')->check($data);
if(!$result){
$this->error($validate->getError());
return json(['code'=>-1,'msg' =>$validate->getError()]);
} else {
//防止重复的email
$resEmail = Db::name('user')->where('email',$data['email'])->where('id','<>',$this->uid)->find();
@ -151,7 +151,7 @@ class User extends BaseController
Cache::tag('user')->clear();
return json(['code'=>0,'msg'=>'资料更新成功']);
} else {
$this->error($result);
return json(['code'=>-1,'msg' =>$result]);
}
}
}
@ -275,7 +275,8 @@ class User extends BaseController
$validate = new userValidate;
$res = $validate->scene('setPass')->check($data);
if(!$res){
return $this->error($validate->getError());
return json(['code'=>-1,'msg' =>$validate->getError()]);
}
$user = new userModel;
$result = $user->setpass($data);
@ -284,7 +285,7 @@ class User extends BaseController
Cookie::delete('auth');
return $this->success('密码修改成功 请登录', (string) url('login/index'));
} else {
return $this->error($result);
return json(['code'=>-1,'msg' =>$result]);
}
}
}
@ -298,9 +299,8 @@ class User extends BaseController
//Cookie::delete('user_id');
if(Session::has('user_id')){
return json(['code' => -1, 'msg' => '退出失败']);
} else {
return json(['code' => 200, 'msg' => '退出成功', 'url' => '/']);
}
return json(['code' => 200, 'msg' => '退出成功', 'url' => '/']);
}
}

View File

@ -30,7 +30,7 @@ return [
'index' => 'index',
'home page' => '首页',
'user center' => '用户中心',
'set info' => '设置',
'set info' => '个人设置',
'my message' => '我的消息',
'my page' => '我的主页',

View File

@ -1 +1,2 @@
myroute.php
a.php

View File

@ -9,6 +9,7 @@
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
*/
use think\facade\Route;
use think\facade\Request;
//详情页URL别称
$detail_as = config('taoler.url_rewrite.article_as');
@ -68,19 +69,24 @@ Route::group('art',function () use($detail_as,$cate_as){
Route::get('tag','tag/getAllTag')->name('get_all_tag');
Route::get('arttag','tag/getArticleTag')->name('get_art_tag');
Route::rule('search/[:keywords]', 'index/search'); // 搜索
// article分类和详情路由 !放到最后!
Route::group(function () use($detail_as, $cate_as){
// 动态路径路由会影响下面的路由,所以动态路由放下面
Route::get($detail_as . ':id$', 'article/detail')->name('article_detail');
Route::get($detail_as . '<id>/<page>$', 'article/detail')->name('article_comment');
//分类
Route::get($cate_as . '<ename>$','article/cate')->name('cate');
Route::get($cate_as . '<ename>/<type>$', 'article/cate')->name('cate_type');
Route::get($cate_as . '<ename>/<type>/<page>$', 'article/cate')->name('cate_page');
})->pattern([
'ename' => '\w+',
'ename' => '[\w|\-]+',
'type' => '\w+',
'page' => '\d+',
'id' => '\d+',
]);
Route::rule('search/[:keywords]', 'index/search'); // 搜索

View File

@ -142,7 +142,7 @@ return [
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
'charset' => 'utf8mb4',
// 数据库表前缀
'prefix' => env('database.prefix', '{$data['DB_PREFIX']}'),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
@ -168,21 +168,39 @@ return [
],
];
EOV;
// 创建数据库链接配置文件
$database = '../config/database.php';
if (file_exists($database)) {
if(is_writable($database)){
$fp = fopen($database,"w");
$resf = fwrite($fp, $db_str);
fclose($fp);
if(!$resf){
return json(['code' => -1,'msg'=>'数据库配置文件创建失败!']);
}
}
// 创建数据库链接配置文件
$database = config_path() . 'database.php';
if (file_exists($database) && is_writable($database)) {
$fp = fopen($database,"w");
$resf = fwrite($fp, $db_str);
fclose($fp);
if(!$resf) return json(['code' => -1,'msg'=>'数据库配置文件创建失败!']);
} else {
return json(['code' => -1,'msg'=>'config/database.php 无写入权限']);
}
}
$env = <<<ENV
APP_DEBUG = false
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = {$data['DB_HOST']}
DATABASE = {$data['DB_NAME']}
USERNAME = {$data['DB_USER']}
PASSWORD = {$data['DB_PWD']}
HOSTPORT = {$data['DB_PORT']}
CHARSET = utf8mb4
DEBUG = false
[LANG]
default_lang = zh-cn
ENV;
file_put_contents(root_path() . '.env', $env);
//安装上锁
file_put_contents('./install.lock', 'lock');
Session::clear();

View File

@ -5,7 +5,7 @@
Target Server Version : 80020 (8.0.20)
File Encoding : 65001
Date: 14/03/2023 19:57:43
Date: 8/06/2023 19:57:43
*/
SET NAMES utf8mb4;
@ -48,7 +48,7 @@ DROP TABLE IF EXISTS `tao_article`;
CREATE TABLE `tao_article` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标题',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容',
`content` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容',
`status` enum('0','-1','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1' COMMENT '状态1显示0待审-1禁止',
`cate_id` int NOT NULL COMMENT '分类id',
`user_id` int NOT NULL COMMENT '用户id',
@ -266,6 +266,11 @@ INSERT INTO `tao_auth_rule` VALUES (120, 'content.cate/edit', '编辑分类', 1,
INSERT INTO `tao_auth_rule` VALUES (121, 'content.cate/delete', '删除分类', 1, 1, 117, 2, '', 2, 50, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (122, 'content.cate/hot', '热点分类', 1, 1, 117, 2, '', 2, 50, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (123, 'content.cate/getAppNameView', '分类应用模板', 1, 1, 117, 2, '', 2, 50, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (124, 'content.tag/index', '标签管理', 1, 1, 4, 1, '', 1, 50, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (125, 'content.tag/list', '标签列表', 1, 1, 124, 2, '', 2, 50, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (126, 'content.tag/add', '添加标签', 1, 1, 124, 2, '', 2, 50, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (127, 'content.tag/edit', '编辑标签', 1, 1, 124, 2, '', 2, 50, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (128, 'content.tag/delete', '删除标签', 1, 1, 124, 2, '', 2, 50, '', 0, 0, 0);
-- ----------------------------
-- Table structure for tao_cate
@ -313,36 +318,29 @@ CREATE TABLE `tao_collection` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文章收藏表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_collection
-- ----------------------------
-- ----------------------------
-- Table structure for tao_comment
-- ----------------------------
DROP TABLE IF EXISTS `tao_comment`;
CREATE TABLE `tao_comment` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '评论id',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评论',
`article_id` int NOT NULL COMMENT '文章id',
`user_id` int NOT NULL COMMENT '评论用户',
`zan` tinyint NOT NULL DEFAULT 0 COMMENT '',
`cai` enum('1','0') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '0求解1采纳',
`status` enum('0','-1','1') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '1通过0待审-1禁止',
`create_time` int NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int NOT NULL DEFAULT 0 COMMENT '更新时间',
`delete_time` int NOT NULL DEFAULT 0 COMMENT '删除时间',
`id` int NOT NULL AUTO_INCREMENT COMMENT '评论id',
`pid` int NOT NULL DEFAULT 0 COMMENT '父id',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评论',
`article_id` int NOT NULL COMMENT '文章id',
`user_id` int NOT NULL COMMENT '评论用户',
`to_user_id` int NULL DEFAULT NULL COMMENT '给用户留言',
`zan` tinyint NOT NULL DEFAULT 0 COMMENT '',
`cai` enum('1','0') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '0求解1采纳',
`status` enum('0','-1','1') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '1通过0待审-1禁止',
`type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '评论类型1帖子2其它',
`create_time` int NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int NOT NULL DEFAULT 0 COMMENT '更新时间',
`delete_time` int NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `aiticle_id`(`article_id` ASC) USING BTREE COMMENT '文章评论索引',
INDEX `user_id`(`user_id` ASC) USING BTREE COMMENT '评论用户索引'
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评论表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_comment
-- ----------------------------
INSERT INTO `tao_comment` VALUES (1, 'https://www.aieok.com', 1, 1, 0, '0', '1', 1555127897, 1578977505, 0);
INSERT INTO `tao_comment` VALUES (2, 'face[嘻嘻] ddddd', 1, 1, 0, '0', '1', 1677900207, 1677975943, 1677975943);
INSERT INTO `tao_comment` VALUES (3, 'ddddfdfd', 1, 1, 0, '0', '1', 1677900215, 1677975943, 1677975943);
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评论表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tao_cunsult
@ -359,10 +357,6 @@ CREATE TABLE `tao_cunsult` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '反馈表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_cunsult
-- ----------------------------
-- ----------------------------
-- Table structure for tao_friend_link
-- ----------------------------
@ -376,14 +370,12 @@ CREATE TABLE `tao_friend_link` (
`update_time` int NOT NULL COMMENT '更新时间',
`delete_time` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '友情链接' ROW_FORMAT = Dynamic;
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '友情链接' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_friend_link
-- ----------------------------
INSERT INTO `tao_friend_link` VALUES (1, 'taobao', 'https://www.taobao.com', '', 0, 0, 0);
INSERT INTO `tao_friend_link` VALUES (2, 'baidu', 'https://www.baidu.com', '', 0, 0, 0);
INSERT INTO `tao_friend_link` VALUES (3, 'tensent', 'https://www.qq.com', '', 0, 0, 0);
INSERT INTO `tao_friend_link` VALUES (1, 'taoler', 'https://www.aieok.com', '', 0, 0, 0);
-- ----------------------------
-- Table structure for tao_mail_server
@ -421,13 +413,7 @@ CREATE TABLE `tao_message` (
`update_time` int NOT NULL DEFAULT 0 COMMENT '更新时间',
`delete_time` int NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_message
-- ----------------------------
INSERT INTO `tao_message` VALUES (1, '测试后台帖子', '评论通知', 1, 'http://www.tp6.com/index/ask/1.html', 2, 1677900207, 1677900207, 0);
INSERT INTO `tao_message` VALUES (2, '测试后台帖子', '评论通知', 1, 'http://www.tp6.com/index/ask/1.html', 2, 1677900215, 1677900215, 0);
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tao_message_to
@ -444,13 +430,7 @@ CREATE TABLE `tao_message_to` (
`update_time` int NOT NULL DEFAULT 0 COMMENT '更新时间',
`delete_time` int NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息详细表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_message_to
-- ----------------------------
INSERT INTO `tao_message_to` VALUES (1, 1, 1, '1', 2, 0, 1677900207, 1677900207, 0);
INSERT INTO `tao_message_to` VALUES (2, 1, 1, '2', 2, 0, 1677900215, 1677900215, 0);
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息详细表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tao_push_jscode
@ -467,10 +447,6 @@ CREATE TABLE `tao_push_jscode` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '站长平台自动推送js代码' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_push_jscode
-- ----------------------------
-- ----------------------------
-- Table structure for tao_slider
-- ----------------------------
@ -489,13 +465,7 @@ CREATE TABLE `tao_slider` (
`update_time` int NOT NULL DEFAULT 0 COMMENT '更新时间',
`delete_time` int NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_slider
-- ----------------------------
INSERT INTO `tao_slider` VALUES (1, 'CODING', 1, '/storage/slider/F1.jpg', '#', '', 1574870400, 1575043200, '1', 0, 0, 0);
INSERT INTO `tao_slider` VALUES (2, '通用右栏底部广告', 2, '/storage/slider/20200101/851c0b88a72590293bcb45454bdce056.jpg', 'https://www.aieok.com', '', 1571155200, 1609344000, '1', 0, 0, 0);
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tao_system
@ -556,10 +526,6 @@ CREATE TABLE `tao_tag` (
INDEX `ename`(`ename` ASC) USING BTREE COMMENT 'ename查询tag索引'
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文章tag表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_tag
-- ----------------------------
-- ----------------------------
-- Table structure for tao_taglist
-- ----------------------------
@ -655,10 +621,6 @@ CREATE TABLE `tao_user_sign` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户签到表' ROW_FORMAT = Fixed;
-- ----------------------------
-- Records of tao_user_sign
-- ----------------------------
-- ----------------------------
-- Table structure for tao_user_signrule
-- ----------------------------
@ -721,8 +683,4 @@ CREATE TABLE `tao_user_zan` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Fixed;
-- ----------------------------
-- Records of tao_user_zan
-- ----------------------------
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -25,16 +25,18 @@ class UserLogin
*/
public function handle($user)
{
$type = $user->user['type'];
$id = $user->user['id'];
$type = $user->user['type'];
$id = $user->user['id'];
$u = User::find($id);
$ip = request()->ip();
$url = 'http://ip-api.com/json/' . $ip . '?lang=zh-CN&fields=57361';
$city = 'earth';
//日志
if($type == 'log'){
//$name = $user->user['name'];
$u = User::find($id);
//日志
if($type == 'log'){
//$name = $user->user['name'];
$ip = request()->ip();
$url = 'http://ip-api.com/json/' . $ip . '?lang=zh-CN&fields=57361';
$city = 'earth';
try{
$ipInfo = HttpHelper::get($url)->toJson();
if($ipInfo->status == 'success')
@ -62,20 +64,21 @@ class UserLogin
// }
// }
$u->allowField(['city','last_login_ip','last_login_time','login_error_num'])->save(
[
'city' => $city,
'last_login_ip' => $ip,
'last_login_time' => time(),
'login_error_num' => 0
]
);
Log::channel('login')->info('login:{user} {ip}',['user'=>$u->name,'ip'=>$ip]);
}
}
if($type == 'logError'){
$res = $u->allowField(['login_error_num','login_error_time'])->save(['login_error_num'=>$u->login_error_num + 1,'login_error_time'=>time()]);
}
if($type == 'logError'){
$u->allowField(['login_error_num','login_error_time'])->save(['login_error_num'=>$u->login_error_num + 1,'login_error_time'=>time()]);
}
$u->allowField(['city','last_login_ip','last_login_time','login_error_num'])->save(
[
'city' => $city,
'last_login_ip' => $ip,
'last_login_time' => time(),
'login_error_num' => 0
]
);
Log::channel('login')->info('login:{user} {ip}',['user'=>$u->name,'ip'=>$ip]);
}
}

View File

@ -1,6 +1,6 @@
{
"name": "taoser/taoler",
"description": "the new thinkphp taoler bbs system",
"description": "the new thinkphp taolerCMS system",
"type": "project",
"keywords": [
"taoler",

634
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -14,6 +14,7 @@ use think\Response;
class Api
{
public $code;
/**
* @param $url
* @param $data

View File

@ -28,9 +28,10 @@ class Files
$arr = array();
$data = scandir($path);
foreach ($data as $value){
if($value !='.' && $value != '..' && !stripos($value,".") && $value != '.gitignore'){
$arr[] = strtolower($value);
}
if (in_array($value, ['.', '..','.gitignore'])) continue;
if(!stripos($value,".")) {
$arr[] = strtolower($value);
}
}
//return array_merge(array_diff($arr, array('install')));
return $arr;

View File

@ -282,7 +282,7 @@ class FormHlp
$switchStr = $switchArr ? lang($switchArr[1]) . '|' . lang($switchArr[0]) : lang('open') . '|' . 'close';
$str = '<div class="layui-form-item">' .$this->label($label,$options) . '
<div class="layui-input-block">
<input ' . $this->addextend($options) . ' ' . $this->addstyle($options) . ' class="' . $this->addClass($options) . '" type="checkbox" value="' . $value . '" checked="" name="' . $name . '" ' . $this->verify($options) . $this->filter($options) . $this->readonlyOrdisabled($options) . ' lay-skin="switch" lay-text="' . $switchStr . '" data-text="' . lang($value) . '"/>
<input ' . $this->addextend($options) . ' ' . $this->addstyle($options) . ' class="' . $this->addClass($options) . '" type="checkbox" value="' . $value . '" checked="'.$checked.'" name="' . $name . '" ' . $this->verify($options) . $this->filter($options) . $this->readonlyOrdisabled($options) . ' lay-skin="switch" lay-text="' . $switchStr . '" data-text="' . lang($value) . '"/>
' . $this->tips($options) . '
</div>
</div>';

View File

@ -32,9 +32,9 @@ if (!function_exists('form_switch')) {
* @param $value
* @return string
*/
function form_switch($name,$switch=[] , $option=[],$value='')
function form_switch($name, $switch=[], $option=[], $value='')
{
return FormHelper::switchs($name,$switch , $option,$value);
return FormHelper::switchs($name, $switch, $option, $value);
}
}
if (!function_exists('form_checkbox')) {

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,17 @@
/>
<missing-glyph />
<glyph glyph-name="github" unicode="&#59047;" d="M512 852.11428587c258.43809493 0 468.11428587-209.67619093 468.11428587-468.11428587 0-206.63344747-134.07573333-382.17630507-319.99512427-444.35748587-23.7568-4.2520384-32.29988587 10.37653333-32.29988587 22.54750507 0 15.25272427 0.62415253 65.80906667 0.62415254 128.6144 0 43.88571413-14.62857173 71.9335616-31.67573334 86.56213333 104.23344747 11.58582827 213.92822827 51.21950507 213.92822934 231.0144 0 51.21950507-18.29546667 92.6476192-48.13775254 125.57165654 4.87619093 12.2099808 20.7140576 59.7235808-4.87619093 124.32335253-39.00952427 12.2099808-128.6144-48.13775253-128.6144-48.13775253a440.02742827 440.02742827 0 0 1-234.0571424 0S305.4055616 670.4859424 266.3960384 658.2759616c-25.59024747-64.59977173-9.7523808-112.1523808-4.87619093-124.32335253-29.88129493-32.9240384-48.13775253-74.35215253-48.13775254-125.57165654 0-179.20975253 109.1096384-219.42857173 213.34308587-231.0144-13.41927573-12.2099808-25.59024747-32.9240384-29.88129493-62.76632426-26.83855253-12.2099808-95.1052192-32.9240384-135.9091808 39.00952426-25.59024747 44.50986667-71.9335616 48.13775253-71.93356267 48.13775254-45.7191616 0.62415253-3.0427424-28.63299093-3.0427424-28.63299094 30.4664384-14.0044192 51.80464747-68.26666667 51.80464747-68.26666666 27.42369493-83.51939093 157.8715424-55.4715424 157.87154346-55.4715424 0-39.00952427 0.62415253-75.56144747 0.62415147-87.1472768 0-12.2099808-8.54308587-26.83855253-32.2998848-22.547504C178.03946667 1.8627050699999472 43.96373333 177.40556160000006 43.96373333 384.03900907c0 258.43809493 209.67619093 468.11428587 468.11428587 468.11428586zM221.2620192 179.82415253c1.20929493 2.4576-0.62415253 5.5003424-4.2520384 7.2947808-3.66689493 1.20929493-6.7096384 0.62415253-7.91893333-1.20929493-1.20929493-2.4576 0.62415253-5.5003424 4.2520384-7.2947808 3.0427424-1.83344747 6.7096384-1.20929493 7.91893333 1.20929493z m18.88060907-20.75306666c2.4576 1.83344747 1.83344747 6.08548587-1.20929494 9.7523808-3.0427424 3.0427424-7.2947808 4.2520384-9.7523808 1.83344746-2.4576-1.83344747-1.83344747-6.08548587 1.20929494-9.7523808 3.0427424-3.0427424 7.2947808-4.2520384 9.7523808-1.83344746z m18.29546666-27.42369494c3.0427424 2.4576 3.0427424 7.2947808 0 11.58582827-2.4576 4.2520384-7.2947808 6.08548587-10.37653333 3.66689493-3.0427424-1.83344747-3.0427424-6.7096384 0-10.96167573s7.91893333-6.08548587 10.37653333-4.2520384z m25.59024747-25.59024853c2.4576 2.4576 1.20929493 7.91893333-2.4576 11.58582933-4.2520384 4.2520384-9.7523808 4.87619093-12.2099808 1.83344747-3.0427424-2.4576-1.83344747-7.91893333 2.4576-11.58582827 4.2520384-4.2520384 9.7523808-4.87619093 12.2099808-1.83344853z m34.75748587-15.2527232c1.20929493 3.66689493-2.4576 7.91893333-7.91893334 9.7523808-4.87619093 1.20929493-10.37653333-0.62415253-11.58582826-4.2520384s2.4576-7.91893333 7.91893333-9.12822827c4.87619093-1.83344747 10.37653333 0 11.58582827 3.66689494z m38.38537173-3.04274347c0 4.2520384-4.87619093 7.2947808-10.37653333 6.7096384-5.5003424 0-9.7523808-3.0427424-9.7523808-6.7096384 0-4.2520384 4.2520384-7.2947808 10.37653333-6.70963733 5.5003424 0 9.7523808 3.0427424 9.7523808 6.70963733z m35.34262827 6.08548587c-0.62415253 3.66689493-5.5003424 6.08548587-10.96167574 5.50034347-5.5003424-1.20929493-9.12822827-4.87619093-8.54308586-9.12822934 0.62415253-3.66689493 5.5003424-6.08548587 10.96167573-4.87618986s9.12822827 4.87619093 8.54308587 8.54308586z" horiz-adv-x="1024" />
<glyph glyph-name="edge" unicode="&#59019;" d="M240.185509 821.062741C322.180562 871.479699 415.37494 897.48813 509.969233 895.934224 845.948962 895.934224 1023.938224 648.353161 1023.938224 456.964708c-0.199988-65.396055-25.998431-127.79229-71.795669-174.389479-45.797237-46.397201-107.993485-72.995596-173.389539-73.995536-150.390927 0-182.98896 46.197213-182.98896 63.996139 0 7.599542 2.399855 12.399252 9.599421 18.798866l1.99988 2.399855 0.799951 3.199807c20.998733 22.998612 31.798082 52.396839 31.798082 83.194981 0 157.390504-164.390082 285.382782-367.977799 285.382782-75.075471 0.599964-149.071006-17.798926-215.027027-53.796754 53.996742 115.03306 165.430019 195.188224 182.628981 207.627473 1.599903 1.099934 0.599964 1.679899 0.599964 1.679899z m31.198118-636.081624c-2.799831-59.99638 9.199445-119.992761 32.798021-174.389479 27.198359-52.796815 65.396055-101.993847 112.993183-138.591638-118.992821 22.998612-222.966548 87.794703-298.781974 178.589225C42.237452 143.383627 0 259.176641 0 380.169341c0 102.393822 124.792471 188.78861 271.983591 188.78861 73.195584 1.199928 144.791264-21.798685 203.587717-65.396054l-7.199566-2.399856c-102.993786-35.197876-196.988115-181.389056-196.988115-316.180924zM939.543315 95.986486l-1.399915-0.199987c-23.598576-37.597732-51.796875-70.195765-84.394908-98.994028-61.596284-55.996622-136.191783-90.99451-217.586873-99.793979-37.197756-0.599964-73.59556 6.399614-107.593509 22.798624-51.196911 20.598757-94.194317 59.99638-123.192567 105.993605-28.798263 47.797116-42.197454 103.393762-37.997708 159.190396-1.199928 40.197575 10.799348 80.595138 29.99819 116.392978 27.798323-66.196006 74.995475-122.592604 135.191844-161.590251 60.196368-38.997647 130.992097-58.996441 202.787766-57.196549 61.99626-0.599964 124.192507 13.399192 180.389116 40.997526l3.799771 1.799892c7.799529 4.599722 15.399071 7.799529 23.1986 0 8.999457-9.799409 3.599783-18.39889-2.399855-27.998311-0.399976-0.399976-0.599964-0.99994-0.799952-1.399916z" horiz-adv-x="1024" />
<glyph glyph-name="leaf" unicode="&#59137;" d="M1017.948269 886.876437c-4.863707 5.785251-12.031275 9.113051-19.557222 9.113051l-26.110427 0c-258.032454 0.102394-461.847374 0.153591-611.905533-35.735447-80.635142-19.301237-142.992985-48.432282-190.606116-89.031436-51.401703-43.82456-86.420393-101.216302-107.155144-175.554223-13.77197-49.353826-20.222782-138.487656 6.96278-227.160714 10.034595-32.766026 25.700852-63.688963 46.589193-92.103251-62.255449-97.530124-116.063407-225.983185-116.063407-378.805977 0-14.130349 11.468109-25.598458 25.598458-25.598458s25.598458 11.468109 25.598458 25.598458c0 235.761795 139.665185 410.650458 222.91137 493.845446 59.7468 59.7468 127.275532 110.175762 195.367429 145.808815 63.381781 33.175601 123.947732 51.4529 170.536925 51.4529 14.130349 0 25.598458 11.468109 25.598458 25.598458s-11.468109 25.598458-25.598458 25.598458c-55.497456 0-122.667809-19.813206-194.241097-57.340545-72.597226-38.039308-144.477695-91.591282-207.80828-154.973063-26.72479-26.72479-58.876453-62.357843-90.823328-105.977615-12.389654 19.506025-22.014674 40.189579-28.619076 61.794677-25.598458 83.553366-16.178225 164.034917-6.604402 198.388047 73.211589 262.384191 351.313233 263.049751 855.858835 262.896161-60.156376-321.926204-172.328817-530.29765-333.599101-619.533873-149.597387-82.785412-297.966048-37.629733-354.845821-14.335136-11.980078 4.914904-24.06255 10.95614-35.786644 17.91892-12.133669 7.218765-27.851122 3.225406-35.069887-8.908263s-3.225406-27.851122 8.908263-35.069887c13.925561-8.2939 28.260697-15.461468 42.595834-21.349114 31.844481-13.004017 83.143791-29.694211 146.679163-35.172281 14.027955-1.228726 27.902319-1.791892 41.674289-1.791892 75.208269 0 145.860012 18.072511 210.675307 53.910352 82.375837 45.565255 153.641943 119.749585 211.904033 220.351524 68.296685 118.00889 119.698388 274.51786 152.720399 465.175173 1.279923 7.423553-0.767954 15.051893-5.631661 20.837145z" horiz-adv-x="1025" />
<glyph glyph-name="folder" unicode="&#60094;" d="M970.666667 682.666667H542.173333L429.793333 795.046667A52.986667 52.986667 0 0 1 392.08 810.666667H96a53.393333 53.393333 0 0 1-53.333333-53.333334v-704a53.393333 53.393333 0 0 1 53.333333-53.333333h874.666667a53.393333 53.393333 0 0 1 53.333333 53.333333V629.333333a53.393333 53.393333 0 0 1-53.333333 53.333334zM96 768h296.08a10.573333 10.573333 0 0 0 7.54-3.126667L481.826667 682.666667H96a53.546667 53.546667 0 0 1-10.666667-1.073334V757.333333a10.666667 10.666667 0 0 0 10.666667 10.666667z m885.333333-714.666667a10.666667 10.666667 0 0 0-10.666666-10.666666H96a10.666667 10.666667 0 0 0-10.666667 10.666666V629.333333a10.666667 10.666667 0 0 0 10.666667 10.666667h874.666667a10.666667 10.666667 0 0 0 10.666666-10.666667z" horiz-adv-x="1024" />
<glyph glyph-name="folder-open" unicode="&#60097;" d="M1003.153333 491.04a52.933333 52.933333 0 0 1-42.38 20.96H896V629.333333a53.393333 53.393333 0 0 1-53.333333 53.333334H461.253333a10.573333 10.573333 0 0 0-7.54 3.126666L344.46 795.046667A52.986667 52.986667 0 0 1 306.746667 810.666667H53.333333a53.393333 53.393333 0 0 1-53.333333-53.333334v-704a53.393333 53.393333 0 0 1 53.333333-53.333333h796.893334a53.453333 53.453333 0 0 1 51.453333 39.333333l110.546667 405.333334a52.953333 52.953333 0 0 1-9.073334 46.373333zM53.333333 768h253.413334a10.573333 10.573333 0 0 0 7.54-3.126667l109.253333-109.253333A52.986667 52.986667 0 0 1 461.253333 640H842.666667a10.666667 10.666667 0 0 0 10.666666-10.666667v-117.333333H173.773333a53.453333 53.453333 0 0 1-51.453333-39.333333L42.666667 180.633333V757.333333a10.666667 10.666667 0 0 0 10.666666 10.666667z m917.726667-312.14l-110.546667-405.333333a10.666667 10.666667 0 0 0-10.286666-7.86H63.226667a10.666667 10.666667 0 0 0-10.286667 13.473333l110.546667 405.333333A10.666667 10.666667 0 0 0 173.773333 469.333333h787a10.666667 10.666667 0 0 0 10.286667-13.473333z" horiz-adv-x="1024" />
<glyph glyph-name="gitee" unicode="&#59035;" d="M512-128C229.222-128 0 101.222 0 384S229.222 896 512 896s512-229.222 512-512-229.222-512-512-512z m259.149 568.883h-290.74a25.293 25.293 0 0 1-25.292-25.293l-0.026-63.206c0-13.952 11.315-25.293 25.267-25.293h177.024c13.978 0 25.293-11.315 25.293-25.267v-12.646a75.853 75.853 0 0 0-75.853-75.853h-240.23a25.293 25.293 0 0 0-25.267 25.293V478.797a75.853 75.853 0 0 0 75.827 75.853h353.946a25.293 25.293 0 0 1 25.267 25.292l0.077 63.207a25.293 25.293 0 0 1-25.268 25.293H417.152a189.62 189.62 0 0 1-189.62-189.645V124.85c0-13.977 11.316-25.293 25.294-25.293h372.94a170.65 170.65 0 0 1 170.65 170.65V415.616a25.293 25.293 0 0 1-25.293 25.267z" horiz-adv-x="1024" />
<glyph glyph-name="github" unicode="&#59047;" d="M512 883.32190493c275.66730126 0 499.32190493-223.65460366 499.32190493-499.32190493 0-220.40901063-143.01411555-407.65472541-341.32813256-473.98131826-25.34058667-4.53550763-34.45321159 11.06830222-34.45321159 24.05067207 0 16.26957255 0.6657627 70.19633778 0.66576271 137.18869334 0 46.81142841-15.60380985 76.72913237-33.7874489 92.33294222 111.18234397 12.35821682 228.19011015 54.63413874 228.1901113 246.41536 0 54.63413874-19.51516445 98.82412715-51.34693604 133.9431003 5.20127033 13.02397952 22.09499477 63.70515285-5.20127033 132.61157604-41.61015922 13.02397952-137.18869333-51.34693603-137.18869333-51.34693604a469.36259015 469.36259015 0 0 1-249.6609519 0S291.63259904 689.58500523 250.02244096 676.56102571c-27.29626397-68.90642318-10.40253952-119.62920619-5.20127033-132.61157604-31.87338126-35.11897429-51.34693603-79.3089627-51.34693604-133.9431003 0-191.15706937 116.38361429-234.05714318 227.56595826-246.41536-14.31389411-13.02397952-27.29626397-35.11897429-31.87338126-66.95074588-28.62778937-13.02397952-101.44556715-35.11897429-144.96979285 41.61015921-27.29626397 47.47719111-76.72913237 51.34693603-76.72913351 51.34693604-48.76710571 0.6657627-3.24559189-30.54185699-3.2455919-30.541857 32.49753429-14.93804715 55.25829063-72.81777778 55.25829064-72.81777777 29.25194126-89.08735033 168.39631189-59.16964523 168.39631302-59.16964523 0-41.61015922 0.6657627-80.5988773 0.66576157-92.95709525 0-13.02397952-9.11262493-28.62778937-34.45321045-24.05067094C155.77543111-23.61311459000001 12.76131555 163.63259903999995 12.76131555 384.04160967c0 275.66730126 223.65460366 499.32190493 499.32190493 499.32190492zM201.87948715 166.21242937c1.28991459 2.62144-0.6657627 5.86703189-4.53550763 7.78109952-3.91135459 1.28991459-7.15694763 0.6657627-8.44686222-1.2899146-1.28991459-2.62144 0.6657627-5.86703189 4.53550763-7.78109952 3.24559189-1.9556773 7.15694763-1.28991459 8.44686222 1.2899146z m20.13931634-22.13660444c2.62144 1.9556773 1.9556773 6.49118493-1.2899146 10.40253952-3.24559189 3.24559189-7.78109952 4.53550763-10.40253952 1.95567729-2.62144-1.9556773-1.9556773-6.49118493 1.2899146-10.40253952 3.24559189-3.24559189 7.78109952-4.53550763 10.40253952-1.95567729z m19.51516444-29.25194127c3.24559189 2.62144 3.24559189 7.78109952 0 12.35821682-2.62144 4.53550763-7.78109952 6.49118493-11.06830222 3.91135459-3.24559189-1.9556773-3.24559189-7.15694763 0-11.69245411s8.44686222-6.49118493 11.06830222-4.53550763z m27.29626396-27.2962651c2.62144 2.62144 1.28991459 8.44686222-2.62144 12.35821795-4.53550763 4.53550763-10.40253952 5.20127033-13.02397952 1.9556773-3.24559189-2.62144-1.9556773-8.44686222 2.62144-12.35821682 4.53550763-4.53550763 10.40253952-5.20127033 13.02397952-1.95567843z m37.0746516-16.26957141c1.28991459 3.91135459-2.62144 8.44686222-8.44686223 10.40253952-5.20127033 1.28991459-11.06830222-0.6657627-12.35821681-4.53550763s2.62144-8.44686222 8.44686222-9.73677682c5.20127033-1.9556773 11.06830222 0 12.35821682 3.9113546z m40.94439651-3.24559304c0 4.53550763-5.20127033 7.78109952-11.06830222 7.15694763-5.86703189 0-10.40253952-3.24559189-10.40253952-7.15694763 0-4.53550763 4.53550763-7.78109952 11.06830222-7.15694648 5.86703189 0 10.40253952 3.24559189 10.40253952 7.15694648z m37.69880349 6.49118493c-0.6657627 3.91135459-5.86703189 6.49118493-11.69245412 5.86703303-5.86703189-1.28991459-9.73677682-5.20127033-9.11262492-9.73677796 0.6657627-3.91135459 5.86703189-6.49118493 11.69245411-5.20126918s9.73677682 5.20127033 9.11262493 9.11262492z" horiz-adv-x="1024" />
<glyph glyph-name="disabled" unicode="&#59084;" d="M509.20496914 834c-245.9627332 0-447.20496914-201.24223594-447.20496914-447.20496914s201.24223594-447.20496914 447.20496914-447.20496914 447.20496914 201.24223594 447.20496914 447.20496914-201.24223594 447.20496914-447.20496914 447.20496914zM509.20496914-10.09937930000001C291.19254628-10.09937930000001 112.31055898 168.78260888 112.31055898 386.79503086c0 95.03105625 33.54037295 184.4720499 95.03105625 257.14285752l553.41614883-553.41614883C693.67701904 23.440993649999996 604.23602451-10.09937930000001 509.20496914-10.09937930000001z m296.27329131 134.16149092l-559.00621055 553.41614883C319.14285752 738.96894375 408.58385117 778.0993793 509.20496914 778.0993793c218.01242197 0 396.89441016-178.8819873 396.89441016-396.89441016 0-95.03105625-39.13043467-190.06211162-100.62111885-257.14285752z" horiz-adv-x="1024" />
@ -58,8 +68,6 @@
<glyph glyph-name="chrome" unicode="&#59018;" d="M515.436 583.685H914.285C840.842 730.955 688.748 832.132 513 832.132c-141.284 0-267.274-65.395-349.42-167.546l151.66-262.682c8.535 102.325 95.704 181.781 200.196 181.781zM514.218 550.803c-91.476 0-165.631-74.155-165.631-165.631s74.155-165.631 165.631-165.631c52.7 0 99.615 24.642 129.95 62.999l1.428 2.474 0.355-0.205c21.252 27.852 33.898 62.624 33.898 100.363 0 84.774-63.702 154.626-145.841 164.413l-6.393 0.632c-4.424 0.354-8.882 0.586-13.397 0.586zM929.561 549.585H627.443c52.209-36.066 86.506-96.297 86.506-164.413 0-45.547-18.268-81.598-41.12-121.192L483.898-63.257c9.624-0.617 19.322-0.966 29.102-0.966 247.521 0 448.177 200.656 448.177 448.177 0 58.508-11.225 114.391-31.616 165.631zM514.218 185.441c-83.583 0-144.927 54.804-185.034 124.651l-0.235-0.136-187.482 324.727C93.081 563.124 64.823 476.84 64.823 383.954c0-225.02 165.839-411.288 381.958-443.298l152.278 263.752c-25.769-12.143-54.518-18.967-84.841-18.967z" horiz-adv-x="1024" />
<glyph glyph-name="edge" unicode="&#59019;" d="M854.794 669.297C797.923 743.783 683.626 823.59 548.62 830.822 136.707 852.889 85.742 435.448 85.742 435.448c55.449 53.038 58.01 97.116 163.936 154.293C673.983 818.768 676.394 476.432 676.394 476.432H346.111c-7.232 65.092 62.681 137.417 62.681 137.417-202.509-98.844-216.974-284.477-216.974-284.477s-28.93-279.655 219.385-364.034 452.029 42.189 452.029 42.189V193.16c-59.065-32.546-102.292-54.405-153.087-63.887-361.623-67.503-364.034 188.044-364.034 188.044h585.83c0 0.001 39.075 199.761-77.147 351.98z" horiz-adv-x="1024" />
<glyph glyph-name="heart" unicode="&#59020;" d="M512 4.100000000000023c-108.9 0-447.3 277.5-447.3 522.2 0 131 106.6 237.6 237.6 237.6 94.9 0 174.8-50.2 209.7-76.1 34.9 25.9 114.8 76.1 209.7 76.1 131 0 237.6-106.6 237.6-237.6 0-244.7-338.4-522.2-447.3-522.2zM302.3 708c-100.2 0-181.7-81.5-181.7-181.7 0-221 326.8-466.3 391.4-466.3s391.4 245.3 391.4 466.3c0 100.2-81.5 181.7-181.7 181.7-103.9 0-190.2-76-191.1-76.8-10.6-9.5-26.7-9.5-37.3 0-0.8 0.8-87.7 76.8-191 76.8z" horiz-adv-x="1024" />
<glyph glyph-name="key" unicode="&#59011;" d="M819.2 588.8c0-172.8-140.8-307.2-307.2-307.2-172.8 0-307.2 140.8-307.2 307.2C204.8 755.2 339.2 896 512 896S819.2 755.2 819.2 588.8L819.2 588.8zM512 838.4c-140.8 0-249.6-115.2-249.6-249.6 0-134.4 108.8-256 249.6-256s256 115.2 256 249.6S652.8 838.4 512 838.4L512 838.4zM480 300.79999999999995l64 0L544-128l-64 0L480 300.79999999999995 480 300.79999999999995zM512 192l192 0 0-64L512 128 512 192 512 192zM512 64l192 0 0-64L512 0 512 64 512 64z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 316 KiB

After

Width:  |  Height:  |  Size: 322 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,111 @@
/**
images压缩扩展模块
changlin_zhao@qq.com
2021.5.25
**/
layui.define(['upload','layer'],function(exports){
var upload = layui.upload;
var layer = layui.layer;
var compressImage = {
uploads: function(obj){
//obj.preview(function(index, file, result){
//执行实例
var files = obj.pushFile();
var filesArry = [];
for (var key in files) { //将上传的文件转为数组形式
filesArry.push(files[key])
}
var index = filesArry.length - 1;
var file = filesArry[index]; //获取最后选择的图片,即处理多选情况
if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
.replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
return obj.upload(index, file)
}
canvasDataURL(file, function (blob) {
var aafile = new File([blob], file.name, {
type: file.type
})
var isLt1M;
if (file.size < aafile.size) {
isLt1M = file.size
} else {
isLt1M = aafile.size
}
if (isLt1M / 1024 / 1024 > 2) {
return layer.alert('上传图片过大!')
} else {
if (file.size < aafile.size) {
return obj.upload(index, file)
}
obj.upload(index, aafile)
}
})
function canvasDataURL(file, callback) { //压缩转化为base64
var reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = function (e) {
const img = new Image()
const quality = 0.8 // 图像质量
const canvas = document.createElement('canvas')
const drawer = canvas.getContext('2d')
img.src = this.result
img.onload = function () {
var originWidth = img.width,/* 图片的宽度 */
originHeight = img.height; /* 图片的高度 */
// 设置最大尺寸限制将所有图片都压缩到小于1m
const maxWidth = 2560, maxHeight = 1600;
// 需要压缩的目标尺寸
let targetWidth = originWidth, targetHeight = originHeight;
// 等比例计算超过最大限制时缩放后的图片尺寸
if (originWidth > maxWidth || originHeight > maxHeight) {
if (originWidth / originHeight > 1) {
// 宽图片
targetWidth = maxWidth;
targetHeight = Math.round(maxWidth * (originHeight / originWidth));
} else {
// 高图片
targetHeight = maxHeight;
targetWidth = Math.round(maxHeight * (originWidth / originHeight));
}
}
canvas.width = targetWidth;
canvas.height = targetHeight;
drawer.drawImage(img, 0, 0, canvas.width, canvas.height)
convertBase64UrlToBlob(canvas.toDataURL(file.type, quality), callback);
}
}
}
function convertBase64UrlToBlob(urlData, callback) { //将base64转化为文件格式
const arr = urlData.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
callback(new Blob([u8arr], {
type: mime
}));
}
//})
}
}
//输出 imgcom 接口
exports('imgcom', compressImage);
});

View File

@ -80,7 +80,7 @@ layui.define(['form', 'upload'], function(exports){
var field = data.field;
var URL = $(this).data('url');
$.post(URL, field,function(res){
if(res.code == 0){
if(res.code === 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 299 KiB

After

Width:  |  Height:  |  Size: 322 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,10 @@
/**
@Name: Fly社区
@Author: 贤心
@Site: fly.layui.com
*/

/* 全局 */
html,body{overflow-x: hidden;}
html body{margin-top: 61px;}
html{background-color: #F2F2F2;}
i{font-style: normal;}
h1,h2,h3 {font-weight: 400;}
/* 布局 */
.layui-mm{position: fixed; top: 100px; bottom: 0;}
@ -185,9 +181,11 @@ 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 img {width:135px; height: 37px;}
.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 +196,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 +210,30 @@ 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;}
*/
/*第二排导航*/
.layui-nav.layui-bg-white {
background-color: #FFFFFF !important;
color: #2F363C !important;
}
.layui-nav.layui-bg-white li a {
height: 50px;
color: #0A0E11;
}
.layui-nav.layui-bg-white li a:hover {
color: #0A0E11;
}
.layui-nav.layui-bg-white .layui-this:after {
content: none !important;
}
.layui-nav.layui-bg-white .layui-nav-item {
height: 50px;
line-height: 50px;
text-align: center;
}
/* 搜索 */
.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;}
@ -383,7 +392,7 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co
.que-body .que-user-info .que-avatar i{position: absolute; left: 35px; top: 15px; }
.que-body .que-user-info span{display: inline-block; font-size: 12px; padding-left: 5px;}
/* 签到 */
/* 签到 */
.fly-signin cite{padding: 0 5px; color: #FF5722; font-style: normal;}
.fly-signin .layui-badge-dot{top: -7px; margin-left: 0px;}
.fly-signin-list{padding: 0; line-height: 30px;}
@ -516,7 +525,7 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co
*/
.layui-form-pane{position:relative; width:100%;}
.que-comments{position:absolute;right:20px;bottom:5px;}
.que-comments{position:absolute; right:15px; bottom:15px;}
.wenda-user{height:200px; margin: 0,auto; text-align: center; pardding-top:20px;}
.wenda-user .user-img{posation:relative; width:100%;}
@ -529,7 +538,7 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co
.detail-zan span{padding-right:5px; color:#999; cursor:pointer;}
.detail-zan span:hover{color:#666;}
.detail-zan span .icon-zan{font-size: 22px;}
.detail-zan span img{height: 25px; border-radius: 100%;}
.detail-zan span img{height: 25px; width:25px; border-radius: 100%; object-fit: cover;}
/* 详情页的底部操作条 */
@ -569,7 +578,7 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co
.detail-about-reply .detail-hits{left: 0; bottom: 0;}
.detail-about-reply .fly-avatar{left: 0; top: 0;}
.jieda-body{margin: 25px 0 20px; min-height: 0; line-height: 24px; font-size:14px;}
.jieda-body{margin: 10px 0; min-height: 0; line-height: 24px; font-size:14px;}
.jieda-body p{margin-bottom: 10px;}
.jieda-body a{color:#4f99cf}
.jieda-reply{position:relative; font-size: 14px}
@ -591,6 +600,10 @@ body .fly-user-main{position: relative; min-height: 600px;}
.fly-user-main .fly-none{min-height: 0;}
.fly-panel-user[pad20]{padding-top: 5px;}
@media screen and (min-width: 768px) {
.fly-panel-user{height: calc(100vh - 280px)}
}
.fly-form-app{margin-top:30px;}
.fly-form-app .iconfont{font-size:26px; padding: 0 5px;}
.fly-form-app .icon-qq{color:#7CA9C9}
@ -712,7 +725,7 @@ body .fly-user-main{position: relative; min-height: 600px;}
@media screen and (max-width: 768px) {
.fly-main{width: 100%;}
.fly-main{width: 100%;}
/* 顶边距 */
.fly-marginTop{margin-top: 0;}
@ -826,7 +839,7 @@ blockquote {
@media (max-width:767px) {.footer-col {margin-right:0}
}
@media (max-width:1239px) {
.footer-col-logo {display:none}
.footer-col-logo {display:none}
}
.footer-col-logo img {display:block;max-width:160px;max-height:60px;height:auto}
.footer-col-sns {float:right;margin-right:0}
@ -856,19 +869,19 @@ blockquote {
@media (min-width: 768px) {
.container {
width:750px;
width:750px;
}
}
@media (min-width: 992px) {
.container {
width:970px;
width:970px;
}
}
@media (min-width: 1200px) {
.container {
width:1170px;
width:1170px;
}
}
@ -883,3 +896,189 @@ 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

@ -0,0 +1,105 @@
/**
images压缩扩展模块
changlin_zhao@qq.com
2023.5.23
**/
layui.define(['upload','layer'],function(exports){
var layer = layui.layer;
var Compressor = {
upload: function (obj) {
// opthions = {
// width: option[0],
// height: option[1],
// quality: option[2]
// }
obj.preview(function(index, file, result){
canvasDataURL(result, {quality: 0.7}, function(base64Codes){
obj.upload(index, convertBase64UrlTo(base64Codes, file.name));
});
});
}
}
// 已知 base64
// canvasDataURL(base64, {quality: 0.7}, function(base64Codes){
// // base64Codes 为压缩后的
// // 其中 convertBase64UrlTo(base64Codes, file.name) 可返回 File 对象和 Blob
// obj.upload(index, convertBase64UrlTo(base64Codes, file.name));
// });
// 未知 base64
// imageCompress(file, {quality: 0.7}, function(base64Codes){
// // base64Codes 为压缩后的
// obj.upload(index, convertBase64UrlTo(base64Codes, file.name));
// });
/**
* 读取文件
* @param {file or Blob} file 上传文件
* @param {object} config 压缩配置 可配置压缩长宽质量等
* @param {function} callback
*/
function imageCompress(file, config, callback){
var ready = new FileReader();
ready.readAsDataURL(file);
ready.onload=function(){
canvasDataURL(this.result, config, callback)
}
}
/**
*
* @param {string} path
* @param {object} config -- {width: '', height: '', quality: 0.7}
* @param {function} callback
*/
function canvasDataURL(path, config, callback){
var img = new Image();
img.src = path;
img.onload = function(){
var that = this, quality = 0.7;
var w = that.width, h = that.height, scale = w / h;
w = config.width || w;
h = config.height || (w / scale);
//生成canvas
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var anw = document.createAttribute("width");
anw.nodeValue = w;
var anh = document.createAttribute("height");
anh.nodeValue = h;
canvas.setAttributeNode(anw);
canvas.setAttributeNode(anh);
ctx.drawImage(that, 0, 0, w, h);
if(config.quality && config.quality <= 1 && config.quality > 0){
quality = config.quality;
}
callback(canvas.toDataURL('image/jpeg', quality));
}
}
/**
* 将图片 base64 转为 File 对象或者 Blob
* @param {*} urlData 图片 base64
* @param {*} filename 图片名 没有图片名将转为 Blob
*/
function convertBase64UrlTo(urlData, filename = null){
var base64Arr = urlData.split(','), mime = base64Arr[0].match(/:(.*?);/)[1],
bstr = atob(base64Arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return filename ? new File([u8arr], filename, {type:mime}) : new Blob([u8arr], {type:mime});
}
//输出 imagecut接口
exports('imagecut', Compressor);
});

View File

@ -696,42 +696,6 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
//console.log(othis.attr('src'));
});
//头条轮播
if($('#FLY_topline')[0]){
layui.use('carousel', function(){
var carousel = layui.carousel;
var ins = carousel.render({
elem: '#FLY_topline'
,width: '100%'
,height: '172px'
,anim: 'fade'
});
var resizeTopline = function(){
var width = $(this).prop('innerWidth');
if(width >= 1200){
ins.reload({
height: '172px'
});
} else if(width >= 992){
ins.reload({
height: '141px'
});
} else if(width >= 768){
ins.reload({
height: '166px'
});
}
};
resizeTopline()
$(window).on('resize', resizeTopline);
});
}
//签到
//活跃榜

View File

@ -234,27 +234,29 @@ layui.define('fly', function(exports){
});
});
}
}
,del: function(li){ //删除评论
layer.confirm('确认删除该回答么?', function(index){
layer.close(index);
fly.json(commentJiedaDelete, {
id: li.data('id')
}, function(res){
if(res.status === 0){
var count = dom.jiedaCount.text()|0;
dom.jiedaCount.html(--count);
li.remove();
//如果删除了最佳答案
if(li.hasClass('jieda-daan')){
$('.jie-status').removeClass('jie-status-ok').text('求解中');
,del: function(span){ //删除评论
if(taonystatus == 0) {
layer.confirm('确认删除该回答么?', function(index){
layer.close(index);
fly.json(commentJiedaDelete, {
id: li.data('id')
}, function(res){
if(res.status === 0){
var count = dom.jiedaCount.text()|0;
dom.jiedaCount.html(--count);
li.remove();
//如果删除了最佳答案
if(li.hasClass('jieda-daan')){
$('.jie-status').removeClass('jie-status-ok').text('求解中');
}
} else {
layer.msg(res.msg);
}
} else {
layer.msg(res.msg);
}
});
});
});
}
}
};

File diff suppressed because it is too large Load Diff

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 { }}\

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -42,35 +42,37 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
/** @var ?string */
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
@ -78,8 +80,7 @@ class ClassLoader
private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
* @var array<string, string>
*/
private $classMap = array();
@ -87,29 +88,29 @@ class ClassLoader
private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var ?string */
/** @var string|null */
private $apcuPrefix;
/**
* @var self[]
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param ?string $vendorDir
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return string[]
* @return array<string, list<string>>
*/
public function getPrefixes()
{
@ -121,8 +122,7 @@ class ClassLoader
}
/**
* @return array[]
* @psalm-return array<string, array<int, string>>
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
@ -130,8 +130,7 @@ class ClassLoader
}
/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirs()
{
@ -139,8 +138,7 @@ class ClassLoader
}
/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
@ -148,8 +146,7 @@ class ClassLoader
}
/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
@ -157,8 +154,7 @@ class ClassLoader
}
/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
@ -175,24 +171,25 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
$paths
);
}
@ -201,19 +198,19 @@ class ClassLoader
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
$paths
);
}
}
@ -222,9 +219,9 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
@ -232,17 +229,18 @@ class ClassLoader
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@ -252,18 +250,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
$paths
);
}
}
@ -272,8 +270,8 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
@ -290,8 +288,8 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
@ -425,7 +423,8 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
@ -476,9 +475,9 @@ class ClassLoader
}
/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return self[]
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
@ -555,18 +554,26 @@ class ClassLoader
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
* @private
*/
function includeFile($file)
{
include $file;
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}

View File

@ -98,7 +98,7 @@ class InstalledVersions
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
@ -119,7 +119,7 @@ class InstalledVersions
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
@ -328,7 +328,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
@ -340,12 +342,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}

View File

@ -14,7 +14,7 @@ return array(
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
'think\\app\\' => array($vendorDir . '/topthink/think-multi-app/src'),
'think\\' => array($vendorDir . '/topthink/framework/src/think', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src'),
'think\\' => array($vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src', $vendorDir . '/topthink/framework/src/think'),
'taoser\\think\\' => array($vendorDir . '/taoser/think-auth/src'),
'taoser\\' => array($vendorDir . '/taoser/think-addons/src', $vendorDir . '/taoser/think-setarr/src'),
'phpspirit\\databackup\\' => array($vendorDir . '/lotofbadcode/phpspirit_databackup/src'),

View File

@ -33,25 +33,18 @@ class ComposerAutoloaderInit1b32198725235c8d6500c87262ef30c2
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit1b32198725235c8d6500c87262ef30c2::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire1b32198725235c8d6500c87262ef30c2($fileIdentifier, $file);
$filesToLoad = \Composer\Autoload\ComposerStaticInit1b32198725235c8d6500c87262ef30c2::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequire1b32198725235c8d6500c87262ef30c2($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}

View File

@ -176,10 +176,10 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
),
'think\\' =>
array (
0 => __DIR__ . '/..' . '/topthink/framework/src/think',
1 => __DIR__ . '/..' . '/topthink/think-helper/src',
2 => __DIR__ . '/..' . '/topthink/think-orm/src',
3 => __DIR__ . '/..' . '/topthink/think-template/src',
0 => __DIR__ . '/..' . '/topthink/think-helper/src',
1 => __DIR__ . '/..' . '/topthink/think-orm/src',
2 => __DIR__ . '/..' . '/topthink/think-template/src',
3 => __DIR__ . '/..' . '/topthink/framework/src/think',
),
'taoser\\think\\' =>
array (

View File

@ -491,18 +491,24 @@
},
{
"name": "guzzlehttp/promises",
"version": "1.5.2",
"version_normalized": "1.5.2.0",
"version": "1.5.3",
"version_normalized": "1.5.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "b94b2807d85443f9719887892882d0329d1e2598"
"reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598",
"reference": "b94b2807d85443f9719887892882d0329d1e2598",
"shasum": ""
"url": "https://api.github.com/repos/guzzle/promises/zipball/67ab6e18aaa14d753cc148911d273f6e6cb6721e",
"reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.5"
@ -510,13 +516,8 @@
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"time": "2022-08-28T14:55:35+00:00",
"time": "2023-05-21T12:31:43+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
@ -558,7 +559,7 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.5.2"
"source": "https://github.com/guzzle/promises/tree/1.5.3"
},
"funding": [
{
@ -578,18 +579,24 @@
},
{
"name": "guzzlehttp/psr7",
"version": "1.9.0",
"version_normalized": "1.9.0.0",
"version": "1.9.1",
"version_normalized": "1.9.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318"
"reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318",
"reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318",
"shasum": ""
"url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b",
"reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.4.0",
@ -606,13 +613,8 @@
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"time": "2022-06-20T21:43:03+00:00",
"time": "2023-04-17T16:00:37+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
@ -671,7 +673,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/1.9.0"
"source": "https://github.com/guzzle/psr7/tree/1.9.1"
},
"funding": [
{
@ -848,17 +850,17 @@
},
{
"name": "laravel/serializable-closure",
"version": "v1.2.2",
"version_normalized": "1.2.2.0",
"version": "v1.3.1",
"version_normalized": "1.3.1.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/serializable-closure.git",
"reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae"
"reference": "e5a3057a5591e1cfe8183034b0203921abe2c902"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae",
"reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/e5a3057a5591e1cfe8183034b0203921abe2c902",
"reference": "e5a3057a5591e1cfe8183034b0203921abe2c902",
"shasum": ""
},
"require": {
@ -870,7 +872,7 @@
"phpstan/phpstan": "^1.8.2",
"symfony/var-dumper": "^5.4.11"
},
"time": "2022-09-08T13:45:54+00:00",
"time": "2023-07-14T13:56:28+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -1162,18 +1164,24 @@
"source": {
"type": "git",
"url": "https://github.com/lotofbadcode/phpspirit_databackup.git",
"reference": "1835cf8230531840ada1ed2b25eba23de5ad32c5"
"reference": "77c2421f8461392c044cf8c29918f495c22a5612"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lotofbadcode/phpspirit_databackup/zipball/1835cf8230531840ada1ed2b25eba23de5ad32c5",
"reference": "1835cf8230531840ada1ed2b25eba23de5ad32c5",
"shasum": ""
"url": "https://api.github.com/repos/lotofbadcode/phpspirit_databackup/zipball/77c2421f8461392c044cf8c29918f495c22a5612",
"reference": "77c2421f8461392c044cf8c29918f495c22a5612",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.0"
},
"time": "2022-06-18T12:21:57+00:00",
"time": "2023-05-12T12:02:05+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1386,24 +1394,18 @@
},
{
"name": "phpmailer/phpmailer",
"version": "v6.7.1",
"version_normalized": "6.7.1.0",
"version": "v6.8.0",
"version_normalized": "6.8.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "49cd7ea3d2563f028d7811f06864a53b1f15ff55"
"reference": "df16b615e371d81fb79e506277faea67a1be18f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/49cd7ea3d2563f028d7811f06864a53b1f15ff55",
"reference": "49cd7ea3d2563f028d7811f06864a53b1f15ff55",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/df16b615e371d81fb79e506277faea67a1be18f1",
"reference": "df16b615e371d81fb79e506277faea67a1be18f1",
"shasum": ""
},
"require": {
"ext-ctype": "*",
@ -1431,7 +1433,7 @@
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication"
},
"time": "2022-12-08T13:30:06+00:00",
"time": "2023-03-06T14:43:22+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1463,7 +1465,7 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.7.1"
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.0"
},
"funding": [
{
@ -1640,24 +1642,24 @@
},
{
"name": "psr/http-client",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"version": "1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0"
"psr/http-message": "^1.0 || ^2.0"
},
"time": "2020-06-29T06:28:15+00:00",
"time": "2023-04-10T20:12:12+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -1677,7 +1679,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
@ -1689,7 +1691,7 @@
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/master"
"source": "https://github.com/php-fig/http-client/tree/1.0.2"
},
"install-path": "../psr/http-client"
},
@ -2287,24 +2289,18 @@
},
{
"name": "symfony/var-exporter",
"version": "v5.4.21",
"version_normalized": "5.4.21.0",
"version": "v5.4.26",
"version_normalized": "5.4.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
"reference": "be74908a6942fdd331554b3cec27ff41b45ccad4"
"reference": "11401fe94f960249b3c63a488c63ba73091c1e4a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/be74908a6942fdd331554b3cec27ff41b45ccad4",
"reference": "be74908a6942fdd331554b3cec27ff41b45ccad4",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/11401fe94f960249b3c63a488c63ba73091c1e4a",
"reference": "11401fe94f960249b3c63a488c63ba73091c1e4a",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
@ -2313,7 +2309,7 @@
"require-dev": {
"symfony/var-dumper": "^4.4.9|^5.0.9|^6.0"
},
"time": "2023-02-21T19:46:44+00:00",
"time": "2023-07-20T07:21:16+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2349,7 +2345,7 @@
"serialize"
],
"support": {
"source": "https://github.com/symfony/var-exporter/tree/v5.4.21"
"source": "https://github.com/symfony/var-exporter/tree/v5.4.26"
},
"funding": [
{
@ -2369,24 +2365,18 @@
},
{
"name": "taoser/think-addons",
"version": "v1.0.6",
"version_normalized": "1.0.6.0",
"version": "v1.0.9",
"version_normalized": "1.0.9.0",
"source": {
"type": "git",
"url": "https://github.com/taoser/think-addons.git",
"reference": "e6e35bfd8b93dc469ebb5c5530ba350131bd7541"
"reference": "00112adf200b897deecbd1bbabc33ad22377b008"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/taoser/think-addons/zipball/e6e35bfd8b93dc469ebb5c5530ba350131bd7541",
"reference": "e6e35bfd8b93dc469ebb5c5530ba350131bd7541",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/taoser/think-addons/zipball/00112adf200b897deecbd1bbabc33ad22377b008",
"reference": "00112adf200b897deecbd1bbabc33ad22377b008",
"shasum": ""
},
"require": {
"php": ">=7.1.0",
@ -2395,7 +2385,7 @@
"topthink/think-helper": "^3.0.0",
"topthink/think-view": "^1.0"
},
"time": "2022-10-06T13:11:38+00:00",
"time": "2023-06-10T05:08:45+00:00",
"type": "library",
"extra": {
"think": {
@ -2429,7 +2419,7 @@
"description": "The ThinkPHP6 Addons Package",
"support": {
"issues": "https://github.com/taoser/think-addons/issues",
"source": "https://github.com/taoser/think-addons/tree/v1.0.6"
"source": "https://github.com/taoser/think-addons/tree/v1.0.9"
},
"install-path": "../taoser/think-addons"
},
@ -2603,24 +2593,18 @@
},
{
"name": "topthink/framework",
"version": "v6.1.2",
"version_normalized": "6.1.2.0",
"version": "v6.1.4",
"version_normalized": "6.1.4.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
"reference": "67235be5b919aaaf1de5aed9839f65d8e766aca3"
"reference": "66eb9cf4d627df12911344cd328faf9bb596bf2c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/67235be5b919aaaf1de5aed9839f65d8e766aca3",
"reference": "67235be5b919aaaf1de5aed9839f65d8e766aca3",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/top-think/framework/zipball/66eb9cf4d627df12911344cd328faf9bb596bf2c",
"reference": "66eb9cf4d627df12911344cd328faf9bb596bf2c",
"shasum": ""
},
"require": {
"ext-json": "*",
@ -2639,7 +2623,7 @@
"mockery/mockery": "^1.2",
"phpunit/phpunit": "^7.0"
},
"time": "2023-02-08T02:24:01+00:00",
"time": "2023-07-11T15:16:03+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2671,29 +2655,35 @@
],
"support": {
"issues": "https://github.com/top-think/framework/issues",
"source": "https://github.com/top-think/framework/tree/v6.1.2"
"source": "https://github.com/top-think/framework/tree/v6.1.4"
},
"install-path": "../topthink/framework"
},
{
"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": {
@ -2727,7 +2717,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"
},
@ -2842,27 +2832,21 @@
},
{
"name": "topthink/think-migration",
"version": "v3.0.4",
"version_normalized": "3.0.4.0",
"version": "v3.0.6",
"version_normalized": "3.0.6.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-migration.git",
"reference": "c5880669b277762d5ff935e551bc0d5c71de6811"
"reference": "82c4226cb14f973b9377c7fc6e89c525cbb8b030"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-migration/zipball/c5880669b277762d5ff935e551bc0d5c71de6811",
"reference": "c5880669b277762d5ff935e551bc0d5c71de6811",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/top-think/think-migration/zipball/82c4226cb14f973b9377c7fc6e89c525cbb8b030",
"reference": "82c4226cb14f973b9377c7fc6e89c525cbb8b030",
"shasum": ""
},
"require": {
"topthink/framework": "^6.0",
"topthink/framework": "^6.0 || ^8.0",
"topthink/think-helper": "^3.0.3"
},
"require-dev": {
@ -2871,7 +2855,7 @@
"suggest": {
"fzaninotto/faker": "Required to use the factory builder (^1.8)."
},
"time": "2022-10-26T07:57:54+00:00",
"time": "2023-07-01T11:01:52+00:00",
"type": "library",
"extra": {
"think": {
@ -2899,23 +2883,23 @@
],
"support": {
"issues": "https://github.com/top-think/think-migration/issues",
"source": "https://github.com/top-think/think-migration/tree/v3.0.4"
"source": "https://github.com/top-think/think-migration/tree/v3.0.6"
},
"install-path": "../topthink/think-migration"
},
{
"name": "topthink/think-multi-app",
"version": "v1.0.16",
"version_normalized": "1.0.16.0",
"version": "v1.0.17",
"version_normalized": "1.0.17.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-multi-app.git",
"reference": "07b9183855150455e1f76f8cbe9d77d6d1bc399f"
"reference": "4055a6187296ac16c0bc7bbab4ed5d92f82f791c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/07b9183855150455e1f76f8cbe9d77d6d1bc399f",
"reference": "07b9183855150455e1f76f8cbe9d77d6d1bc399f",
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/4055a6187296ac16c0bc7bbab4ed5d92f82f791c",
"reference": "4055a6187296ac16c0bc7bbab4ed5d92f82f791c",
"shasum": "",
"mirrors": [
{
@ -2928,7 +2912,7 @@
"php": ">=7.1.0",
"topthink/framework": "^6.0|^8.0"
},
"time": "2023-02-07T08:40:09+00:00",
"time": "2023-03-29T02:04:29+00:00",
"type": "library",
"extra": {
"think": {
@ -2953,26 +2937,26 @@
"email": "liu21st@gmail.com"
}
],
"description": "thinkphp6 multi app support",
"description": "thinkphp multi app support",
"support": {
"issues": "https://github.com/top-think/think-multi-app/issues",
"source": "https://github.com/top-think/think-multi-app/tree/v1.0.16"
"source": "https://github.com/top-think/think-multi-app/tree/v1.0.17"
},
"install-path": "../topthink/think-multi-app"
},
{
"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": [
{
@ -2992,7 +2976,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": {
@ -3020,7 +3004,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"
},
@ -3279,30 +3263,24 @@
},
{
"name": "workerman/phpsocket.io",
"version": "v1.1.16",
"version_normalized": "1.1.16.0",
"version": "v1.1.18",
"version_normalized": "1.1.18.0",
"source": {
"type": "git",
"url": "https://github.com/walkor/phpsocket.io.git",
"reference": "f4dc14e69e9d0d8ce69c6180f93b76b7743f2304"
"reference": "b89b3f2ed44f6f79fd9895e2d198b52b3fb4783b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/phpsocket.io/zipball/f4dc14e69e9d0d8ce69c6180f93b76b7743f2304",
"reference": "f4dc14e69e9d0d8ce69c6180f93b76b7743f2304",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/walkor/phpsocket.io/zipball/b89b3f2ed44f6f79fd9895e2d198b52b3fb4783b",
"reference": "b89b3f2ed44f6f79fd9895e2d198b52b3fb4783b",
"shasum": ""
},
"require": {
"workerman/channel": ">=1.0.0",
"workerman/workerman": ">=4.0.0"
"workerman/workerman": "^4.0.0"
},
"time": "2022-11-25T13:00:18+00:00",
"time": "2023-06-16T01:41:34+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3320,7 +3298,7 @@
],
"support": {
"issues": "https://github.com/walkor/phpsocket.io/issues",
"source": "https://github.com/walkor/phpsocket.io/tree/v1.1.16"
"source": "https://github.com/walkor/phpsocket.io/tree/v1.1.18"
},
"funding": [
{
@ -3336,24 +3314,18 @@
},
{
"name": "workerman/workerman",
"version": "v4.1.9",
"version_normalized": "4.1.9.0",
"version": "v4.1.13",
"version_normalized": "4.1.13.0",
"source": {
"type": "git",
"url": "https://github.com/walkor/workerman.git",
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7"
"reference": "807780ff672775fcd08f89e573a2824e939021ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/workerman/zipball/1f92d02c26106b5fbe6f61ea776198aad6e426f7",
"reference": "1f92d02c26106b5fbe6f61ea776198aad6e426f7",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/walkor/workerman/zipball/807780ff672775fcd08f89e573a2824e939021ce",
"reference": "807780ff672775fcd08f89e573a2824e939021ce",
"shasum": ""
},
"require": {
"php": ">=7.0"
@ -3361,7 +3333,7 @@
"suggest": {
"ext-event": "For better performance. "
},
"time": "2023-03-10T13:59:12+00:00",
"time": "2023-07-31T05:57:25+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {

View File

@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'taoser/taoler',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'eddc6843101a94454f9333fb993cff1741007b42',
'pretty_version' => '2.3.10.x-dev',
'version' => '2.3.10.9999999-dev',
'reference' => '0c2f0154a81dd0a6268da627982d1bf41c0ef231',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -74,18 +74,18 @@
'dev_requirement' => false,
),
'guzzlehttp/promises' => array(
'pretty_version' => '1.5.2',
'version' => '1.5.2.0',
'reference' => 'b94b2807d85443f9719887892882d0329d1e2598',
'pretty_version' => '1.5.3',
'version' => '1.5.3.0',
'reference' => '67ab6e18aaa14d753cc148911d273f6e6cb6721e',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '1.9.0',
'version' => '1.9.0.0',
'reference' => 'e98e3e6d4f86621a9b75f623996e6bbdeb4b9318',
'pretty_version' => '1.9.1',
'version' => '1.9.1.0',
'reference' => 'e4490cabc77465aaee90b20cfc9a770f8c04be6b',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
@ -119,9 +119,9 @@
'dev_requirement' => false,
),
'laravel/serializable-closure' => array(
'pretty_version' => 'v1.2.2',
'version' => '1.2.2.0',
'reference' => '47afb7fae28ed29057fdca37e16a84f90cc62fae',
'pretty_version' => 'v1.3.1',
'version' => '1.3.1.0',
'reference' => 'e5a3057a5591e1cfe8183034b0203921abe2c902',
'type' => 'library',
'install_path' => __DIR__ . '/../laravel/serializable-closure',
'aliases' => array(),
@ -157,7 +157,7 @@
'lotofbadcode/phpspirit_databackup' => array(
'pretty_version' => 'v1.2',
'version' => '1.2.0.0',
'reference' => '1835cf8230531840ada1ed2b25eba23de5ad32c5',
'reference' => '77c2421f8461392c044cf8c29918f495c22a5612',
'type' => 'library',
'install_path' => __DIR__ . '/../lotofbadcode/phpspirit_databackup',
'aliases' => array(),
@ -191,9 +191,9 @@
'dev_requirement' => false,
),
'phpmailer/phpmailer' => array(
'pretty_version' => 'v6.7.1',
'version' => '6.7.1.0',
'reference' => '49cd7ea3d2563f028d7811f06864a53b1f15ff55',
'pretty_version' => 'v6.8.0',
'version' => '6.8.0.0',
'reference' => 'df16b615e371d81fb79e506277faea67a1be18f1',
'type' => 'library',
'install_path' => __DIR__ . '/../phpmailer/phpmailer',
'aliases' => array(),
@ -239,9 +239,9 @@
'dev_requirement' => false,
),
'psr/http-client' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
'pretty_version' => '1.0.2',
'version' => '1.0.2.0',
'reference' => '0955afe48220520692d2d09f7ab7e0f93ffd6a31',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(),
@ -338,27 +338,27 @@
'dev_requirement' => false,
),
'symfony/var-exporter' => array(
'pretty_version' => 'v5.4.21',
'version' => '5.4.21.0',
'reference' => 'be74908a6942fdd331554b3cec27ff41b45ccad4',
'pretty_version' => 'v5.4.26',
'version' => '5.4.26.0',
'reference' => '11401fe94f960249b3c63a488c63ba73091c1e4a',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-exporter',
'aliases' => array(),
'dev_requirement' => false,
),
'taoser/taoler' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'eddc6843101a94454f9333fb993cff1741007b42',
'pretty_version' => '2.3.10.x-dev',
'version' => '2.3.10.9999999-dev',
'reference' => '0c2f0154a81dd0a6268da627982d1bf41c0ef231',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'taoser/think-addons' => array(
'pretty_version' => 'v1.0.6',
'version' => '1.0.6.0',
'reference' => 'e6e35bfd8b93dc469ebb5c5530ba350131bd7541',
'pretty_version' => 'v1.0.9',
'version' => '1.0.9.0',
'reference' => '00112adf200b897deecbd1bbabc33ad22377b008',
'type' => 'library',
'install_path' => __DIR__ . '/../taoser/think-addons',
'aliases' => array(),
@ -392,18 +392,18 @@
'dev_requirement' => false,
),
'topthink/framework' => array(
'pretty_version' => 'v6.1.2',
'version' => '6.1.2.0',
'reference' => '67235be5b919aaaf1de5aed9839f65d8e766aca3',
'pretty_version' => 'v6.1.4',
'version' => '6.1.4.0',
'reference' => '66eb9cf4d627df12911344cd328faf9bb596bf2c',
'type' => 'library',
'install_path' => __DIR__ . '/../topthink/framework',
'aliases' => array(),
'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(),
@ -428,27 +428,27 @@
'dev_requirement' => false,
),
'topthink/think-migration' => array(
'pretty_version' => 'v3.0.4',
'version' => '3.0.4.0',
'reference' => 'c5880669b277762d5ff935e551bc0d5c71de6811',
'pretty_version' => 'v3.0.6',
'version' => '3.0.6.0',
'reference' => '82c4226cb14f973b9377c7fc6e89c525cbb8b030',
'type' => 'library',
'install_path' => __DIR__ . '/../topthink/think-migration',
'aliases' => array(),
'dev_requirement' => false,
),
'topthink/think-multi-app' => array(
'pretty_version' => 'v1.0.16',
'version' => '1.0.16.0',
'reference' => '07b9183855150455e1f76f8cbe9d77d6d1bc399f',
'pretty_version' => 'v1.0.17',
'version' => '1.0.17.0',
'reference' => '4055a6187296ac16c0bc7bbab4ed5d92f82f791c',
'type' => 'library',
'install_path' => __DIR__ . '/../topthink/think-multi-app',
'aliases' => array(),
'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(),
@ -500,18 +500,18 @@
'dev_requirement' => false,
),
'workerman/phpsocket.io' => array(
'pretty_version' => 'v1.1.16',
'version' => '1.1.16.0',
'reference' => 'f4dc14e69e9d0d8ce69c6180f93b76b7743f2304',
'pretty_version' => 'v1.1.18',
'version' => '1.1.18.0',
'reference' => 'b89b3f2ed44f6f79fd9895e2d198b52b3fb4783b',
'type' => 'library',
'install_path' => __DIR__ . '/../workerman/phpsocket.io',
'aliases' => array(),
'dev_requirement' => false,
),
'workerman/workerman' => array(
'pretty_version' => 'v4.1.9',
'version' => '4.1.9.0',
'reference' => '1f92d02c26106b5fbe6f61ea776198aad6e426f7',
'pretty_version' => 'v4.1.13',
'version' => '4.1.13.0',
'reference' => '807780ff672775fcd08f89e573a2824e939021ce',
'type' => 'library',
'install_path' => __DIR__ . '/../workerman/workerman',
'aliases' => array(),

View File

@ -1,5 +1,11 @@
# CHANGELOG
## 1.5.3 - 2023-05-21
### Changed
- Removed remaining usage of deprecated functions
## 1.5.2 - 2022-08-07
### Changed

View File

@ -46,11 +46,6 @@
"test": "vendor/bin/simple-phpunit",
"test-ci": "vendor/bin/simple-phpunit --coverage-text"
},
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true

View File

@ -78,7 +78,7 @@ final class Each
$concurrency,
callable $onFulfilled = null
) {
return each_limit(
return self::ofLimit(
$iterable,
$concurrency,
$onFulfilled,

View File

@ -107,7 +107,7 @@ final class Utils
{
$results = [];
foreach ($promises as $key => $promise) {
$results[$key] = inspect($promise);
$results[$key] = self::inspect($promise);
}
return $results;

View File

@ -6,7 +6,7 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
max-parallel: 10
matrix:
@ -21,11 +21,7 @@ jobs:
extensions: mbstring
- name: Checkout code
uses: actions/checkout@v2
- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999
if: matrix.php > 8
uses: actions/checkout@v3
- name: Install dependencies
run: composer update --no-interaction --no-progress

View File

@ -4,14 +4,13 @@ on:
pull_request:
jobs:
build:
name: Test
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
max-parallel: 10
matrix:
php: ['7.2', '7.3', '7.4', '8.0']
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Set up PHP
@ -21,7 +20,7 @@ jobs:
coverage: none
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Download dependencies
uses: ramsey/composer-install@v1

View File

@ -6,11 +6,11 @@ on:
jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2

View File

@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
## 1.9.1 - 2023-04-17
### Fixed
- Fixed header validation issue
## 1.9.0 - 2022-06-20
### Added

Some files were not shown because too many files have changed in this diff Show More