public function admin(){ if(request()->isPost()){ //获取第二页的数据传current = 2过来即可 $post[\'origin\'] = input(\'origin\'); $post[\'lenght\'] = input(\'lenght\'); $post[\'current\'] = input(\'current\'); //当前数据开始查询位置 if ( !isset($post[\'origin\']) || empty($post[\'origin\']) ) { $post[\'origin\'] = 0 ; } //每页显示多少条数据 if ( !isset($post[\'lenght\']) || empty($post[\'lenght\']) ) { $post[\'lenght\'] = 6 ; } //当前页 if ( isset($post[\'current\']) && !empty($post[\'current\']) && $post[\'current\']>=1 ) { $data[\'current\'] = ceil($post[\'current\']); if (($data[\'current\']-1)>=1){ $post[\'origin\'] = ($post[\'current\']-1) * $post[\'lenght\']; } }else{ $data[\'current\'] = $post[\'origin\'] / $post[\'lenght\']; } $data[\'lenght\'] = $post[\'lenght\']; if ($data[\'current\']<=1) { $data[\'current\'] = 1; } //数据 $data[\'data\'] = AdminModel::admin_lst($post[\'origin\'],$post[\'lenght\']); //数据总条数 $data[\'count\'] = StudyModel::rules_count(); //总页数 $data[\'page\'] = ceil($data[\'count\'] / $data[\'lenght\']);
return json([\'code\'=>1,\'data\'=>$data]); } }