mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]代码优化
This commit is contained in:
parent
f4753695d4
commit
aa218c9135
@ -44,11 +44,10 @@ class User extends BasicAdmin {
|
||||
// 实例Query对象
|
||||
$db = Db::name($this->table)->where('is_deleted', '0');
|
||||
// 应用搜索条件
|
||||
if (isset($get['username']) && $get['username'] !== '') {
|
||||
$db->where('username', 'like', "%{$get['username']}%");
|
||||
}
|
||||
if (isset($get['phone']) && $get['phone'] !== '') {
|
||||
$db->where('phone', 'like', "%{$get['phone']}%");
|
||||
foreach (['username', 'phone'] as $key) {
|
||||
if (isset($get[$key]) && $get[$key] !== '') {
|
||||
$db->where($key, 'like', "%{$get[$key]}%");
|
||||
}
|
||||
}
|
||||
// 实例化并显示
|
||||
parent::_list($db);
|
||||
|
@ -42,8 +42,10 @@ class Fans extends BasicAdmin {
|
||||
$this->title = '微信粉丝管理';
|
||||
$db = Db::name($this->table);
|
||||
$get = $this->request->get();
|
||||
if (isset($get['nickname']) && $get['nickname'] !== '') {
|
||||
$db->where('nickname', 'like', "%{$get['nickname']}%");
|
||||
foreach (['nickname'] as $key) {
|
||||
if (isset($get[$key]) && $get[$key] !== '') {
|
||||
$db->where($key, 'like', "%{$get[$key]}%");
|
||||
}
|
||||
}
|
||||
return parent::_list($db);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user