代码优化
This commit is contained in:
@@ -1228,12 +1228,13 @@ class Adapter implements WeChatServiceInterface
|
|||||||
|
|
||||||
public function syncTrafficSourceUser()
|
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
|
SELECT
|
||||||
f.wechatId identifier,
|
f.wechatId identifier,
|
||||||
c.departmentId companyId,
|
c.departmentId companyId,
|
||||||
f.ownerNickname fromd,
|
f.ownerNickname fromd,
|
||||||
f.ownerWechatId sourceId
|
f.ownerWechatId sourceId,
|
||||||
|
f.createTime createTime
|
||||||
FROM
|
FROM
|
||||||
s2_wechat_friend f
|
s2_wechat_friend f
|
||||||
LEFT JOIN s2_wechat_account a ON f.wechatAccountId = a.id
|
LEFT JOIN s2_wechat_account a ON f.wechatAccountId = a.id
|
||||||
@@ -1260,19 +1261,20 @@ class Adapter implements WeChatServiceInterface
|
|||||||
|
|
||||||
public function syncTrafficSourceGroup()
|
public function syncTrafficSourceGroup()
|
||||||
{
|
{
|
||||||
$sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`)
|
$sql = "insert into ck_traffic_source(`identifier`,companyId,`fromd`,`sourceId`,`createTime`)
|
||||||
SELECT
|
SELECT
|
||||||
m.wechatId identifier,
|
m.wechatId identifier,
|
||||||
c.departmentId companyId,
|
c.departmentId companyId,
|
||||||
r.nickname fromd,
|
r.nickname fromd,
|
||||||
f.ownerWechatId sourceId
|
m.chatroomId sourceId,
|
||||||
FROM
|
m.createTime createTime
|
||||||
s2_wechat_chatroom_member m
|
FROM
|
||||||
JOIN s2_wechat_chatroom r ON m.chatroomId = r.chatroomId
|
s2_wechat_chatroom_member m
|
||||||
LEFT JOIN s2_wechat_account a ON a.id = r.wechatAccountId
|
JOIN s2_wechat_chatroom r ON m.chatroomId = r.chatroomId
|
||||||
LEFT JOIN s2_company_account c on c.id = a.deviceAccountId
|
LEFT JOIN s2_wechat_account a ON a.id = r.wechatAccountId
|
||||||
ORDER BY m.id DESC
|
LEFT JOIN s2_company_account c on c.id = a.deviceAccountId
|
||||||
GROUP BY m.wechatId
|
ORDER BY m.id DESC
|
||||||
|
GROUP BY m.wechatId
|
||||||
LIMIT ?, ?
|
LIMIT ?, ?
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
identifier=VALUES(identifier),
|
identifier=VALUES(identifier),
|
||||||
|
|||||||
Reference in New Issue
Block a user