소스 검색

fix: update cs_type

igb 5 일 전
부모
커밋
70c0b37ddb
1개의 변경된 파일17개의 추가작업 그리고 2개의 파일을 삭제
  1. 17 2
      customers.php

+ 17 - 2
customers.php

@@ -849,8 +849,23 @@ $hrefstr = "?keys=" . $keys;
                     </div>
                     <div class="col6">
                         <?php
-                        $clientType = $conn->query("SELECT businessType FROM clienttype WHERE id=" . (int)$row['cs_type']);
-                        echo $clientType->num_rows > 0 ? $clientType->fetch_assoc()['businessType'] : '未填写';
+                        // 使用JOIN查询一次性获取所有业务类型
+                        $businessTypes = $conn->query("
+                            SELECT ct.businessType 
+                            FROM customer_business_type cbt
+                            JOIN clienttype ct ON cbt.business_type_id = ct.id
+                            WHERE cbt.customer_id = " . (int)$row['id']);
+                        
+                        if ($businessTypes->num_rows > 0) {
+                            $types = [];
+                            while ($type = $businessTypes->fetch_assoc()) {
+                                $types[] = $type['businessType'];
+                            }
+                            // 显示所有业务类型,用顿号分隔
+                            echo implode('、', $types);
+                        } else {
+                            echo '未填写';
+                        }
                         ?>
                     </div>
                     <div class="col6">