前台版本显示,后台反馈优化,数据库备份优化
This commit is contained in:
parent
945e470915
commit
4d1cb7988e
@ -5,5 +5,6 @@ namespace app;
|
|||||||
class Request extends \think\Request
|
class Request extends \think\Request
|
||||||
{
|
{
|
||||||
//过滤空格
|
//过滤空格
|
||||||
protected $filter = ['trim'];
|
protected $filter = ['trim','htmlspecialchars','strip_tags'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,17 @@ class Database extends AdminController
|
|||||||
$this->database = Config::get('database.connections.mysql.database');
|
$this->database = Config::get('database.connections.mysql.database');
|
||||||
$this->username = Config::get('database.connections.mysql.username');
|
$this->username = Config::get('database.connections.mysql.username');
|
||||||
$this->password = Config::get('database.connections.mysql.password');
|
$this->password = Config::get('database.connections.mysql.password');
|
||||||
|
$this->backdir = Config::get('taoler.databasebackdir');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
if(Request::isAjax()){
|
if(Request::isAjax()){
|
||||||
$backName = Files::getDirName('../data');
|
$backName = Files::getDirName($this->backdir);
|
||||||
|
|
||||||
|
if(empty($backName)){
|
||||||
|
return json(['code'=>-1,'msg'=>'还没有数据']);
|
||||||
|
}
|
||||||
|
|
||||||
$res['count'] = count($backName);
|
$res['count'] = count($backName);
|
||||||
if($res['count']){
|
if($res['count']){
|
||||||
@ -38,11 +43,8 @@ class Database extends AdminController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
return json(['code'=>-1,'msg'=>'还没有数据']);
|
|
||||||
}
|
}
|
||||||
return json($res);
|
return json($res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
@ -50,14 +52,11 @@ class Database extends AdminController
|
|||||||
|
|
||||||
public function backup()
|
public function backup()
|
||||||
{
|
{
|
||||||
//halt(app()->getRootPath());
|
|
||||||
//自行判断文件夹
|
//自行判断文件夹
|
||||||
$backupdir = '../data';
|
|
||||||
if (isset($_POST['backdir']) && $_POST['backdir'] != '') {
|
if (isset($_POST['backdir']) && $_POST['backdir'] != '') {
|
||||||
$backupdir = $_POST['backdir'];
|
$backupdir = $_POST['backdir'];
|
||||||
} else {
|
} else {
|
||||||
$backupdir = app()->getRootPath() .'data/'. date('Ymdhis');
|
$backupdir = $this->backdir . date('Ymdhis');
|
||||||
//halt($backupdir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_dir($backupdir)) {
|
if (!is_dir($backupdir)) {
|
||||||
@ -88,7 +87,7 @@ class Database extends AdminController
|
|||||||
{
|
{
|
||||||
$name = input('name');
|
$name = input('name');
|
||||||
//var_dump($name);
|
//var_dump($name);
|
||||||
$dir = app()->getRootPath() .'data/'.$name;
|
$dir = $this->backdir . $name;
|
||||||
|
|
||||||
$res = Files::delDir($dir);
|
$res = Files::delDir($dir);
|
||||||
|
|
||||||
|
@ -23,14 +23,12 @@ class Index extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// 控制器初始化显示左侧导航菜单
|
//控制器初始化显示左侧导航菜单
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
|
|
||||||
$this->sys_version = Config::get('taoler.version');
|
$this->sys_version = Config::get('taoler.version');
|
||||||
$this->sys = Db::name('system')->where('id',1)->find();
|
$this->sys = $this->getSystem();
|
||||||
//域名转换为无http协议
|
$this->domain = $this->getHttpUrl($this->sys['domain']);
|
||||||
$www = stripos($this->sys['domain'],'://') ? substr(stristr($this->sys['domain'],'://'),3) : $this->sys['domain'];
|
|
||||||
$this->domain = Request::scheme().'://'. $www;
|
|
||||||
$this->api = $this->sys['api_url'];
|
$this->api = $this->sys['api_url'];
|
||||||
if(empty($this->api)){
|
if(empty($this->api)){
|
||||||
$baseUrl = $this->sys['base_url'];
|
$baseUrl = $this->sys['base_url'];
|
||||||
@ -162,17 +160,14 @@ class Index extends AdminController
|
|||||||
public function cunsult()
|
public function cunsult()
|
||||||
{
|
{
|
||||||
$url = $this->api.'/v1/reply';
|
$url = $this->api.'/v1/reply';
|
||||||
|
|
||||||
//$mail = Db::name('system')->where('id',1)->value('auth_mail'); // bug邮件发送
|
//$mail = Db::name('system')->where('id',1)->value('auth_mail'); // bug邮件发送
|
||||||
if(Request::isAjax()){
|
if(Request::isAjax()){
|
||||||
$data = Request::only(['type','title','content']);
|
$data = Request::only(['type','title','content','post']);
|
||||||
|
|
||||||
$data['poster'] = 3; //公共id
|
|
||||||
|
|
||||||
$apiRes = Api::urlPost($url,$data);
|
|
||||||
|
|
||||||
if($apiRes){
|
|
||||||
//halt($data);
|
//halt($data);
|
||||||
|
$apiRes = Api::urlPost($url,$data);
|
||||||
|
$data['poster'] = Session::get('admin_id');
|
||||||
|
unset($data['post']);
|
||||||
|
if($apiRes){
|
||||||
$res = Cunsult::create($data);
|
$res = Cunsult::create($data);
|
||||||
if($res->id){
|
if($res->id){
|
||||||
//$result = mailto($mail,$data['title'],'我的问题类型是'.$data['type'].$data['content']);
|
//$result = mailto($mail,$data['title'],'我的问题类型是'.$data['type'].$data['content']);
|
||||||
|
@ -172,6 +172,9 @@
|
|||||||
<textarea id="L_content" name="content" required lay-verify="content" autocomplete="off" class="layui-textarea"></textarea>
|
<textarea id="L_content" name="content" required lay-verify="content" autocomplete="off" class="layui-textarea"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item layui-hide">
|
||||||
|
<input type="text" name="post" lay-verify="required" autocomplete="off" class="layui-input layui-hide" value="{$insurl}">
|
||||||
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<button type="submit" class="layui-btn " lay-filter="cunsult-add" lay-submit id="cunsult-add">立即发布</button>
|
<button type="submit" class="layui-btn " lay-filter="cunsult-add" lay-submit id="cunsult-add">立即发布</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="layui-nav-item layui-hide-xs" lay-unselect>
|
<li class="layui-nav-item layui-hide-xs" lay-unselect>
|
||||||
<a href="{$Request.scheme}://www.{$Request.rootDomain}" target="_blank" title="前台">
|
<a href="{$domain}" target="_blank" title="前台">
|
||||||
<i class="layui-icon layui-icon-website"></i>
|
<i class="layui-icon layui-icon-website"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -67,6 +67,8 @@ abstract class AdminController
|
|||||||
//权限auth检查
|
//权限auth检查
|
||||||
//$this->checkAuth();
|
//$this->checkAuth();
|
||||||
$this->getMenu();
|
$this->getMenu();
|
||||||
|
//系统配置
|
||||||
|
$this->getIndexUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,32 +161,6 @@ abstract class AdminController
|
|||||||
//return View::assign('menus', $menus);
|
//return View::assign('menus', $menus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**创建目录
|
|
||||||
* This function creates recursive directories if it doesn't already exist
|
|
||||||
*
|
|
||||||
* @param String The path that should be created
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function create_dir($path)
|
|
||||||
{
|
|
||||||
if (!is_dir($path))
|
|
||||||
{
|
|
||||||
$directory_path = "";
|
|
||||||
$directories = explode("/",$path);
|
|
||||||
array_pop($directories);
|
|
||||||
|
|
||||||
foreach($directories as $directory)
|
|
||||||
{
|
|
||||||
$directory_path .= $directory."/";
|
|
||||||
if (!is_dir($directory_path))
|
|
||||||
{
|
|
||||||
mkdir($directory_path);
|
|
||||||
chmod($directory_path, 0777);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//清除缓存Cache
|
//清除缓存Cache
|
||||||
public function clearData(){
|
public function clearData(){
|
||||||
$dir = app()->getRootPath().'runtime/admin/temp';
|
$dir = app()->getRootPath().'runtime/admin/temp';
|
||||||
@ -197,4 +173,31 @@ abstract class AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//显示网站设置
|
||||||
|
protected function getSystem()
|
||||||
|
{
|
||||||
|
//1.系统配置信息
|
||||||
|
return Db::name('system')->cache('system',3600)->find(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//域名协议转换 把数据库中的带HTTP或不带协议的域名转换为当前协议的域名前缀
|
||||||
|
protected function getHttpUrl($url)
|
||||||
|
{
|
||||||
|
//域名转换为无http协议
|
||||||
|
$www = stripos($url,'://') ? substr(stristr($url,'://'),3) : $url;
|
||||||
|
$htpw = Request::scheme().'://'. $www;
|
||||||
|
return $htpw;
|
||||||
|
}
|
||||||
|
|
||||||
|
//得到当前系统安装前台域名
|
||||||
|
|
||||||
|
protected function getIndexUrl()
|
||||||
|
{
|
||||||
|
$sysUrl = $this->getSystem();
|
||||||
|
$domain = $this->getHttpUrl($sysUrl['domain']);
|
||||||
|
View::assign(['domain'=>$domain,'insurl'=>$sysUrl['domain']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
//版本配置
|
//版本配置
|
||||||
'version' => '1.6.7',
|
'version' => '1.6.10',
|
||||||
'salt' => 'taoler'
|
//加盐
|
||||||
|
'salt' => 'taoler',
|
||||||
|
//数据库备份目录
|
||||||
|
'databasebackdir' => app()->getRootPath() .'data/'
|
||||||
];
|
];
|
@ -14,9 +14,10 @@ class Api
|
|||||||
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 20);
|
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 20);
|
||||||
curl_setopt($ch,CURLOPT_POST, 1);
|
curl_setopt($ch,CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
curl_setopt($ch, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 设置超时限制 防止死循环
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 设置超时限制 防止死循环
|
||||||
//curl_setopt($ch, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
|
|
||||||
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
|
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
|
||||||
$res = curl_exec($ch);
|
$res = curl_exec($ch);
|
||||||
$httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
$httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
||||||
|
@ -188,7 +188,7 @@ layui.define(function(exports){
|
|||||||
var $ = layui.$
|
var $ = layui.$
|
||||||
,table = layui.table;
|
,table = layui.table;
|
||||||
|
|
||||||
//动态
|
//动态news
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#LAY-index-topnews'
|
elem: '#LAY-index-topnews'
|
||||||
,url: indexNews //接口
|
,url: indexNews //接口
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="fly-footer html5plus-hide">
|
<div class="fly-footer html5plus-hide">
|
||||||
<p> Copyright © {:date('Y')}{$sysInfo.copyright|raw}</p>
|
<p> Copyright © {:date('Y')}{$sysInfo.copyright|raw}v{:config('taoler.version')}</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" target="_blank">站务反馈</a>
|
<a href="#" target="_blank">站务反馈</a>
|
||||||
<a href="#" target="_blank">获取本站源码</a>
|
<a href="#" target="_blank">获取本站源码</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user