mirror of https://gitee.com/karson/fastadmin.git
parent
36d762fc81
commit
077eebec86
|
|
@ -19,8 +19,7 @@
|
|||
{%relationWithList%}
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->limit($offset, $limit)
|
||||
->paginate();
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
{%visibleFieldList%}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class Index extends Backend
|
|||
}
|
||||
|
||||
/**
|
||||
* 注销登录
|
||||
* 退出登录
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ class Admin extends Backend
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
|
|
@ -90,26 +92,21 @@ class Admin extends Backend
|
|||
$adminGroupName[$this->auth->id][$n['id']] = $n['name'];
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$total = $this->model
|
||||
->where($where)
|
||||
->where('id', 'in', $this->childrenAdminIds)
|
||||
->order($sort, $order)
|
||||
->count();
|
||||
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->where('id', 'in', $this->childrenAdminIds)
|
||||
->field(['password', 'salt', 'token'], true)
|
||||
->order($sort, $order)
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $k => &$v) {
|
||||
$groups = isset($adminGroupName[$v['id']]) ? $adminGroupName[$v['id']] : [];
|
||||
$v['groups'] = implode(',', array_keys($groups));
|
||||
$v['groups_text'] = implode(',', array_values($groups));
|
||||
}
|
||||
unset($v);
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,21 +40,17 @@ class Adminlog extends Backend
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$total = $this->model
|
||||
->where($where)
|
||||
->where('admin_id', 'in', $this->childrenAdminIds)
|
||||
->order($sort, $order)
|
||||
->count();
|
||||
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->where('admin_id', 'in', $this->childrenAdminIds)
|
||||
->order($sort, $order)
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
->paginate($limit);
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Attachment extends Backend
|
|||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
$mimetypeQuery = [];
|
||||
$filter = $this->request->request('filter');
|
||||
|
|
@ -51,24 +51,19 @@ class Attachment extends Backend
|
|||
}
|
||||
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$total = $this->model
|
||||
->where($mimetypeQuery)
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->count();
|
||||
|
||||
$list = $this->model
|
||||
->where($mimetypeQuery)
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
->paginate($limit);
|
||||
|
||||
$cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root());
|
||||
foreach ($list as $k => &$v) {
|
||||
$v['fullurl'] = ($v['storage'] == 'local' ? $cdnurl : $this->view->config['upload']['cdnurl']) . $v['url'];
|
||||
}
|
||||
unset($v);
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,25 +22,18 @@ class Profile extends Backend
|
|||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
$model = model('AdminLog');
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$total = $model
|
||||
->where($where)
|
||||
->where('admin_id', $this->auth->id)
|
||||
->order($sort, $order)
|
||||
->count();
|
||||
|
||||
$list = $model
|
||||
->where($where)
|
||||
->where('admin_id', $this->auth->id)
|
||||
->order($sort, $order)
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
->paginate($limit);
|
||||
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,29 +33,23 @@ class User extends Backend
|
|||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$total = $this->model
|
||||
->with('group')
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->count();
|
||||
$list = $this->model
|
||||
->with('group')
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
->paginate($limit);
|
||||
foreach ($list as $k => $v) {
|
||||
$v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
|
||||
$v->hidden(['password', 'salt']);
|
||||
}
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ return [
|
|||
'Password' => '密码',
|
||||
'Sign up' => '注 册',
|
||||
'Sign in' => '登 录',
|
||||
'Sign out' => '注 销',
|
||||
'Sign out' => '退 出',
|
||||
'Keep login' => '保持会话',
|
||||
'Guest' => '游客',
|
||||
'Welcome' => '%s,你好!',
|
||||
|
|
@ -69,7 +69,7 @@ return [
|
|||
'Home' => '主页',
|
||||
'Online' => '在线',
|
||||
'Login' => '登录',
|
||||
'Logout' => '注销',
|
||||
'Logout' => '退出',
|
||||
'Profile' => '个人资料',
|
||||
'Index' => '首页',
|
||||
'Hot' => '热门',
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class Auth extends \fast\Auth
|
|||
}
|
||||
|
||||
/**
|
||||
* 注销登录
|
||||
* 退出登录
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ trait Backend
|
|||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
|
|
@ -54,8 +54,7 @@ trait Backend
|
|||
$list = $this->model
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->limit($offset, $limit)
|
||||
->paginate();
|
||||
->paginate($limit);
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class User extends Api
|
|||
}
|
||||
|
||||
/**
|
||||
* 注销登录
|
||||
* 退出登录
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ return [
|
|||
'Password' => '密码',
|
||||
'Sign up' => '注 册',
|
||||
'Sign in' => '登 录',
|
||||
'Sign out' => '注 销',
|
||||
'Sign out' => '退 出',
|
||||
'Guest' => '游客',
|
||||
'Welcome' => '%s,你好!',
|
||||
'Add' => '添加',
|
||||
|
|
@ -42,7 +42,7 @@ return [
|
|||
'None' => '无',
|
||||
'Home' => '主页',
|
||||
'Online' => '在线',
|
||||
'Logout' => '注销',
|
||||
'Logout' => '退出',
|
||||
'Profile' => '个人资料',
|
||||
'Index' => '首页',
|
||||
'Hot' => '热门',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ return [
|
|||
'Change password' => '修改密码',
|
||||
'Captcha is incorrect' => '验证码不正确',
|
||||
'Logged in successful' => '登录成功',
|
||||
'Logout successful' => '注销成功',
|
||||
'Logout successful' => '退出成功',
|
||||
'Operation failed' => '操作失败',
|
||||
'Invalid parameters' => '参数不正确',
|
||||
'Change password failure' => '修改密码失败',
|
||||
|
|
|
|||
|
|
@ -261,8 +261,14 @@ class Backend extends Controller
|
|||
$op = $this->request->get("op", '', 'trim');
|
||||
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id');
|
||||
$order = $this->request->get("order", "DESC");
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$offset = $this->request->get("offset/d", 0);
|
||||
$limit = $this->request->get("limit/d", 10);
|
||||
//新增自动计算页码
|
||||
$page = $limit ? intval($offset / $limit) + 1 : 1;
|
||||
if ($this->request->has("page")) {
|
||||
$page = $this->request->get("page/d", 1);
|
||||
}
|
||||
$this->request->get([config('paginate.var_page') => $page]);
|
||||
$filter = (array)json_decode($filter, true);
|
||||
$op = (array)json_decode($op, true);
|
||||
$filter = $filter ? $filter : [];
|
||||
|
|
@ -404,7 +410,7 @@ class Backend extends Controller
|
|||
}
|
||||
}
|
||||
};
|
||||
return [$where, $sort, $order, $offset, $limit];
|
||||
return [$where, $sort, $order, $offset, $limit, $page];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ return [
|
|||
'Password' => '密码',
|
||||
'Sign up' => '注 册',
|
||||
'Sign in' => '登 录',
|
||||
'Sign out' => '注 销',
|
||||
'Sign out' => '退 出',
|
||||
'Guest' => '游客',
|
||||
'Welcome' => '%s,你好!',
|
||||
'Add' => '添加',
|
||||
|
|
@ -47,7 +47,7 @@ return [
|
|||
'Last' => '末页',
|
||||
'None' => '无',
|
||||
'Online' => '在线',
|
||||
'Logout' => '注销',
|
||||
'Logout' => '退出',
|
||||
'Profile' => '个人资料',
|
||||
'Index' => '首页',
|
||||
'Hot' => '热门',
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ class Auth
|
|||
}
|
||||
|
||||
/**
|
||||
* 注销
|
||||
* 退出
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
|
@ -239,7 +239,7 @@ class Auth
|
|||
$this->_logined = false;
|
||||
//删除Token
|
||||
Token::delete($this->_token);
|
||||
//注销成功的事件
|
||||
//退出成功的事件
|
||||
Hook::listen("user_logout_successed", $this->_user);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class User extends Frontend
|
|||
$this->error(__('User center already closed'));
|
||||
}
|
||||
|
||||
//监听注册登录注销的事件
|
||||
//监听注册登录退出的事件
|
||||
Hook::add('user_login_successed', function ($user) use ($auth) {
|
||||
$expire = input('post.keeplogin') ? 30 * 86400 : 0;
|
||||
Cookie::set('uid', $user->id, $expire);
|
||||
|
|
@ -208,11 +208,11 @@ class User extends Frontend
|
|||
}
|
||||
|
||||
/**
|
||||
* 注销登录
|
||||
* 退出登录
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
//注销本站
|
||||
//退出本站
|
||||
$this->auth->logout();
|
||||
$this->success(__('Logout successful'), url('user/index'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ return [
|
|||
'Password' => '密码',
|
||||
'Sign up' => '注 册',
|
||||
'Sign in' => '登 录',
|
||||
'Sign out' => '注 销',
|
||||
'Sign out' => '退 出',
|
||||
'Guest' => '游客',
|
||||
'Welcome' => '%s,你好!',
|
||||
'Add' => '添加',
|
||||
|
|
@ -44,7 +44,7 @@ return [
|
|||
'Last' => '末页',
|
||||
'None' => '无',
|
||||
'Online' => '在线',
|
||||
'Logout' => '注销',
|
||||
'Logout' => '退出',
|
||||
'Profile' => '个人资料',
|
||||
'Index' => '首页',
|
||||
'Hot' => '热门',
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ return [
|
|||
'Change password successful' => '修改密码成功',
|
||||
'Captcha is incorrect' => '验证码不正确',
|
||||
'Logged in successful' => '登录成功',
|
||||
'Logout successful' => '注销成功',
|
||||
'Logout successful' => '退出成功',
|
||||
'User center already closed' => '会员中心已经关闭',
|
||||
'Operation failed' => '操作失败',
|
||||
'Invalid parameters' => '参数不正确',
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@
|
|||
<a href="javascript:;" data-id="14" class="list-group-item">会员登录</a>
|
||||
<a href="javascript:;" data-id="15" class="list-group-item">手机验证码登录</a>
|
||||
<a href="javascript:;" data-id="16" class="list-group-item">注册会员</a>
|
||||
<a href="javascript:;" data-id="17" class="list-group-item">注销登录</a>
|
||||
<a href="javascript:;" data-id="17" class="list-group-item">退出登录</a>
|
||||
<a href="javascript:;" data-id="18" class="list-group-item">修改会员个人信息</a>
|
||||
<a href="javascript:;" data-id="19" class="list-group-item">修改邮箱</a>
|
||||
<a href="javascript:;" data-id="20" class="list-group-item">修改手机号</a>
|
||||
|
|
@ -2174,7 +2174,7 @@
|
|||
<div class="panel-heading" id="heading-17">
|
||||
<h4 class="panel-title">
|
||||
<span class="label label-success">GET</span>
|
||||
<a data-toggle="collapse" data-parent="#accordion17" href="#collapseOne17"> 注销登录 <span class="text-muted">/api/user/logout</span></a>
|
||||
<a data-toggle="collapse" data-parent="#accordion17" href="#collapseOne17"> 退出登录 <span class="text-muted">/api/user/logout</span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseOne17" class="panel-collapse collapse">
|
||||
|
|
@ -2192,7 +2192,7 @@
|
|||
|
||||
<div class="tab-pane active" id="info17">
|
||||
<div class="well">
|
||||
注销登录 </div>
|
||||
退出登录 </div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><strong>Headers</strong></div>
|
||||
<div class="panel-body">
|
||||
|
|
|
|||
Loading…
Reference in New Issue