13283339616 6 years ago
parent
commit
d8dd918c2d
1 changed files with 5 additions and 4 deletions
  1. 5 4
      app/Api/V1/Controllers/FeaturesController.php

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

245
         $id=$request->input('id');
245
         $id=$request->input('id');
246
         $special=Special::where('id',$id)->first();
246
         $special=Special::where('id',$id)->first();
247
         if($special['title']=='上午' || $special['title']=='中午' || $special['title']=='下午'){
247
         if($special['title']=='上午' || $special['title']=='中午' || $special['title']=='下午'){
248
-            $contain_recipes_time=json_decode($special['contain_recipes_time']);
248
+            $contain_recipes_time=json_decode($special['contain_recipes_time'],true);
249
+            arsort($contain_recipes_time);
249
             $idArr=array();
250
             $idArr=array();
250
             $today=date('Y-m-d');
251
             $today=date('Y-m-d');
251
             foreach($contain_recipes_time as $key=>$value){
252
             foreach($contain_recipes_time as $key=>$value){
254
                 }
255
                 }
255
             }
256
             }
256
             $lastarr=explode(',',$special['contain_recipes']);
257
             $lastarr=explode(',',$special['contain_recipes']);
257
-            $idArr=array_intersect_assoc($idArr,$lastarr);
258
+            $idArr=array_intersect($idArr,$lastarr);
258
         }else{
259
         }else{
259
             $idArr=explode(',',$special['contain_recipes']);
260
             $idArr=explode(',',$special['contain_recipes']);
260
         }
261
         }
266
         $id=$request->input('id');
267
         $id=$request->input('id');
267
         $menu=Menu::where('id',$id)->first();
268
         $menu=Menu::where('id',$id)->first();
268
         $init=array();
269
         $init=array();
269
-        $list=explode(',',$menu['ingredients']);
270
+        $list=explode(';',$menu['ingredients']);
270
         foreach($list as $item){
271
         foreach($list as $item){
271
-            $origin=explode(':',$item);
272
+            $origin=explode(',',$item);
272
             $init[$origin[0]]=$origin[1];
273
             $init[$origin[0]]=$origin[1];
273
         }
274
         }
274
         $menu['ingredients']=$init;
275
         $menu['ingredients']=$init;