From d61dd141ff05b70be8202aa413fa3aa48934b78c Mon Sep 17 00:00:00 2001 From: Devil Date: Thu, 17 Dec 2020 18:50:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/default/public/module/base_form.html | 6 ++- .../index/view/default/public/tips_error.html | 4 +- .../view/default/public/tips_success.html | 4 +- application/module/FormHandleModule.php | 10 ++++ application/service/UserService.php | 46 +++++++++++++------ 5 files changed, 52 insertions(+), 18 deletions(-) diff --git a/application/index/view/default/public/module/base_form.html b/application/index/view/default/public/module/base_form.html index 6ad670445..7acad3e0d 100644 --- a/application/index/view/default/public/module/base_form.html +++ b/application/index/view/default/public/module/base_form.html @@ -1,3 +1,5 @@ +{{block name="form_header"}}{{/block}} +
{{block name="form_content_top"}}{{/block}} @@ -52,4 +54,6 @@ {{block name="form_extend"}}{{/block}} -
\ No newline at end of file + + +{{block name="form_footer"}}{{/block}} \ No newline at end of file diff --git a/application/index/view/default/public/tips_error.html b/application/index/view/default/public/tips_error.html index 26ca5b129..41206f7c8 100755 --- a/application/index/view/default/public/tips_error.html +++ b/application/index/view/default/public/tips_error.html @@ -22,7 +22,9 @@ {{$msg}}
- 回到首页 + {{if !isset($is_to_home) or $is_to_home eq 1}} + 回到首页 + {{/if}} {{if !empty($to_url) and !empty($to_title)}} {{$to_title}} {{/if}} diff --git a/application/index/view/default/public/tips_success.html b/application/index/view/default/public/tips_success.html index c10f0825a..bab67001b 100755 --- a/application/index/view/default/public/tips_success.html +++ b/application/index/view/default/public/tips_success.html @@ -22,7 +22,9 @@ {{$msg}}
- 回到首页 + {{if !isset($is_to_home) or $is_to_home eq 1}} + 回到首页 + {{/if}} {{if !empty($to_url) and !empty($to_title)}} {{$to_title}} {{/if}} diff --git a/application/module/FormHandleModule.php b/application/module/FormHandleModule.php index 9df944462..01e053ba4 100644 --- a/application/module/FormHandleModule.php +++ b/application/module/FormHandleModule.php @@ -467,6 +467,16 @@ class FormHandleModule $where_name = $form_name; // 条件类型 $where_type = isset($v['search_config']['where_type']) ? $v['search_config']['where_type'] : $v['search_config']['form_type']; + // 条件默认值处理 + $where_type_default_arr = [ + 'input' => '=', + 'select' => 'in', + ]; + if(array_key_exists($where_type, $where_type_default_arr)) + { + $where_type = $where_type_default_arr[$where_type]; + } + // 是否自定义条件处理 $where_custom = isset($v['search_config']['where_type_custom']) ? $v['search_config']['where_type_custom'] : ''; // 条件类型 diff --git a/application/service/UserService.php b/application/service/UserService.php index 4504f2b27..5cca4b192 100755 --- a/application/service/UserService.php +++ b/application/service/UserService.php @@ -136,7 +136,7 @@ class UserService $n = isset($params['n']) ? intval($params['n']) : 10; // 获取用户列表 - $data = Db::name('User')->where($where)->order($order_by)->limit($m, $n)->select(); + $data = Db::name('User')->where($where)->order($order_by)->field($field)->limit($m, $n)->select(); if(!empty($data)) { $common_gender_list = lang('common_gender_list'); @@ -144,27 +144,43 @@ class UserService foreach($data as &$v) { // 生日 - $v['birthday_text'] = empty($v['birthday']) ? '' : date('Y-m-d', $v['birthday']); - - // 头像 - if(!empty($v['avatar'])) + if(array_key_exists('birthday', $v)) { - $v['avatar'] = ResourcesService::AttachmentPathViewHandle($v['avatar']); - } else { - $v['avatar'] = config('shopxo.attachment_host').'/static/index/'.strtolower(MyC('common_default_theme', 'default', true)).'/images/default-user-avatar.jpg'; + $v['birthday_text'] = empty($v['birthday']) ? '' : date('Y-m-d', $v['birthday']); } - // 注册时间 - $v['add_time'] = date('Y-m-d H:i:s', $v['add_time']); + // 头像 + if(array_key_exists('avatar', $v)) + { + if(!empty($v['avatar'])) + { + $v['avatar'] = ResourcesService::AttachmentPathViewHandle($v['avatar']); + } else { + $v['avatar'] = config('shopxo.attachment_host').'/static/index/'.strtolower(MyC('common_default_theme', 'default', true)).'/images/default-user-avatar.jpg'; + } + } - // 更新时间 - $v['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']); + // 时间 + if(array_key_exists('add_time', $v)) + { + $v['add_time'] = date('Y-m-d H:i:s', $v['add_time']); + } + if(array_key_exists('upd_time', $v)) + { + $v['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']); + } // 性别 - $v['gender_text'] = isset($common_gender_list[$v['gender']]) ? $common_gender_list[$v['gender']]['name'] : '未知'; + if(array_key_exists('gender', $v)) + { + $v['gender_text'] = isset($common_gender_list[$v['gender']]) ? $common_gender_list[$v['gender']]['name'] : '未知'; + } // 状态 - $v['status_text'] = $common_user_status_list[$v['status']]['name']; + if(array_key_exists('status', $v)) + { + $v['status_text'] = $common_user_status_list[$v['status']]['name']; + } } } return DataReturn('处理成功', 0, $data); @@ -433,7 +449,7 @@ class UserService * @desc description * @param [ array] $user [用户数据] */ - private static function UserHandle($user) + public static function UserHandle($user) { // 基础数据处理 if(isset($user['add_time']))