master
yulingwei 5 years ago
parent 06486d458c
commit a7f6d8b7a4

@ -443,7 +443,7 @@ unset($_REQUEST['parent_id']);
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Promote/ch_reg_list','status'=>1])->find());
$user->user_join__($model,$_GET['p']);
$user->user_join_v1($model,$_GET['p']);
}

@ -54,18 +54,18 @@ class RebateController extends ThinkController {
}
private function rebateRecordList($search=null){
$rmap = [];
if(isset($search['user_account'])){
$map['account']=array('like','%'.trim($search['user_account']).'%');
$res=M('user','tab_')->where($map)->field('id')->select();
$res=M('user','tab_')->where(array_merge($map, ['account'=>['like','%'.trim($search['user_account']).'%']]))->field('id')->select();
if(!empty($res)){
foreach ($res as $key => $value) {
$asd[]=implode(",",$value);
}
$map['user_id'] = array('in',implode(',',$asd));
$rmap['rl.user_id'] = $map['user_id'] = array('in',implode(',',$asd));
}
unset($search['user_account']);
}
empty(I('game_id')) || $map['game_id'] = I('game_id');
empty(I('game_id')) || $rmap['game_id'] = $map['game_id'] = I('game_id');
$total =D("RebateList")->field('sum(pay_amount) pay_amount,sum(ratio_amount) ratio_amount')->where($map)->find();
$ttotal=D("RebateList")->field('sum(pay_amount) pay_amount,sum(ratio_amount) ratio_amount')->where('create_time'.total(1))->where(array('pay_status'=>1))->find();
$ytotal=D("RebateList")->field('sum(pay_amount) pay_amount,sum(ratio_amount) ratio_amount')->where('create_time'.total(5))->where(array('pay_status'=>1))->find();
@ -80,7 +80,7 @@ class RebateController extends ThinkController {
/*parent::lists("RebateList",$_GET["p"],$map);*/
$data = D('RebateList')->lists($_GET['p'], $map);
$data = D('RebateList')->lists($_GET['p'], $rmap);
$this->assign('list_data', $data['data']);
$this->assign('_page', $data['page']);

@ -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);

@ -107,7 +107,7 @@ class RebateListModel extends Model{
->order('rl.id desc')
->select();
$count = $this->where($map)->count();
$count = $this->alias('rl')->where($map)->count();
$data['data'] = $list;

Loading…
Cancel
Save