优化后台会员列表头像显示

优化后台请求方法判断
pull/234/head
Karson 2020-09-02 21:54:10 +08:00
parent 9d2e7f1c95
commit 6f56a83422
10 changed files with 72 additions and 54 deletions

View File

@ -218,6 +218,10 @@ class Admin extends Backend
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$ids = array_intersect($this->childrenAdminIds, array_filter(explode(',', $ids)));
// 避免越权删除管理员

View File

@ -40,8 +40,7 @@ class Adminlog extends Backend
*/
public function index()
{
if ($this->request->isAjax())
{
if ($this->request->isAjax()) {
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
@ -68,8 +67,9 @@ class Adminlog extends Backend
public function detail($ids)
{
$row = $this->model->get(['id' => $ids]);
if (!$row)
if (!$row) {
$this->error(__('No Results were found'));
}
$this->view->assign("row", $row->toArray());
return $this->view->fetch();
}
@ -87,7 +87,7 @@ class Adminlog extends Backend
* 编辑
* @internal
*/
public function edit($ids = NULL)
public function edit($ids = null)
{
$this->error();
}
@ -97,21 +97,21 @@ class Adminlog extends Backend
*/
public function del($ids = "")
{
if ($ids)
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$childrenGroupIds = $this->childrenGroupIds;
$adminList = $this->model->where('id', 'in', $ids)->where('admin_id', 'in', function ($query) use ($childrenGroupIds) {
$query->name('auth_group_access')->field('uid');
})->select();
if ($adminList)
{
if ($adminList) {
$deleteIds = [];
foreach ($adminList as $k => $v)
{
foreach ($adminList as $k => $v) {
$deleteIds[] = $v->id;
}
if ($deleteIds)
{
if ($deleteIds) {
$this->model->destroy($deleteIds);
$this->success();
}
@ -134,5 +134,4 @@ class Adminlog extends Backend
{
return parent::selectpage();
}
}

View File

@ -189,6 +189,10 @@ class Group extends Backend
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$ids = explode(',', $ids);
$grouplist = $this->auth->getGroups();

View File

@ -134,6 +134,10 @@ class Rule extends Backend
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$delIds = [];
foreach (explode(',', $ids) as $k => $v) {

View File

@ -103,6 +103,10 @@ class Attachment extends Backend
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
\think\Hook::add('upload_delete', function ($params) {
if ($params['storage'] == 'local') {

View File

@ -87,6 +87,10 @@ class Rule extends Backend
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$delIds = [];
foreach (explode(',', $ids) as $k => $v) {

View File

@ -52,6 +52,7 @@ class User extends Backend
->limit($offset, $limit)
->select();
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);
@ -94,6 +95,10 @@ class User extends Backend
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
$row = $this->model->get($ids);
$this->modelValidate = true;
if (!$row) {

View File

@ -11725,9 +11725,11 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
}
//渲染内容前
table.on('pre-body.bs.table', function (e, data) {
if (options.maintainSelected) {
$.each(data, function (i, row) {
row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
});
}
});
//当内容渲染完成后
table.on('post-body.bs.table', function (e, data) {

View File

@ -199,9 +199,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
}
//渲染内容前
table.on('pre-body.bs.table', function (e, data) {
if (options.maintainSelected) {
$.each(data, function (i, row) {
row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
});
}
});
//当内容渲染完成后
table.on('post-body.bs.table', function (e, data) {

View File

@ -74,22 +74,12 @@
}
//Different radius each side
.border-radius(@top-left;
@top-right
;
@bottom-left
;
@bottom-right
)
.border-radius(@top-left, @top-right, @bottom-left, @bottom-right)
{
border-top-left-radius: @top-left
;
border-top-right-radius: @top-right
;
border-bottom-right-radius: @bottom-right
;
border-bottom-left-radius: @bottom-left
;
border-top-left-radius: @top-left;
border-top-right-radius: @top-right;
border-bottom-right-radius: @bottom-right;
border-bottom-left-radius: @bottom-left;
}
//Gradient background