From 00b56f75fe9ba8f76fa751b44a6a6ca5b36c79fa Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Tue, 22 Jul 2025 16:03:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Adapters/ChuKeBao/Adapter.php | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php index 8da320aa..f4e62737 100644 --- a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php +++ b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php @@ -1228,12 +1228,13 @@ class Adapter implements WeChatServiceInterface public function syncTrafficSourceUser() { - $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`) + $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`,`createTime`) SELECT f.wechatId identifier, c.departmentId companyId, f.ownerNickname fromd, - f.ownerWechatId sourceId + f.ownerWechatId sourceId, + f.createTime createTime FROM s2_wechat_friend f LEFT JOIN s2_wechat_account a ON f.wechatAccountId = a.id @@ -1260,19 +1261,20 @@ class Adapter implements WeChatServiceInterface public function syncTrafficSourceGroup() { - $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`) - SELECT - m.wechatId identifier, - c.departmentId companyId, - r.nickname fromd, - f.ownerWechatId sourceId - FROM - s2_wechat_chatroom_member m - JOIN s2_wechat_chatroom r ON m.chatroomId = r.chatroomId - LEFT JOIN s2_wechat_account a ON a.id = r.wechatAccountId - LEFT JOIN s2_company_account c on c.id = a.deviceAccountId - ORDER BY m.id DESC - GROUP BY m.wechatId + $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`,`createTime`) + SELECT + m.wechatId identifier, + c.departmentId companyId, + r.nickname fromd, + m.chatroomId sourceId, + m.createTime createTime + FROM + s2_wechat_chatroom_member m + JOIN s2_wechat_chatroom r ON m.chatroomId = r.chatroomId + LEFT JOIN s2_wechat_account a ON a.id = r.wechatAccountId + LEFT JOIN s2_company_account c on c.id = a.deviceAccountId + ORDER BY m.id DESC + GROUP BY m.wechatId LIMIT ?, ? ON DUPLICATE KEY UPDATE identifier=VALUES(identifier),