WIN-2308041133\Administrator 10 hours ago
parent
commit
1d15c837f4

+ 3 - 2
app/api/controller/publics/ArticleController.php

@@ -21,11 +21,12 @@ class ArticleController
      */
     public function lst(Request $request, $cid)
     {
-        list($page, $limit) = UtilService::getMore([
+        list($page, $limit,$mer_id) = UtilService::getMore([
             ['page',1],
             ['limit',10],
+            ['mer_id',0]
         ],$request, true);
-        $list = Article::cidByArticleList($cid,$page,$limit,"id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url") ?? [];
+        $list = Article::cidByArticleList($cid,$page,$limit,$mer_id,"id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url") ?? [];
         if(is_object($list)) $list = $list->toArray();
         return app('json')->successful($list);
     }

+ 2 - 1
app/api/controller/store/StoreProductController.php

@@ -47,7 +47,8 @@ class StoreProductController
             ['page', 0],
             ['limit', 0],
             ['type', 0],
-            ['is_wholesale',0]
+            ['is_wholesale',0],
+            ['mer_id',0]
         ], $request);
         return app('json')->successful(StoreProduct::getProductList($data, $request->uid()));
     }

+ 4 - 1
app/models/article/Article.php

@@ -69,7 +69,7 @@ class Article extends BaseModel
      * @param string $field
      * @return mixed
      */
-    public static function cidByArticleList($cid, $page, $limit, $field = 'id,title,image_input,visit,add_time,synopsis,url')
+    public static function cidByArticleList($cid, $page, $limit,$mer_id, $field = 'id,title,image_input,visit,add_time,synopsis,url')
     {
         $model = new self();
 //        if ($cid) $model->where("`cid` LIKE '$cid,%' OR `cid` LIKE '%,$cid,%' OR `cid` LIKE '%,$cid' OR `cid`=$cid ");
@@ -77,6 +77,9 @@ class Article extends BaseModel
         $model = $model->field($field);
         $model = $model->where('status', 1);
         $model = $model->where('hide', 0);
+        if ($mer_id>0){
+            $model = $model->where('mer_id', $mer_id);
+        }
         $model = $model->order('sort DESC,add_time DESC');
         if ($page) $model = $model->page($page, $limit);
         return $model->select();

+ 4 - 0
app/models/store/StoreProduct.php

@@ -97,6 +97,7 @@ class StoreProduct extends BaseModel
         $page = $data['page'];
         $limit = $data['limit'];
         $type = $data['type']; // 某些模板需要购物车数量 1 = 需要查询,0 = 不需要
+        $mer_id = $data['mer_id'];
         $type_wholesale = 1;
         $model = self::validWhere();
         if ($sId) {
@@ -111,6 +112,9 @@ class StoreProduct extends BaseModel
             });
         }
         if (!empty($keyword)) $model->where('keyword|store_name', 'LIKE', htmlspecialchars("%$keyword%"));
+        if ($mer_id>0){
+            $model->where('mer_id', $mer_id);
+        }
         if ($news != 0) $model->where('is_new', 1);
         if ($is_wholesale != 0){
             $model->where('is_wholesale', 1);