moonsflyer 4 ヶ月 前
コミット
04a32fd2b4

+ 31 - 1
phalapi/src/app/Api/Home.php

@@ -82,7 +82,9 @@ class Home extends Api {
             ),
             'getShopAddressList' => array(
             ),
-
+            'getShopGoodsClassidList' => array(
+                'uid' => array('name' => 'uid', 'type' => 'int', 'default'=>'1' ,'desc' => '店铺用户id'),
+            ),
 		);
 	}
 
@@ -543,6 +545,34 @@ class Home extends Api {
     }
 
     /**
+     * 获取云店店铺商品分类列表
+     * @desc 获取云店店铺商品分类列表
+     * @return int code 操作码,0表示成功
+     * @return array list
+     * @return array list[0]  分类信息
+     * @return array list[0][three_classid] 三级分类id
+     * @return array list[0][gc_name] 三级分类名称
+     * @return array list[0][gc_icon] 三级分类图片
+     * @return string msg 提示信息
+     */
+    public function getShopGoodsClassidList() {
+        $rs = array('code' => 0, 'msg' => '', 'list' => array());
+        $uid=\App\checkNull($this->uid);
+        $domain=new Domain_Home();
+
+        $key="getShopGoodsClassidList_".$uid;
+        $shopGoodsClassidList=\App\getcaches($key);
+        if(!$shopGoodsClassidList){
+            $shopGoodsClassidList = $domain->getShopGoodsClassidList($uid);
+            \App\setCaches($key,$shopGoodsClassidList,2);
+        }
+
+        $rs['list'] = $shopGoodsClassidList;
+
+        return $rs;
+    }
+
+    /**
      * 获取二级分类
      * @desc 获取一级分类下的二级分类列表
      * @return int code 操作码 0表示成功

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

@@ -78,6 +78,14 @@ class Home{
 
         return $rs;
     }
+    public function getShopGoodsClassidList($uid){
+        $rs = array();
+
+        $model = new Model_Home();
+        $rs = $model->getShopGoodsClassidList($uid);
+
+        return $rs;
+    }
 
     public function getShopGoodsList($p,$shopclassid){
         $rs = array();

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

@@ -169,6 +169,10 @@ class Home extends NotORM{
         return $info;
     }
 
+    public function getShopGoodsClassidList($uid){
+        $info=\App\getShopGoodsClassidList($uid);
+        return $info;
+    }
     /*商城-一级分类商品列表*/
     public function getShopGoodsList($p,$shopclassid){
         $order="isrecom desc,sale_nums desc,id desc";

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

@@ -4456,6 +4456,27 @@ namespace App;
 //        }
         return $rs;
     }
+    //获店铺地址
+    function getShopGoodsClassidList($uid){
+
+        $list = [];
+        $where['uid'] = $uid;
+        $rs=\PhalApi\DI()->notorm->shop_goods
+            ->select("DISTINCT three_classid")
+            ->where($where)
+            ->fetchAll();
+        if($rs){
+            $classid_arr = array_column($rs,'three_classid');
+            $class_where = " gc_id in {$classid_arr}";
+            $res=\PhalApi\DI()->notorm->shop_goods_class
+                ->select("gc_id,gc_name,gc_icon")
+                ->where($class_where)
+                ->fetchAll();
+            $list = $res;
+        }
+
+        return $list;
+    }
 
     // 根据不同条件获取物流列表信息
     function getExpressInfo($where){