From 521a678a22dfd069855e9c87773c5efc46122175 Mon Sep 17 00:00:00 2001 From: tensent Date: Thu, 16 Apr 2020 15:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=88=97=E8=A1=A8=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E4=B8=ADlinux=E4=B8=8B=E6=97=A0=E6=B3=95=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=87=BD=E6=95=B0=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 15 +++++++++++++++ app/controller/admin/Content.php | 4 +--- app/model/Form.php | 2 +- app/model/Model.php | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/common.php b/app/common.php index 52a8633d..bb33fceb 100755 --- a/app/common.php +++ b/app/common.php @@ -98,6 +98,21 @@ function get_username($uid = 0) { return $name; } +/** + * 根据用户ID获取昵称 + * @param integer $uid 用户ID + * @return string 用户名 + */ +function get_nickname($uid = 0) { + static $list; + if (!($uid && is_numeric($uid))) { + //获取当前登录用户名 + return session('userInfo.nickname'); + } + $name = Member::where('uid', $uid)->value('nickname'); + return $name ? $name : '未知'; +} + function avatar($uid, $size = 'middle') { return request()->domain() . '/static/common/images/default_avatar_' . $size . '.jpg'; } diff --git a/app/controller/admin/Content.php b/app/controller/admin/Content.php index 687cf6b0..0122af77 100644 --- a/app/controller/admin/Content.php +++ b/app/controller/admin/Content.php @@ -45,9 +45,7 @@ class Content extends Base { $map[] = ['title', 'LIKE', '%'.$param['keyword'].'%']; } - $list = $this->model->where($map)->order($order)->paginate($this->modelInfo['list_row'], false, array( - 'query' => $this->request->param(), - )); + $list = $this->model->where($map)->order($order)->paginate($this->request->pageConfig); $this->data = array( 'grid' => $this->modelInfo['grid_list'], diff --git a/app/model/Form.php b/app/model/Form.php index ad55d638..7faaeab7 100644 --- a/app/model/Form.php +++ b/app/model/Form.php @@ -94,7 +94,7 @@ class Form extends \think\Model { $list[$field] = ['field' => $field, 'title' => $title]; if (strrpos($title, "|")) { $title = explode("|", $title); - $list[$field] = ['field' => $field, 'title' => $title[0], 'format' => $title[1]]; + $list[$field] = ['field' => $field, 'title' => $title[0], 'format' => trim($title[1])]; } } } diff --git a/app/model/Model.php b/app/model/Model.php index dfe49d72..5be30128 100644 --- a/app/model/Model.php +++ b/app/model/Model.php @@ -123,7 +123,7 @@ class Model extends \think\Model{ $list[$field] = ['field' => $field, 'title' => $title]; if (strrpos($title, "|")) { $title = explode("|", $title); - $list[$field] = ['field' => $field, 'title' => $title[0], 'format' => $title[1]]; + $list[$field] = ['field' => $field, 'title' => $title[0], 'format' => trim($title[1])]; } } }