mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-07-04 13:02:53 +08:00
dev -> tp5
This commit is contained in:
170
application/admin/controller/AlipayLifeUser.php
Executable file
170
application/admin/controller/AlipayLifeUser.php
Executable file
@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
/**
|
||||
* 生活号用户管理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class AlipayLifeUser extends Common
|
||||
{
|
||||
/**
|
||||
* 构造方法
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-03T12:39:08+0800
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// 调用父类前置方法
|
||||
parent::__construct();
|
||||
|
||||
// 登录校验
|
||||
$this->Is_Login();
|
||||
|
||||
// 权限校验
|
||||
$this->Is_Power();
|
||||
}
|
||||
|
||||
/**
|
||||
* [Index 用户列表]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-06T21:31:53+0800
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
// 参数
|
||||
$param = array_merge($_POST, $_GET);
|
||||
|
||||
// 条件
|
||||
$where = $this->GetIndexWhere();
|
||||
|
||||
// 模型
|
||||
$m = db('AlipayLifeUser');
|
||||
|
||||
// 分页
|
||||
$number = MyC('admin_page_number');
|
||||
$page_param = array(
|
||||
'number' => $number,
|
||||
'total' => $m->alias('au')->where($where)->join('INNER JOIN __USER__ AS u ON u.id=au.user_id')->count(),
|
||||
'where' => $param,
|
||||
'url' => url('Admin/AlipayLifeUser/Index'),
|
||||
);
|
||||
$page = new \base\Page($page_param);
|
||||
|
||||
// 获取列表
|
||||
$field = 'u.*, au.alipay_life_id, au.id AS alipay_life_user_id, au.user_id, au.add_time AS alipay_life_add_time';
|
||||
$list = $this->SetDataHandle($m->alias('au')->where($where)->join('INNER JOIN __USER__ AS u ON u.id=au.user_id')->field($field)->limit($page->GetPageStarNumber(), $number)->order('au.id desc')->select());
|
||||
|
||||
// 性别
|
||||
$this->assign('common_gender_list', lang('common_gender_list'));
|
||||
|
||||
// 参数
|
||||
$this->assign('param', $param);
|
||||
|
||||
// 分页
|
||||
$this->assign('page_html', $page->GetPageHtml());
|
||||
|
||||
// 数据列表
|
||||
$this->assign('list', $list);
|
||||
|
||||
$this->display('Index');
|
||||
}
|
||||
|
||||
/**
|
||||
* [SetDataHandle 数据处理]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-29T21:27:15+0800
|
||||
* @param [array] $data [用户数据]
|
||||
* @return [array] [处理好的数据]
|
||||
*/
|
||||
private function SetDataHandle($data)
|
||||
{
|
||||
if(!empty($data))
|
||||
{
|
||||
$common_gender_list = lang('common_gender_list');
|
||||
$life_m = db('AlipayLife');
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 生日
|
||||
if(!empty($v['birthday']))
|
||||
{
|
||||
$v['birthday_text'] = date('Y-m-d', $v['birthday']);
|
||||
} else {
|
||||
$v['birthday_text'] = '';
|
||||
}
|
||||
|
||||
// 注册时间
|
||||
$v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
|
||||
|
||||
// 关注时间
|
||||
$v['alipay_life_add_time'] = date('Y-m-d H:i:s', $v['alipay_life_add_time']);
|
||||
|
||||
// 更新时间
|
||||
$v['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']);
|
||||
|
||||
// 性别
|
||||
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
|
||||
|
||||
// 所属生活号
|
||||
$v['alipay_life_name'] = $life_m->where(['id'=>$v['alipay_life_id']])->getField('name');
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetIndexWhere 用户列表条件]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-10T22:16:29+0800
|
||||
*/
|
||||
private function GetIndexWhere()
|
||||
{
|
||||
$where = array('is_delete_time'=>0);
|
||||
|
||||
// 模糊
|
||||
if(!empty($_REQUEST['keyword']))
|
||||
{
|
||||
$like_keyword = array('like', '%'.I('keyword').'%');
|
||||
$where[] = array(
|
||||
'u.username' => $like_keyword,
|
||||
'u.nickname' => $like_keyword,
|
||||
'u.mobile' => $like_keyword,
|
||||
'_logic' => 'or',
|
||||
);
|
||||
}
|
||||
|
||||
// 是否更多条件
|
||||
if(I('is_more', 0) == 1)
|
||||
{
|
||||
// 等值
|
||||
if(I('gender', -1) > -1)
|
||||
{
|
||||
$where['u.gender'] = intval(I('gender', 0));
|
||||
}
|
||||
|
||||
// 表达式
|
||||
if(!empty($_REQUEST['time_start']))
|
||||
{
|
||||
$where['au.add_time'][] = array('gt', strtotime(I('time_start')));
|
||||
}
|
||||
if(!empty($_REQUEST['time_end']))
|
||||
{
|
||||
$where['au.add_time'][] = array('lt', strtotime(I('time_end')));
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user