diff --git a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php index 171bbd5f..86f6027d 100644 --- a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php +++ b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php @@ -1228,14 +1228,15 @@ class Adapter implements WeChatServiceInterface public function syncTrafficSourceUser() { - $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`,`createTime`,`type`) + $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`,`createTime`,`type`, `status`) SELECT f.wechatId identifier, c.departmentId companyId, f.ownerNickname fromd, f.ownerWechatId sourceId, f.createTime createTime, - 1 as type + 1 as type, + CASE WHEN f.isDeleted = 1 THEN -3 ELSE 3 END as status FROM s2_wechat_friend f LEFT JOIN s2_wechat_account a ON f.wechatAccountId = a.id @@ -1262,14 +1263,15 @@ class Adapter implements WeChatServiceInterface public function syncTrafficSourceGroup() { - $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`,`createTime`,`type`) + $sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`,`createTime`,`type`, `status`) SELECT m.wechatId identifier, c.departmentId companyId, r.nickname fromd, m.chatroomId sourceId, m.createTime createTime, - 2 as type + 2 as type, + CASE WHEN m.friendType = 1 THEN 3 ELSE 1 END as status FROM s2_wechat_chatroom_member m JOIN s2_wechat_chatroom r ON m.chatroomId = r.chatroomId