搜索条件细节优化

This commit is contained in:
gongfuxiang 2019-05-11 21:28:38 +08:00
parent 20a68bfbde
commit 2e54aa4cfa
17 changed files with 151 additions and 58 deletions

View File

@ -85,6 +85,9 @@ class AppHomeNav extends Common
// 是否启用
$this->assign('common_is_enable_list', lang('common_is_enable_list'));
// 是否
$this->assign('common_is_text_list', lang('common_is_text_list'));
// 所属平台
$this->assign('common_platform_type', lang('common_platform_type'));

View File

@ -92,6 +92,9 @@ class Message extends Common
// 是否已读
$this->assign('common_is_read_list', lang('common_is_read_list'));
// 是否
$this->assign('common_is_text_list', lang('common_is_text_list'));
// 参数
$this->assign('params', $params);
return $this->fetch();

View File

@ -7,7 +7,7 @@
<form class="am-form form-validation form-search" method="post" action="{{:MyUrl('admin/admin/index')}}" request-type="form">
<div class="thin">
<div class="am-input-group am-input-group-sm am-fl so">
<input type="text" autocomplete="off" name="keywords" class="am-radius" placeholder="用户名" value="{{if !empty($params.keywords)}}{{$params.keywords}}{{/if}}" />
<input type="text" autocomplete="off" name="keywords" class="am-radius" placeholder="用户名/手机" value="{{if !empty($params.keywords)}}{{$params.keywords}}{{/if}}" />
<span class="am-input-group-btn">
<button class="am-btn am-btn-default am-radius" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
</span>
@ -44,6 +44,22 @@
{{/foreach}}
</select>
</td>
<tr>
<td class="time">
<span>时间:</span>
<span>
<input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
<em class="text-grey">~</em>
<span>
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
</td>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:MyUrl('admin/admin/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
</td>
</tr>
</tr>
</tbody>
</table>

View File

@ -35,6 +35,17 @@
{{/foreach}}
</select>
</td>
<td>
<span>登录:</span>
<select name="is_need_login" class="chosen-select" data-placeholder="是否需要登录...">
<option value="-1">是否需要登录...</option>
{{foreach $common_is_text_list as $v}}
<option value="{{$v.id}}" {{if isset($params['is_need_login']) and $params['is_need_login'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</td>
</tr>
<tr>
<td>
<span>平台:</span>
<select name="platform" class="chosen-select" data-placeholder="所属平台...">
@ -46,8 +57,6 @@
{{/foreach}}
</select>
</td>
</tr>
<tr>
<td>
<span>类型:</span>
<select name="event_type" class="chosen-select" data-placeholder="事件类型...">
@ -57,6 +66,8 @@
{{/foreach}}
</select>
</td>
</tr>
<tr>
<td class="time">
<span>时间:</span>
<span>
@ -67,9 +78,6 @@
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:MyUrl('admin/apphomenav/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
@ -94,8 +102,8 @@
<th>所属平台</th>
<th>导航图标</th>
<th>事件值</th>
<th>是否需要登录</th>
<th>是否启用</th>
<th>登录</th>
<th>启用</th>
<th>创建时间</th>
<th>操作</th>
</tr>

View File

@ -55,7 +55,13 @@
{{/foreach}}
</select>
</td>
<td class="time">
<td class="input">
<span>热度:</span>
<input type="number" name="access_count" class="am-form-field am-input-sm am-radius" placeholder="浏览热度" value="{{if !empty($params.access_count)}}{{$params.access_count}}{{/if}}" data-validation-message="热度有误" />
</td>
</tr>
<tr>
<td class="time">
<span>时间:</span>
<span>
<input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
@ -65,9 +71,6 @@
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:MyUrl('admin/article/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
@ -90,8 +93,8 @@
<tr>
<th>标题</th>
<th class="am-hide-sm-only">文章分类</th>
<th class="am-hide-sm-only">访问次数</th>
<th>状态</th>
<th class="am-hide-sm-only">访问热度</th>
<th>启用</th>
<th>首页推荐</th>
<th>更多</th>
<th>操作</th>

View File

@ -55,8 +55,19 @@
{{/foreach}}
</select>
</td>
<td class="time">
<span>时间:</span>
<td>
<span>满屏:</span>
<select name="is_full_screen" class="chosen-select" data-placeholder="是否满屏...">
<option value="-1">是否满屏...</option>
{{foreach $common_is_full_screen_list as $v}}
<option value="{{$v.id}}" {{if isset($params['is_full_screen']) and $params['is_full_screen'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</td>
</tr>
<tr>
<td class="time">
<span>时间:</span>
<span>
<input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
@ -65,9 +76,6 @@
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:MyUrl('admin/customview/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
@ -89,7 +97,7 @@
<thead>
<tr>
<th>标题</th>
<th>状态</th>
<th>启用</th>
<th class="am-hide-sm-only">是否含头部</th>
<th class="am-hide-sm-only">是否含尾部</th>
<th class="am-hide-sm-only">是否满屏</th>

View File

@ -55,7 +55,18 @@
{{/foreach}}
</select>
</td>
<td class="time">
<td>
<span>删除:</span>
<select name="user_is_delete_time" class="chosen-select" data-placeholder="用户是否删除...">
<option value="-1">用户是否删除...</option>
{{foreach $common_is_text_list as $v}}
<option value="{{$v.id}}" {{if isset($params['user_is_delete_time']) and $params['user_is_delete_time'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</td>
</tr>
<tr>
<td class="time">
<span>时间:</span>
<span>
<input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
@ -65,9 +76,6 @@
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:MyUrl('admin/message/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
@ -87,6 +95,7 @@
<th>标题</th>
<th class="am-hide-sm-only">内容</th>
<th class="am-hide-sm-only">是否已读</th>
<th class="am-hide-sm-only">用户删除</th>
<th class="am-hide-sm-only">发送时间</th>
<th>操作</th>
</tr>
@ -120,6 +129,9 @@
<td class="am-hide-sm-only">
{{if empty($v['is_read_name'])}}<span class="cr-ddd">未设置</span>{{else /}}{{$v.is_read_name}}{{/if}}
</td>
<td class="am-hide-sm-only">
{{if empty($v['user_is_delete_time_name'])}}<span class="cr-ddd">未设置</span>{{else /}}{{$v.user_is_delete_time_name}}{{/if}}
</td>
<td class="am-hide-sm-only">
{{if empty($v['add_time_time'])}}<span class="cr-ddd">未设置</span>{{else /}}{{$v.add_time_time}}{{/if}}
</td>

View File

@ -57,7 +57,19 @@
{{/foreach}}
</select>
</td>
<td class="time">
<td class="price">
<span>金额:</span>
<span>
<input type="text" autocomplete="off" name="price_start" class="am-form-field am-input-sm am-radius" placeholder="最低支付金额" value="{{if !empty($params.price_start)}}{{$params.price_start}}{{/if}}" data-validation-message="支付金额格式有误" autocomplete="off" />
</span>
<em class="text-grey">~</em>
<span>
<input type="text" autocomplete="off" name="price_end" class="am-form-field am-input-sm am-radius" placeholder="最高支付金额" value="{{if !empty($params.price_end)}}{{$params.price_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="支付金额格式有误" autocomplete="off" />
</span>
</td>
</tr>
<tr>
<td class="time">
<span>时间:</span>
<span>
<input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
@ -67,9 +79,6 @@
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
</span>
</td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
<a href="{{:MyUrl('admin/paylog/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>

View File

@ -19,8 +19,8 @@
<th>适用终端</th>
<th class="am-hide-sm-only">作者</th>
<th class="am-hide-sm-only th-desc">描述</th>
<th>是否启用</th>
<th>用户放开</th>
<th>启用</th>
<th>用户放开</th>
<th>操作</th>
</tr>
</thead>

View File

@ -63,18 +63,33 @@ class AdminService
$where = [];
if(!empty($params['keywords']))
{
$where[] = ['username', 'like', '%'.$params['keywords'].'%'];
}
if(isset($params['role_id']) && $params['role_id'] > -1)
{
$where[] = ['role_id', '=', intval($params['role_id'])];
$where[] = ['username|mobile', 'like', '%'.$params['keywords'].'%'];
}
// 等值
if(isset($params['gender']) && $params['gender'] > -1)
// 是否更多条件
if(isset($params['is_more']) && $params['is_more'] == 1)
{
$where[] = ['gender', '=', intval($params['gender'])];
if(isset($params['role_id']) && $params['role_id'] > -1)
{
$where[] = ['role_id', '=', intval($params['role_id'])];
}
// 等值
if(isset($params['gender']) && $params['gender'] > -1)
{
$where[] = ['gender', '=', intval($params['gender'])];
}
if(!empty($params['time_start']))
{
$where[] = ['add_time', '>', strtotime($params['time_start'])];
}
if(!empty($params['time_end']))
{
$where[] = ['add_time', '<', strtotime($params['time_end'])];
}
}
return $where;
}

View File

@ -133,8 +133,13 @@ class AppNavService
// 等值
if(isset($params['is_enable']) && $params['is_enable'] > -1)
{
$where[] = ['is_enable', '=', intval($params['is_enable'])];
}
if(isset($params['is_need_login']) && $params['is_need_login'] > -1)
{
$where[] = ['is_need_login', '=', intval($params['is_need_login'])];
}
if(isset($params['event_type']) && $params['event_type'] > -1)
{
$where[] = ['event_type', '=', intval($params['event_type'])];

View File

@ -126,6 +126,10 @@ class ArticleService
{
$where[] = ['a.is_home_recommended', '=', intval($params['is_home_recommended'])];
}
if(isset($params['access_count']) && $params['access_count'] > -1)
{
$where[] = ['a.access_count', '>', intval($params['access_count'])];
}
if(!empty($params['time_start']))
{

View File

@ -118,6 +118,10 @@ class CustomViewService
{
$where[] = ['is_enable', '=', intval($params['is_enable'])];
}
if(isset($params['is_full_screen']) && $params['is_full_screen'] > -1)
{
$where[] = ['is_full_screen', '=', intval($params['is_full_screen'])];
}
if(isset($params['is_header']) && $params['is_header'] > -1)
{
$where[] = ['is_header', '=', intval($params['is_header'])];

View File

@ -265,6 +265,9 @@ class MessageService
// 业务类型
$v['business_type_name'] = $common_business_type_list[$v['business_type']]['name'];
// 用户是否已删除
$v['user_is_delete_time_name'] = ($v['user_is_delete_time'] == 0) ? '否' : '是';
// 性别
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
@ -331,6 +334,15 @@ class MessageService
{
$where[] = ['u.gender', '=', intval($params['gender'])];
}
if(isset($params['user_is_delete_time']) && $params['user_is_delete_time'] > -1)
{
if(intval($params['user_is_delete_time']) == 0)
{
$where[] = ['m.user_is_delete_time', '=', 0];
} else {
$where[] = ['m.user_is_delete_time', '>', 0];
}
}
if(!empty($params['time_start']))
{

View File

@ -161,6 +161,15 @@ class PayLogService
$where[] = ['u.gender', '=', intval($params['gender'])];
}
if(!empty($params['price_start']))
{
$where[] = ['p.pay_price', '>', PriceNumberFormat($params['price_start'])];
}
if(!empty($params['price_end']))
{
$where[] = ['p.pay_price', '<', PriceNumberFormat($params['price_end'])];
}
if(!empty($params['time_start']))
{
$where[] = ['p.add_time', '>', strtotime($params['time_start'])];

View File

@ -317,7 +317,7 @@ button.colorpicker-submit img {
.form-search .so-list select { padding: 0 0 0 8px; }
.form-search .more-submit input { display: none; }
@media only screen and (min-width: 641px) {
.form-search .so-list .chosen-container, .form-search .so-list select { width:217px !important; display: -webkit-inline-box; }
.form-search .so-list .chosen-container, .form-search .so-list select, .form-search .input input { width:217px !important; display: -webkit-inline-box; }
.form-search .thin_sub:hover { color:#F60; }
}
@media only screen and (max-width: 641px) {
@ -326,5 +326,5 @@ button.colorpicker-submit img {
.form-search .so-list tr td:last-child { margin-top:10px; }
.form-search .so-list tr td:last-child { padding-top:0px !important; }
.form-search .chosen-container-single .chosen-search input[type="text"] { width: 100% !important; }
.form-search .so-list select, .form-search .so-list .chosen-container { width: calc(100% - 44px) !important; display: -webkit-inline-box; }
.form-search .so-list select, .form-search .so-list .chosen-container, .form-search .input input { width: calc(100% - 44px) !important; display: -webkit-inline-box; }
}

View File

@ -1,21 +1,3 @@
/**
* 搜索表单
*/
.form-search .form-keyword { display: initial !important; }
.form-search .more-submit input { display: none; }
.form-search .param-date input { display: initial !important; }
@media only screen and (max-width: 641px) {
.form-search .form-keyword { width: calc(100% - 140px) !important; }
.form-search .param-where { width: 100% !important; margin-left: 0px !important; }
.form-search .param-date input { width: 47% !important; }
}
@media only screen and (min-width: 641px) {
.form-search .form-keyword { width: 35% !important; }
.form-search .param-where { width: 32% !important; float: left; }
.form-search .param-date input { width: 45% !important; }
.form-search .param-where:nth-child(1), .param-where:nth-child(4) { margin-left: 0px !important; }
}
/**
* 用户信息
*/