流量池数据来源优化

This commit is contained in:
wong
2025-07-23 14:10:57 +08:00
parent a36d22e7ea
commit ad8eab3fe5

View File

@@ -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