ZhouBenXu 4 ay önce
ebeveyn
işleme
2bea903f2c
1 değiştirilmiş dosya ile 6 ekleme ve 0 silme
  1. 6 0
      app/admin/service/card/CardService.php

+ 6 - 0
app/admin/service/card/CardService.php

@@ -9,6 +9,7 @@
 
 namespace app\admin\service\card;
 
+use app\admin\service\sys_manage\CategoryService;
 use app\model\CardBatch;
 use support\Db;
 use support\exception\BusinessException;
@@ -180,7 +181,12 @@ class CardService
             })
             ->count();
         if (!empty($rows)) {
+            // 查询所有分类信息
+            $category = array_column($rows, 'join_card_category_id');
+            $categoryInfos = CategoryService::getCategoryInfos($category) ?? [];
+            $categoryInfos && $categoryInfos = array_column($categoryInfos, null, 'category_id');
             foreach ($rows as $key => &$value) {
+                $value['category_name'] = $categoryInfos[$value['join_card_category_id']]['category_name'] ?? "";
                 $value['card_status_value'] = Card::CARD_STATUS[$value['card_status']];
                 !empty($value['card_json']) && $value['card_json'] = json_decode($value['card_json'], true);
                 !empty($value['card_assign_json']) && $value['card_assign_json'] = json_decode($value['card_assign_json'], true);