Browse Source

分类店铺

moonsflyer 4 months ago
parent
commit
b6be294ed2

+ 9 - 8
phalapi/src/app/Api/Home.php

@@ -76,6 +76,7 @@ class Home extends Api {
             ),
             'getClassidShopList' => array(
                 'classid' => array('name' => 'classid', 'type' => 'int', 'default'=>'1' ,'desc' => '分类id'),
+                'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
             ),
 		);
 	}
@@ -490,18 +491,18 @@ class Home extends Api {
      */
     public function getClassidShopList() {
         $rs = array('code' => 0, 'msg' => '', 'list' => array());
-        $id=\App\checkNull($this->id);
-
+        $classid=\App\checkNull($this->classid);
+        $p=\App\checkNull($this->p);
         $domain=new Domain_Home();
 
-        $key="getNewsDetail_".$id;
-        $newsInfo=\App\getcaches($key);
-        if(!$newsInfo){
-            $newsInfo = $domain->getNewsDetail($id);
-            \App\setCaches($key,$newsInfo,2);
+        $key="getClassidShopList_".$classid.'_'.$p;
+        $classidShopList=\App\getcaches($key);
+        if(!$classidShopList){
+            $classidShopList = $domain->getClassidShopList($classid,$p);
+            \App\setCaches($key,$classidShopList,2);
         }
 
-        $rs['list'] = $newsInfo;
+        $rs['list'] = $classidShopList;
 
         return $rs;
     }

+ 8 - 0
phalapi/src/app/Domain/Home.php

@@ -62,6 +62,14 @@ class Home{
         return $rs;
     }
 
+    public function getClassidShopList($classid,$p){
+        $rs = array();
+
+        $model = new Model_Home();
+        $rs = $model->getClassidShopLists($classid,$p);
+
+        return $rs;
+    }
     public function getShopGoodsList($p,$shopclassid){
         $rs = array();
 

+ 6 - 0
phalapi/src/app/Model/Home.php

@@ -151,6 +151,12 @@ class Home extends NotORM{
         $info=\App\getNewsDetail($where);
         return $info;
     }
+    public function getClassidShopLists($classid,$p){
+        $where=['goods_classid'=>$classid];
+        $info=\App\getClassidShopLists($where,$p);
+        return $info;
+    }
+
     /*商城-一级分类商品列表*/
     public function getShopGoodsList($p,$shopclassid){
         $order="isrecom desc,sale_nums desc,id desc";

+ 26 - 0
phalapi/src/app/functions.php

@@ -4417,7 +4417,33 @@ namespace App;
 
         return $info;
     }
+    //获分类店铺格式化处理
+    function getClassidShopLists($where,$p){
 
+        $nums = 20;
+        if($p<1){
+            $p=1;
+        }
+        $start=($p-1)*$nums;
+        $rs=\PhalApi\DI()->notorm->seller_goods_class
+            ->select("uid,goods_classid,status")
+            ->where($where)
+            ->limit($start,$nums)
+            ->fetchAll();
+        $shop_list = [];
+        foreach($rs as &$v){
+            $shop_info=\PhalApi\DI()->notorm->shop_apply
+                ->where(['uid'=>$v['uid']])
+                ->find();
+//            $v['cate_name']=$cate_name;
+//
+//            $v['addtime'] = date('Y-m-d H:i:s',$shop_info['addtime']);
+//
+//            $v['image'] = get_upload_path($v['image']);
+            $shop_list[]=$shop_info;
+        }
+        return $shop_list;
+    }
     // 根据不同条件获取物流列表信息
     function getExpressInfo($where){
         $info=\PhalApi\DI()->notorm->shop_express