|
|
|
@ -134,7 +134,7 @@ class UserEvent extends BaseEvent {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function user_join__($model = null, $p = 0){
|
|
|
|
|
public function user_join_v1($model = null, $p = 0){
|
|
|
|
|
$model || $this->error('模型名标识必须!');
|
|
|
|
|
$page = intval($p);
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
@ -172,7 +172,71 @@ class UserEvent extends BaseEvent {
|
|
|
|
|
->order($model['order'])
|
|
|
|
|
->group($model['group'])
|
|
|
|
|
/* 数据分页 */
|
|
|
|
|
// ->page($page, $row)
|
|
|
|
|
->page($page, $row)
|
|
|
|
|
/* 执行查询 */
|
|
|
|
|
->select();
|
|
|
|
|
$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']));
|
|
|
|
|
$this->assign('userarpu_order',$data_order);
|
|
|
|
|
$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()函数用于求大于数字的最小整数
|
|
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
|
|
$this->assign('model', $model);
|
|
|
|
|
$this->assign('list_data', $data);
|
|
|
|
|
$this->meta_title = $model['title'].'列表';
|
|
|
|
|
$this->display($model['template_list']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function user_join__($model = null, $p = 0){
|
|
|
|
|
$model || $this->error('模型名标识必须!');
|
|
|
|
|
$page = intval($p);
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
|
$arraypage = $page; //默认显示第一页数据
|
|
|
|
|
//解析列表规则
|
|
|
|
|
$fields = $model['fields'];
|
|
|
|
|
// 关键字搜索
|
|
|
|
|
$map = $model['map']; //array();
|
|
|
|
|
foreach ($key as $key => $value) {
|
|
|
|
|
if(isset($_REQUEST[$value])){
|
|
|
|
|
$map[$value] = array('like','%'.$_GET[$value].'%');
|
|
|
|
|
unset($_REQUEST[$value]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 条件搜索
|
|
|
|
|
foreach($_REQUEST as $name=>$val){
|
|
|
|
|
if(in_array($name,$fields)){
|
|
|
|
|
$map[$name] = $val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
|
|
|
|
|
|
|
|
|
|
//读取模型数据列表
|
|
|
|
|
$name = $model['m_name'];
|
|
|
|
|
$data = 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'])
|
|
|
|
|
/* 数据分页 */
|
|
|
|
|
->page($page, $row)
|
|
|
|
|
/* 执行查询 */
|
|
|
|
|
->select();
|
|
|
|
|
$count=count($data);
|
|
|
|
|