|
@@ -298,19 +298,18 @@ use think\App;class CatPlat extends Base{
|
|
$plat_id=isset($this->post['platform_id']) && $this->post['platform_id'] !==""? intval($this->post['platform_id']) :"";
|
|
$plat_id=isset($this->post['platform_id']) && $this->post['platform_id'] !==""? intval($this->post['platform_id']) :"";
|
|
if($pid!==""){
|
|
if($pid!==""){
|
|
$where[]=["pid","=",$pid];
|
|
$where[]=["pid","=",$pid];
|
|
- if ($pid!=0){
|
|
|
|
- $pcat = Db::name('cat')->where(['id'=>$pid,"is_del"=>0])->find();
|
|
|
|
- if($pcat==false){
|
|
|
|
- return error_show(1004,"未找到分类数据");
|
|
|
|
- }else{
|
|
|
|
- if($pcat['level']==2){
|
|
|
|
- if($plat_id==""){
|
|
|
|
- return error_show(1004,"参数 platform_id 不能为空");
|
|
|
|
- }
|
|
|
|
|
|
+ if ($pid!=0){
|
|
|
|
+ $pcat = Db::name('cat')->where(['id'=>$pid,"is_del"=>0])->find();
|
|
|
|
+ if($pcat==false){
|
|
|
|
+ return error_show(1004,"未找到分类数据");
|
|
|
|
+ }else{
|
|
|
|
+ if($pcat['level']==2){
|
|
|
|
+ if($plat_id==""){
|
|
|
|
+ return error_show(1004,"参数 platform_id 不能为空");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
if($plat_id!=""){
|
|
if($plat_id!=""){
|
|
$platform = Db::name("platform")->where(["id"=>$plat_id,"is_del"=>0])->find();
|
|
$platform = Db::name("platform")->where(["id"=>$plat_id,"is_del"=>0])->find();
|
|
@@ -319,7 +318,12 @@ use think\App;class CatPlat extends Base{
|
|
if($status!==""){
|
|
if($status!==""){
|
|
$where[]=['status',"=",$status];
|
|
$where[]=['status',"=",$status];
|
|
}
|
|
}
|
|
- $list = Db::name('cat')->where($where)->select();
|
|
|
|
|
|
+ $page = isset($post['page'])&&$post['page']!=""?intval($post['page']) :"1";
|
|
|
|
+ $size = isset($post['size'])&&$post['size']!=""?intval($post['size']) :"15";
|
|
|
|
+ $count = Db::name("cat")->where($where)->count();
|
|
|
|
+ $total = ceil($count/$size);
|
|
|
|
+ $page = $total> $page ? $page: intval($total);
|
|
|
|
+ $list = Db::name('cat')->where($where)->page($page,$size)->select();
|
|
$data=[];
|
|
$data=[];
|
|
foreach ($list as $key=>$value){
|
|
foreach ($list as $key=>$value){
|
|
if($value['level']==3){
|
|
if($value['level']==3){
|
|
@@ -338,6 +342,6 @@ use think\App;class CatPlat extends Base{
|
|
$value['platform_id'] = $plat_id;
|
|
$value['platform_id'] = $plat_id;
|
|
$data[]=$value;
|
|
$data[]=$value;
|
|
}
|
|
}
|
|
- return app_show(0, "获取成功",$list);
|
|
|
|
|
|
+ return app_show(0, "获取成功",["list"=>$list,"count"=>$count]);
|
|
}
|
|
}
|
|
}
|
|
}
|