正在显示
1 个修改的文件
包含
19 行增加
和
7 行删除
@@ -211,12 +211,16 @@ class Common | @@ -211,12 +211,16 @@ class Common | ||
211 | * 查询总页数(软删除) | 211 | * 查询总页数(软删除) |
212 | * @ApiInternal | 212 | * @ApiInternal |
213 | */ | 213 | */ |
214 | - public static function countSoft($table,$where){ | ||
215 | - $limit = config('verify.limit'); | ||
216 | - $count = Db::name($table) | ||
217 | - ->where($where) | ||
218 | - ->useSoftDelete('deletetime') | ||
219 | - ->count(); | 214 | + public static function countSoft($table,$where='',$limit=''){ |
215 | + if(empty($limit)){ | ||
216 | + $limit = config('verify.limit'); | ||
217 | + } | ||
218 | + | ||
219 | + if(empty($where)){ | ||
220 | + $count = Db::name($table)->useSoftDelete('deletetime')->count(); | ||
221 | + }else{ | ||
222 | + $count = Db::name($table)->where($where)->useSoftDelete('deletetime')->count(); | ||
223 | + } | ||
220 | return ceil($count/$limit); | 224 | return ceil($count/$limit); |
221 | } | 225 | } |
222 | 226 | ||
@@ -293,7 +297,15 @@ class Common | @@ -293,7 +297,15 @@ class Common | ||
293 | 297 | ||
294 | $arr['data'] = $res; | 298 | $arr['data'] = $res; |
295 | //总页数 | 299 | //总页数 |
296 | - $arr['total_page'] = self::countSoft('goods',$where); | 300 | + if(empty($where)){ |
301 | + if($is_news == 1){ | ||
302 | + $arr['total_page'] = self::countSoft('goods',['is_new'=>0],$limit); | ||
303 | + }else{ | ||
304 | + $arr['total_page'] = self::countSoft('goods','',$limit); | ||
305 | + } | ||
306 | + }else{ | ||
307 | + $arr['total_page'] = self::countSoft('goods',$where,$limit); | ||
308 | + } | ||
297 | if(empty($flag)){ | 309 | if(empty($flag)){ |
298 | return $arr; | 310 | return $arr; |
299 | }else{ | 311 | }else{ |
-
请 注册 或 登录 后发表评论