13283339616 6 anos atrás
pai
commit
fb1a924005

+ 5 - 2
app/Api/V1/Controllers/FeaturesController.php

@@ -84,10 +84,10 @@ class FeaturesController extends BaseController
84 84
         $menuList = Menu::selectRecommend(0, $time);
85 85
         return $this->response->array(self::returnValue(['data' => $menuList], 200));
86 86
     }
87
-    //获取banner推荐菜品
87
+    //获取banner
88 88
     public function getBannerRecommend(Request $request)
89 89
     {
90
-        $menuList = Menu::selectRecommend(1);
90
+        $menuList =DB::table('news')->where('imgUrl','!=','None')->where('imgUrl','!=','')->limit(3);
91 91
         return $this->response->array(self::returnValue(['data' => $menuList], 200));
92 92
     }
93 93
     //获取推荐标签
@@ -339,6 +339,9 @@ class FeaturesController extends BaseController
339 339
     public function menuDetail(Request $request){
340 340
         $id=$request->input('id');
341 341
         $menu=Menu::where('id',$id)->first();
342
+        if(!$menu){
343
+            return $this->response->array(self::returnValue(['data' => 'menu is not found'], 1099));
344
+        }
342 345
         if(!$this->startsWith($menu['url'],'http') && $menu['url'] !='None' && $menu['url']!=''){
343 346
             $menu['url']=config('constants.HOST_URL').$menu['url'];
344 347
         }

+ 3 - 2
app/Api/V1/Controllers/FindsController.php

@@ -11,6 +11,7 @@ use App\Models\VestPublish;
11 11
 use Illuminate\Http\Request;
12 12
 use Solr;
13 13
 use DB;
14
+use App\Models\Menu;
14 15
 class FindsController extends BaseController
15 16
 {
16 17
     //发现页面
@@ -33,9 +34,9 @@ class FindsController extends BaseController
33 34
             }else{
34 35
                 $user_id = Menu::getUserId($token);
35 36
                 //查询是否收藏过该商品  收藏过 - 取消收藏 ; 未收藏 - 进行收藏操作
36
-                $userArr=DB::table('users')->where('user_id',$user_id)->plucks('user_id');
37
+                $userArr=DB::table('users')->where('user_id',$user_id)->pluck('user_id');
37 38
                 $userArr=json_decode(json_encode($userArr),true);
38
-                $findArr=DB::table('users')->where('user_id',$user_id)->plucks('vest_publish_id');
39
+                $findArr=DB::table('users')->where('user_id',$user_id)->pluck('vest_publish_id');
39 40
                 $findArr=json_decode(json_encode($findArr),true);
40 41
                 $collectArr=array_combine($findArr,$userArr);
41 42
                 foreach($publish_info as $key=>$value){