用户列表优化

feat/task1-c-wallet
devil 2020-06-08 22:40:11 +08:00
parent 9e99c1e007
commit 8b5b2228b2
2 changed files with 2 additions and 48 deletions

View File

@ -119,11 +119,9 @@ class User extends Common
*/ */
public function ExcelExport() public function ExcelExport()
{ {
// 条件 // 获取数据列表
$where = UserService::UserListWhere($this->data_post);
$data_params = [ $data_params = [
'where' => $where, 'where' => $this->form_where,
'm' => 0, 'm' => 0,
'n' => 0, 'n' => 0,
]; ];

View File

@ -168,50 +168,6 @@ class UserService
return DataReturn('处理成功', 0, $data); return DataReturn('处理成功', 0, $data);
} }
/**
* 用户列表条件
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-10T22:16:29+0800
* @param [array] $params [输入参数]
*/
public static function UserListWhere($params = [])
{
$where = [];
if(!empty($params['keywords']))
{
$where[] =['username|nickname|mobile', 'like', '%'.$params['keywords'].'%'];
}
// 是否更多条件
if(isset($params['is_more']) && $params['is_more'] == 1)
{
// 性别
if(isset($params['gender']) && $params['gender'] > -1)
{
$where[] = ['gender', '=', intval($params['gender'])];
}
// 状态
if(isset($params['status']) && $params['status'] > -1)
{
$where[] = ['status', '=', intval($params['status'])];
}
// 时间
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;
}
/** /**
* 用户总数 * 用户总数
* @author Devil * @author Devil