管理后台时时实时注册查询修改

master
zhengchanglong 5 years ago
parent e96bd42ef6
commit 0b8dfcdc89

@ -3,10 +3,10 @@ namespace Admin\Event;
use Think\Controller;
/**
* 后台事件控制器
* @author 王贺
* @author 王贺
*/
class UserEvent extends BaseEvent {
public function lists($model=null,$p=1,$extends_map=array()){
parent::custom_list($model,$p,$extends_map);
}
@ -31,7 +31,7 @@ class UserEvent extends BaseEvent {
}
}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
//读取模型数据列表
$name = $model['m_name'];
@ -56,22 +56,22 @@ class UserEvent extends BaseEvent {
->group('tab_user.id')
->where($map)
->select();
$count=count($count);
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$count=count($count);
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('model', $model);
$this->assign('list_data', $data);
$this->assign('count', $count);
$this->meta_title = $model['title'].'列表';
$this->display($model['template_list']);
}
public function user_join_($model = null, $p = 0){
public function user_join_($model = null, $p = 0){
$model || $this->error('模型名标识必须!');
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
@ -80,8 +80,8 @@ class UserEvent extends BaseEvent {
// 关键字搜索
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
// $row = 1;
//读取模型数据列表
$name = $model['m_name'];
@ -114,27 +114,27 @@ class UserEvent extends BaseEvent {
/* 数据分页 */
/* 执行查询 */
->count();
if($model['ranking']==1){
if($model['ranking']==1){
$i=($page-1)*$row;
foreach ($data as $key => $value) {
$ss[++$i]=$value;
$ss[++$i]=$value;
}
$this->assign('list_data', $ss);
}else{
$this->assign('list_data', $data);
}
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('list_data', $ss);
}else{
$this->assign('list_data', $data);
}
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('model', $model);
$this->meta_title = $model['title'].'列表';
$this->display($model['template_list']);
}
public function user_join_v1($model = null, $p = 0){
public function user_join_v1($model = null, $p = 0){
$model || $this->error('模型名标识必须!');
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
@ -156,8 +156,8 @@ class UserEvent extends BaseEvent {
}
}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 50;}
//读取模型数据列表
$name = $model['m_name'];
@ -175,12 +175,27 @@ class UserEvent extends BaseEvent {
->page($page, $row)
/* 执行查询 */
->select();
$count=count($data);
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$count = M($name,"tab_")
->field($model['fields'])
->join($model['join'])
->join($model['joins'])
->join($model['joinss'])
// 查询条件
->where($model['map'])
/* 默认通过id逆序排列 */
->order($model['order'])
->group($model['group'])
/* 数据分页 */
/* 执行查询 */
->count();
//$count=count($data);
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
@ -188,10 +203,10 @@ class UserEvent extends BaseEvent {
$this->assign('userarpu_order_type',$data_order_type);
}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//$size=$row;//每页显示的记录数
//$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
//$data = array_slice($data, ($arraypage-1)*$size, $size);
$this->assign('model', $model);
$this->assign('list_data', $data);
$this->meta_title = $model['title'].'列表';
@ -220,8 +235,8 @@ class UserEvent extends BaseEvent {
}
}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
//读取模型数据列表
$name = $model['m_name'];
@ -239,12 +254,12 @@ class UserEvent extends BaseEvent {
->page($page, $row)
/* 执行查询 */
->select();
$count=count($data);
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$count=count($data);
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
@ -266,19 +281,19 @@ class UserEvent extends BaseEvent {
/**
*获取用户实体
*@param int $id
*@return array
*@author 小纯洁
*/
*获取用户实体
*@param int $id
*@return array
*@author 小纯洁
*/
public function user_entity($id=0){
$user = M("user","tab_");
$map['id'] = $id;
$data = $user->where($map)->find();
$user = M("user","tab_");
$map['id'] = $id;
$data = $user->where($map)->find();
if(is_numeric($data['head_img'])){
$data['head_img'] = get_cover($data['head_img'],'path');
}
return $data;
return $data;
}
}

Loading…
Cancel
Save