13283339616 6 vuotta sitten
vanhempi
commit
fb1a924005

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

84
         $menuList = Menu::selectRecommend(0, $time);
84
         $menuList = Menu::selectRecommend(0, $time);
85
         return $this->response->array(self::returnValue(['data' => $menuList], 200));
85
         return $this->response->array(self::returnValue(['data' => $menuList], 200));
86
     }
86
     }
87
-    //获取banner推荐菜品
87
+    //获取banner
88
     public function getBannerRecommend(Request $request)
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
         return $this->response->array(self::returnValue(['data' => $menuList], 200));
91
         return $this->response->array(self::returnValue(['data' => $menuList], 200));
92
     }
92
     }
93
     //获取推荐标签
93
     //获取推荐标签
339
     public function menuDetail(Request $request){
339
     public function menuDetail(Request $request){
340
         $id=$request->input('id');
340
         $id=$request->input('id');
341
         $menu=Menu::where('id',$id)->first();
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
         if(!$this->startsWith($menu['url'],'http') && $menu['url'] !='None' && $menu['url']!=''){
345
         if(!$this->startsWith($menu['url'],'http') && $menu['url'] !='None' && $menu['url']!=''){
343
             $menu['url']=config('constants.HOST_URL').$menu['url'];
346
             $menu['url']=config('constants.HOST_URL').$menu['url'];
344
         }
347
         }

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

11
 use Illuminate\Http\Request;
11
 use Illuminate\Http\Request;
12
 use Solr;
12
 use Solr;
13
 use DB;
13
 use DB;
14
+use App\Models\Menu;
14
 class FindsController extends BaseController
15
 class FindsController extends BaseController
15
 {
16
 {
16
     //发现页面
17
     //发现页面
33
             }else{
34
             }else{
34
                 $user_id = Menu::getUserId($token);
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
                 $userArr=json_decode(json_encode($userArr),true);
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
                 $findArr=json_decode(json_encode($findArr),true);
40
                 $findArr=json_decode(json_encode($findArr),true);
40
                 $collectArr=array_combine($findArr,$userArr);
41
                 $collectArr=array_combine($findArr,$userArr);
41
                 foreach($publish_info as $key=>$value){
42
                 foreach($publish_info as $key=>$value){