moonsflyer 4 maanden geleden
bovenliggende
commit
db4c9f5cb2
4 gewijzigde bestanden met toevoegingen van 15 en 8 verwijderingen
  1. 3 1
      phalapi/src/app/Api/Home.php
  2. 2 2
      phalapi/src/app/Domain/Home.php
  3. 2 2
      phalapi/src/app/Model/Home.php
  4. 8 3
      phalapi/src/app/functions.php

+ 3 - 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'),
+                'name'=> array('name' => 'name', 'type' => 'string', 'default'=>'' ,'desc' => '店铺名称'),
                 'province'=> array('name' => 'province', 'type' => 'string', 'default'=>'' ,'desc' => '地址省份'),
                 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
             ),
@@ -495,6 +496,7 @@ class Home extends Api {
         $rs = array('code' => 0, 'msg' => '', 'list' => array());
         $classid=\App\checkNull($this->classid);
         $province=\App\checkNull($this->province);
+        $name=\App\checkNull($this->name);
         $p=\App\checkNull($this->p);
 
         $domain=new Domain_Home();
@@ -502,7 +504,7 @@ class Home extends Api {
         $key="getClassidShopList_".$classid.'_'.$p;
         $classidShopList=\App\getcaches($key);
         if(!$classidShopList){
-            $classidShopList = $domain->getClassidShopList($classid,$province,$p);
+            $classidShopList = $domain->getClassidShopList($classid,$province,$name,$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,$province,$p){
+    public function getClassidShopList($classid,$province,$name,$p){
         $rs = array();
 
         $model = new Model_Home();
-        $rs = $model->getClassidShopLists($classid,$province,$p);
+        $rs = $model->getClassidShopLists($classid,$province,$name,$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,$province,$p){
+    public function getClassidShopLists($classid,$province,$name,$p){
         $where=['goods_classid'=>$classid];
-        $info=\App\getClassidShopLists($where,$province,$p);
+        $info=\App\getClassidShopLists($where,$province,$name,$p);
         return $info;
     }
 

+ 8 - 3
phalapi/src/app/functions.php

@@ -4418,7 +4418,7 @@ namespace App;
         return $info;
     }
     //获分类店铺格式化处理
-    function getClassidShopLists($where,$province,$p){
+    function getClassidShopLists($where,$province,$name,$p){
 
         $nums = 20;
         if($p<1){
@@ -4432,9 +4432,14 @@ namespace App;
             ->fetchAll();
         $shop_list = [];
         foreach($rs as &$v){
-            $shopwhere['uid'] = $v['uid'];
+            $shopwhere =[];
+            $shopwhere[] = ['uid','=',$v['uid']];
             if(!empty($province)){
-                $shopwhere['province']=$province;
+                $shopwhere[]=['province','=',$province];
+            }
+
+            if(!empty($name)){
+                $shopwhere[]=['name','like','%'.$name.'%'];
             }
             $shop_info=\PhalApi\DI()->notorm->shop_apply
                 ->select('uid,name,thumb,username,sale_nums,service_points,province')