moonsflyer 4 månader sedan
förälder
incheckning
545970566f
1 ändrade filer med 52 tillägg och 0 borttagningar
  1. 52 0
      phalapi/src/app/Api/Shop.php

+ 52 - 0
phalapi/src/app/Api/Shop.php

@@ -181,6 +181,10 @@ class Shop extends Api {
                 
 			),
 
+            'getShopGoodsList'=>array(
+                'uid' => array('name' => 'uid', 'type' => 'int', 'desc' => '店铺用户ID'),
+            ),
+
 		);
 	}
 	
@@ -843,6 +847,54 @@ class Shop extends Api {
 		return $rs;			
 	}
 
+    /**
+     * 店铺信息(带商品列表)
+     * @desc 用于获取店铺信息(带商品列表)
+     * @return int code 操作码,0表示成功
+     * @return array info
+     * @return string info[0].list[].id 商品ID
+     * @return string info[0].list[].name 商品名
+     * @return string info[0].list[].thumb 商品封面
+     * @return string info[0].list[].sale_nums 商品销量
+     * @return string info[0].list[].price 现价
+     * @return string msg 提示信息
+     */
+    public function getShopGoodsList() {
+        $rs = array('code' => 0, 'msg' => '', 'info' => array());
+
+        $uid=\App\checkNull($this->uid);
+        $p=\App\checkNull($this->p);
+
+
+
+        $domain = new Domain_Shop();
+        $info = $domain->getShop($uid);
+
+        if(!$info){
+            $rs['code']=1001;
+            $rs['msg']=\PhalApi\T('店铺不存在');
+            return $rs;
+        }
+
+        $list=[];
+        $nums=0;
+        if($uid>1){
+
+            $where=[];
+            $where['uid']=$uid;
+            $where['status']=1;
+
+            $list = $domain->getGoodsList($where,$p);
+            $nums = $domain->countGoods($where);
+
+        }
+
+        $info['goods_nums']=$nums; //店铺在售商品重新赋值
+        $info['goods_list'] = $list;
+
+
+        return $info;
+    }