Browse Source

Merge branch 'gift'

zz 6 years ago
parent
commit
d162825702
1 changed files with 8 additions and 8 deletions
  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;