网站配置
This commit is contained in:
parent
3fe9ef818d
commit
caf4fc942a
@ -60,7 +60,12 @@ class Index extends AdminController
|
||||
{
|
||||
//版本检测
|
||||
$verCheck = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]);
|
||||
$versions = $verCheck->code ? "有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}" : $verCheck->msg;
|
||||
if($verCheck->code !== -1){
|
||||
$versions = $verCheck->code ? "有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}" : $verCheck->msg;
|
||||
View::assign('versions',$versions);
|
||||
}else{
|
||||
View::assign('versions','版本检测暂时不可服务');
|
||||
}
|
||||
|
||||
//评论、帖子状态
|
||||
$comm = Db::name('comment')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
|
||||
@ -92,7 +97,7 @@ class Index extends AdminController
|
||||
}
|
||||
|
||||
|
||||
View::assign(['versions'=>$versions,'comms'=>$comms,'forums'=>$forums,'monthTime'=>$monthTime,'monthUserCount'=>Cache::get('monthUserCount')]);
|
||||
View::assign(['comms'=>$comms,'forums'=>$forums,'monthTime'=>$monthTime,'monthUserCount'=>Cache::get('monthUserCount')]);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ use think\facade\Config;
|
||||
use think\exception\ValidateException;
|
||||
use taoler\com\Files;
|
||||
use taoler\com\Api;
|
||||
use app\common\lib\SetConf;
|
||||
|
||||
class Set extends AdminController
|
||||
{
|
||||
@ -66,6 +67,31 @@ class Set extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
/**配置设置
|
||||
* parem $id
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$conf = Config::get('taoler.config');
|
||||
if(Request::isPost()){
|
||||
$data = Request::param();
|
||||
foreach($conf as $c=>$f){
|
||||
|
||||
if(array_key_exists($c,$data)){
|
||||
$conf[$c] = (int) $data[$c];
|
||||
}else{
|
||||
$conf[$c] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$setConf = new SetConf;
|
||||
$value = [
|
||||
'config'=>$conf
|
||||
];
|
||||
$upRes = $setConf->setConfig('taoler',$value);
|
||||
return $upRes;
|
||||
}
|
||||
}
|
||||
|
||||
//上传logo
|
||||
public function upload()
|
||||
|
@ -11,6 +11,7 @@
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" lay-id="website">网站设置</li>
|
||||
<li lay-id="email">邮箱服务</li>
|
||||
<li lay-id="email">服务配置</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
@ -168,6 +169,30 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form" wid100 lay-filter="config">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">区域简称:</label>
|
||||
<div class="layui-input-inline" style="width: 30px;">
|
||||
<input type="checkbox" name="area_show" lay-skin="primary" value=1 {if config('taoler.config.area_show') == 1} checked {/if}>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">发件人所在地区简称</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">邮件通知:</label>
|
||||
<div class="layui-input-inline" style="width: 30px;">
|
||||
<input type="checkbox" name="email_notice" lay-skin="primary" value=1 {if config('taoler.config.email_notice') == 1} checked {/if}>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">发帖,评论等邮件提醒</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="set_system_config">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -219,6 +244,15 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(set_system_config)', function(data){
|
||||
console.log(data);
|
||||
var field = data.field;
|
||||
$.post("{:url('admin/set/config')}",field);
|
||||
|
||||
layer.msg(JSON.stringify(data.field));
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
@ -23,7 +23,7 @@ class BaseController extends BaseCtrl
|
||||
$this->showSystem();
|
||||
//显示分类导航
|
||||
$this->showNav();
|
||||
$this->showUser();
|
||||
$this->showUser($this->uid);
|
||||
|
||||
}
|
||||
|
||||
@ -63,9 +63,8 @@ class BaseController extends BaseCtrl
|
||||
}
|
||||
|
||||
//显示当前登录用户
|
||||
protected function showUser()
|
||||
protected function showUser($id)
|
||||
{
|
||||
$id = $this->uid;
|
||||
$user = Cache::get('user'.$id);
|
||||
if(!$user){
|
||||
//1.查询用户
|
||||
@ -75,6 +74,7 @@ class BaseController extends BaseCtrl
|
||||
|
||||
//2.将User变量赋给模板 公共模板nav.html
|
||||
View::assign('user',$user);
|
||||
return $user;
|
||||
}
|
||||
|
||||
//显示网站设置
|
||||
|
@ -19,14 +19,35 @@ class SetConf
|
||||
{
|
||||
if (is_array($data)){
|
||||
$fileurl = app()->getConfigPath() . $file.".php";
|
||||
//var_dump( $fileurl);
|
||||
$string = file_get_contents($fileurl); //加载配置文件
|
||||
foreach ($data as $key => $value) {
|
||||
$pats = '/\'' . $key . '\'(.*?)\',/';
|
||||
$reps = "'". $key. "'". " => " . "'".$value ."',";
|
||||
$string = preg_replace($pats, $reps, $string); // 正则查找然后替换
|
||||
if(is_array($value)){//二维数组
|
||||
foreach ($value as $k => $v) {
|
||||
if(is_int($v)){//数字类型
|
||||
$pats = '/\'' . $k . '\'(.*?),/';
|
||||
$reps = "'". $k. "'". " => " . $v .",";
|
||||
//halt($reps);
|
||||
}else{//字符类型
|
||||
$pats = '/\'' . $k . '\'(.*?)\',/';
|
||||
$reps = "'". $k. "'". " => " . "'".$v ."',";
|
||||
}
|
||||
|
||||
$string = preg_replace($pats, $reps, $string); // 正则查找然后替换
|
||||
}
|
||||
|
||||
}else{//一维数组
|
||||
|
||||
if(is_int($value)){//数字类型
|
||||
$pats = '/\'' . $key . '\'(.*?),/';
|
||||
$reps = "'". $key. "'". " => " . "".$value .",";
|
||||
}else{//字符类型
|
||||
$pats = '/\'' . $key . '\'(.*?)\',/';
|
||||
$reps = "'". $key. "'". " => " . "'".$value ."',";
|
||||
}
|
||||
|
||||
$string = preg_replace($pats, $reps, $string); // 正则查找然后替换
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
file_put_contents($fileurl, $string); // 写入配置文件
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ class Article extends Model
|
||||
{
|
||||
$artTop = Cache::get('arttop');
|
||||
if (!$artTop) {
|
||||
$artTop = $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,jie,upzip,has_img,has_video,has_audio')->where(['is_top' => 1, 'status' => 1, 'delete_time' => 0])->with([
|
||||
$artTop = $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,jie,upzip,has_img,has_video,has_audio')->where(['is_top' => 1, 'status' => 1])->with([
|
||||
'cate' => function ($query) {
|
||||
$query->where('delete_time', 0)->field('id,catename,ename');
|
||||
},
|
||||
|
@ -130,7 +130,7 @@ class Article extends BaseController
|
||||
$data = Request::only(['content','article_id','user_id']);
|
||||
$sendId = $data['user_id'];
|
||||
if(empty($data['content'])){
|
||||
return json(['code'=>0, 'msg'=>'评论不能为空!']);
|
||||
return json(['code'=>0, 'msg'=>'评论不能为空!']);
|
||||
}
|
||||
|
||||
//用户留言存入数据库
|
||||
@ -150,7 +150,7 @@ class Article extends BaseController
|
||||
}
|
||||
$data = ['title'=>$title,'content'=>'评论通知','link'=>$link,'user_id'=>$sendId,'type'=>2]; //type=2为评论留言
|
||||
Message::sendMsg($sendId,$receveId,$data);
|
||||
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'评论审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚对 <b>'.$title.'</b> 发表了评论,请尽快处理。');
|
||||
$res = ['code'=>0, 'msg'=>'留言成功'];
|
||||
} else {
|
||||
$res = ['code'=>-1, 'msg'=>'留言失败'];
|
||||
@ -184,6 +184,7 @@ class Article extends BaseController
|
||||
$link = (string)url('article/detail', ['id' => $aid]);
|
||||
//清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。');
|
||||
$res = Msgres::success('add_success', $link);
|
||||
} else {
|
||||
$res = Msgres::error('add_error');
|
||||
|
@ -11,6 +11,7 @@ use think\facade\Session;
|
||||
use think\facade\Cookie;
|
||||
use think\facade\Cache;
|
||||
use think\facade\View;
|
||||
use think\facade\Config;
|
||||
use app\common\model\User;
|
||||
|
||||
class Login extends BaseController
|
||||
@ -105,6 +106,7 @@ class Login extends BaseController
|
||||
|
||||
if ($result == 1) {
|
||||
$res = ['code'=>0,'msg'=>'注册成功','url'=>(string) url('login/index')];
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'注册新用户通知','Hi亲爱的管理员:</br>新用户 <b>'.$data['name'].'</b> 刚刚注册了新的账号,请尽快处理。');
|
||||
}else {
|
||||
$res = ['code'=>-1,'msg'=>$result];
|
||||
}
|
||||
|
@ -7,9 +7,16 @@ return [
|
||||
//应用名,此项不可更改
|
||||
'appname' => 'TaoLer',
|
||||
//版本配置
|
||||
'version' => '1.7.21',
|
||||
'version' => '1.7.22',
|
||||
//加盐
|
||||
'salt' => 'taoler',
|
||||
//数据库备份目录
|
||||
'databasebackdir' => app()->getRootPath() .'data/'
|
||||
'databasebackdir' => app()->getRootPath() .'data/',
|
||||
//配置
|
||||
'config' =>[
|
||||
'area_show' => 1,
|
||||
'email_notice' => 1,
|
||||
]
|
||||
|
||||
|
||||
];
|
@ -16,7 +16,7 @@ class Api
|
||||
curl_setopt($ch,CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 设置超时限制 防止死循环
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 设置超时限制 防止死循环
|
||||
|
||||
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
|
||||
$res = curl_exec($ch);
|
||||
|
@ -24,7 +24,7 @@
|
||||
</h2>
|
||||
<div class="fly-list-info">
|
||||
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
<span class="layui-badge layui-bg-green " title="哪个小区">{:getAsing($art.user.area_id) ?: '无'}</span>
|
||||
{if config('taoler.config.area_show') == 1}<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>{/if}
|
||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||
<!--
|
||||
|
@ -58,12 +58,10 @@
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
||||
<i class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($article.user.area_id) ?: '无'}</i>
|
||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||
<i class="iconfont icon-renzheng" title="认证信息:{{ rows.user.approve }}"></i>
|
||||
{if($article.user.vip > 0)}
|
||||
<i class="layui-badge fly-badge-vip">vip{$article.user.vip}</i>
|
||||
{/if}
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($article.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||
<i class="iconfont icon-renzheng" title="认证信息:{{ rows.user.approve }}"></i>
|
||||
{if($article.user.vip > 0)}<i class="layui-badge fly-badge-vip">vip{$article.user.vip}</i>{/if}
|
||||
</a>
|
||||
</div>
|
||||
<div class="detail-hits" id="LAY_jieAdmin" data-id="{$article['id']}">
|
||||
|
@ -8,7 +8,7 @@
|
||||
</h2>
|
||||
<div class="fly-list-info">
|
||||
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
<i class="layui-badge layui-bg-green" title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</i>
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green" title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||
<!--
|
||||
|
@ -8,7 +8,7 @@
|
||||
</h2>
|
||||
<div class="fly-list-info">
|
||||
<a href="{:url('user/home',['id'=>$top.user_id])}" link>
|
||||
<i class="layui-badge layui-bg-green" title="来自哪简称">{:getAsing($top.user.area_id) ?: '无'}</i>
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green" title="来自哪简称">{:getAsing($top.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$top.user.nickname ?: $top.user.name}</cite>
|
||||
<i>{$top.create_time|date='Y-m-d'}</i>
|
||||
<!--
|
||||
|
Loading…
x
Reference in New Issue
Block a user