...
|
...
|
@@ -211,12 +211,16 @@ class Common |
|
|
* 查询总页数(软删除)
|
|
|
* @ApiInternal
|
|
|
*/
|
|
|
public static function countSoft($table,$where){
|
|
|
$limit = config('verify.limit');
|
|
|
$count = Db::name($table)
|
|
|
->where($where)
|
|
|
->useSoftDelete('deletetime')
|
|
|
->count();
|
|
|
public static function countSoft($table,$where='',$limit=''){
|
|
|
if(empty($limit)){
|
|
|
$limit = config('verify.limit');
|
|
|
}
|
|
|
|
|
|
if(empty($where)){
|
|
|
$count = Db::name($table)->useSoftDelete('deletetime')->count();
|
|
|
}else{
|
|
|
$count = Db::name($table)->where($where)->useSoftDelete('deletetime')->count();
|
|
|
}
|
|
|
return ceil($count/$limit);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -293,7 +297,15 @@ class Common |
|
|
|
|
|
$arr['data'] = $res;
|
|
|
//总页数
|
|
|
$arr['total_page'] = self::countSoft('goods',$where);
|
|
|
if(empty($where)){
|
|
|
if($is_news == 1){
|
|
|
$arr['total_page'] = self::countSoft('goods',['is_new'=>0],$limit);
|
|
|
}else{
|
|
|
$arr['total_page'] = self::countSoft('goods','',$limit);
|
|
|
}
|
|
|
}else{
|
|
|
$arr['total_page'] = self::countSoft('goods',$where,$limit);
|
|
|
}
|
|
|
if(empty($flag)){
|
|
|
return $arr;
|
|
|
}else{
|
...
|
...
|
|