This commit is contained in:
taoser 2023-05-05 12:04:46 +08:00
parent a825153e2e
commit 3dbc77904e
61 changed files with 1513 additions and 550 deletions

View File

@ -447,7 +447,12 @@ abstract class BaseController
*/
public function getParamFilter(array $array) :array
{
return array_filter($array, "filter");
return array_filter($array, function($arr){
if($arr === '' || $arr === null){
return false;
}
return true;
});
}
/**

View File

@ -11,6 +11,7 @@
namespace app\admin\controller\content;
use app\common\controller\AdminController;
use think\App;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
@ -20,6 +21,17 @@ use app\common\model\Comment as CommentModel;
class Comment extends AdminController
{
protected $model;
public function __construct(App $app)
{
parent::__construct($app);
$this->model = new \app\common\model\Comment();
}
/**
* 浏览
* @return string
@ -28,68 +40,93 @@ class Comment extends AdminController
{
return View::fetch();
}
public function list1()
{
$data = Request::only(['name','content','status']);
$map = $this->getParamFilter($data);
$where = [];
if(!empty($map['content'])){
$where[] = ['content', 'like', $map['content'].'%'];
}
if(isset($data['status'])){
$where[] = ['status', '=', (int) $data['status']];
}
if(isset($data['name'])){
$userId = Db::name('user')->where('name',$data['name'])->value('id');
$where[] = ['user_id', '=', $userId];
}
unset($map);
$list = $this->model->getCommentList($where, input('page'), input('limit'));
$res = [];
if($list['total']) {
$res = ['code' =>0, 'msg' => 'ok', 'count' => $list['total']];
foreach($list['data'] as $k => $v){
$res['data'][] = [
'id' => $v['id'],
'replyer' => $v['user']['name'],
'title' => $v['article']['title'],
'avatar' => $v['user']['user_img'],
'content' => strip_tags($v['content']),
'replytime' => $v['create_time'],
'check' => $v['status'],
//'url' => $this->getArticleUrl($v['article_id'], 'index', $v->article->cate->ename),
];
}
return json($res);
}
return json(['code' => 0, 'msg' => 'no data']);
}
//帖子评论
public function list()
{
if(Request::isAjax()) {
$data = Request::only(['name','content','status']);
$map = array_filter($data);
$where = array();
if(!empty($map['content'])){
$where[] = ['a.content','like', $map['content'].'%'];
unset($map['content']);
}
if(isset($data['status']) && $data['status'] !== '' ){
$where[] = ['a.status','=',(int)$data['status']];
unset($map['status']);
}
/*
$replys = Comment::field('id,article_id,user_id,content,create_time')->with([
'user' => function($query){
$query->field('id,name,user_img');
},
'article' => function($query){
$query->field('id,title');
}
])->paginate(15);
*/
$replys = Db::name('comment')
->alias('a')
->join('user u','a.user_id = u.id')
->join('article c','a.article_id = c.id')
->join('cate ca','c.cate_id = ca.id')
->field('a.id as aid,name,ename,appname,title,user_img,a.content as content,a.create_time as create_time,a.status as astatus,c.id as cid')
->where('a.delete_time',0)
->where($map)
->where($where)
->order('a.create_time', 'desc')
->paginate(15);
$count = $replys->total();
$res = [];
if ($count) {
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($replys as $k => $v){
$url = $this->getRouteUrl($v['cid'],$v['ename'], $v['appname']);
//$res['data'][] = ['id'=>$v['id'],'replyer'=>$v->user->name,'cardid'=>$v->article->title,'avatar'=>$v->user->user_img,'content'=>$v['content'],'replytime'=>$v['create_time']];
$res['data'][] = [
'id' => $v['aid'],
'replyer' => $v['name'],
'title' => htmlspecialchars($v['title']),
'avatar' => $v['user_img'],
'content' => strip_tags($v['content']),
'replytime' => date("Y-m-d",$v['create_time']),
'check' => $v['astatus'],
'url' => $url
];
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}
$data = Request::only(['name','content','status']);
$map = array_filter($data);
$where = array();
if(!empty($map['content'])){
$where[] = ['a.content','like', $map['content'].'%'];
unset($map['content']);
}
if(isset($data['status']) && $data['status'] !== '' ){
$where[] = ['a.status','=',(int)$data['status']];
unset($map['status']);
}
$replys = Db::name('comment')
->alias('a')
->join('user u','a.user_id = u.id')
->join('article c','a.article_id = c.id')
->join('cate ca','c.cate_id = ca.id')
->field('a.id as aid,name,ename,appname,title,user_img,a.content as content,a.create_time as create_time,a.status as astatus,c.id as cid')
->where('a.delete_time',0)
->where($map)
->where($where)
->order('a.create_time', 'desc')
->paginate([
'list_rows' => input('limit'),
'page' => input('page')
]);
$count = $replys->total();
if ($count) {
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($replys as $k => $v){
$res['data'][] = [
'id' => $v['aid'],
'replyer' => $v['name'],
'title' => htmlspecialchars($v['title']),
'avatar' => $v['user_img'],
'content' => strip_tags($v['content']),
'replytime' => date("Y-m-d",$v['create_time']),
'check' => $v['astatus'],
'url' => $this->getArticleUrl($v['cid'],'index',$v['ename'])
];
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
}
return json($res);
}

View File

@ -99,7 +99,6 @@ class Forum extends AdminController
'reply' => $v['is_reply'],
'check' => $v['status']
];
}
return json(['code' =>0, 'msg' => 'ok', 'count' => $list['total'], 'data' => $res['data']]);
}

View File

@ -34,78 +34,28 @@ class Arts
}
/**
* 获取文章链接地址
* @param int $aid 文章id
* @param string $ename 所属分类ename
* @param string $appname 所属应用名
* 非admin应用的文章url路由地址
* @param int $aid
* @param $ename
* @return string
*/
protected function getRouteUrl(int $aid, string $ename = '', string $appname = '') : string
public function getRouteUrl(int $aid, $ename = '')
{
$indexUrl = $this->getIndexUrl();
$domain = $this->getDomain();
$appName = app('http')->getName();
$articleUrl = (string) url('article_detail', ['id' => $aid]);
// 详情动态路由,$aid, $ename
if(config('taoler.url_rewrite.article_as') == '<ename>/'){
// 分类可变路由
$artUrl = (string) url('article_detail', ['id' => (int) $aid, 'ename'=> $ename]);
//$artUrl = (string) Route::buildUrl('article_detail', ['id' => $aid, 'ename'=> $ename]);
} else {
$artUrl = (string) url('article_detail', ['id' => $aid]);
}
//halt($indexUrl,$artUrl);
//多应用时,文章所属应用 2022.11.17
$app = app('http')->getName();
if(empty($appname)) {
// 获取article所属应用的应用名
$cid = Db::name('article')->where('id',$aid)->value('cate_id');
$appname = Db::name('cate')->where('id',$cid)->value('appname');
$articleUrl = (string) url('article_detail', ['id' => (int) $aid, 'ename'=> $ename]);
}
// 判断index应用是否绑定域名
$bind_index = array_search($appname, config('app.domain_bind'));
// 判断index应用是否域名映射
$map_index = array_search($appname, config('app.app_map'));
// article 所属应用名
$index = $map_index ?: $appname; // index应用名
// // 判断应用是否绑定域名
// $app_bind = array_search($appName, config('app.domain_bind'));
// // 判断应用是否域名映射
// $app_map = array_search($appName, config('app.app_map'));
// 判断是否开启绑定
//$domain_bind = array_key_exists('domain_bind',config('app'));
// 判断index应用是否绑定域名
//$bind_index = array_search('index',config('app.domain_bind'));
// 判断admin应用是否绑定域名
$bind_admin = array_search('admin',config('app.domain_bind'));
// 判断index应用是否域名映射
//$map_index = array_search('index',config('app.app_map'));
// 判断admin应用是否域名映射
$map_admin = array_search('admin',config('app.app_map'));
// $index = $map_index ?: 'index'; // index应用名
$admin = $map_admin ?: 'admin'; // admin应用名
if($bind_index) {
// echo 111;
// index或home前端(非admin应用)域名进行了绑定
// $url = $indexUrl . str_replace($admin . '/','',$artUrl);
$url = $indexUrl . $artUrl;
} else {
if($bind_admin) {
// echo 222;
// admin绑定域名
$url = $indexUrl .'/' . $index . $artUrl;
} elseif ($app == 'admin' && isset($map_admin)) {
// echo 333;
// var_dump($admin, $appname, $artUrl);
// admin进行了映射
$url = $indexUrl . str_replace($admin, $index, $artUrl);
} else {
// echo 444;
// admin未绑定域名
$url = $indexUrl . str_replace($app, $index, $artUrl);
}
}
//halt($url);
return $url;
//a.appName不是admin
return $domain . $articleUrl;
}
/**

View File

@ -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')
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')
->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')
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')
->with([
'cate' => function($query) {
$query->field('id,catename,ename');

View File

@ -119,7 +119,26 @@ class Comment extends Model
return $userCommList;
}
public function getCommentList(array $where, int $page = 1, int$limit = 10)
{
return $this->field('id,article_id,user_id,content,status,create_time')
->with([
'user'=> function($query){
$query->field('id,name,user_img');
},
'article' => function($query) {
$query->field('id,title');
}
])
->where($where)
->order(['create_time' => 'desc'])
->paginate([
'list_rows' => $limit,
'page' => $page
])
->toArray();
}
// 获取url
public function getUrlAttr($value,$data)

View File

@ -87,9 +87,8 @@ class Article extends BaseController
$article = new ArticleModel();
$artDetail = $this->model->getArtDetail($id);
if($artDetail['read_type'] == 1 && session('art_pass_'.$id) != $artDetail['art_pass'])
{
$artDetail['content'] = '加密文件!请正确输入密码查看!';
if($artDetail['read_type'] == 1 && session('art_pass_'.$id) != $artDetail['art_pass']) {
$artDetail['content'] = '本文已加密!请输入正确密码查看!';
}
if(is_null($artDetail)){
@ -355,8 +354,7 @@ class Article extends BaseController
$article = ArticleModel::find($id);
if(Request::isAjax()){
$data = Request::only(['id','cate_id','title','title_color','read_type','art_pass','user_id','content','upzip','keywords','description','captcha']);
$data['user_id'] = $this->uid;
$data = Request::only(['id','cate_id','title','title_color','read_type','art_pass','content','upzip','keywords','description','captcha']);
$tagId = input('tagid');
// 验证码

View File

@ -11,15 +11,12 @@
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;
use yzh52521\EasyHttp\Http;
use QL\QueryList;
class Index extends BaseController
{

View File

@ -3,7 +3,6 @@ namespace app\install\controller;
use app\common\controller\BaseController;
use think\facade\View;
use think\facade\Db;
use think\facade\Request;
use think\facade\Session;
@ -12,135 +11,107 @@ class Index extends BaseController
// 检测是否安装过
protected function initialize(){
if(file_exists('./install.lock')){
echo "<script>alert('已经成功安装了TaoLer社区系统安装系统已锁定。如需重新安装请删除根目录下的install.lock文件')</script>";
die();
echo '<script src="/static/layui/layui.js"></script>'.
'<script>var layer = layui.layer; layer.alert("TaoLer系统已被锁定。<br>如需重新安装请删除public目录下的install.lock文件")</script>';
die();
}
}
//安装首页
// 安装首页
public function index()
{
Session::set('install',1);
return View::fetch('agreement');
return View::fetch('step');
}
//test
public function test()
{
if(Session::get('install') == 1){
Session::set('install',2);
return View::fetch('test');
} else {
return redirect('index.html');
}
}
//create
public function create(){
if(Session::get('install') == 2){
Session::set('install',3);
return View::fetch('create');
} else {
return redirect('test.html');
}
}
// 安装
public function install(){
//if(Session::get('install') != 3){
// return redirect('./create.html');
//}
public function install()
{
if(Request::isAjax()){
$data = Request::param();
//var_dump($data);
if (!preg_match("/^[a-zA-Z]{1}([0-9a-zA-Z]|[._]){4,19}$/", $data['admin_user'])) {
return json(['code'=>-1,'msg'=>"管理用户名至少包含5个字符需以字母开头"]);
}
if(Request::isAjax()){
$data = Request::param();
//var_dump($data);
if (!preg_match("/^[a-zA-Z]{1}([0-9a-zA-Z]|[._]){4,19}$/", $data['admin_user'])) {
return json(['code'=>-1,'msg'=>"管理用户名至少包含5个字符需以字母开头"]);
}
if (!preg_match("/^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,22}$/", $data['admin_pass'])) {
return json(['code'=>-1,'msg'=>'登录密码至少包含6个字符。可使用字母数字和符号']);
}
if ($data['admin_pass'] != $data['admin_pass2']) {
return json(['code'=>-1,'msg'=>'两次输入的密码不一致']);
//die("<script>alert('两次输入的密码不一致');history.go(-1)</script>");
}
if (!preg_match("/^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,22}$/", $data['admin_pass'])) {
return json(['code'=>-1,'msg'=>'登录密码至少包含6个字符。可使用字母数字和符号']);
}
if ($data['admin_pass'] != $data['admin_pass2']) {
return json(['code'=>-1,'msg'=>'两次输入的密码不一致']);
}
$email = $data['admin_email'];
$user = $data['admin_user'];
$create_time = time();
$salt = substr(md5($create_time),-6);
$pass = md5(substr_replace(md5($data['admin_pass']),$salt,0,6));
$webname = $data['webname'];
$webtitle = $data['webtitle'];
$web = Request::host();
//数据库配置
$dbhost = $data['DB_HOST'];
$dbuser = $data['DB_USER'];
$dbpass = $data['DB_PWD'];
$dbport = $data['DB_PORT'];
$dbname = $data['DB_NAME'];
$prefix = $data['DB_PREFIX'];
if ($data['DB_TYPE'] == 'mysql') {
//创建数据库
try {
$conn = new \PDO("mysql:host=$dbhost", $dbuser, $dbpass);
}
catch(\PDOException $e)
{
return json(['code'=>-1,'msg'=>"数据库信息错误" . $e->getMessage()]);
}
$sql = 'CREATE DATABASE IF NOT EXISTS '.$dbname.' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci';
// 使用 exec() ,没有结果返回
$conn->exec($sql);
//echo $dbname."数据库创建成功<br>";
$conn = null;
//写入数据表
try {
$db = new \PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
}
catch(\PDOException $e)
{
return json(['code'=>-1,'msg'=>"数据库连接失败" . $e->getMessage()]);
}
//创建表
$res = create_tables($db,$prefix);
if(!$res){
return json(['code'=>-1,'msg'=>"数据表创建失败"]);
}
//写入初始配置
$table_admin = $data['DB_PREFIX'] . "admin";
$table_user = $data['DB_PREFIX'] . "user";
$table_system = $data['DB_PREFIX'] . "system";
$sql_a = "UPDATE $table_admin SET username='{$user}',email='{$email}',password='{$pass}',status=1,auth_group_id=1,create_time='{$create_time}' WHERE id = 1";
$sql_u = "UPDATE $table_user SET name='{$user}',email='{$email}',password='{$pass}',auth=1,status=1,create_time='{$create_time}' WHERE id = 1";
$sql_s = "UPDATE $table_system SET webname='{$webname}',webtitle='{$webtitle}',domain='{$web}',create_time='{$create_time}' WHERE id = 1";
$res_a = $db->exec($sql_a);
//var_dump($db->errorInfo());
if($res_a == 0){
return json(['code'=>-1,'msg'=>"管理员账号写入失败"]);
}
$res_u = $db->exec($sql_u);
if($res_u == 0){
return json(['code'=>-1,'msg'=>"前台管理员写入失败"]);
}
$res_s = $db->exec($sql_s);
if($res_s == 0){
return json(['code'=>-1,'msg'=>"网站配置写入失败"]);
}
$db = null;
$email = $data['admin_email'];
$user = $data['admin_user'];
$create_time = time();
$salt = substr(md5($create_time),-6);
$pass = md5(substr_replace(md5($data['admin_pass']),$salt,0,6));
$webname = $data['webname'];
$webtitle = $data['webtitle'];
$web = Request::host();
//数据库配置
$dbhost = $data['DB_HOST'];
$dbuser = $data['DB_USER'];
$dbpass = $data['DB_PWD'];
$dbport = $data['DB_PORT'];
$dbname = $data['DB_NAME'];
$prefix = $data['DB_PREFIX'];
if ($data['DB_TYPE'] == 'mysql') {
//创建数据库
try {
$conn = new \PDO("mysql:host=$dbhost", $dbuser, $dbpass);
}
catch(\PDOException $e)
{
return json(['code'=>-1,'msg'=>"数据库信息错误" . $e->getMessage()]);
}
$sql = 'CREATE DATABASE IF NOT EXISTS '.$dbname.' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci';
// 使用 exec() ,没有结果返回
$conn->exec($sql);
//echo $dbname."数据库创建成功<br>";
$conn = null;
//写入数据表
try {
$db = new \PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
} catch(\PDOException $e) {
return json(['code'=>-1,'msg'=>"数据库连接失败" . $e->getMessage()]);
}
//创建表
$res = create_tables($db, $prefix);
if(!$res){
return json(['code'=>-1,'msg'=>"数据表创建失败"]);
}
//写入初始配置
$table_admin = $data['DB_PREFIX'] . "admin";
$table_user = $data['DB_PREFIX'] . "user";
$table_system = $data['DB_PREFIX'] . "system";
$sql_a = "UPDATE $table_admin SET username='{$user}',email='{$email}',password='{$pass}',status=1,auth_group_id=1,create_time='{$create_time}' WHERE id = 1";
$sql_u = "UPDATE $table_user SET name='{$user}',email='{$email}',password='{$pass}',auth=1,status=1,create_time='{$create_time}' WHERE id = 1";
$sql_s = "UPDATE $table_system SET webname='{$webname}',webtitle='{$webtitle}',domain='{$web}',create_time='{$create_time}' WHERE id = 1";
$res_a = $db->exec($sql_a);
//var_dump($db->errorInfo());
if($res_a == 0){
return json(['code'=>-1,'msg'=>"管理员账号写入失败"]);
}
$res_u = $db->exec($sql_u);
if($res_u == 0){
return json(['code'=>-1,'msg'=>"前台管理员写入失败"]);
}
$res_s = $db->exec($sql_s);
if($res_s == 0){
return json(['code'=>-1,'msg'=>"网站配置写入失败"]);
}
$db = null;
$db_str = <<<php
$db_str = <<<EOV
<?php
return [
// 默认使用的数据库连接配置
@ -196,32 +167,28 @@ return [
// 更多的数据库配置信息
],
];
php;
// 创建数据库链接配置文件
$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){
$res = json(['code' => -1,'msg'=>'数据库配置文件创建失败!']);
}
} else {
$res = json(['code' => -1,'msg'=>'config/database.php 无写入权限']);
}
}
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'=>'数据库配置文件创建失败!']);
}
}
return json(['code' => -1,'msg'=>'config/database.php 无写入权限']);
}
}
}
//安装上锁
file_put_contents('./install.lock', 'lock');
Session::clear();
//安装上锁
file_put_contents('./install.lock', 'lock');
Session::clear();
$res = json(['code' => 0,'msg'=>'安装成功','url'=>(string) url('success/complete')]);
} else {
$res = json(['code' => -1,'msg'=>'请求失败']);
}
return $res;
return json(['code' => 0,'msg'=>'安装成功','url'=>(string) url('success/complete')]);
}
return json(['code' => -1,'msg'=>'请求失败']);
}
}

View File

@ -0,0 +1,474 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>引导安装</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
<link rel="stylesheet" href="/static/admin/css/install.css">
</head>
<body class="pear-container">
<div class="layui-row layui-col-space10">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card">
<div class="layui-card-body" style="padding-top: 40px;">
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
<div carousel-item>
<div>
<form class="layui-form" action="javascript:void(0);" style="margin: 0 auto;max-width: 750px;padding-top: 20px;">
<div class="inside2">
<div class="inwp cl">
<h2>TaoLerCMS - 建站系统以下简称TaoLer安装协议</h2>
<hr>
<p>1、欢迎使用TaoLer系统她是一款轻量化、快速、便捷、简单的综合社区内容管理系统。</p>
<p>2、适用于学校、企业、社团组织、社区、政府、本地华商圈等综合型服务类型</p>
<p>3、本系统在作者能力范围内做到安全可靠代码严禁并力争进行长期更新支持、及时修复BUG减少使用者的使用成本。</p>
<p>4、尽管程序在发布前已经过安全测试但仍不能完全保证漏洞的存在和丢失数据的风险作者不承担商业风险。</p>
<p>5、本程序版权归开发者所有在未经过作者同意的情况下严禁转售、赠送他人。</p>
<p>6、您可以在完全遵守本许可协议的基础上免费下载安装使用商业应用请联系作者授权。</p>
<p>7、无论您是个人或组织、盈利与否、用途如何包括以学习和研究为目的均需仔细阅读本协议包括免除或者限制开发团队责任的免责条款及对您的权利限制。请您审阅并接受或不接受本服务条款。如您不同意本服务条款及/或随时对其的修改,您应不使用或主动取消产品。否则,您的任何对产品中的相关服务的注册、登陆、下载、查看等使用行为将被视为您对本服务条款全部的完全接受,包括接受对服务条款随时所做的任何修改。</p>
<p>8、本协议一旦发生变更, TaoLer开发团队将在网页上公布修改内容。修改后的服务条款一旦在网站管理后台上公布即有效代替原来的服务条款。如果您选择接受本条款即表示您同意接受协议各项条件的约束。如果您不同意本服务条款则不能获得使用本服务的权利。您若有违反本条款规定TaoLer有权随时中止或终止您对本程序的使用资格并保留追究相关法律责任的权利。</p>
<p>9、在理解、同意、并遵守本协议的全部条款后方可开始使用本程序。本许可协议条款的解释效力及纠纷的解决适用于中华人民共和国大陆法律。</p>
<p>10、您使用本系统需要遵循许可协议一旦安装表示您已接受该系统各项条款。</p>
</div>
</br>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<input type="checkbox" name="agrement" title="同意" checked>
<button class="pear-btn pear-btn-success" lay-submit lay-filter="formStep">
&emsp;下一步&emsp;
</button>
</div>
</div>
</form>
</div>
<div>
<form class="layui-form" action="javascript:void(0);" style="margin: 0 auto;max-width: 600px;padding-top: 20px;">
<div class="layui-form-item inside2">
<div class="inwp cl">
<h2>环境检测:</h2>
<table style="width:600px;">
<tr>
<th style="width:25%;">坏境</th>
<th style="width:25%;">最低配置</th>
<th style="width:25%;">当前配置</th>
<th style="width:25%;">是否符合</th>
</tr>
<tr>
<td>操作系统</td>
<td>不限</td>
<td>
<?php echo php_uname('s'); ?>
</td>
<td class="yes"></td>
</tr>
<tr>
<td>php版本</td>
<td>&gt;7.4.0</td>
<td>
<?php echo PHP_VERSION ?>
</td>
<td>
<?php if (version_compare(PHP_VERSION, '7.4.0', '>=')): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif ?>
</td>
</tr>
</table>
<h2>扩展检测:</h2>
<table style="width:600px;">
<tr>
<th width="25%">坏境</th>
<th width="25%">最低配置</th>
<th width="25%">当前配置</th>
<th width="25%">是否符合</th>
</tr>
<tr>
<td>数据库</td>
<td>Mysqli</td>
<td><?php
$pdo = false;
if(class_exists('PDO', false))
{
if(defined('PDO::MYSQL_ATTR_USE_BUFFERED_QUERY'))
{
echo 'PDO_MYSQL';
$pdo = true;
}
else
{
echo '不支持PDO_MYSQL';
}
}
else
{
echo '不支持PDO_MYSQL';
}
if(!$pdo)
{
if (function_exists('mysqli_close'))
{
echo 'MySQLi';
$pdo = true;
}
}
?>
</td>
<td>
<?php if ($pdo): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif; ?>
</td>
</tr>
<tr>
<td>PDO</td>
<td>支持</td>
<td>
<?php if(extension_loaded('pdo')): ?>
Yes
<?php else: ?>
No
<?php endif; ?>
</td>
<td>
<?php if(extension_loaded('pdo')): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif; ?>
</td>
</tr>
<tr>
<td>fileinfo</td>
<td>支持</td>
<td>
<?php if(get_extension_funcs('fileinfo')): ?>
Yes
<?php else: ?>
No
<?php endif; ?>
</td>
<td>
<?php if(get_extension_funcs('fileinfo')): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif; ?>
</td>
</tr>
</table>
<h2>目录权限:</h2>
<table style="width:600px;">
<tr>
<th width="25%">坏境</th>
<th width="25%">最低配置</th>
<th width="25%">当前配置</th>
<th width="25%">是否符合</th>
</tr>
<tr>
<td>app</td>
<td>可写</td>
<td>
<?php if (is_writable('../app')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td>
<?php if (is_writable('../app')): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif ?>
</td>
</tr>
<tr>
<td>config</td>
<td>可写</td>
<td>
<?php if (is_writable('../config')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td>
<?php if (is_writable('../config')): ?>
<span class="yes"></span>
<?php else: ?> ×
<?php endif ?>
</td>
</tr>
<tr>
<td>public</td>
<td>可写</td>
<td>
<?php if (is_writable('../public')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td>
<?php if (is_writable('../public')): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif ?>
</td>
</tr>
<tr>
<td>runtime</td>
<td>可写</td>
<td>
<?php if (is_writable('../runtime')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td>
<?php if (is_writable('../runtime')): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif ?>
</td>
</tr>
<tr>
<td>view</td>
<td>可写</td>
<td>
<?php if (is_writable('../view')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td>
<?php if (is_writable('../view')): ?>
<span class="yes"></span>
<?php else: ?>
×
<?php endif ?>
</td>
</tr>
</table>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="pear-btn pear-btn-success pre">上一步</button>
<button class="pear-btn pear-btn-success" lay-submit lay-filter="formStep2">
&emsp;下一步&emsp;
</button>
</div>
</div>
</form>
</div>
<div class="inside2">
<div class="inwp cl">
<form class="layui-form" action="javascript:void(0);" style="margin: 0 auto;max-width: 600px;padding-top: 20px;" >
<h2>创建数据库:</h2>
<input type="hidden" name="DB_TYPE" value="mysql">
<div class="layui-form-item">
<label class="layui-form-label">数据库地址</label>
<div class="layui-input-block">
<input type="text" name="DB_HOST" value="127.0.0.1" required lay-verify="required" 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="DB_USER" value="root" required lay-verify="required" 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="DB_PWD" required lay-verify="required" 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="DB_PORT" value="3306" 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" type="text" name="DB_NAME" required lay-verify="required" 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="DB_PREFIX" value="tao_" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<h2>网站信息:</h2>
<div class="layui-form-item">
<label class="layui-form-label">网站名称</label>
<div class="layui-input-block">
<input type="text" name="webname" placeholder="请输入网站名称" required lay-verify="required" 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="webtitle" placeholder="请输入网站副标题" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<h2>管理员账号:</h2>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="admin_user" placeholder="至少5字符" required lay-verify="required" 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="admin_email" placeholder="请输入正确邮箱" required lay-verify="email" 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="password" name="admin_pass" placeholder="至少包含6个字符。可使用字母数字和符号" required lay-verify="required" 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="password" name="admin_pass2" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="pear-btn pear-btn-success pre">上一步</button>
<button class="pear-btn pear-btn-success" lay-submit lay-filter="formStep3">
&emsp;下一步&emsp;
</button>
</div>
</div>
</form>
</div>
</div>
<div>
<div style="text-align: center;margin-top: 90px;">
<i class="layui-icon layui-circle" style="color: white;font-size:30px;font-weight:bold;background: #52C41A;padding: 20px;line-height: 80px;">&#xe605;</i>
<div style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
安装成功
</div>
<div style="font-size: 14px;color: #666;margin-top: 20px;">恭喜您心愿达成,祝马到成功!</div>
</div>
<div style="text-align: center;margin-top: 50px;">
<a href="/" class="pear-btn pear-btn-success next" target="_blank">去前端查看</a>
<a href="/admin" class="pear-btn pear-btn-success" target="_blank">去管理后台</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script>
layui.use(['form', 'step','code','element','toast'], function() {
var $ = layui.$,
form = layui.form,
step = layui.step;
let toast = layui.toast;
layui.code();
step.render({
elem: '#stepForm',
filter: 'stepForm',
width: '100%',
stepWidth: '750px',
height: '950px',
stepItems: [{
title: '协议'
}, {
title: '检测'
}, {
title: '安装'
}, {
title: '成功'
}
]
});
//协议
form.on('submit(formStep)', function(data) {
if(data.field.agrement == 'on') {
// 同意协议进行下一步
step.next('#stepForm');
} else {
toast.error({title:"错误消息",message:"您未同意协议,将要退出安装!"});
// 不同意关闭安装页码
// var userAgent = navigator.userAgent;
// if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") != -1) {
// location.href = "about:blank";
// } else {
// window.opener = null;
// window.open('', '_self');
// }
// window.close();
}
return false;
});
// 配置检测
form.on('submit(formStep2)', function(data) {
if ($('.yes').length < 10) {
toast.error({title:"错误消息",message:"您的配置或权限不符合要求,请检查"});
} else {
step.next('#stepForm');
}
return false;
});
// 数据库信息
form.on('submit(formStep3)', function(data) {
$.post("{:url('index/install')}", data.field, function(res){
if(res.code === 0) {
// 安装成功
step.next('#stepForm');
} else {
toast.error({title:"错误消息",message: res.msg});
}
})
return false;
});
// 上一步
$('.pre').click(function() {
step.pre('#stepForm');
return false;
});
// $('.next').click(function() {
// step.next('#stepForm');
// return false;
// });
})
</script>
</body>
</html>

28
composer.lock generated
View File

@ -1800,16 +1800,16 @@
},
{
"name": "psr/http-message",
"version": "1.0.1",
"version": "1.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"shasum": "",
"mirrors": [
{
@ -1819,12 +1819,12 @@
]
},
"require": {
"php": ">=5.3.0"
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
},
"autoload": {
@ -1853,9 +1853,9 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
"source": "https://github.com/php-fig/http-message/tree/1.1"
},
"time": "2016-08-06T14:39:51+00:00"
"time": "2023-04-04T09:50:52+00:00"
},
{
"name": "psr/log",
@ -3237,16 +3237,16 @@
},
{
"name": "workerman/channel",
"version": "v1.1.0",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/walkor/channel.git",
"reference": "3df772d0d20d4cebfcfd621c33d1a1ab732db523"
"reference": "fbfb81c7ebc5858c4053f226cbb5d15fe670ff6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/channel/zipball/3df772d0d20d4cebfcfd621c33d1a1ab732db523",
"reference": "3df772d0d20d4cebfcfd621c33d1a1ab732db523",
"url": "https://api.github.com/repos/walkor/channel/zipball/fbfb81c7ebc5858c4053f226cbb5d15fe670ff6e",
"reference": "fbfb81c7ebc5858c4053f226cbb5d15fe670ff6e",
"shasum": "",
"mirrors": [
{
@ -3271,9 +3271,9 @@
"homepage": "http://www.workerman.net",
"support": {
"issues": "https://github.com/walkor/channel/issues",
"source": "https://github.com/walkor/channel/tree/v1.1.0"
"source": "https://github.com/walkor/channel/tree/v1.2.0"
},
"time": "2021-02-08T02:45:42+00:00"
"time": "2023-04-04T02:47:35+00:00"
},
{
"name": "workerman/phpsocket.io",

View File

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

View File

@ -0,0 +1,34 @@
body{background:#fff}
.cl{zoom:1}
.cl:after{content:'\20';display:block;height:0;clear:both;visibility:hidden}
.z{float:left}
.y{float:right}
.logo {height:37px;padding:10px 0 0 10px;}
.header{background:#009688;height:60px;width:100%;position:fixed;left:0;top:0;z-index:999}
.header a{font-size:18px;padding:0 30px 0 0;line-height:60px;font-weight:100;color:#fff}
.header h2{font-size:18px;padding:0 0 0 30px;line-height:60px;font-weight:100;color:#fff}
.header a:hover{color:#fff}
.inside{width:100%;min-width:1000px;height:65px;background:#393D49}
.inside h2 img{float:left;padding:0}
.inside ul{width:120px;height:65px;float:left;margin-left:68px}
.inside .innumber1{background:#FF5722!important;color:#fff!important}
.inside .innumber{margin-top:12px;width:40px;height:40px;line-height:40px;text-align:center;font-size:20px;border-radius:50%;background:#fff;float:left;color:#009688}
.inside .inword{width:80px;height:65px;float:left;line-height:65px;text-indent:10px;font-size:16px;color:#fff}
.inwp{width:100%;margin:0 auto}
.inout1 a{float:left;border:1px solid #C9C9C9;background-color:#fff;color:#555;padding:8px 18px;border-radius:2px;margin-right:10px;margin-top:20px}
.inout2 a{float:left;color:#fff;padding:9px 18px;background:#009688;border-radius:2px;margin-top:20px}
.inout1 a:hover{color:#555;opacity:.8;filter:alpha(opacity=80)}
.inout2 a:hover{color:#fff;opacity:.8;filter:alpha(opacity=80)}
.inout2 input{float:left;color:#fff;padding:9px 18px;background:#009688;border-radius:2px;margin-top:20px;border:none}
.inout2 input:hover{color:#fff;opacity:.8;filter:alpha(opacity=80)}
.inside2 h2{font-size:20px;margin:20px 0}
.inside2 h3{font-size:16px;margin:20px 0 10px 0;color:#FF5722}
.inside2 p{font-size:14px;line-height:28px;margin-bottom:10px}
.inside2 tr{border:1px solid #EAEAEA}
.inside2 tr th{border-left:1px solid #EAEAEA;background:#F9F9F9;line-height:45px}
.inside2 tr td{border-left:1px solid #EAEAEA;line-height:40px;padding-left:20px}

File diff suppressed because one or more lines are too long

View File

@ -14,14 +14,26 @@
/>
<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="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" />
<glyph glyph-name="moon" unicode="&#59074;" d="M696.832 680.448c98.816-62.976 162.304-173.056 162.304-294.912 0-192.512-156.672-349.184-349.184-349.184-121.856 0-232.448 63.488-294.912 162.816h5.12c263.168 0 477.184 214.016 477.184 477.184-0.512 1.536-0.512 3.072-0.512 4.096m-78.336 103.936c9.216-34.304 14.336-70.656 14.336-108.032 0-228.352-184.832-413.184-413.184-413.184-37.376 0-73.728 5.12-108.544 14.336 47.616-175.616 207.872-305.152 398.848-305.152 228.352 0 413.184 184.832 413.184 413.184 0 190.976-129.024 351.232-304.64 398.848z" horiz-adv-x="1024" />
<glyph glyph-name="error" unicode="&#59027;" d="M512-60.09287109000002c-245.26845703 0-444.09550781 198.82880859-444.09550781 444.09550781s198.82705078 444.09287109 444.09550781 444.09287109c245.26669922 0 444.09550781-198.82880859 444.09550781-444.09550781s-198.82880859-444.09287109-444.09550781-444.09287109zM512 772.58378906c-214.60166016 0-388.58378906-173.97861328-388.58378906-388.58378906s173.98125-388.58115234 388.58378906-388.58115234c214.60166016 0 388.58115234 173.97861328 388.58115234 388.58115234s-173.97861328 388.58378906-388.58115234 388.58378906zM551.41103516 383.85585937999997l117.60029297-117.62138672c10.84306641-10.82460938 10.84306641-28.40625 0-39.24580079-10.83955078-10.84306641-28.42119141-10.84306641-39.24580079 0l-117.62138671 117.60029297-118.39570313-118.39570312c-10.93271484-10.93095703-28.64091797-10.93095703-39.55517578 0-10.93271484 10.93095703-10.93271484 28.64091797 0 39.55693359l118.39570312 118.41240235-117.60292968 117.60292968c-10.84130859 10.84130859-10.84130859 28.40625 0 39.24931641 10.84306641 10.83955078 28.40625 10.83955078 39.2493164 0l117.60292969-117.60292969 119.28164063 119.28164063c10.93095703 10.91513672 28.64091797 10.91513672 39.55693359 0 10.93095703-10.93095703 10.93095703-28.64091797 0-39.57363281l-119.26757813-119.26582032z" horiz-adv-x="1024" />
<glyph glyph-name="success" unicode="&#59031;" d="M661.31818174 521.04545479c10.22727305 12.27272695 30.68181826 14.31818174 42.95454521 4.09090868 12.27272695-10.22727305 14.31818174-30.68181826 4.09090957-42.95454521l-204.54545478-243.40909131c-10.22727305-12.27272695-30.68181826-14.31818174-42.95454522-4.09090869L327.90909131 345.13636347c-12.27272695 10.22727305-14.31818174 30.68181826-4.09090957 42.95454522 10.22727305 12.27272695 30.68181826 14.31818174 42.95454521 4.09090957l110.4545461-92.04545478 184.09090869 220.90909131zM512-66C262.45454521-66 62 134.45454521 62 384S262.45454521 834 512 834s450-200.45454521 450-450-200.45454521-450-450-450z m0 40.90909131c225 0 409.09090869 184.09090869 409.09090869 409.09090869S737 793.09090869 512 793.09090869 102.90909131 609 102.90909131 384s184.09090869-409.09090869 409.09090869-409.09090869z" horiz-adv-x="1024" />
<glyph glyph-name="question" unicode="&#59033;" d="M468.125 159a37.50000029 37.50000029 0 1 1 37.50000029 37.50000029 37.50000029 37.50000029 0 0 1-37.50000029-37.50000029z m37.50000029 92.62500029h-3.00000058a31.5 31.5 0 0 0-28.49999942 34.49999971A203.24999971 203.24999971 0 0 0 549.50000029 400.12500029c56.62500029 56.62500029 57.75000029 74.99999971 58.5 93.74999942a81.37500029 81.37500029 0 0 1-23.25000058 60.75A98.62499971 98.62499971 0 0 1 512 584.99999971a94.5 94.5 0 0 1-94.5-94.5 31.5 31.5 0 1 0-63.37500029 0A157.5 157.5 0 0 0 512 646.50000029a162.37500029 162.37500029 0 0 0 117.74999971-50.25000058 144.37500029 144.37500029 0 0 0 39.75000029-105.75c-2.25-40.87500029-14.625-72.74999971-77.24999971-135-31.5-31.5-51.75-55.50000029-53.62500058-74.99999971a31.5 31.5 0 0 0-31.12499971-29.99999971z m277.875-139.87500029A386.62499971 386.62499971 0 1 0 361.99999971 740.24999971a386.62499971 386.62499971 0 0 0 423.37500029-629.62499971zM512 834a450 450 0 1 1 450-450A450 450 0 0 1 512 834z" horiz-adv-x="1024" />
<glyph glyph-name="lock" unicode="&#59034;" d="M512-66A450 450 0 1 0 962 384 450.39130401 450.39130401 0 0 0 512-66z m0 860.86956533A410.86956533 410.86956533 0 1 1 922.86956533 384 411.26086934 411.26086934 0 0 1 512 794.86956533zM665.78260888 398.86956533h-14.47826132v78.26086934a139.69565244 139.69565244 0 0 1-279-7.82608711v-70.04347823h-11.73912979a19.95652177 19.95652177 0 0 1-19.95652178-20.34782577v-199.56521778a19.95652177 19.95652177 0 0 1 19.95652178-20.34782578h302.86956445a19.95652177 19.95652177 0 0 1 19.95652179 20.34782578v199.56521778a20.73913067 20.73913067 0 0 1-17.60869513 19.95652177z m-254.34782665 70.43478223a100.56521777 100.56521777 0 0 0 200.73913066 4.69565244v-74.73913067H411.43478223z" horiz-adv-x="1024" />
<glyph glyph-name="eye" unicode="&#59029;" d="M513.92 449.493333a64 64 0 1 0-64-64 64 64 0 0 0 64 64m0 64a128 128 0 1 1 128-128 128 128 0 0 1-128 128zM512 606.2933330000001c128 0 257.706667-67.84 397.226667-207.146666a21.333333 21.333333 0 0 0 0-30.08C770.133333 229.54666699999996 640 161.70666700000004 512 161.70666700000004s-257.28 67.84-396.8 207.146666a21.333333 21.333333 0 0 0 0 30.08c139.52 139.52 268.8 207.36 396.8 207.36m0 64c-145.92 0-291.84-75.306667-442.453333-225.92a85.333333 85.333333 0 0 1 0-120.746666C220.586667 173.013333 366.506667 97.70666700000004 512 97.70666700000004s292.266667 75.306667 442.666667 225.92a85.333333 85.333333 0 0 1 0 120.746666C804.266667 594.986667 658.346667 670.293333 512 670.293333z" horiz-adv-x="1024" />
<glyph glyph-name="eye-invisible" unicode="&#59030;" d="M386.346667 391.466667l121.813333 121.813333a128 128 0 0 1-121.813333-121.813333z m238.72 57.6L576 400.213333a64 64 0 0 0-76.8-76.8l-48.853333-48.853333a128 128 0 0 1 174.506666 174.506667zM109.013333 384a21.333333 21.333333 0 0 0 6.186667 15.146667c139.52 139.306667 268.8 207.146667 396.8 207.146666a372.266667 372.266667 0 0 0 79.786667-8.96l52.266666 52.266667a443.52 443.52 0 0 1-132.053333 21.333333c-145.92 0-291.84-75.306667-442.453333-225.92a85.333333 85.333333 0 0 1 0-120.746666 1063.04 1063.04 0 0 1 134.186666-115.2l45.866667 45.866666a985.813333 985.813333 0 0 0-134.4 114.133334 21.333333 21.333333 0 0 0-6.186667 14.933333z m845.653334 60.373333a966.613333 966.613333 0 0 1-185.813334 149.333334l-46.72-46.72a877.653333 877.653333 0 0 0 187.306667-147.2 21.333333 21.333333 0 0 0 0-30.08C770.133333 229.54666699999996 640 161.70666700000004 512 161.70666700000004a393.386667 393.386667 0 0 0-145.706667 29.013333l-48.64-48.64A466.133333 466.133333 0 0 1 512 97.70666700000004c145.92 0 291.84 75.306667 442.453333 225.92a85.333333 85.333333 0 0 1 0.213334 120.746666zM777.267604 692.049287m22.627417-22.627417l0 0q22.627417-22.627417 0-45.254834l-527.973064-527.973063q-22.627417-22.627417-45.254834 0l0 0q-22.627417 22.627417 0 45.254834l527.973064 527.973063q22.627417 22.627417 45.254834 0Z" horiz-adv-x="1024" />
<glyph glyph-name="backspace" unicode="&#59028;" d="M484.46100645 268.09861505000003a28.76779355 28.76779355 0 0 0-20.34016344 49.107957l174.2671828 174.27268816a28.76779355 28.76779355 0 0 0 40.68473118-40.68032687l-174.2671828-174.27819355a28.6940215 28.6940215 0 0 0-20.34456774-8.42322581zM658.72708818 268.09861505000003a28.68301076 28.68301076 0 0 0-20.34016345 8.42322581l-174.26718279 174.27709248a28.76228818 28.76228818 0 0 0 0 40.68032687 28.75127742 28.75127742 0 0 0 40.68142795 0l174.2671828-174.27268816a28.77990537 28.77990537 0 0 0-20.34126451-49.107957zM834.5379785 74.81145805999995H340.57028818c-28.46940215 0-55.25305806 12.53684301-73.49016775 34.39428818L75.75838279 339.01887310999996c-10.54830108 13.06205592-16.20232258 28.91974194-16.1968172 44.98663226 0.00660645 15.39083011 4.67406452 29.85015053 13.50248602 41.81333334 0.33803011 0.45694624 0.68266666 0.90288172 1.04822366 1.33009892L266.70685592 658.36593548a95.32449032 95.32449032 0 0 0 73.86233118 34.82921291H834.5379785c51.98286452 0 94.27516559-42.28789677 94.27516558-94.27076129v-429.83776344c0-51.98286452-42.29230108-94.27516559-94.27516558-94.2751656zM119.01522581 391.16579785c-0.90728602-1.35872689-1.91587097-3.52344086-1.91587097-7.17680861 0-2.92005161 1.14952258-6.01517419 3.15568172-8.50140214l191.02114409-229.45307528a38.55965592 38.55965592 0 0 1 29.29300645-13.69297203H834.5379785a36.78472258 36.78472258 0 0 1 36.74508387 36.74508387v429.83776344a36.78472258 36.78472258 0 0 1-36.74508387 36.73957849H340.5691871a38.60590108 38.60590108 0 0 1-29.53524302-13.96934193L119.01522581 391.16579785z" horiz-adv-x="1024" />
<glyph glyph-name="help-circle" unicode="&#59260;" d="M505.181 153.98199999999997c-26.499 0-47.972-21.481-47.972-47.968s21.474-47.977 47.972-47.977c26.48 0 47.948 21.488 47.948 47.977s-21.469 47.968-47.948 47.968zM505.181 825.872c-246.883 0-447.689-200.826-447.689-447.683 0-246.874 200.806-447.705 447.689-447.705 246.849 0 447.683 200.83 447.683 447.705 0 246.858-200.836 447.683-447.683 447.683zM505.181-5.273000000000025c-211.46 0-383.455 172.045-383.455 383.459 0 211.431 171.995 383.436 383.455 383.436 211.391 0 383.455-172.003 383.455-383.436 0-211.417-172.064-383.459-383.455-383.459zM505.162 664.795c-88.146 0-159.892-71.093-159.892-158.448 0-17.648 14.347-31.981 31.981-31.981 17.675 0 31.985 14.332 31.985 31.981 0 52.987 42.167 94.498 95.946 94.498 52.873 0 95.926-43.366 95.926-96.677 0-21.324-26.753-48.058-52.634-73.965-35.309-35.267-75.282-75.237-75.282-127.563v-54.067c0-17.663 14.341-31.985 31.989-31.985 17.634 0 31.97 14.363 31.97 32.016v54.071c0 25.807 28.719 54.524 56.54 82.282 35.074 35.074 71.383 71.346 71.383 119.221-0.002 88.573-71.718 160.617-159.914 160.617z" horiz-adv-x="1024" />
<glyph glyph-name="tips-fill" unicode="&#60206;" d="M512 832C264.6 832 64 631.4 64 384s200.6-448 448-448 448 200.6 448 448S759.4 832 512 832z m-32-232c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-272c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8V600z m32-440c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z" horiz-adv-x="1024" />
<glyph glyph-name="test" unicode="&#59026;" d="M513.058-31.072000000000003c-56.004 0-110.35 10.976-161.528 32.622-49.416 20.901-93.789 50.816-131.887 88.914-38.098 38.099-68.013 82.472-88.915 131.888-21.646 51.178-32.622 105.524-32.622 161.528s10.976 110.35 32.622 161.528c20.901 49.416 50.816 93.789 88.915 131.887s82.471 68.013 131.887 88.915c51.178 21.646 105.524 32.622 161.528 32.622 64.817 0 126.912-14.538 184.56-43.209 54.937-27.323 104.055-67.35 142.042-115.754 10.911-13.903 8.486-34.019-5.417-44.93-13.903-10.91-34.018-8.485-44.929 5.417-67.071 85.461-167.763 134.476-276.256 134.476-193.516 0-350.952-157.436-350.952-350.952s157.436-350.952 350.952-350.952c200.075 0 350.952 141.419 350.952 328.952 0 17.673 14.327 32 32 32s32-14.327 32-32c0-109.988-43.501-210.61-122.49-283.33-76.785-70.692-180.65-109.622-292.462-109.622zM636.555 275.40700000000004c-5.39 0-10.85 1.362-15.862 4.23-15.34 8.776-20.66 28.327-11.884 43.667L781.3 624.79c8.776 15.341 28.33 20.661 43.667 11.884 15.34-8.777 20.66-28.327 11.884-43.667L664.359 291.52099999999996c-5.908-10.327-16.703-16.114-27.804-16.114zM628.023 263.38199999999995a31.856 31.856 0 0 0-19.204 6.424L403.383 424.242c-14.127 10.62-16.97 30.681-6.35 44.807 10.62 14.127 30.68 16.97 44.807 6.35l205.437-154.438c14.127-10.619 16.97-30.68 6.35-44.807-6.289-8.363-15.888-12.772-25.604-12.772zM219.079 140.418a31.849 31.849 0 0 0-18.931 6.222c-14.238 10.47-17.293 30.499-6.823 44.737l202.489 275.372c10.468 14.239 30.499 17.294 44.737 6.823 14.238-10.47 17.293-30.499 6.823-44.737L244.885 153.46299999999997c-6.271-8.528-15.974-13.045-25.806-13.045z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 316 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
.pear-nav-tree {
width: 230px;
width: 230px !important;
border-radius: 0px;
background-color: #28333E;
}

View File

@ -55,6 +55,14 @@
font-size: 15px !important;
}
.layui-table-cell .pear-btn {
margin-right: 5px;
}
.layui-table-cell .pear-btn:last-child {
margin-right: 0px;
}
.layui-table-page {
height: 45px !important;
padding-top: 10px !important;

View File

@ -177,7 +177,7 @@ layui.define(['table', 'laypage','jquery', 'element'], function(exports) {
function createCard(elem, linenum, item, no) {
var line = 12 / linenum;
var card =
'<div id=' + item.id + ' onclick="cardTableCheckedCard(' + elem + ',this)" class="layui-col-md' + line + ' ew-datagrid-item" data-index="' + no+'" data-number="1"> <div class="project-list-item"> <div class="project-list-item-cover" style="background-image: url(' +item.image + ');"></div> <div class="project-list-item-body"> <h2 class="layui-elip">' + item.title + '</h2> <div class="project-list-item-text layui-text">' + item.remark + '</div> <div class="project-list-item-desc"> <span class="time">' +item.time + '</span> <div class="ew-head-list"></div> </div> </div > </div > </div > '
'<div id=' + item.id + ' onclick="cardTableCheckedCard(' + elem + ',this)" class="layui-col-md' + line + ' ew-datagrid-item" data-index="' + no+'" data-number="1"> <div class="project-list-item"> <img class="project-list-item-cover" src="' + item.image + '"> <div class="project-list-item-body"> <h2 class="layui-elip">' + item.title + '</h2> <div class="project-list-item-text layui-text">' + item.remark + '</div> <div class="project-list-item-desc"> <span class="time">' +item.time + '</span> <div class="ew-head-list"></div> </div> </div > </div > </div > '
return card;
}

View File

@ -1,119 +1,114 @@
layui.define(['jquery', 'element','table'], function(exports) {
"use strict";
layui.define(['jquery', 'element', 'table'], function (exports) {
"use strict";
/**
* 常用封装类
* */
var MOD_NAME = 'common',
$ = layui.jquery,
table = layui.table,
element = layui.element;
/**
* 常用封装类
* */
var MOD_NAME = 'common',
$ = layui.jquery,
table = layui.table,
element = layui.element;
var common = new function() {
/**
* 获取当前表格选中字段
* @param obj 表格回调参数
* @param field 要获取的字段
* */
this.checkField = function(obj, field) {
let data = table.checkStatus(obj.config.id).data;
if (data.length === 0) {
return "";
}
let ids = "";
for (let i = 0; i < data.length; i++) {
ids += data[i][field] + ",";
}
ids = ids.substr(0, ids.length - 1);
return ids;
}
/**
* 当前是否为与移动端
* */
this.isModile = function(){
if ($(window).width() <= 768) {
return true;
}
return false;
}
/**
* 提交 json 数据
* @param href 必选 提交接口
* @param data 可选 提交数据
* @param ajaxtype 可选 提交方式(默认为get)
* @param table 可选 刷新父级表
* @param callback 可选 自定义回调函数
* @param dataType 可选 返回数据类型 智能猜测可以是xml, json, script, html
* @param is_async 可选 请求是否异步处理默认是 true
* @param is_cache 可选 浏览器是否缓存被请求页面默认是 true
* */
this.submit = function(href,data,ajaxtype,table,callback,dataType,is_async,is_cache){
if(ajaxtype=='' || ajaxtype==undefined){ ajaxtype='get';}
var common = new function () {
if(data!==undefined){
$.ajaxSetup({data:JSON.stringify(data)});
}else {
$.ajaxSetup({data:''});
}
if(is_cache!==undefined){
$.ajaxSetup({dataType:dataType });
}
if(is_async!==undefined){
$.ajaxSetup({async:is_async });
}
if(is_cache!==undefined){
$.ajaxSetup({cache:is_cache });
}
$.ajax({
url:href,
contentType:'application/json',
type:ajaxtype,
success:callback !=null?callback:function(result){
if(result.code==1){
layer.msg(result.msg,{icon:1,time:1000},function(){
if(parent.layer.getFrameIndex(window.name)!=undefined){
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
if(table!=null){parent.layui.table.reload(table);}
}else {
if(table!=null){layui.table.reload(table);}
}
});
}else{
layer.msg(result.msg,{icon:2,time:1000});
}
},
error:function(xhr){
if(xhr.status==401)
{
layer.msg('权限不足,您无法访问受限资源或数据',{icon: 5});
}
if(xhr.status==404)
{
layer.msg('请求url地址错误请确认后刷新重试',{icon: 5});
}
if(xhr.status==419)
{
layer.msg('长时间未操作,自动刷新后重试!',{icon: 5});
setTimeout(function () { window.location.reload();}, 2000);
}
if(xhr.status==429)
{
layer.msg('尝试次数太多,请一分钟后再试',{icon: 5});
}
if(xhr.status==500)
{
layer.msg(xhr.responseJSON.message,{icon: 5});
}
}
,complete:function (xhr,status){
/**
* 获取当前表格选中字段
* @param obj 表格回调参数
* @param field 要获取的字段
* */
this.checkField = function (obj, field) {
let data = table.checkStatus(obj.config.id).data;
if (data.length === 0) {
return "";
}
let ids = "";
for (let i = 0; i < data.length; i++) {
ids += data[i][field] + ",";
}
ids = ids.substring(0, ids.length - 1);
return ids;
}
}
})
}
}
exports(MOD_NAME, common);
/**
* 当前是否为与移动端
* */
this.isModile = function () {
return $(window).width() <= 768;
}
/**
* 提交 json 数据
* @param href 必选 提交接口
* @param data 可选 提交数据
* @param ajaxtype 可选 提交方式(默认为get)
* @param table 可选 刷新父级表
* @param callback 可选 自定义回调函数
* @param dataType 可选 返回数据类型 智能猜测可以是xml, json, script, html
* @param is_async 可选 请求是否异步处理默认是 true
* @param is_cache 可选 浏览器是否缓存被请求页面默认是 true
* */
this.submit = function (href, data, ajaxtype, table, callback, dataType, is_async, is_cache) {
if (data !== undefined) {
$.ajaxSetup({data: JSON.stringify(data)});
} else {
$.ajaxSetup({data: ''});
}
if (dataType !== undefined) {
$.ajaxSetup({dataType: dataType});
}
if (is_async !== undefined) {
$.ajaxSetup({async: is_async});
}
if (is_cache !== undefined) {
$.ajaxSetup({cache: is_cache});
}
$.ajax({
url: href,
contentType: 'application/json',
type: ajaxtype || 'get',
success: callback != null ? callback : function (result) {
if (result.code === 1) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
let frameIndex = parent.layer.getFrameIndex(window.name);
if (frameIndex) {
parent.layer.close(frameIndex);//关闭当前页
}
table && parent.layui.table.reload(table);
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
},
error: function (xhr) {
if (xhr.status === 401) {
layer.msg('权限不足,您无法访问受限资源或数据', {icon: 5});
return;
}
if (xhr.status === 404) {
layer.msg('请求url地址错误请确认后刷新重试', {icon: 5});
return;
}
if (xhr.status === 419) {
layer.msg('长时间未操作,自动刷新后重试!', {icon: 5});
setTimeout(function () {
window.location.reload();
}, 2000);
return;
}
if (xhr.status === 429) {
layer.msg('尝试次数太多,请一分钟后再试', {icon: 5});
return;
}
if (xhr.status === 500) {
layer.msg(xhr.responseJSON.message, {icon: 5});
}
}
, complete: function (xhr, status) {
}
})
}
}
exports(MOD_NAME, common);
});

View File

@ -137,4 +137,4 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}
exports(MOD_NAME, new message());
})
})

View File

@ -9,43 +9,43 @@ layui.config({
base: rootPath + "module/",
version: "3.30.0"
}).extend({
admin: "admin", // 框架布局组件
common: "common", // 公共方法封装
menu: "menu", // 数据菜单组件
frame: "frame", // 内容页面组件
tab: "tab", // 多选项卡组件
echarts: "echarts", // 数据图表组件
echartsTheme: "echartsTheme", // 数据图表主题
encrypt: "encrypt", // 数据加密组件
select: "select", // 下拉多选组件
drawer: "drawer", // 抽屉弹层组件
notice: "notice", // 消息提示组件
step:"step", // 分布表单组件
tag:"tag", // 多标签页组件
popup:"popup", // 弹层封装
treetable:"treetable", // 树状表格
dtree:"dtree", // 树结构
tinymce:"tinymce/tinymce", // 编辑器
area:"area", // 省市级联
count:"count", // 数字滚动
topBar: "topBar", // 置顶组件
button: "button", // 加载按钮
design: "design", // 表单设计
card: "card", // 数据卡片组件
loading: "loading", // 加载组件
cropper:"cropper", // 裁剪组件
convert:"convert", // 数据转换
yaml:"yaml", // yaml 解析组件
context: "context", // 上下文组件
http: "http", // ajax请求组件
theme: "theme", // 主题转换
message: "message", // 通知组件
toast: "toast", // 消息通知
iconPicker: "iconPicker",// 图标选择
nprogress: "nprogress", // 进度过渡
watermark:"watermark/watermark", //水印
fullscreen:"fullscreen", //全屏组件
popover:"popover/popover" //汽泡组件
admin: "admin", // 框架布局组件
common: "common", // 公共方法封装
menu: "menu", // 数据菜单组件
frame: "frame", // 内容页面组件
tab: "tab", // 多选项卡组件
echarts: "echarts", // 数据图表组件
echartsTheme: "echartsTheme",// 数据图表主题
encrypt: "encrypt", // 数据加密组件
select: "select", // 下拉多选组件
drawer: "drawer", // 抽屉弹层组件
notice: "notice", // 消息提示组件
step:"step", // 分布表单组件
tag:"tag", // 多标签页组件
popup:"popup", // 弹层封装
treetable:"treetable", // 树状表格
dtree:"dtree", // 树结构
tinymce:"tinymce/tinymce", // 编辑器
area:"area", // 省市级联
count:"count", // 数字滚动
topBar: "topBar", // 置顶组件
button: "button", // 加载按钮
design: "design", // 表单设计
card: "card", // 数据卡片组件
loading: "loading", // 加载组件
cropper:"cropper", // 裁剪组件
convert:"convert", // 数据转换
yaml:"yaml", // yaml 解析组件
context: "context", // 上下文组件
http: "http", // 网络请求组件
theme: "theme", // 主题转换
message: "message", // 通知组件
toast: "toast", // 消息通知
iconPicker: "iconPicker", // 图标选择
nprogress: "nprogress", // 进度过渡
watermark:"watermark/watermark", //水印组件
fullscreen:"fullscreen", //全屏组件
popover:"popover/popover" //汽泡组件
}).use(['layer', 'theme'], function () {
layui.theme.changeTheme(window, false);
});

View File

@ -1761,17 +1761,17 @@
},
{
"name": "psr/http-message",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"version": "1.1",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"shasum": "",
"mirrors": [
{
@ -1781,13 +1781,13 @@
]
},
"require": {
"php": ">=5.3.0"
"php": "^7.2 || ^8.0"
},
"time": "2016-08-06T14:39:51+00:00",
"time": "2023-04-04T09:50:52+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
},
"installation-source": "dist",
@ -1817,7 +1817,7 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
"source": "https://github.com/php-fig/http-message/tree/1.1"
},
"install-path": "../psr/http-message"
},
@ -3302,23 +3302,29 @@
},
{
"name": "workerman/channel",
"version": "v1.1.0",
"version_normalized": "1.1.0.0",
"version": "v1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/walkor/channel.git",
"reference": "3df772d0d20d4cebfcfd621c33d1a1ab732db523"
"reference": "fbfb81c7ebc5858c4053f226cbb5d15fe670ff6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/channel/zipball/3df772d0d20d4cebfcfd621c33d1a1ab732db523",
"reference": "3df772d0d20d4cebfcfd621c33d1a1ab732db523",
"shasum": ""
"url": "https://api.github.com/repos/walkor/channel/zipball/fbfb81c7ebc5858c4053f226cbb5d15fe670ff6e",
"reference": "fbfb81c7ebc5858c4053f226cbb5d15fe670ff6e",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"workerman/workerman": ">=4.0.12"
},
"time": "2021-02-08T02:45:42+00:00",
"time": "2023-04-04T02:47:35+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3333,7 +3339,7 @@
"homepage": "http://www.workerman.net",
"support": {
"issues": "https://github.com/walkor/channel/issues",
"source": "https://github.com/walkor/channel/tree/v1.1.0"
"source": "https://github.com/walkor/channel/tree/v1.2.0"
},
"install-path": "../workerman/channel"
},

View File

@ -3,7 +3,7 @@
'name' => 'taoser/taoler',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'f3d0aa0ea3473bafd7ce92799552709c43f3f02d',
'reference' => '161a45102f046e53da3e5666e5c6cc052b5029b4',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -263,9 +263,9 @@
),
),
'psr/http-message' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
'pretty_version' => '1.1',
'version' => '1.1.0.0',
'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
@ -358,7 +358,7 @@
'taoser/taoler' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'f3d0aa0ea3473bafd7ce92799552709c43f3f02d',
'reference' => '161a45102f046e53da3e5666e5c6cc052b5029b4',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -500,9 +500,9 @@
'dev_requirement' => false,
),
'workerman/channel' => array(
'pretty_version' => 'v1.1.0',
'version' => '1.1.0.0',
'reference' => '3df772d0d20d4cebfcfd621c33d1a1ab732db523',
'pretty_version' => 'v1.2.0',
'version' => '1.2.0.0',
'reference' => 'fbfb81c7ebc5858c4053f226cbb5d15fe670ff6e',
'type' => 'library',
'install_path' => __DIR__ . '/../workerman/channel',
'aliases' => array(),

View File

@ -10,4 +10,7 @@ interface that describes a HTTP message. See the specification for more details.
Usage
-----
We'll certainly need some stuff in here.
Before reading the usage guide we recommend reading the PSR-7 interfaces method list:
* [`PSR-7 Interfaces Method List`](docs/PSR7-Interfaces.md)
* [`PSR-7 Usage Guide`](docs/PSR7-Usage.md)

View File

@ -11,7 +11,7 @@
}
],
"require": {
"php": ">=5.3.0"
"php": "^7.2 || ^8.0"
},
"autoload": {
"psr-4": {
@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
}
}

View File

@ -0,0 +1,130 @@
# Interfaces
The purpose of this list is to help in finding the methods when working with PSR-7. This can be considered as a cheatsheet for PSR-7 interfaces.
The interfaces defined in PSR-7 are the following:
| Class Name | Description |
|---|---|
| [Psr\Http\Message\MessageInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagemessageinterface) | Representation of a HTTP message |
| [Psr\Http\Message\RequestInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagerequestinterface) | Representation of an outgoing, client-side request. |
| [Psr\Http\Message\ServerRequestInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageserverrequestinterface) | Representation of an incoming, server-side HTTP request. |
| [Psr\Http\Message\ResponseInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageresponseinterface) | Representation of an outgoing, server-side response. |
| [Psr\Http\Message\StreamInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagestreaminterface) | Describes a data stream |
| [Psr\Http\Message\UriInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageuriinterface) | Value object representing a URI. |
| [Psr\Http\Message\UploadedFileInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageuploadedfileinterface) | Value object representing a file uploaded through an HTTP request. |
## `Psr\Http\Message\MessageInterface` Methods
| Method Name | Description | Notes |
|------------------------------------| ----------- | ----- |
| `getProtocolVersion()` | Retrieve HTTP protocol version | 1.0 or 1.1 |
| `withProtocolVersion($version)` | Returns new message instance with given HTTP protocol version | |
| `getHeaders()` | Retrieve all HTTP Headers | [Request Header List](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields), [Response Header List](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields) |
| `hasHeader($name)` | Checks if HTTP Header with given name exists | |
| `getHeader($name)` | Retrieves a array with the values for a single header | |
| `getHeaderLine($name)` | Retrieves a comma-separated string of the values for a single header | |
| `withHeader($name, $value)` | Returns new message instance with given HTTP Header | if the header existed in the original instance, replaces the header value from the original message with the value provided when creating the new instance. |
| `withAddedHeader($name, $value)` | Returns new message instance with appended value to given header | If header already exists value will be appended, if not a new header will be created |
| `withoutHeader($name)` | Removes HTTP Header with given name| |
| `getBody()` | Retrieves the HTTP Message Body | Returns object implementing `StreamInterface`|
| `withBody(StreamInterface $body)` | Returns new message instance with given HTTP Message Body | |
## `Psr\Http\Message\RequestInterface` Methods
Same methods as `Psr\Http\Message\MessageInterface` + the following methods:
| Method Name | Description | Notes |
|------------------------------------| ----------- | ----- |
| `getRequestTarget()` | Retrieves the message's request target | origin-form, absolute-form, authority-form, asterisk-form ([RFC7230](https://www.rfc-editor.org/rfc/rfc7230.txt)) |
| `withRequestTarget($requestTarget)` | Return a new message instance with the specific request-target | |
| `getMethod()` | Retrieves the HTTP method of the request. | GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE (defined in [RFC7231](https://tools.ietf.org/html/rfc7231)), PATCH (defined in [RFC5789](https://tools.ietf.org/html/rfc5789)) |
| `withMethod($method)` | Returns a new message instance with the provided HTTP method | |
| `getUri()` | Retrieves the URI instance | |
| `withUri(UriInterface $uri, $preserveHost = false)` | Returns a new message instance with the provided URI | |
## `Psr\Http\Message\ServerRequestInterface` Methods
Same methods as `Psr\Http\Message\RequestInterface` + the following methods:
| Method Name | Description | Notes |
|------------------------------------| ----------- | ----- |
| `getServerParams() ` | Retrieve server parameters | Typically derived from `$_SERVER` |
| `getCookieParams()` | Retrieves cookies sent by the client to the server. | Typically derived from `$_COOKIES` |
| `withCookieParams(array $cookies)` | Returns a new request instance with the specified cookies | |
| `withQueryParams(array $query)` | Returns a new request instance with the specified query string arguments | |
| `getUploadedFiles()` | Retrieve normalized file upload data | |
| `withUploadedFiles(array $uploadedFiles)` | Returns a new request instance with the specified uploaded files | |
| `getParsedBody()` | Retrieve any parameters provided in the request body | |
| `withParsedBody($data)` | Returns a new request instance with the specified body parameters | |
| `getAttributes()` | Retrieve attributes derived from the request | |
| `getAttribute($name, $default = null)` | Retrieve a single derived request attribute | |
| `withAttribute($name, $value)` | Returns a new request instance with the specified derived request attribute | |
| `withoutAttribute($name)` | Returns a new request instance that without the specified derived request attribute | |
## `Psr\Http\Message\ResponseInterface` Methods:
Same methods as `Psr\Http\Message\MessageInterface` + the following methods:
| Method Name | Description | Notes |
|------------------------------------| ----------- | ----- |
| `getStatusCode()` | Gets the response status code. | |
| `withStatus($code, $reasonPhrase = '')` | Returns a new response instance with the specified status code and, optionally, reason phrase. | |
| `getReasonPhrase()` | Gets the response reason phrase associated with the status code. | |
## `Psr\Http\Message\StreamInterface` Methods
| Method Name | Description | Notes |
|------------------------------------| ----------- | ----- |
| `__toString()` | Reads all data from the stream into a string, from the beginning to end. | |
| `close()` | Closes the stream and any underlying resources. | |
| `detach()` | Separates any underlying resources from the stream. | |
| `getSize()` | Get the size of the stream if known. | |
| `eof()` | Returns true if the stream is at the end of the stream.| |
| `isSeekable()` | Returns whether or not the stream is seekable. | |
| `seek($offset, $whence = SEEK_SET)` | Seek to a position in the stream. | |
| `rewind()` | Seek to the beginning of the stream. | |
| `isWritable()` | Returns whether or not the stream is writable. | |
| `write($string)` | Write data to the stream. | |
| `isReadable()` | Returns whether or not the stream is readable. | |
| `read($length)` | Read data from the stream. | |
| `getContents()` | Returns the remaining contents in a string | |
| `getMetadata($key = null)()` | Get stream metadata as an associative array or retrieve a specific key. | |
## `Psr\Http\Message\UriInterface` Methods
| Method Name | Description | Notes |
|------------------------------------| ----------- | ----- |
| `getScheme()` | Retrieve the scheme component of the URI. | |
| `getAuthority()` | Retrieve the authority component of the URI. | |
| `getUserInfo()` | Retrieve the user information component of the URI. | |
| `getHost()` | Retrieve the host component of the URI. | |
| `getPort()` | Retrieve the port component of the URI. | |
| `getPath()` | Retrieve the path component of the URI. | |
| `getQuery()` | Retrieve the query string of the URI. | |
| `getFragment()` | Retrieve the fragment component of the URI. | |
| `withScheme($scheme)` | Return an instance with the specified scheme. | |
| `withUserInfo($user, $password = null)` | Return an instance with the specified user information. | |
| `withHost($host)` | Return an instance with the specified host. | |
| `withPort($port)` | Return an instance with the specified port. | |
| `withPath($path)` | Return an instance with the specified path. | |
| `withQuery($query)` | Return an instance with the specified query string. | |
| `withFragment($fragment)` | Return an instance with the specified URI fragment. | |
| `__toString()` | Return the string representation as a URI reference. | |
## `Psr\Http\Message\UploadedFileInterface` Methods
| Method Name | Description | Notes |
|------------------------------------| ----------- | ----- |
| `getStream()` | Retrieve a stream representing the uploaded file. | |
| `moveTo($targetPath)` | Move the uploaded file to a new location. | |
| `getSize()` | Retrieve the file size. | |
| `getError()` | Retrieve the error associated with the uploaded file. | |
| `getClientFilename()` | Retrieve the filename sent by the client. | |
| `getClientMediaType()` | Retrieve the media type sent by the client. | |
> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`.
> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered.

View File

@ -0,0 +1,159 @@
### PSR-7 Usage
All PSR-7 applications comply with these interfaces
They were created to establish a standard between middleware implementations.
> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`.
> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered.
The following examples will illustrate how basic operations are done in PSR-7.
##### Examples
For this examples to work (at least) a PSR-7 implementation package is required. (eg: zendframework/zend-diactoros, guzzlehttp/psr7, slim/slim, etc)
All PSR-7 implementations should have the same behaviour.
The following will be assumed:
`$request` is an object of `Psr\Http\Message\RequestInterface` and
`$response` is an object implementing `Psr\Http\Message\RequestInterface`
### Working with HTTP Headers
#### Adding headers to response:
```php
$response->withHeader('My-Custom-Header', 'My Custom Message');
```
#### Appending values to headers
```php
$response->withAddedHeader('My-Custom-Header', 'The second message');
```
#### Checking if header exists:
```php
$request->hasHeader('My-Custom-Header'); // will return false
$response->hasHeader('My-Custom-Header'); // will return true
```
> Note: My-Custom-Header was only added in the Response
#### Getting comma-separated values from a header (also applies to request)
```php
// getting value from request headers
$request->getHeaderLine('Content-Type'); // will return: "text/html; charset=UTF-8"
// getting value from response headers
$response->getHeaderLine('My-Custom-Header'); // will return: "My Custom Message; The second message"
```
#### Getting array of value from a header (also applies to request)
```php
// getting value from request headers
$request->getHeader('Content-Type'); // will return: ["text/html", "charset=UTF-8"]
// getting value from response headers
$response->getHeader('My-Custom-Header'); // will return: ["My Custom Message", "The second message"]
```
#### Removing headers from HTTP Messages
```php
// removing a header from Request, removing deprecated "Content-MD5" header
$request->withoutHeader('Content-MD5');
// removing a header from Response
// effect: the browser won't know the size of the stream
// the browser will download the stream till it ends
$response->withoutHeader('Content-Length');
```
### Working with HTTP Message Body
When working with the PSR-7 there are two methods of implementation:
#### 1. Getting the body separately
> This method makes the body handling easier to understand and is useful when repeatedly calling body methods. (You only call `getBody()` once). Using this method mistakes like `$response->write()` are also prevented.
```php
$body = $response->getBody();
// operations on body, eg. read, write, seek
// ...
// replacing the old body
$response->withBody($body);
// this last statement is optional as we working with objects
// in this case the "new" body is same with the "old" one
// the $body variable has the same value as the one in $request, only the reference is passed
```
#### 2. Working directly on response
> This method is useful when only performing few operations as the `$request->getBody()` statement fragment is required
```php
$response->getBody()->write('hello');
```
### Getting the body contents
The following snippet gets the contents of a stream contents.
> Note: Streams must be rewinded, if content was written into streams, it will be ignored when calling `getContents()` because the stream pointer is set to the last character, which is `\0` - meaning end of stream.
```php
$body = $response->getBody();
$body->rewind(); // or $body->seek(0);
$bodyText = $body->getContents();
```
> Note: If `$body->seek(1)` is called before `$body->getContents()`, the first character will be ommited as the starting pointer is set to `1`, not `0`. This is why using `$body->rewind()` is recommended.
### Append to body
```php
$response->getBody()->write('Hello'); // writing directly
$body = $request->getBody(); // which is a `StreamInterface`
$body->write('xxxxx');
```
### Prepend to body
Prepending is different when it comes to streams. The content must be copied before writing the content to be prepended.
The following example will explain the behaviour of streams.
```php
// assuming our response is initially empty
$body = $repsonse->getBody();
// writing the string "abcd"
$body->write('abcd');
// seeking to start of stream
$body->seek(0);
// writing 'ef'
$body->write('ef'); // at this point the stream contains "efcd"
```
#### Prepending by rewriting separately
```php
// assuming our response body stream only contains: "abcd"
$body = $response->getBody();
$body->rewind();
$contents = $body->getContents(); // abcd
// seeking the stream to beginning
$body->rewind();
$body->write('ef'); // stream contains "efcd"
$body->write($contents); // stream contains "efabcd"
```
> Note: `getContents()` seeks the stream while reading it, therefore if the second `rewind()` method call was not present the stream would have resulted in `abcdefabcd` because the `write()` method appends to stream if not preceeded by `rewind()` or `seek(0)`.
#### Prepending by using contents as a string
```php
$body = $response->getBody();
$body->rewind();
$contents = $body->getContents(); // efabcd
$contents = 'ef'.$contents;
$body->rewind();
$body->write($contents);
```

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@ -38,7 +40,7 @@ interface MessageInterface
* @param string $version HTTP protocol version
* @return static
*/
public function withProtocolVersion($version);
public function withProtocolVersion(string $version);
/**
* Retrieves all message header values.
@ -75,7 +77,7 @@ interface MessageInterface
* name using a case-insensitive string comparison. Returns false if
* no matching header name is found in the message.
*/
public function hasHeader($name);
public function hasHeader(string $name);
/**
* Retrieves a message header value by the given case-insensitive name.
@ -91,7 +93,7 @@ interface MessageInterface
* header. If the header does not appear in the message, this method MUST
* return an empty array.
*/
public function getHeader($name);
public function getHeader(string $name);
/**
* Retrieves a comma-separated string of the values for a single header.
@ -112,7 +114,7 @@ interface MessageInterface
* concatenated together using a comma. If the header does not appear in
* the message, this method MUST return an empty string.
*/
public function getHeaderLine($name);
public function getHeaderLine(string $name);
/**
* Return an instance with the provided value replacing the specified header.
@ -129,7 +131,7 @@ interface MessageInterface
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
public function withHeader($name, $value);
public function withHeader(string $name, $value);
/**
* Return an instance with the specified header appended with the given value.
@ -147,7 +149,7 @@ interface MessageInterface
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
public function withAddedHeader($name, $value);
public function withAddedHeader(string $name, $value);
/**
* Return an instance without the specified header.
@ -161,7 +163,7 @@ interface MessageInterface
* @param string $name Case-insensitive header field name to remove.
* @return static
*/
public function withoutHeader($name);
public function withoutHeader(string $name);
/**
* Gets the body of the message.

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@ -55,10 +57,10 @@ interface RequestInterface extends MessageInterface
*
* @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
* request-target forms allowed in request messages)
* @param mixed $requestTarget
* @param string $requestTarget
* @return static
*/
public function withRequestTarget($requestTarget);
public function withRequestTarget(string $requestTarget);
/**
* Retrieves the HTTP method of the request.
@ -82,7 +84,7 @@ interface RequestInterface extends MessageInterface
* @return static
* @throws \InvalidArgumentException for invalid HTTP methods.
*/
public function withMethod($method);
public function withMethod(string $method);
/**
* Retrieves the URI instance.
@ -125,5 +127,5 @@ interface RequestInterface extends MessageInterface
* @param bool $preserveHost Preserve the original state of the Host header.
* @return static
*/
public function withUri(UriInterface $uri, $preserveHost = false);
public function withUri(UriInterface $uri, bool $preserveHost = false);
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@ -49,7 +51,7 @@ interface ResponseInterface extends MessageInterface
* @return static
* @throws \InvalidArgumentException For invalid status code arguments.
*/
public function withStatus($code, $reasonPhrase = '');
public function withStatus(int $code, string $reasonPhrase = '');
/**
* Gets the response reason phrase associated with the status code.

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@ -224,7 +226,7 @@ interface ServerRequestInterface extends RequestInterface
* @param mixed $default Default value to return if the attribute does not exist.
* @return mixed
*/
public function getAttribute($name, $default = null);
public function getAttribute(string $name, $default = null);
/**
* Return an instance with the specified derived request attribute.
@ -241,7 +243,7 @@ interface ServerRequestInterface extends RequestInterface
* @param mixed $value The value of the attribute.
* @return static
*/
public function withAttribute($name, $value);
public function withAttribute(string $name, $value);
/**
* Return an instance that removes the specified derived request attribute.
@ -257,5 +259,5 @@ interface ServerRequestInterface extends RequestInterface
* @param string $name The attribute name.
* @return static
*/
public function withoutAttribute($name);
public function withoutAttribute(string $name);
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@ -84,7 +86,7 @@ interface StreamInterface
* SEEK_END: Set position to end-of-stream plus offset.
* @throws \RuntimeException on failure.
*/
public function seek($offset, $whence = SEEK_SET);
public function seek(int $offset, int $whence = SEEK_SET);
/**
* Seek to the beginning of the stream.
@ -112,7 +114,7 @@ interface StreamInterface
* @return int Returns the number of bytes written to the stream.
* @throws \RuntimeException on failure.
*/
public function write($string);
public function write(string $string);
/**
* Returns whether or not the stream is readable.
@ -131,7 +133,7 @@ interface StreamInterface
* if no bytes are available.
* @throws \RuntimeException if an error occurs.
*/
public function read($length);
public function read(int $length);
/**
* Returns the remaining contents in a string
@ -149,10 +151,10 @@ interface StreamInterface
* stream_get_meta_data() function.
*
* @link http://php.net/manual/en/function.stream-get-meta-data.php
* @param string $key Specific metadata to retrieve.
* @param string|null $key Specific metadata to retrieve.
* @return array|mixed|null Returns an associative array if no key is
* provided. Returns a specific key value if a key is provided and the
* value is found, or null if the key is not found.
*/
public function getMetadata($key = null);
public function getMetadata(?string $key = null);
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@ -62,7 +64,7 @@ interface UploadedFileInterface
* @throws \RuntimeException on any error during the move operation, or on
* the second or subsequent call to the method.
*/
public function moveTo($targetPath);
public function moveTo(string $targetPath);
/**
* Retrieve the file size.

View File

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@ -188,7 +191,7 @@ interface UriInterface
* @return static A new instance with the specified scheme.
* @throws \InvalidArgumentException for invalid or unsupported schemes.
*/
public function withScheme($scheme);
public function withScheme(string $scheme);
/**
* Return an instance with the specified user information.
@ -204,7 +207,7 @@ interface UriInterface
* @param null|string $password The password associated with $user.
* @return static A new instance with the specified user information.
*/
public function withUserInfo($user, $password = null);
public function withUserInfo(string $user, ?string $password = null);
/**
* Return an instance with the specified host.
@ -218,7 +221,7 @@ interface UriInterface
* @return static A new instance with the specified host.
* @throws \InvalidArgumentException for invalid hostnames.
*/
public function withHost($host);
public function withHost(string $host);
/**
* Return an instance with the specified port.
@ -237,7 +240,7 @@ interface UriInterface
* @return static A new instance with the specified port.
* @throws \InvalidArgumentException for invalid ports.
*/
public function withPort($port);
public function withPort(?int $port);
/**
* Return an instance with the specified path.
@ -261,7 +264,7 @@ interface UriInterface
* @return static A new instance with the specified path.
* @throws \InvalidArgumentException for invalid paths.
*/
public function withPath($path);
public function withPath(string $path);
/**
* Return an instance with the specified query string.
@ -278,7 +281,7 @@ interface UriInterface
* @return static A new instance with the specified query string.
* @throws \InvalidArgumentException for invalid query strings.
*/
public function withQuery($query);
public function withQuery(string $query);
/**
* Return an instance with the specified URI fragment.
@ -294,7 +297,7 @@ interface UriInterface
* @param string $fragment The fragment to use with the new instance.
* @return static A new instance with the specified fragment.
*/
public function withFragment($fragment);
public function withFragment(string $fragment);
/**
* Return the string representation as a URI reference.

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2023-03-28 11:40:31
// This file is automatically generated at:2023-04-13 15:00:47
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -80,7 +80,7 @@ class Client
* Ping interval.
* @var int
*/
public static $pingInterval = 25;
public static $pingInterval = 55;
/**
* Connect to channel server
@ -274,11 +274,12 @@ class Client
* @param string $events
* @param mixed $data
*/
public static function publish($events, $data)
public static function publish($events, $data , $is_loop = false)
{
self::sendAnyway(array('type' => 'publish', 'channels' => (array)$events, 'data' => $data));
$type = $is_loop == true ? 'publishLoop' : 'publish';
self::sendAnyway(array('type' => $type, 'channels' => (array)$events, 'data' => $data));
}
/**
* Watch a channel of queue
* @param string|array $channels

View File

@ -120,6 +120,22 @@ class Server
}
}
break;
case 'publishLoop':
//choose one subscriber from the list
foreach ($data['channels'] as $channel) {
if (empty($worker->channels[$channel])) {
continue;
}
$buffer = serialize(array('type' => 'event', 'channel' => $channel, 'data' => $data['data']))."\n";
//这是要点,每次取出一个元素,如果取不到,说明已经到最后,重置到第一个
$connection = next($worker->channels[$channel]);
if( $connection == false ){
$connection = reset($worker->channels[$channel]);
}
$connection->send($buffer);
}
break;
case 'watch':
foreach ($data['channels'] as $channel) {
$this->getQueue($channel)->addWatch($connection);

View File

@ -3,7 +3,7 @@
use Channel\Client;
use Channel\Server;
use Workerman\Worker;
use Workerman\Lib\Timer;
use Workerman\Timer;
// composer autoload
include __DIR__ . '/../vendor/autoload.php';

View File

@ -3,7 +3,7 @@
use Channel\Client;
use Channel\Server;
use Workerman\Worker;
use Workerman\Lib\Timer;
use Workerman\Timer;
// composer autoload
include __DIR__ . '/../vendor/autoload.php';

View File

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2022/2/20
* Time: 12:00
*/
include_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
$processName = "ChannelServerTest";
Worker::$pidFile = "var/{$processName}.pid";
Worker::$logFile = "var/{$processName}_logFile.log";
Worker::$stdoutFile = "var/{$processName}_stdout.log";
$channel_server = new Channel\Server('0.0.0.0', 2206);
if(!defined('GLOBAL_START'))
{
Worker::runAll();
}

View File

@ -0,0 +1,34 @@
<?php
include_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
use Workerman\Lib\Timer;
use Workerman\Connection\TcpConnection;
use Workerman\Connection\AsyncUdpConnection;
use Workerman\Connection\AsyncTcpConnection;
//监听端口
$worker = new Worker("");
//开启进程数量
$worker->count = 8;
$processName = "client";
$worker->name = $processName;
$worker->reusePort = true; //开启均衡负载模式
Worker::$pidFile = "var/{$processName}.pid";
Worker::$logFile = "var/{$processName}_logFile.log";
Worker::$stdoutFile = "var/{$processName}_stdout.log";
$worker->onWorkerStart = function() use($worker){
usleep(10);
Channel\Client::connect('127.0.0.1' , 2206);
$event_name = "test_channel";
Channel\Client::on($event_name, function($event_data)use($worker ,$event_name ){
$log_str = "{$worker->id} on {$event_name}:".json_encode($event_data,320)."\n";
echo $log_str;
});
};
Worker::runAll();

View File

@ -0,0 +1,35 @@
<?php
include_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
use Workerman\Lib\Timer;
use Workerman\Connection\TcpConnection;
use Workerman\Connection\AsyncUdpConnection;
use Workerman\Connection\AsyncTcpConnection;
//监听端口
$worker = new Worker("");
//开启进程数量
$worker->count = 1;
$processName = "send";
$worker->name = $processName;
$worker->reusePort = true; //开启均衡负载模式
Worker::$pidFile = "var/{$processName}.pid";
Worker::$logFile = "var/{$processName}_logFile.log";
Worker::$stdoutFile = "var/{$processName}_stdout.log";
$worker->onWorkerStart = function() use($worker){
Channel\Client::connect('127.0.0.1' , 2206);
Timer::add( 1 , function ()use($worker){
$data_arr = [
'time' => microtime(true),
'date' => date("Y-m-d H:i:s"),
];
$event_name = "test_channel";
Channel\Client::publish($event_name, $data_arr , true);
});
};
Worker::runAll();

View File

@ -50,6 +50,11 @@
<cite>{$art.user.nickname ?: $art.user.name}</cite>
</a>
{$art.create_time|date='Y-m-d'}
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
<span ><i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}</span>
</div>
</div>

View File

@ -55,9 +55,11 @@
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
{/if}
{if($article.read_type == 1)}
<div id="jiemi" style="text-align:center">
<button type="button" class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #FF5722;"></i> 阅读请解密 </button>
</div>
{/if}
{/empty}
{notempty name="tags"}
@ -93,21 +95,28 @@
<div class="detail-hits"><span class="post-time" data="{$vo.create_time}"></span>{:hook('ipShow', $vo.user.city)}</div>
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
</div>
<div class="detail-body jieda-body photos">{$vo.content|raw}</div>
{//加密未解密评论不可查看}
{if($article.read_type == 0 || (($article.read_type == 1) && $passJieMi))}
<div class="detail-body jieda-body photos">{$vo.content|raw}</div>
<div class="jieda-reply">
<span class="jieda-zan {if($vo.zan != 0)}zanok{/if}" type="zan"><i class="iconfont icon-zan"></i><em>{$vo.zan}</em></span>
<span type="reply" id="user-reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
{//评论 编辑/删除/采纳/权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="edit" class="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/}
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
{/if}
</div>
</div>
{else /}
<div class="detail-body jieda-body photos"><i class="layui-icon layui-icon-password" style="font-size: 24px; color: #FF5722;"></i> 评论解密后查看 </div>
{/if}
<div style="margin: 5px 0px;">
<hr style="border:1px dotted red;height:1px;width:90%" />
<div>{$vo.user.sign|raw}</div>
@ -231,7 +240,7 @@
othis.html(fly.content(html));
});
} else {
$("#comment-edit").on('click',function (){
$(".comment-edit").on('click',function (){
var id = $(this).data('id');
layer.open({
type: 2,

View File

@ -58,6 +58,11 @@
</div>
<div class="d-inline-block">
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" class="text-muted" title="发布于{$art.user.name}" rel="category">{$art.user.nickname ?: $art.user.name}</a>
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
</div>
<div class="flex-fill"></div>
<div class="mx-1">

View File

@ -63,9 +63,11 @@
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
{/if}
{if($article.read_type == 1)}
<div id="jiemi" style="text-align:center">
<button type="button" class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #FF5722;"></i> 阅读请解密 </button>
</div>
{/if}
{/empty}
{notempty name="tags"}
@ -141,22 +143,26 @@
<div class="detail-hits"><span class="post-time" data="{$vo.create_time}"></span>{:hook('ipShow',$vo.user.city)}</div>
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
</div>
{//加密未解密评论不可查看}
{if($article.read_type == 0 || (($article.read_type == 1) && $passJieMi))}
<div class="detail-body jieda-body photos">{$vo.content|raw}</div>
<div class="jieda-reply">
<span class="jieda-zan {if($vo.zan != 0)}zanok{/if}" type="zan"><i class="iconfont icon-zan"></i><em>{$vo.zan}</em></span>
<span type="reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
{//评论 编辑/删除/采纳/权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="edit" class="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/}
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
{/if}
</div>
</div>
<hr width="90%" style="border:1px dotted red;height:1px;margin:5px 0px;"; />
{else /}
<div class="detail-body jieda-body photos"><i class="layui-icon layui-icon-password" style="font-size: 24px; color: #FF5722;"></i> 评论解密后查看 </div>
{/if}
<hr style="width:90%;border:1px dotted red;height:1px;margin:5px 0px;"; />
<div>{$vo.user.sign|raw}</div>
</li>
@ -333,7 +339,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
othis.html(fly.content(html));
});
} else {
$("#comment-edit").on('click',function (){
$(".comment-edit").on('click',function (){
var id = $(this).data('id');
layer.open({
type: 2,
@ -347,7 +353,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
//加载评论编辑器
if(taonystatus == 1) {
$("#comment-edit").attr('type','');
$(".comment-edit").attr('type','');
}
//tpl模板给发布时间赋值

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
name = blog
type = sub
auth = taoler
description = 内页模板
version = 0.1
push_time = 2022-7-21

View File

@ -41,10 +41,11 @@
{/if}
-->
</a>
{$art.has_img ?= '<i class="layui-icon layui-icon-picture" style=" color: #5FB878;"></i>'}
{$art.has_video ?= '<i class="layui-icon layui-icon-play" style="color: #FF5722;"></i>'}
{$art.has_audio ?= '<i class="layui-icon layui-icon-speaker" style="color: #000000;"></i>'}
{$art.upzip ?= ' <i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i>'}
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span>
{if ($art.jie == 1)}<span class="layui-badge fly-badge-accept layui-hide-xs">{:lang('end')}</span>{/if}
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}</span>

View File

@ -110,7 +110,7 @@
{//评论编辑删除采纳权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="edit" class="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/if}
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}<span class="jieda-accept" type="accept">{:lang('accept')}</span>{/if}

View File

@ -28,7 +28,6 @@
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" value="{$article.title_color ?? '#333'}">
<input type="hidden" name="user_id" value="{$article.user_id}">
</div>
</div>
{if ($user.auth == 1)}

View File

@ -31,10 +31,11 @@
<i>{$art.create_time|date='Y-m-d'}</i>
</a>
<span>
{$art.has_img ?= ' <i class="layui-icon layui-icon-picture" style=" color: #5FB878;"></i>'}
{$art.has_video ?= ' <i class="layui-icon layui-icon-play" style="color: #FF5722;"></i>'}
{$art.has_audio ?= ' <i class="layui-icon layui-icon-speaker" style="color: #000000;"></i>'}
{$art.upzip ?= ' <i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i>'}
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
</span>
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span>
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}</span>

View File

@ -44,7 +44,9 @@
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
<div id="jiemi" style="text-align:center">
<button type="button" class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #FF5722;"></i> 阅读请解密 </button>
</div>
{/if}
{/empty}

View File

@ -37,10 +37,11 @@
</a>
{//图标}
<span>
{$art.has_img ?= ' <i class="layui-icon layui-icon-picture" style=" color: #5FB878;"></i>'}
{$art.has_video ?= ' <i class="layui-icon layui-icon-play" style="color: #FF5722;"></i>'}
{$art.has_audio ?= ' <i class="layui-icon layui-icon-speaker" style="color: #000000;"></i>'}
{$art.upzip ?= ' <i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i>'}
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
</span>
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span>
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}</span>

View File

@ -66,7 +66,9 @@
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
<div id="jiemi" style="text-align:center">
<button type="button" class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #FF5722;"></i> 阅读请解密 </button>
</div>
{/if}
{/empty}
@ -111,6 +113,9 @@
<div class="detail-hits"><span class="post-time" data="{$vo.create_time}"></span>{:hook('ipShow',$vo.user.city)}</span></div>
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
</div>
{//加密未解密评论不可查看}
{if($article.read_type == 0 || (($article.read_type == 1) && $passJieMi))}
<div class="detail-body jieda-body photos">{$vo.content|raw}</div>
<div class="jieda-reply">
<span class="jieda-zan {if($vo.zan != 0)}zanok{/if}" type="zan">
@ -120,7 +125,7 @@
{//评论编辑删除采纳权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="edit" class="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/if}
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}
@ -128,8 +133,12 @@
{/if}
</div>
</div>
{else /}
<div class="detail-body jieda-body photos"><i class="layui-icon layui-icon-password" style="font-size: 24px; color: #FF5722;"></i> 评论解密后查看 </div>
{/if}
<div style="margin: 5px 0px;">
<hr width="90%" style="border:1px dotted red;height:1px" />
<hr style="width:90%;border:1px dotted red;height:1px" />
<div>{$vo.user.sign|raw}</div>
</div>
</li>
@ -247,7 +256,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
othis.html(fly.content(html));
});
} else {
$("#comment-edit").on('click',function (){
$(".comment-edit").on('click',function (){
var id = $(this).data('id');
layer.open({
type: 2,

View File

@ -14,6 +14,7 @@
{$art.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
{$art.has_video ?= '<span><i class="layui-icon layui-icon-play" style="color: #FF5722;"></i></span>'}
{$art.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
{$art.read_type ?= '<span><i class="layui-icon layui-icon-password" style="color: #FF5722;"></i></span>'}
{$art.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span>
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i>{$art.comments_count}</span>