article 独立多应用路由

This commit is contained in:
taoser 2023-03-16 22:30:36 +08:00
parent a86a2142bf
commit d6d512f54e
46 changed files with 340 additions and 183 deletions

View File

@ -243,11 +243,12 @@ abstract class BaseController
/** /**
* 获取文章链接地址 * 获取文章链接地址
* @param int $aid * @param int $aid 文章id
* @param string $ename * @param string $ename 所属分类ename
* @param string $appname 所属应用名
* @return string * @return string
*/ */
protected function getRouteUrl(int $aid,string $ename = '') : string protected function getRouteUrl(int $aid, string $ename = '', string $appname = '') : string
{ {
$indexUrl = $this->getIndexUrl(); $indexUrl = $this->getIndexUrl();
if(config('taoler.url_rewrite.article_as') == '<ename>/'){ if(config('taoler.url_rewrite.article_as') == '<ename>/'){
@ -257,37 +258,61 @@ abstract class BaseController
} else { } else {
$artUrl = (string) url('article_detail', ['id' => $aid]); $artUrl = (string) url('article_detail', ['id' => $aid]);
} }
//dump($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');
}
// 判断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应用名
// 判断是否开启绑定 // 判断是否开启绑定
//$domain_bind = array_key_exists('domain_bind',config('app')); //$domain_bind = array_key_exists('domain_bind',config('app'));
// 判断index应用是否绑定域名 // 判断index应用是否绑定域名
$bind_index = array_search('index',config('app.domain_bind')); //$bind_index = array_search('index',config('app.domain_bind'));
// 判断admin应用是否绑定域名 // 判断admin应用是否绑定域名
$bind_admin = array_search('admin',config('app.domain_bind')); $bind_admin = array_search('admin',config('app.domain_bind'));
// 判断index应用是否域名映射 // 判断index应用是否域名映射
$map_index = array_search('index',config('app.app_map')); //$map_index = array_search('index',config('app.app_map'));
// 判断admin应用是否域名映射 // 判断admin应用是否域名映射
$map_admin = array_search('admin',config('app.app_map')); $map_admin = array_search('admin',config('app.app_map'));
$index = $map_index ? $map_index : 'index'; // index应用名 // $index = $map_index ?: 'index'; // index应用名
$admin = $map_admin ? $map_admin : 'admin'; // admin应用名 $admin = $map_admin ?: 'admin'; // admin应用名
if($bind_index) { if($bind_index) {
// index绑定域名 // echo 111;
$url = $indexUrl . str_replace($admin.'/','',$artUrl); // index或home前端(非admin应用)域名进行了绑定
} else { // index未绑定域名 // url = $indexUrl . str_replace($admin . '/','',$artUrl);
// admin绑定域名 $url = $indexUrl . $artUrl;
} else {
if($bind_admin) { if($bind_admin) {
// echo 222;
// admin绑定域名
$url = $indexUrl .'/' . $index . $artUrl; $url = $indexUrl .'/' . $index . $artUrl;
} elseif ($app == 'admin' && isset($map_admin)) {
// echo 333;
// var_dump($admin, $appname, $artUrl);
// admin进行了映射
$url = $indexUrl . str_replace($admin, $appname, $artUrl);
} else { } else {
$url = $indexUrl . str_replace($admin,$index,$artUrl); // echo 444;
// admin未绑定域名
$url = $indexUrl . str_replace($app, $appname, $artUrl);
} }
}
}
//halt($url);
return $url; return $url;
} }

View File

@ -63,7 +63,7 @@ class Forum extends AdminController
->alias('a') ->alias('a')
->join('user u','a.user_id = u.id') ->join('user u','a.user_id = u.id')
->join('cate c','a.cate_id = c.id') ->join('cate c','a.cate_id = c.id')
->field('a.id as aid,ename,name,user_img,title,content,a.update_time as update_time,is_top,a.is_hot as is_hot,is_reply,a.status as status') ->field('a.id as aid,ename,appname,name,user_img,title,content,a.update_time as update_time,is_top,a.is_hot as is_hot,is_reply,a.status as status')
->where('a.delete_time',0) ->where('a.delete_time',0)
->where($map) ->where($map)
->where($where) ->where($where)
@ -76,7 +76,7 @@ class Forum extends AdminController
$res['msg'] = ''; $res['msg'] = '';
$res['count'] = $count; $res['count'] = $count;
foreach($forumList as $k=>$v){ foreach($forumList as $k=>$v){
$url = $this->getRouteUrl($v['aid'],$v['ename']); $url = $this->getRouteUrl($v['aid'],$v['ename'],$v['appname']);
$res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'url'=>$url,'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']]; $res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'url'=>$url,'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']];
} }
} else { } else {
@ -87,17 +87,6 @@ class Forum extends AdminController
return View::fetch(); return View::fetch();
} }
//编辑帖子
public function listform()
{
if(Request::isAjax()){
$data = Request::param();
$form = Db::name('article')->find($data['id']);
//halt($form);
}
return View::fetch();
}
//删除帖子 //删除帖子
public function listdel($id) public function listdel($id)
{ {
@ -246,7 +235,7 @@ class Forum extends AdminController
->join('user u','a.user_id = u.id') ->join('user u','a.user_id = u.id')
->join('article c','a.article_id = c.id') ->join('article c','a.article_id = c.id')
->join('cate ca','c.cate_id = ca.id') ->join('cate ca','c.cate_id = ca.id')
->field('a.id as aid,name,ename,title,user_img,a.content as content,a.create_time as create_time,a.status as astatus,c.id as cid') ->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('a.delete_time',0)
->where($map) ->where($map)
->where($where) ->where($where)
@ -258,7 +247,7 @@ class Forum extends AdminController
if ($count) { if ($count) {
$res = ['code'=>0,'msg'=>'','count'=>$count]; $res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($replys as $k => $v){ foreach($replys as $k => $v){
$url = $this->getRouteUrl($v['cid'],$v['ename']); $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['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'=>htmlspecialchars($v['content']),'replytime'=>date("Y-m-d",$v['create_time']),'check'=>$v['astatus'],'url'=>$url]; $res['data'][] = ['id'=>$v['aid'],'replyer'=>$v['name'],'title'=>htmlspecialchars($v['title']),'avatar'=>$v['user_img'],'content'=>htmlspecialchars($v['content']),'replytime'=>date("Y-m-d",$v['create_time']),'check'=>$v['astatus'],'url'=>$url];
} }
@ -364,8 +353,8 @@ class Forum extends AdminController
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串 // 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords']))))); $data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
// 获取分类ename // 获取分类ename,appname
$cate_ename = Db::name('cate')->where('id',$data['cate_id'])->value('ename'); $cateName = Db::name('cate')->field('ename,appname')->find($data['cate_id']);
$article = new Article(); $article = new Article();
$result = $article->add($data); $result = $article->add($data);
@ -385,7 +374,7 @@ class Forum extends AdminController
// 清除文章tag缓存 // 清除文章tag缓存
Cache::tag('tagArtDetail')->clear(); Cache::tag('tagArtDetail')->clear();
$link = $this->getRouteUrl((int)$aid, $cate_ename); $link = $this->getRouteUrl((int)$aid, $cateName['ename'],$cateName['appname']);
// 推送给百度收录接口 // 推送给百度收录接口
$this->baiduPushUrl($link); $this->baiduPushUrl($link);
@ -463,7 +452,7 @@ class Forum extends AdminController
} }
//删除原有缓存显示编辑后内容 //删除原有缓存显示编辑后内容
Cache::delete('article_'.$id); Cache::delete('article_'.$id);
$link = $this->getRouteUrl((int) $id, $article->cate->ename); $link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
// 推送给百度收录接口 // 推送给百度收录接口
$this->baiduPushUrl($link); $this->baiduPushUrl($link);
$editRes = Msgres::success('edit_success',$link); $editRes = Msgres::success('edit_success',$link);

View File

@ -3,6 +3,7 @@ namespace app\admin\controller;
use app\common\controller\AdminController; use app\common\controller\AdminController;
use think\facade\Db; use think\facade\Db;
use taoser\think\Auth;
class Menu extends AdminController class Menu extends AdminController
{ {
@ -20,8 +21,11 @@ class Menu extends AdminController
*/ */
public function getMenuNavbar() public function getMenuNavbar()
{ {
// 用户菜单权限
$auth = new Auth();
$pid = empty(input('id')) ? 0 : input('id'); $pid = empty(input('id')) ? 0 : input('id');
$data = Db::name('auth_rule')->field('id,title,icon,name,sort')->where(['delete_time'=> 0,'status'=> 1,'ismenu'=>1,'pid'=>$pid])->select(); $data = Db::name('auth_rule')->field('id,title,icon,name,sort')->where(['pid'=>$pid,'status'=> 1, 'ismenu'=>1, 'delete_time'=> 0])->select();
$tree = []; $tree = [];
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
$hasChild = $this->hasChildren($v['id']); $hasChild = $this->hasChildren($v['id']);
@ -30,7 +34,10 @@ class Menu extends AdminController
} else { } else {
$v['hasChildren'] = 0; $v['hasChildren'] = 0;
} }
$tree[] = ['id'=>$v['id'],'text'=>$v['title'],'icon'=>$v['icon'],'hasChildren'=>$v['hasChildren'],'href'=>(string) url($v['name']),'sort'=>$v['sort']]; if ($auth->check($v['name'], session('admin_id')) || session('admin_id') == 1) {
$tree[] = ['id'=>$v['id'],'text'=>$v['title'],'icon'=>$v['icon'],'hasChildren'=>$v['hasChildren'],'href'=>(string) url($v['name']),'sort'=>$v['sort']];
}
} }
// 排序 // 排序
$cmf_arr = array_column($tree, 'sort'); $cmf_arr = array_column($tree, 'sort');

View File

@ -0,0 +1,2 @@
*
!.gitignore

2
app/admin/model/taocai/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -23,7 +23,7 @@
{{# if(d.have_newversion === 1){ }} {{# if(d.have_newversion === 1){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="install" data-url="{:url('Addons/upgrade')}" data-userlogin="{:url('Addons/userLogin')}" data-ispay="{:url('Addons/isPay')}"><i class="layui-icon layui-icon-edit"></i>升级</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="install" data-url="{:url('Addons/upgrade')}" data-userlogin="{:url('Addons/userLogin')}" data-ispay="{:url('Addons/isPay')}"><i class="layui-icon layui-icon-edit"></i>升级</a>
{{# } else { }} {{# } else { }}
{{# if(d.isInstall ===1) { }} {{# if(d.isInstall === 1) { }}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="config" data-url="{:url('Addons/config')}"><i class="layui-icon layui-icon-set"></i>设置</a> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="config" data-url="{:url('Addons/config')}"><i class="layui-icon layui-icon-set"></i>设置</a>
{{# } else { }} {{# } else { }}
<a class="layui-btn layui-btn-xs" lay-event="install" data-url="{:url('Addons/install')}" data-userlogin="{:url('Addons/userLogin')}" data-ispay="{:url('Addons/isPay')}"><i class="layui-icon layui-icon-edit"></i>安装</a> <a class="layui-btn layui-btn-xs" lay-event="install" data-url="{:url('Addons/install')}" data-userlogin="{:url('Addons/userLogin')}" data-ispay="{:url('Addons/isPay')}"><i class="layui-icon layui-icon-edit"></i>安装</a>
@ -47,8 +47,8 @@
</div> </div>
{include file="public/user_login" /} {include file="public/user_login" /}
{/block} {/block}
{block name="js"}
{block name="js"}
<script> <script>
var addonList = "{:url('Addons/index')}"; var addonList = "{:url('Addons/index')}";
layui.config({ layui.config({
@ -93,7 +93,7 @@
data:field, data:field,
daType:"json", daType:"json",
success:function (data){ success:function (data){
if (res.code == 0) { if (res.code === 0) {
notify.success(res.msg, "topRight"); notify.success(res.msg, "topRight");
} else { } else {
notify.error(res.msg, "topRight"); notify.error(res.msg, "topRight");
@ -115,7 +115,7 @@
var url = $(this).data('url'); var url = $(this).data('url');
//执行帖子审核 //执行帖子审核
$.post(url,{ name: data.name },function(res){ $.post(url,{ name: data.name },function(res){
if(res.code == 0){ if(res.code === 0){
notify.success(res.msg, "topRight"); notify.success(res.msg, "topRight");
} else { } else {
notify.error(res.msg, "topRight"); notify.error(res.msg, "topRight");

View File

@ -25,9 +25,9 @@
</div> </div>
</div> </div>
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-md6"> <div class="layui-col-sm6">
<div class="pay-type"> <div class="pay-type">
<div style="padding: 5px; text-align: center;"><a><img src="/static/res/images/alipay.jpg" style="height:80px;"></a></div> <div style="padding: 5px; text-align: center;"><img src="/static/res/images/alipay.jpg" style="height:80px;"></div>
</div> </div>
<div class="soft-info"> <div class="soft-info">
<div>不支持退款</div> <div>不支持退款</div>
@ -35,8 +35,8 @@
<div>软件协议:本软件为原作者拥有版权权限,购买软件可以商用,禁止第三方出售行为。</div> <div>软件协议:本软件为原作者拥有版权权限,购买软件可以商用,禁止第三方出售行为。</div>
</div> </div>
</div> </div>
<div class="layui-col-md6"> <div class="layui-col-sm6">
<div class="qrcode" data-text="{$orderData.qr_code_img}"> <div class="qrcode" data-text="支付宝当面付" style="padding: 5px; text-align: center;">
<img src="{$orderData.qr_code_img}"> <img src="{$orderData.qr_code_img}">
</div> </div>
<div class="pay-tips"> <div class="pay-tips">

View File

@ -67,10 +67,10 @@
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-filter="artStatus" lay-text="通过|{{ d.check == 0 ? '待审' : '禁止' }}" {{ d.check == 1 ? 'checked' : '' }}> <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-filter="artStatus" lay-text="通过|{{ d.check == 0 ? '待审' : '禁止' }}" {{ d.check == 1 ? 'checked' : '' }}>
</script> </script>
<script type="text/html" id="table-forum-list"> <script type="text/html" id="table-forum-list">
<a class="layui-btn layui-btn-xs" lay-event="edit" ><i class="layui-icon layui-icon-edit"></i></a> <a class="layui-btn layui-btn-xs" lay-event="edit" data-url="{:url('Forum/edit')}"><i class="layui-icon layui-icon-edit"></i></a>
{if condition="checkRuleButton('forum/listdel')"} {if condition="checkRuleButton('forum/listdel')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-url="{:url('Forum/listdel')}"><i class="layui-icon layui-icon-delete"></i></a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i></a>{/if} {else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i></a>{/if}
</script> </script>
</div> </div>
</div> </div>
@ -82,15 +82,12 @@
<script> <script>
var forumList = "{:url('Forum/list')}", var forumList = "{:url('Forum/list')}",
forumListdel = "{:url('Forum/listdel')}",
forumListform = "{:url('Forum/listform')}",
forumReplys = "{:url('Forum/replys')}", forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}", forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}", forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}", forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}", forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}"; forumTagsForm = "{:url('Forum/tagsform')}";
forumEdit = "{:url('Forum/edit')}";
layui.config({ layui.config({
base: '/static/admin/' //静态资源所在路径 base: '/static/admin/' //静态资源所在路径
}).extend({ }).extend({

View File

@ -32,13 +32,6 @@ overflow: visible;
</div> </div>
<div class="layui-card-body"> <div class="layui-card-body">
<script type="text/html" id="inputSel">
<select name="detpl" lay-filter="detpl" id="{{d.id}}" >
{volist name="template" id="vo"}
<option value="{$vo}" {{# if (d.detpl == "{$vo}"){ }} selected {{# } }}>{$vo}</option>
{/volist}
</select>
</script>
<script type="text/html" id="buttonHot"> <script type="text/html" id="buttonHot">
{if condition="checkRuleButton('Forum/tagshot')"}<input type="checkbox" name="is_hot" lay-skin="primary" lay-filter="menu-show" {{# if(d.is_hot ==1){ }} checked value="0"{{# } else { }}value="1"{{# } }} id="{{d.id}}" > {if condition="checkRuleButton('Forum/tagshot')"}<input type="checkbox" name="is_hot" lay-skin="primary" lay-filter="menu-show" {{# if(d.is_hot ==1){ }} checked value="0"{{# } else { }}value="1"{{# } }} id="{{d.id}}" >
{else /}<input type="checkbox" title="禁用" disabled> {/if} {else /}<input type="checkbox" title="禁用" disabled> {/if}

View File

@ -24,10 +24,9 @@
<body class="{if($Request.url == url('index/index'))} layui-layout-body {/if}"> <body class="{if($Request.url == url('index/index'))} layui-layout-body {/if}">
{block name="body"}内容{/block} {block name="body"}内容{/block}
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
var AdminLogin = "{:url('Login/index')}", var AdminLogin = "{:url('Login/index')}", AdminLogout = "{:url('Admin/logout')}", adminClearCache = "{:url('Admin/clearCache')}", sysCy = "{$clevel}";
AdminLogout = "{:url('Admin/logout')}",
adminClearCache = "{:url('Admin/clearCache')}", sysCy = "{$clevel}";
var menuNav = "{:url('menu/getMenuNavbar')}"; var menuNav = "{:url('menu/getMenuNavbar')}";
var menuCOntroller = "{:url('index/home')}";
var $ = layui.jquery; var $ = layui.jquery;
</script> </script>
{block name="js"}js文件{/block} {block name="js"}js文件{/block}

2
app/admin/view/taocai/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -17,7 +17,7 @@
</div> </div>
<div class="layui-input-inline layui-input-company"><button style="float: left;" type="button" class="layui-btn layui-btn-sm" id="upgrade-key">保存</button></div> <div class="layui-input-inline layui-input-company"><button style="float: left;" type="button" class="layui-btn layui-btn-sm" id="upgrade-key">保存</button></div>
<div class="layui-form-mid layui-word-aux" >无Key不能升级</div> <div class="layui-form-mid layui-word-aux" >无Key不能升级</div>
<div class="layui-form-mid layui-word-aux " ><a href="https://www.aieok.com/bbs/Api/key.html" target="_blank">去官网申请Key</a></div> <div class="layui-form-mid layui-word-aux " ><a href="https://www.aieok.com/article/user/key.html" target="_blank">去官网申请Key</a></div>
</div> </div>
{else /} {else /}
<div class="layui-form-item"> <div class="layui-form-item">

View File

@ -33,7 +33,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">申请key?</label> <label class="layui-form-label">申请key?</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<div class="layui-form-mid layui-word-aux " ><a href="https://www.aieok.com/bbs/Api/key.html" target="_blank">更换网址,请去官网重新申请key</a></div> <div class="layui-form-mid layui-word-aux " ><a href="https://www.aieok.com/article/user/key.html" target="_blank">更换网址,请去官网重新申请key</a></div>
<div class="layui-form-mid layui-word-aux " ><span>未通知api接口变更,请不要私自更改api否则无法升级</span></div> <div class="layui-form-mid layui-word-aux " ><span>未通知api接口变更,请不要私自更改api否则无法升级</span></div>
</div> </div>
</div> </div>

View File

@ -43,8 +43,7 @@ class AdminController extends \app\BaseController
$admin_id = $this->aid; $admin_id = $this->aid;
$auth = new Auth(); $auth = new Auth();
$auth_rule_list = Db::name('auth_rule')->where(['delete_time'=> 0,'status'=> 1,'ismenu'=>1])->select(); $auth_rule_list = Db::name('auth_rule')->where(['status'=> 1, 'ismenu'=>1, 'delete_time'=> 0])->select();
foreach ($auth_rule_list as $value) { foreach ($auth_rule_list as $value) {
if ($auth->check($value['name'], $admin_id) || $admin_id == 1) { if ($auth->check($value['name'], $admin_id) || $admin_id == 1) {
// 查询是否设置映射 // 查询是否设置映射

View File

@ -42,6 +42,10 @@ class BaseController extends BaseCtrl
'subcatelist' => $this->showSubnav(), 'subcatelist' => $this->showSubnav(),
//当前登录用户 //当前登录用户
'user' => $this->showUser($this->uid), 'user' => $this->showUser($this->uid),
//多站点
'stationList' => $this->getStationList(),
// 当前站点
'city' => input('city') ?: Db::name('station')->where('master',1)->value('city_ename')
]); ]);
@ -162,4 +166,17 @@ class BaseController extends BaseCtrl
return $sysInfo; return $sysInfo;
} }
// 多站点
protected function getStationList()
{
return $stationList = Db::name('station')->select()->toArray();
}
//
protected function getCity($cityname)
{
return Db::name('station')->field('city_name,city_ename')->where('city_ename', $cityname)->find();
}
} }

View File

@ -35,11 +35,12 @@ class Arts
/** /**
* 获取文章链接地址 * 获取文章链接地址
* @param int $aid * @param int $aid 文章id
* @param string $ename * @param string $ename 所属分类ename
* @param string $appname 所属应用名
* @return string * @return string
*/ */
public function getRouteUrl(int $aid,string $ename = '') : string public function getRouteUrl(int $aid, string $ename = '', string $appname = '') : string
{ {
$indexUrl = $this->getIndexUrl(); $indexUrl = $this->getIndexUrl();
if(config('taoler.url_rewrite.article_as') == '<ename>/'){ if(config('taoler.url_rewrite.article_as') == '<ename>/'){
@ -49,33 +50,53 @@ class Arts
} else { } else {
$artUrl = (string) url('article_detail', ['id' => $aid]); $artUrl = (string) url('article_detail', ['id' => $aid]);
} }
//dump($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');
}
// 判断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应用名
// 判断是否开启绑定 // 判断是否开启绑定
//$domain_bind = array_key_exists('domain_bind',config('app')); //$domain_bind = array_key_exists('domain_bind',config('app'));
// 判断index应用是否绑定域名 // 判断index应用是否绑定域名
$bind_index = array_search('index',config('app.domain_bind')); //$bind_index = array_search('index',config('app.domain_bind'));
// 判断admin应用是否绑定域名 // 判断admin应用是否绑定域名
$bind_admin = array_search('admin',config('app.domain_bind')); $bind_admin = array_search('admin',config('app.domain_bind'));
// 判断index应用是否域名映射 // 判断index应用是否域名映射
$map_index = array_search('index',config('app.app_map')); //$map_index = array_search('index',config('app.app_map'));
// 判断admin应用是否域名映射 // 判断admin应用是否域名映射
$map_admin = array_search('admin',config('app.app_map')); $map_admin = array_search('admin',config('app.app_map'));
$index = $map_index ? $map_index : 'index'; // index应用名 // $index = $map_index ?: 'index'; // index应用名
$admin = $map_admin ? $map_admin : 'admin'; // admin应用名 $admin = $map_admin ?: 'admin'; // admin应用名
if($bind_index) { if($bind_index) {
// index绑定域名 // index或home前端(非admin应用)域名进行了绑定
$url = $indexUrl . str_replace($admin.'/','',$artUrl); // url = $indexUrl . str_replace($admin . '/','',$artUrl);
} else { // index未绑定域名 $url = $indexUrl . $artUrl;
// admin绑定域名 } else {
if($bind_admin) { if($bind_admin) {
// admin绑定域名
$url = $indexUrl .'/' . $index . $artUrl; $url = $indexUrl .'/' . $index . $artUrl;
} elseif ($app == 'admin' && isset($map_admin)) {
// admin进行了映射
$url = $indexUrl . str_replace($admin, $appname, $artUrl);
} else { } else {
$url = $indexUrl . str_replace($admin,$index,$artUrl);
// admin未绑定域名
$url = $indexUrl . str_replace($app, $appname, $artUrl);
} }
} }
@ -300,7 +321,7 @@ class Arts
//下载远程图片 //下载远程图片
private function downloadImage($url) private function downloadImage($url, $userId = 1)
{ {
$ch = curl_init(); $ch = curl_init();
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, 'GET' ); curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, 'GET' );
@ -310,18 +331,19 @@ class Arts
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
$file = curl_exec($ch); $file = curl_exec($ch);
curl_close($ch); curl_close($ch);
return $this->saveAsImage($url, $file); return $this->saveAsImage($url, $file, $userId);
} }
//把图片保存到本地 //把图片保存到本地
private function saveAsImage($url, $file) private function saveAsImage($url, $file, $userId = 1)
{ {
$filename = pathinfo($url, PATHINFO_BASENAME); $filename = pathinfo($url, PATHINFO_BASENAME);
//$dirname = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_DIRNAME); //$dirname = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_DIRNAME);
$dirname = date('Ymd',time()); $dirname = date('Ymd',time());
$uid = session('user_id') ?: $userId;
//路径 //路径
$path = 'storage/' . $this->uid . '/article_pic/' . $dirname . '/'; $path = 'storage/' . $uid . '/article_pic/' . $dirname . '/';
//绝对文件夹 //绝对文件夹
$fileDir = public_path() . $path; $fileDir = public_path() . $path;
//文件绝对路径 //文件绝对路径
@ -349,7 +371,7 @@ class Arts
} }
//下载网络图片到本地并替换 //下载网络图片到本地并替换
public function downUrlPicsReaplace($content) public function downUrlPicsReaplace($content, $userId = 1)
{ {
// 批量下载网络图片并替换 // 批量下载网络图片并替换
$images = $this->getArticleAllpic($content); $images = $this->getArticleAllpic($content);
@ -359,7 +381,7 @@ class Arts
if((stripos($image,'http') !== false) && (stripos($image, Request::domain()) === false) && (stripos($image, '?') === false)) { if((stripos($image,'http') !== false) && (stripos($image, Request::domain()) === false) && (stripos($image, '?') === false)) {
// 如果图片中没有带参数或者加密可下载 // 如果图片中没有带参数或者加密可下载
//下载远程图片(可下载) //下载远程图片(可下载)
$newImageUrl = $this->downloadImage($image); $newImageUrl = $this->downloadImage($image, $userId);
//替换图片链接 //替换图片链接
$content = str_replace($image,Request::domain().$newImageUrl,$content); $content = str_replace($image,Request::domain().$newImageUrl,$content);
} }

View File

@ -33,6 +33,12 @@ class Cate extends Model
return $this->field('ename,catename,detpl,desc')->where('ename',$ename)->cache('cate_'.$ename,600)->find(); return $this->field('ename,catename,detpl,desc')->where('ename',$ename)->cache('cate_'.$ename,600)->find();
} }
// 查询子分类
public function getSubCate(string $ename)
{
return $this->field('ename,catename')->where('pid', $this::where('ename', $ename)->value('id'))->select();
}
// 删除类别 // 删除类别
public function del($id) public function del($id)
{ {

View File

@ -18,7 +18,7 @@ class UpgradeAuth extends Model
public function getAuthLevelAttr($value) public function getAuthLevelAttr($value)
{ {
$level = [0=>'免费', 1=>'初级', 2=>'中级', 3=>'高级']; $level = [0=>'免费', 1=>'初级', 2=>'中级', 3=>'高级'];
return $level[$value]; return $level[$value];
} }

View File

@ -207,11 +207,10 @@ class Article extends BaseController
if (Comment::create($data)) { if (Comment::create($data)) {
//站内信 //站内信
$article = Db::name('article')->field('id,title,user_id,cate_id')->where('id',$data['article_id'])->find(); $article = Db::name('article')->field('id,title,user_id,cate_id')->where('id',$data['article_id'])->find();
// 获取分类ename // 获取分类ename,appname
$cate_ename = Db::name('cate')->where('id',$article['cate_id'])->value('ename'); $cateName = Db::name('cate')->field('ename,appname')->find($article['cate_id']);
$title = $article['title'];
//$link = (string) url('article_detail',['id'=>$data['article_id']]); //$link = (string) url('article_detail',['id'=>$data['article_id']]);
$link = $this->getRouteUrl($data['article_id'], $cate_ename); $link = $this->getRouteUrl($data['article_id'], $cateName['ename'], $cateName['appname']);
//评论中回复@user comment //评论中回复@user comment
$preg = "/@([^@\s]*)\s/"; $preg = "/@([^@\s]*)\s/";
@ -268,9 +267,9 @@ class Article extends BaseController
// 把中文,转换为英文,并去空格->转为数组->去掉空数组->再转化为带,号的字符串 // 把中文,转换为英文,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords']))))); $data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace('',',',$data['keywords'])))));
// 获取分类ename // 获取分类ename,appname
$cate_ename = Db::name('cate')->where('id',$data['cate_id'])->value('ename'); $cateName = Db::name('cate')->field('ename,appname')->find($data['cate_id']);
$article = new ArticleModel(); $article = new ArticleModel();
$result = $article->add($data); $result = $article->add($data);
@ -292,7 +291,7 @@ class Article extends BaseController
// 发提醒邮件 // 发提醒邮件
if(Config::get('taoler.config.email_notice')) hook('mailtohook',[$this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。']); if(Config::get('taoler.config.email_notice')) hook('mailtohook',[$this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。']);
$link = $this->getRouteUrl((int)$aid, $cate_ename); $link = $this->getRouteUrl((int)$aid, $cateName['ename'], $cateName['appname']);
// 推送给百度收录接口 // 推送给百度收录接口
$this->baiduPushUrl($link); $this->baiduPushUrl($link);
@ -393,7 +392,7 @@ class Article extends BaseController
//删除原有缓存显示编辑后内容 //删除原有缓存显示编辑后内容
Cache::delete('article_'.$id); Cache::delete('article_'.$id);
$link = $this->getRouteUrl((int) $id, $article->cate->ename); $link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
// 推送给百度收录接口 // 推送给百度收录接口
$this->baiduPushUrl($link); $this->baiduPushUrl($link);
$editRes = Msgres::success('edit_success',$link); $editRes = Msgres::success('edit_success',$link);

View File

@ -36,7 +36,8 @@ class Login extends BaseController
return redirect((string) url('user/index')); return redirect((string) url('user/index'));
} }
//获取登录前访问页面refer //获取登录前访问页面refer
$refer = Request::server('HTTP_REFERER'); $refer = str_replace(Request::domain(), '', Request::server('HTTP_REFERER'));
Cookie::set('refer', $refer);
if(Request::isAjax()) { if(Request::isAjax()) {
// 检验登录是否开放 // 检验登录是否开放
if(config('taoler.config.is_login') == 0 ) return json(['code'=>-1,'msg'=>'抱歉,网站维护中,暂时不能登录哦!']); if(config('taoler.config.is_login') == 0 ) return json(['code'=>-1,'msg'=>'抱歉,网站维护中,暂时不能登录哦!']);
@ -83,8 +84,7 @@ class Login extends BaseController
$user = new User(); $user = new User();
$res = $user->login($data); $res = $user->login($data);
if ($res == 1) { //登陆成功 if ($res == 1) { //登陆成功
$user = $user->getLoggedUser(); return Msgres::success('login_success', Cookie::get('refer'));
return Msgres::success('login_success',$refer);
} else { } else {
return Msgres::error($res); return Msgres::error($res);
} }

View File

@ -29,21 +29,28 @@ class User extends BaseController
} }
// 发帖list // 我的发帖list
public function artList() public function artList()
{ {
$article = Article::withCount('comments')->where(['user_id'=>$this->uid])->order('update_time','desc')->paginate(10); $param = Request::only(['page','limit']);
$count = $article->total(); $myArticle = Article::field('id,cate_id,title,status,pv,create_time')
->withCount(['comments'])
->where(['user_id'=>$this->uid])
->order('update_time','desc')
->paginate([
'list_rows' => $param['limit'],
'page' => $param['page']
]);
$count = $myArticle->total();
$res = []; $res = [];
if($count){ if($count){
$res['code'] = 0; $res['code'] = 0;
$res['count'] = $count; $res['count'] = $count;
foreach($article as $v){ foreach($myArticle as $v){
$res['data'][] = ['id'=>$v['id'], $res['data'][] = ['id'=>$v['id'],
'title' => htmlspecialchars($v['title']), 'title' => htmlspecialchars($v['title']),
'url' => (string) url('article/detail',['id'=>$v['id']]), 'url' => $this->getRouteUrl($v['id'], $v->cate->ename, $v->cate->appname),
'url' => $this->getRouteUrl($v['id'], $v->cate->ename), 'status' => $v['status'] ? '正常':'待审',
'status' => $v['status'] ? '正常':'待审核',
'ctime' => $v['create_time'], 'ctime' => $v['create_time'],
'datas' => $v['pv'].'阅/'.$v['comments_count'].'答' 'datas' => $v['pv'].'阅/'.$v['comments_count'].'答'
]; ];

1
app/index/route/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
myroute.php

View File

@ -474,6 +474,26 @@ CREATE TABLE `tao_slider` (
INSERT INTO `tao_slider` VALUES ('1', 'CODING', '1', '/storage/slider/F1.jpg', '#', '', '1574870400', '1575043200', '1', '0', '0', '0'); INSERT INTO `tao_slider` VALUES ('1', 'CODING', '1', '/storage/slider/F1.jpg', '#', '', '1574870400', '1575043200', '1', '0', '0', '0');
INSERT INTO `tao_slider` VALUES ('2', '通用右栏底部广告', '2', '/storage/slider/20200101/851c0b88a72590293bcb45454bdce056.jpg', 'https://www.aieok.com', '', '1571155200', '1609344000', '1', '0', '0', '0'); INSERT INTO `tao_slider` VALUES ('2', '通用右栏底部广告', '2', '/storage/slider/20200101/851c0b88a72590293bcb45454bdce056.jpg', 'https://www.aieok.com', '', '1571155200', '1609344000', '1', '0', '0', '0');
-- ----------------------------
-- Table structure for tao_station
-- ----------------------------
DROP TABLE IF EXISTS `tao_station`;
CREATE TABLE `tao_station` (
`id` int NOT NULL AUTO_INCREMENT,
`city_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`city_ename` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`master` tinyint(1) NOT NULL DEFAULT 0,
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `ename`(`city_ename` ASC) USING BTREE COMMENT 'ename索引'
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_station
-- ----------------------------
INSERT INTO `tao_station` VALUES (1, '北京', 'beijing', 1, '2011-11-11 00:00:00');
INSERT INTO `tao_station` VALUES (2, '上海', 'shanghai', 0, '2222-11-21 08:08:08');
-- ---------------------------- -- ----------------------------
-- Table structure for tao_system -- Table structure for tao_system
-- ---------------------------- -- ----------------------------
@ -492,7 +512,7 @@ CREATE TABLE `tao_system` (
`copyright` varchar(100) NOT NULL DEFAULT '' COMMENT '版权', `copyright` varchar(100) NOT NULL DEFAULT '' COMMENT '版权',
`keywords` tinytext NOT NULL COMMENT '网站关键字', `keywords` tinytext NOT NULL COMMENT '网站关键字',
`descript` text NOT NULL COMMENT '网站描述', `descript` text NOT NULL COMMENT '网站描述',
`state` tinytext CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '网站声明', `state` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '网站声明',
`is_open` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开启站点1开启0关闭', `is_open` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开启站点1开启0关闭',
`is_comment` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开启评论1开启0关闭', `is_comment` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开启评论1开启0关闭',
`is_reg` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开放注册1开启0禁止', `is_reg` enum('0','1') NOT NULL DEFAULT '1' COMMENT '是否开放注册1开启0禁止',

View File

@ -17,6 +17,7 @@ use think\facade\Session;
use think\facade\Cookie; use think\facade\Cookie;
use think\facade\Db; use think\facade\Db;
use think\facade\Config; use think\facade\Config;
use think\facade\Request;
class Auth class Auth
{ {
@ -29,8 +30,11 @@ class Auth
*/ */
public function handle($request, \Closure $next) public function handle($request, \Closure $next)
{ {
// var_dump(Request::url(),Request::pathinfo(),$request->baseUrl(),$request->controller());
//访问路径 //访问路径
$path = app('http')->getName().'/'.stristr($request->pathinfo(),".html",true); // $path = app('http')->getName().'/'.stristr($request->pathinfo(),".html",true);
$path = stristr($request->pathinfo(),".html",true);
//登陆前获取加密的Cookie //登陆前获取加密的Cookie
$cooAuth = Cookie::get('adminAuth'); $cooAuth = Cookie::get('adminAuth');
@ -43,7 +47,7 @@ class Auth
//验证cookie //验证cookie
$salt = Config::get('taoler.salt'); $salt = Config::get('taoler.salt');
$auth = md5($user['username'].$salt).":".$userId; $auth = md5($user['username'].$salt).":".$userId;
if($auth==$cooAuth){ if($auth == $cooAuth){
Session::set('admin_name',$user['username']); Session::set('admin_name',$user['username']);
Session::set('admin_id',$userId); Session::set('admin_id',$userId);
} }
@ -51,19 +55,49 @@ class Auth
} }
//没有登录及当前非登录页重定向登录页 // //没有登录及当前非登录页重定向登录页
if(!Session::has('admin_id') && $path !== 'admin/login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) ) // if(!Session::has('admin_id') && $path !== 'admin/login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) )
{ // {
return redirect((string) url('login/index')); // return redirect((string) url('login/index'));
} // }
// //登陆后无法访问登录页
//登陆后无法访问登录页 // if(Session::has('admin_id') && $path == 'admin/login/index'){
if(Session::has('admin_id') && $path == 'admin/login/index'){ // return redirect((string) url('index/index'));
return redirect((string) url('index/index')); // }
} // // 排除公共权限
// $not_check = ['admin/','index/index', 'admin/menu/getMenuNavbar','admin/login/index','admin/index/index','admin/index/home','admin/Admin/info','admin/Admin/repass','admin/Admin/logout','admin/Index/news','admin/Index/cunsult','admin/Index/replys','admin/Index/reply','admin/captcha','addons/socail/','admin/addons/social/oauth/login','admin/addons/bacimg/index/getImages'];
// 排除公共权限
$not_check = ['admin/','admin/login/index','admin/index/index','admin/index/home','admin/Admin/info','admin/Admin/repass','admin/Admin/logout','admin/Index/news','admin/Index/cunsult','admin/Index/replys','admin/Index/reply','admin/captcha','addons/socail/','admin/addons/social/oauth/login','admin/addons/bacimg/index/getImages'];
//没有登录及当前非登录页重定向登录页
if(!Session::has('admin_id') && $path !== 'login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) )
{
return redirect((string) url('login/index'));
}
//登陆后无法访问登录页
if(Session::has('admin_id') && $path == 'login/index' || $path == ''){
return redirect((string) url('index/index'));
}
// 排除公共权限
$not_check = [
'captcha',
'admin/index',
'index/index',
'menu/getMenuNavbar',
'login/index',
'index/home',
'Admin/info',
'Admin/repass',
'Admin/logout',
'Index/news',
'Index/cunsult',
'Index/replys',
'Index/reply',
'admin/captcha',
'addons/socail/',
'addons/social/oauth/login',
'addons/bacimg/index/getImages'
];
if (!in_array($path, $not_check)) { if (!in_array($path, $not_check)) {
$auth = new UserAuth(); $auth = new UserAuth();

22
composer.lock generated
View File

@ -2277,16 +2277,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v4.4.46", "version": "v4.4.47",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "90425fd98d1ecad98e4b2dca9f54f62069193b15" "reference": "1069c7a3fca74578022fab6f81643248d02f8e63"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/90425fd98d1ecad98e4b2dca9f54f62069193b15", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1069c7a3fca74578022fab6f81643248d02f8e63",
"reference": "90425fd98d1ecad98e4b2dca9f54f62069193b15", "reference": "1069c7a3fca74578022fab6f81643248d02f8e63",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -2352,7 +2352,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v4.4.46" "source": "https://github.com/symfony/var-dumper/tree/v4.4.47"
}, },
"funding": [ "funding": [
{ {
@ -2368,7 +2368,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-09-03T23:07:25+00:00" "time": "2022-10-03T15:15:11+00:00"
}, },
{ {
"name": "symfony/var-exporter", "name": "symfony/var-exporter",
@ -3326,16 +3326,16 @@
}, },
{ {
"name": "workerman/workerman", "name": "workerman/workerman",
"version": "v4.1.3", "version": "v4.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/walkor/workerman.git", "url": "https://github.com/walkor/workerman.git",
"reference": "01028d8008c5691ec38c5f675fc13d76496a6db9" "reference": "83e007acf936e2233ac92d7368b87716f2bae338"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/walkor/workerman/zipball/01028d8008c5691ec38c5f675fc13d76496a6db9", "url": "https://api.github.com/repos/walkor/workerman/zipball/83e007acf936e2233ac92d7368b87716f2bae338",
"reference": "01028d8008c5691ec38c5f675fc13d76496a6db9", "reference": "83e007acf936e2233ac92d7368b87716f2bae338",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -3391,7 +3391,7 @@
"type": "patreon" "type": "patreon"
} }
], ],
"time": "2022-09-23T14:05:12+00:00" "time": "2022-10-09T11:33:14+00:00"
}, },
{ {
"name": "yansongda/pay", "name": "yansongda/pay",

View File

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

View File

@ -106,7 +106,7 @@ layui.define(["table", "form", "upload","notify","hxNav"], function (exports) {
layer.close(index); layer.close(index);
layer.open({ layer.open({
type: 2, type: 2,
area: ['80%', '90%'], area: ['50%', '65%'],
fixed: false, //不固定 fixed: false, //不固定
maxmin: true, maxmin: true,
content: 'pay.html'+ "?id=" + data.id+ "&name=" + data.name + "&version=" + data.version + "&uid=" + userinfo.uid + "&price=" + data.price, content: 'pay.html'+ "?id=" + data.id+ "&name=" + data.name + "&version=" + data.version + "&uid=" + userinfo.uid + "&price=" + data.price,

View File

@ -30,16 +30,17 @@ var forms = table.render({
//监听工具条 //监听工具条
table.on('tool(LAY-app-forum-list)', function(obj){ table.on('tool(LAY-app-forum-list)', function(obj){
var data = obj.data; var data = obj.data;
var url = $(this).data('url');
if(obj.event === 'del'){ if(obj.event === 'del'){
layer.confirm('确定删除此条帖子?', function(index){ layer.confirm('确定删除此条帖子?', function(index){
//obj.del(); //obj.del();
$.ajax({ $.ajax({
type:'post', type:'post',
url:forumListdel, url:url,
data:{id:data.id}, data:{id:data.id},
dataType:'json', dataType:'json',
success:function(data){ success:function(data){
if(data.code == 0){ if(data.code === 0){
layer.msg(data.msg,{ layer.msg(data.msg,{
icon:6, icon:6,
time:2000 time:2000
@ -64,7 +65,7 @@ var forms = table.render({
layer.open({ layer.open({
type: 2 type: 2
,title: '编辑帖子' ,title: '编辑帖子'
,content: forumEdit + '?id='+ data.id ,content: url + '?id='+ data.id
,area: ['100%', '100%'] ,area: ['100%', '100%']
,btn: ['确定', '取消'] ,btn: ['确定', '取消']
,resize: false ,resize: false
@ -85,11 +86,11 @@ var forms = table.render({
$.ajax({ $.ajax({
type:"post", type:"post",
url: forumEdit, url: url,
data: field, data: field,
daType:"json", daType:"json",
success:function (data){ success:function (data){
if (data.code == 0) { if (data.code === 0) {
layer.msg(data.msg,{icon:6,time:2000}); layer.msg(data.msg,{icon:6,time:2000});
} else { } else {
layer.open({title:'编辑失败',content:data.msg,icon:5,anim:6}); layer.open({title:'编辑失败',content:data.msg,icon:5,anim:6});
@ -140,7 +141,7 @@ var forms = table.render({
data:{id:data.id}, data:{id:data.id},
dataType:'json', dataType:'json',
success:function(data){ success:function(data){
if(data.code == 0){ if(data.code === 0){
layer.msg(data.msg,{ layer.msg(data.msg,{
icon:6, icon:6,
time:2000 time:2000

View File

@ -26,7 +26,7 @@
'<i class="layui-icon layui-icon-down layui-nav-more"></i></a>'+ '<i class="layui-icon layui-icon-down layui-nav-more"></i></a>'+
'<dl class="layui-nav-child">'+ '<dl class="layui-nav-child">'+
'<dd data-name="console" class="layui-this">'+ '<dd data-name="console" class="layui-this">'+
'<a lay-href="/admin/index/home.html">控制台</a>'+ '<a lay-href="' + menuCOntroller + '">控制台</a>'+
'</dd>'+ '</dd>'+
'</dl>'+ '</dl>'+
'</li>'; '</li>';

View File

@ -22,17 +22,17 @@ layui.define(['table', 'form', 'notify'], function(exports){
{type: 'checkbox'} {type: 'checkbox'}
,{field: 'id', width: 60, title: 'ID', sort: true} ,{field: 'id', width: 60, title: 'ID', sort: true}
,{field: 'username', title: '用户名', minWidth: 80} ,{field: 'username', title: '用户名', minWidth: 80}
,{field: 'nick', title: '昵称',Width: 80} ,{field: 'nick', title: '昵称',width: 80}
,{field: 'avatar', title: '头像', width: 60, templet: '#imgTpl'} ,{field: 'avatar', title: '头像', width: 60, templet: '#imgTpl'}
//,{field: 'phone', title: '手机',width: 80} //,{field: 'phone', title: '手机',width: 80}
,{field: 'email', title: '邮箱', minWidth: 120} ,{field: 'email', title: '邮箱', minWidth: 120}
,{field: 'sex', width: 60, title: '性别',templet: '#sex'} ,{field: 'sex', width: 60, title: '性别',templet: '#sex'}
,{field: 'ip', title: '登录IP', width: 100} ,{field: 'ip', title: '登录IP', width: 120}
,{field: 'city', title: '城市', width: 80} ,{field: 'city', title: '城市', width: 80}
,{field: 'logintime', title: '最后登录',width: 150, sort: true} ,{field: 'logintime', title: '最后登录',width: 150, sort: true}
,{field: 'jointime', title: '注册时间',width: 110, sort: true} ,{field: 'jointime', title: '注册时间',width: 110, sort: true}
,{field: 'check', title: '状态', templet: '#buttonCheck', width: 95, align: 'center'} ,{field: 'check', title: '状态', templet: '#buttonCheck', width: 95, align: 'center'}
,{field: 'auth', title: '超理员', templet: '#buttonAuth', width: 80, align: 'center'} ,{field: 'auth', title: '超管', templet: '#buttonAuth', width: 60, align: 'center'}
,{title: '操作', width: 100, align:'center', toolbar: '#table-useradmin-webuser'} ,{title: '操作', width: 100, align:'center', toolbar: '#table-useradmin-webuser'}
]] ]]
,page: true ,page: true

View File

@ -1 +1,18 @@
ALTER TABLE `tao_cate` ADD `appname` varchar(20) NOT NULL DEFAULT 'index' COMMENT '所属应用' AFTER `status`; ALTER TABLE `tao_system` modify `state` text DEFAULT NULL COMMENT '网站声明';
DROP TABLE IF EXISTS `tao_station`;
CREATE TABLE `tao_station` (
`id` int NOT NULL AUTO_INCREMENT,
`city_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`city_ename` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`master` tinyint(1) NOT NULL DEFAULT 0,
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `ename`(`city_ename` ASC) USING BTREE COMMENT 'ename索引'
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_station
-- ----------------------------
INSERT INTO `tao_station` VALUES (1, '北京', 'beijing', 1, '2011-11-11 00:00:00');
INSERT INTO `tao_station` VALUES (2, '上海', 'shanghai', 0, '2222-11-21 08:08:08');

View File

@ -2238,17 +2238,17 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v4.4.46", "version": "v4.4.47",
"version_normalized": "4.4.46.0", "version_normalized": "4.4.47.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "90425fd98d1ecad98e4b2dca9f54f62069193b15" "reference": "1069c7a3fca74578022fab6f81643248d02f8e63"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/90425fd98d1ecad98e4b2dca9f54f62069193b15", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1069c7a3fca74578022fab6f81643248d02f8e63",
"reference": "90425fd98d1ecad98e4b2dca9f54f62069193b15", "reference": "1069c7a3fca74578022fab6f81643248d02f8e63",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -2278,7 +2278,7 @@
"ext-intl": "To show region name in time zone dump", "ext-intl": "To show region name in time zone dump",
"symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
}, },
"time": "2022-09-03T23:07:25+00:00", "time": "2022-10-03T15:15:11+00:00",
"bin": [ "bin": [
"Resources/bin/var-dump-server" "Resources/bin/var-dump-server"
], ],
@ -2316,7 +2316,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v4.4.46" "source": "https://github.com/symfony/var-dumper/tree/v4.4.47"
}, },
"funding": [ "funding": [
{ {
@ -3339,17 +3339,17 @@
}, },
{ {
"name": "workerman/workerman", "name": "workerman/workerman",
"version": "v4.1.3", "version": "v4.1.4",
"version_normalized": "4.1.3.0", "version_normalized": "4.1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/walkor/workerman.git", "url": "https://github.com/walkor/workerman.git",
"reference": "01028d8008c5691ec38c5f675fc13d76496a6db9" "reference": "83e007acf936e2233ac92d7368b87716f2bae338"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/walkor/workerman/zipball/01028d8008c5691ec38c5f675fc13d76496a6db9", "url": "https://api.github.com/repos/walkor/workerman/zipball/83e007acf936e2233ac92d7368b87716f2bae338",
"reference": "01028d8008c5691ec38c5f675fc13d76496a6db9", "reference": "83e007acf936e2233ac92d7368b87716f2bae338",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -3364,7 +3364,7 @@
"suggest": { "suggest": {
"ext-event": "For better performance. " "ext-event": "For better performance. "
}, },
"time": "2022-09-23T14:05:12+00:00", "time": "2022-10-09T11:33:14+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -3,7 +3,7 @@
'name' => 'taoser/taoler', 'name' => 'taoser/taoler',
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '22c5b7c31c4425068784b5e30b6cae18549c4190', 'reference' => '70c9f4a1c46ca50786773a38e86e10cf67fc15aa',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -338,9 +338,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/var-dumper' => array( 'symfony/var-dumper' => array(
'pretty_version' => 'v4.4.46', 'pretty_version' => 'v4.4.47',
'version' => '4.4.46.0', 'version' => '4.4.47.0',
'reference' => '90425fd98d1ecad98e4b2dca9f54f62069193b15', 'reference' => '1069c7a3fca74578022fab6f81643248d02f8e63',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-dumper', 'install_path' => __DIR__ . '/../symfony/var-dumper',
'aliases' => array(), 'aliases' => array(),
@ -358,7 +358,7 @@
'taoser/taoler' => array( 'taoser/taoler' => array(
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '22c5b7c31c4425068784b5e30b6cae18549c4190', 'reference' => '70c9f4a1c46ca50786773a38e86e10cf67fc15aa',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -518,9 +518,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'workerman/workerman' => array( 'workerman/workerman' => array(
'pretty_version' => 'v4.1.3', 'pretty_version' => 'v4.1.4',
'version' => '4.1.3.0', 'version' => '4.1.4.0',
'reference' => '01028d8008c5691ec38c5f675fc13d76496a6db9', 'reference' => '83e007acf936e2233ac92d7368b87716f2bae338',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../workerman/workerman', 'install_path' => __DIR__ . '/../workerman/workerman',
'aliases' => array(), 'aliases' => array(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2022-11-16 12:08:28 // This file is automatically generated at:2022-11-23 14:02:06
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'taoser\\addons\\Service', 0 => 'taoser\\addons\\Service',

View File

@ -10,6 +10,10 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
if ('cli' !== PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}
/** /**
* Starts a dump server to collect and output dumps on a single place with multiple formats support. * Starts a dump server to collect and output dumps on a single place with multiple formats support.
* *

View File

@ -162,6 +162,7 @@ class Auth
} }
// 获取用户需要验证的所有有效规则列表 // 获取用户需要验证的所有有效规则列表
$authList = $this->getAuthList($uid, $type); $authList = $this->getAuthList($uid, $type);
// halt($authList);
if (is_string($name)) { if (is_string($name)) {
$name = strtolower($name); $name = strtolower($name);
if (strpos($name, ',') !== false) { if (strpos($name, ',') !== false) {

View File

@ -16,6 +16,7 @@ namespace Workerman\Connection;
/** /**
* ConnectionInterface. * ConnectionInterface.
*/ */
#[\AllowDynamicProperties]
abstract class ConnectionInterface abstract class ConnectionInterface
{ {
/** /**

View File

@ -26,6 +26,7 @@ use \Exception;
* Worker class * Worker class
* A container for listening ports * A container for listening ports
*/ */
#[\AllowDynamicProperties]
class Worker class Worker
{ {
/** /**
@ -33,7 +34,7 @@ class Worker
* *
* @var string * @var string
*/ */
const VERSION = '4.1.3'; const VERSION = '4.1.4';
/** /**
* Status starting. * Status starting.
@ -637,9 +638,18 @@ class Worker
if (\DIRECTORY_SEPARATOR !== '/') { if (\DIRECTORY_SEPARATOR !== '/') {
return; return;
} }
$fd = $fd ?: \fopen(static::$pidFile . '.lock', 'a+'); $lock_file = static::$pidFile . '.lock';
$fd = $fd ?: \fopen($lock_file, 'a+');
if ($fd) { if ($fd) {
flock($fd, $flag); flock($fd, $flag);
if ($flag === \LOCK_UN) {
fclose($fd);
$fd = null;
clearstatcache();
if (\is_file($lock_file)) {
unlink($lock_file);
}
}
} }
} }

View File

@ -313,7 +313,6 @@
// 发布文章 // 发布文章
form.on("submit(article-add)", function (data) { form.on("submit(article-add)", function (data) {
var field = data.field; var field = data.field;
console.log(field)
var index = layer.load(1); var index = layer.load(1);
$.ajax({ $.ajax({
type: "post", type: "post",

View File

@ -51,7 +51,7 @@
{/notempty} {/notempty}
</div> </div>
{/if} {/if}
<div style="margin-top: 25px">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
{notempty name="tags"} {notempty name="tags"}
<div style="margin-top: 15px">标签 <div style="margin-top: 15px">标签
{volist name="tags" id="vo" } {volist name="tags" id="vo" }
@ -60,8 +60,9 @@
</div> </div>
{/notempty} {/notempty}
<div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125)"> <div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125)">
<p>{$sysInfo.state}</p> <p style="line-height:200%;">{$sysInfo.state|raw}</p>
</div> </div>
<div style="margin-top: 20px">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
</div> </div>
{//评论内容} {//评论内容}

View File

@ -59,7 +59,7 @@
{/notempty} {/notempty}
</div> </div>
{/if} {/if}
<div style="margin-top: 25px;">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
{notempty name="tags"} {notempty name="tags"}
<div style="margin-top: 15px">标签 <div style="margin-top: 15px">标签
{volist name="tags" id="vo" } {volist name="tags" id="vo" }
@ -68,8 +68,9 @@
</div> </div>
{/notempty} {/notempty}
<div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125);"> <div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125);">
<p>{$sysInfo.state}</p> <p style="line-height:200%;">{$sysInfo.state|raw}</p>
</div> </div>
<div style="margin-top: 20px;">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
<div class="detail-zan"> <div class="detail-zan">
<span class="jieda-zan" type="zan" id="article-zan"> <span class="jieda-zan" type="zan" id="article-zan">
点赞 <i class="iconfont icon-zan"></i> <em>{:count($userZanList)}</em> 点赞 <i class="iconfont icon-zan"></i> <em>{:count($userZanList)}</em>

View File

@ -261,7 +261,6 @@ $(function(){
function getBdiduWords(flag,title,content) { function getBdiduWords(flag,title,content) {
$.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) { $.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) {
if (res.code == 0) { if (res.code == 0) {
console.log(res.data)
$("input[name='keywords']").val(res.data.join(',')); $("input[name='keywords']").val(res.data.join(','));
} }
}, },

View File

@ -18,7 +18,7 @@
<div class="layui-col-md12 content detail"> <div class="layui-col-md12 content detail">
<div class="fly-panel detail-box"> <div class="fly-panel detail-box">
{//标题} {//标题}
<h1 style="color:{$article.title_color ?? '#333'}; margin:10px 5px 15px 5px;" align="center">{$article.title}</h1> <h1 align="center" style="color:{$article.title_color ?: '#333'}; margin:10px 5px 15px 5px;">{$article.title}</h1>
{//作者} {//作者}
<div class="detail-about" align="center"> <div class="detail-about" align="center">
@ -39,7 +39,7 @@
{/notempty} {/notempty}
</div> </div>
{/if} {/if}
<div style="margin-top: 25px;">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
{notempty name="tags"} {notempty name="tags"}
<div style="margin-top: 15px">标签 <div style="margin-top: 15px">标签
{volist name="tags" id="vo" } {volist name="tags" id="vo" }
@ -48,8 +48,9 @@
</div> </div>
{/notempty} {/notempty}
<div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125);"> <div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125);">
<p>{$sysInfo.state}</p> <p style="line-height:200%;">{$sysInfo.state|raw}</p>
</div> </div>
<div style="margin-top: 20px;">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
</div> </div>
</div> </div>
{//crud管理模块} {//crud管理模块}

View File

@ -62,7 +62,7 @@
{/notempty} {/notempty}
</div> </div>
{/if} {/if}
<div style="margin-top: 25px;">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
{notempty name="tags"} {notempty name="tags"}
<div style="margin-top: 15px">标签 <div style="margin-top: 15px">标签
{volist name="tags" id="vo" } {volist name="tags" id="vo" }
@ -71,8 +71,9 @@
</div> </div>
{/notempty} {/notempty}
<div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125);"> <div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125);">
<p>{$sysInfo.state}</p> <p style="line-height:200%; ">{$sysInfo.state|raw}</p>
</div> </div>
<div style="margin-top: 20px;">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</a></div>
<div class="detail-zan"> <div class="detail-zan">
<span class="jieda-zan" type="zan" id="article-zan"> <span class="jieda-zan" type="zan" id="article-zan">
点赞 <i class="iconfont icon-zan"></i> <em>{:count($userZanList)}</em> 点赞 <i class="iconfont icon-zan"></i> <em>{:count($userZanList)}</em>

View File

@ -15,7 +15,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="TaoLer社区"> <meta name="keywords" content="TaoLer社区">
<meta name="description" content="TaoLer社区是模块化前端UI框架社区致力于为web开发提供强劲动力"> <meta name="description" content="TaoLer社区是模块化前端UI框架社区致力于为web开发提供强劲动力">
<link rel="stylesheet" href="http://at.alicdn.com/t/font_24081_qs69ykjbea.css" /> <link rel="stylesheet" href="https://at.alicdn.com/t/font_24081_qs69ykjbea.css" />
<link rel="stylesheet" href="{$Request.domain}/static/layui/css/layui.css"> <link rel="stylesheet" href="{$Request.domain}/static/layui/css/layui.css">
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css"> <link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css">
{block name="css"}{/block} {block name="css"}{/block}

View File

@ -33,7 +33,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label for="L_city" class="layui-form-label">城市</label> <label for="L_city" class="layui-form-label">城市</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="L_city" name="city" autocomplete="off" value="{$user.city}" class="layui-input" placeholder="{$user.city}"> <input type="text" id="L_city" name="city" autocomplete="off" value="{$user.city}" disabled class="layui-input" placeholder="{$user.city}">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -133,7 +133,7 @@
data:field, data:field,
dataType:"json", dataType:"json",
success:function(data){ success:function(data){
if(data.code == 0){ if(data.code === 0){
layer.msg(data.msg,{icon:6,tiye:2000},function(){ layer.msg(data.msg,{icon:6,tiye:2000},function(){
location.reload(); location.reload();
}); });
@ -153,7 +153,7 @@
data:field, data:field,
dataType:"json", dataType:"json",
success:function(data){ success:function(data){
if(data.code == 1){ if(data.code === 1){
layer.msg(data.msg,{icon:6,tiye:2000},function(){ layer.msg(data.msg,{icon:6,tiye:2000},function(){
location.reload(); location.reload();
}); });