From bb59175fdbb1e62eceac8437918bf3d57bb4da6f Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Mon, 21 Apr 2025 10:45:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=BA=93=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cunkebao/app/content/[id]/edit/page.tsx | 2 +- .../controller/ContentLibraryController.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Cunkebao/app/content/[id]/edit/page.tsx b/Cunkebao/app/content/[id]/edit/page.tsx index 808c1ba8..a7809573 100644 --- a/Cunkebao/app/content/[id]/edit/page.tsx +++ b/Cunkebao/app/content/[id]/edit/page.tsx @@ -98,7 +98,7 @@ export default function EditContentLibraryPage({ params }: { params: Promise<{ i const data = response.data // 直接使用API返回的好友和群组数据 - const friends = data.sourceFriends || []; + const friends = data.selectedFriends || []; const groups = data.sourceGroups || []; setFormData({ diff --git a/Server/application/cunkebao/controller/ContentLibraryController.php b/Server/application/cunkebao/controller/ContentLibraryController.php index b1024a29..01ffed19 100644 --- a/Server/application/cunkebao/controller/ContentLibraryController.php +++ b/Server/application/cunkebao/controller/ContentLibraryController.php @@ -111,6 +111,24 @@ class ContentLibraryController extends Controller $library['timeEnd'] = date('Y-m-d', $library['timeEnd']); } + // 获取好友详细信息 + if (!empty($library['sourceFriends'])) { + $friendIds = $library['sourceFriends']; + $friendsInfo = []; + + if (!empty($friendIds)) { + // 查询好友信息,使用wechat_account表 + $friendsInfo = Db::name('wechat_account') + ->field('wechatId, nickname, avatar') + ->whereIn('wechatId', $friendIds) + ->select(); + } + + // 将好友信息添加到返回数据中 + $library['selectedFriends'] = $friendsInfo; + } + + return json([ 'code' => 200,