zz il y a 6 ans
Parent
commit
b8ecdd0c28
1 fichiers modifiés avec 8 ajouts et 8 suppressions
  1. 8 8
      app/Modules/Book/Services/BookGiftsService.php

+ 8 - 8
app/Modules/Book/Services/BookGiftsService.php

@@ -189,10 +189,10 @@ class BookGiftsService
                 ];
             }
             if($gift){
-                foreach ($gift as $item){
-                    $item['name_desc'] = $gift_info[$item['gift_id']];
-                    $item['cost'] = $gift_info[$item['cost']];
-                    $item['icon'] = $gift_info[$item['icon']];
+                foreach ($gift as &$item){
+                    $item['name_desc'] = $gift_info[$item['gift_id']]['name_desc'];
+                    $item['cost'] = $gift_info[$item['gift_id']]['cost'];
+                    $item['icon'] = $gift_info[$item['gift_id']]['icon'];
                 }
             }
             return $gift;
@@ -247,10 +247,10 @@ class BookGiftsService
                 ];
             }
             if($gift){
-                foreach ($gift as $item){
-                    $item['name_desc'] = $gift_info[$item['gift_id']];
-                    $item['cost'] = $gift_info[$item['cost']];
-                    $item['icon'] = $gift_info[$item['icon']];
+                foreach ($gift as &$item){
+                    $item['name_desc'] = $gift_info[$item['gift_id']]['name_desc'];
+                    $item['cost'] = $gift_info[$item['gift_id']]['cost'];
+                    $item['icon'] = $gift_info[$item['gift_id']]['icon'];
                 }
             }
             return $gift;