tpl
This commit is contained in:
parent
09c27401c6
commit
4170518686
@ -127,14 +127,33 @@ class Forum extends AdminController
|
||||
public function replys()
|
||||
{
|
||||
if(Request::isAjax()) {
|
||||
$replys = Comment::with(['user','article'])->paginate(15);
|
||||
/*
|
||||
$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')
|
||||
->field('a.id as aid,name,title,user_img,a.content as content,a.create_time as create_time')
|
||||
->where('a.delete_time',0)
|
||||
->order('a.create_time', 'desc')
|
||||
->paginate(15);
|
||||
|
||||
$count = $replys->total();
|
||||
$res = [];
|
||||
if ($replys) {
|
||||
$res = ['code'=>0,'msg'=>'','count'=>$count];
|
||||
foreach($replys as $k => $v){
|
||||
//var_dump($v);
|
||||
$res['data'][] = ['id'=>$k+1,'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'],'cardid'=>$v['title'],'avatar'=>$v['user_img'],'content'=>$v['content'],'replytime'=>$v['create_time']];
|
||||
}
|
||||
}
|
||||
return json($res);
|
||||
|
@ -1,10 +1,13 @@
|
||||
<?php
|
||||
namespace app\index\controller;
|
||||
|
||||
use think\facade\View;
|
||||
|
||||
class Error
|
||||
{
|
||||
public function __call($method, $args)
|
||||
{
|
||||
return 'error request!';
|
||||
//return 'error request!';
|
||||
return View::fetch('404');
|
||||
}
|
||||
}
|
@ -8,11 +8,11 @@ return [
|
||||
// 服务器地址
|
||||
'hostname' => '127.0.0.1',
|
||||
// 数据库名
|
||||
'database' => '',
|
||||
'database' => 'taotest',
|
||||
// 用户名
|
||||
'username' => '',
|
||||
'username' => 'root',
|
||||
// 密码
|
||||
'password' => '',
|
||||
'password' => 'root',
|
||||
// 端口
|
||||
'hostport' => '3306',
|
||||
// 数据库连接参数
|
||||
|
@ -128,10 +128,13 @@ php;
|
||||
//管理员
|
||||
$table_admin = $data['DB_PREFIX'] . "admin";
|
||||
$table_user = $data['DB_PREFIX'] . "user";
|
||||
$table_system = $data['DB_PREFIX'] . "system";
|
||||
$sql_admin = "UPDATE $table_admin SET username = '{$username}', password = '{$pass}', status=1,create_time = '{$create_time}' WHERE id = 1";
|
||||
$sql_user = "UPDATE $table_user SET name = '{$username}', password = '{$pass}', status=1, auth=1, create_time = '{$create_time}' WHERE id = 1";
|
||||
$sql_syste = "UPDATE $table_system SET create_time = '{$create_time}' WHERE id = 1";
|
||||
$db->execute($sql_admin);
|
||||
$db->execute($sql_user);
|
||||
$db->execute($sql_syste);
|
||||
|
||||
Db::getConnection()->close();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ return [
|
||||
'deny_app_list' => [],
|
||||
|
||||
// 异常页面的模板文件
|
||||
'exception_tmpl' => '../veiw/404.html',
|
||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||
|
||||
// 错误显示信息,非调试模式有效
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
|
63
config/database-1.php
Normal file
63
config/database-1.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
use think\facade\Env;
|
||||
|
||||
return [
|
||||
// 默认使用的数据库连接配置
|
||||
'default' => Env::get('database.driver', 'mysql'),
|
||||
|
||||
// 自定义时间查询规则
|
||||
'time_query_rule' => [],
|
||||
|
||||
// 自动写入时间戳字段
|
||||
// true为自动识别类型 false关闭
|
||||
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
|
||||
'auto_timestamp' => true,
|
||||
|
||||
// 时间字段取出后的默认时间格式
|
||||
'datetime_format' => 'Y-m-d H:i:s',
|
||||
|
||||
// 数据库连接配置信息
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
// 数据库类型
|
||||
'type' => Env::get('database.type', 'mysql'),
|
||||
// 服务器地址
|
||||
'hostname' => Env::get('database.hostname', '127.0.0.1'),
|
||||
// 数据库名
|
||||
'database' => Env::get('database.database', ''),
|
||||
// 用户名
|
||||
'username' => Env::get('database.username', 'root'),
|
||||
// 密码
|
||||
'password' => Env::get('database.password', ''),
|
||||
// 端口
|
||||
'hostport' => Env::get('database.hostport', '3306'),
|
||||
// 数据库连接参数
|
||||
'params' => [],
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => Env::get('database.charset', 'utf8'),
|
||||
// 数据库表前缀
|
||||
'prefix' => Env::get('database.prefix', ''),
|
||||
|
||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||
'deploy' => 0,
|
||||
// 数据库读写是否分离 主从式有效
|
||||
'rw_separate' => false,
|
||||
// 读写分离后 主服务器数量
|
||||
'master_num' => 1,
|
||||
// 指定从服务器序号
|
||||
'slave_no' => '',
|
||||
// 是否严格检查字段是否存在
|
||||
'fields_strict' => true,
|
||||
// 是否需要断线重连
|
||||
'break_reconnect' => false,
|
||||
// 监听SQL
|
||||
'trigger_sql' => true,
|
||||
// 开启字段缓存
|
||||
'fields_cache' => false,
|
||||
// 字段缓存路径
|
||||
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
|
||||
],
|
||||
|
||||
// 更多的数据库配置信息
|
||||
],
|
||||
];
|
@ -16,11 +16,11 @@ return [
|
||||
// 服务器地址
|
||||
'hostname' => '127.0.0.1',
|
||||
// 数据库名
|
||||
'database' => '',
|
||||
'database' => 'taotao',
|
||||
// 用户名
|
||||
'username' => '',
|
||||
'username' => 'root',
|
||||
// 密码
|
||||
'password' => '',
|
||||
'password' => 'root',
|
||||
// 端口
|
||||
'hostport' => '3306',
|
||||
// 数据库连接参数
|
||||
|
57
view/404.html
Normal file
57
view/404.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>404 - TaoLer社区</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="keywords" content="fly,layui,前端社区">
|
||||
<meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区,致力于为web开发提供强劲动力">
|
||||
<link rel="stylesheet" href="/static/res/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="/static/res/css/global.css" charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<include file="./index/public/header.html" />
|
||||
<include file="./index/public/column" />
|
||||
<div class="layui-container fly-marginTop">
|
||||
<div class="fly-panel">
|
||||
<div class="fly-none">
|
||||
<h2><i class="iconfont icon-404"></i></h2>
|
||||
<p>页面或者数据被<a href="http://fly.layui.com/u/336" target="_blank"> 纸飞机 </a>运到火星了,啥都看不到了…</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<include file="./footer" />
|
||||
<script src="/static/res/mods/jquery.min.js" charset="utf-8"></script>
|
||||
<script src="/static/res/layui/layui.js" charset="utf-8"></script>
|
||||
|
||||
<script>
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: {$user.id ? 168*$user.id : -1}
|
||||
,avatar: '{if condition="$user['user_img'] neq ''"}/uploads/{$user['user_img']}{else /}/static/res/images/avatar/00.jpg{/if}'
|
||||
,experience: 83
|
||||
,sex: '{if condition="$user['sex'] eq 0"}男{else/}女{/if}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
57
view/index/error/404.html
Normal file
57
view/index/error/404.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>404 - TaoLer社区</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="keywords" content="fly,layui,前端社区">
|
||||
<meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区,致力于为web开发提供强劲动力">
|
||||
<link rel="stylesheet" href="/static/res/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="/static/res/css/global.css" charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<include file="./index/public/header.html" />
|
||||
<include file="./index/public/column" />
|
||||
<div class="layui-container fly-marginTop">
|
||||
<div class="fly-panel">
|
||||
<div class="fly-none">
|
||||
<h2><i class="iconfont icon-404"></i></h2>
|
||||
<p>页面或者数据被<a href="http://fly.layui.com/u/336" target="_blank"> 纸飞机 </a>运到火星了,啥都看不到了…</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<include file="./footer" />
|
||||
<script src="/static/res/mods/jquery.min.js" charset="utf-8"></script>
|
||||
<script src="/static/res/layui/layui.js" charset="utf-8"></script>
|
||||
|
||||
<script>
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: {$user.id ? 168*$user.id : -1}
|
||||
,avatar: '{if condition="$user['user_img'] neq ''"}/uploads/{$user['user_img']}{else /}/static/res/images/avatar/00.jpg{/if}'
|
||||
,experience: 83
|
||||
,sex: '{if condition="$user['sex'] eq 0"}男{else/}女{/if}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user