moonsflyer 4 месяцев назад
Родитель
Сommit
06f246ab5d

+ 4 - 1
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'),
+                'province'=> array('name' => 'province', 'type' => 'string', 'default'=>'' ,'desc' => '地址省份'),
                 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
             ),
 		);
@@ -493,13 +494,15 @@ class Home extends Api {
     public function getClassidShopList() {
         $rs = array('code' => 0, 'msg' => '', 'list' => array());
         $classid=\App\checkNull($this->classid);
+        $province=\App\checkNull($this->province);
         $p=\App\checkNull($this->p);
+
         $domain=new Domain_Home();
 
         $key="getClassidShopList_".$classid.'_'.$p;
         $classidShopList=\App\getcaches($key);
         if(!$classidShopList){
-            $classidShopList = $domain->getClassidShopList($classid,$p);
+            $classidShopList = $domain->getClassidShopList($classid,$province,$p);
             \App\setCaches($key,$classidShopList,2);
         }
 

+ 2 - 2
phalapi/src/app/Domain/Home.php

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

+ 2 - 2
phalapi/src/app/Model/Home.php

@@ -151,9 +151,9 @@ class Home extends NotORM{
         $info=\App\getNewsDetail($where);
         return $info;
     }
-    public function getClassidShopLists($classid,$p){
+    public function getClassidShopLists($classid,$province,$p){
         $where=['goods_classid'=>$classid];
-        $info=\App\getClassidShopLists($where,$p);
+        $info=\App\getClassidShopLists($where,$province,$p);
         return $info;
     }
 

+ 14 - 6
phalapi/src/app/functions.php

@@ -4418,7 +4418,7 @@ namespace App;
         return $info;
     }
     //获分类店铺格式化处理
-    function getClassidShopLists($where,$p){
+    function getClassidShopLists($where,$province,$p){
 
         $nums = 20;
         if($p<1){
@@ -4432,18 +4432,26 @@ namespace App;
             ->fetchAll();
         $shop_list = [];
         foreach($rs as &$v){
+            $shopwhere['uid'] = $v['uid'];
+            if(!empty($province)){
+                $shopwhere['province']=$province;
+            }
             $shop_info=\PhalApi\DI()->notorm->shop_apply
-                ->select('uid,name,thumb,username,sale_nums,service_points')
-                ->where(['uid'=>$v['uid']])
+                ->select('uid,name,thumb,username,sale_nums,service_points,province')
+                ->where($shopwhere)
                 ->fetchOne();
+
 //            $v['cate_name']=$cate_name;
 //
 //            $v['addtime'] = date('Y-m-d H:i:s',$shop_info['addtime']);
 //
-            $shop_info['thumb'] =  get_upload_path( $shop_info['thumb']);
-            $shop_info['delivery_time'] =  '35分钟' ;
+            if($shop_info){
+                $shop_info['thumb'] =  get_upload_path( $shop_info['thumb']);
+                $shop_info['delivery_time'] =  '35分钟' ;
+
+                $shop_list[]=$shop_info;
+            }
 
-            $shop_list[]=$shop_info;
         }
         return $shop_list;
     }