通话记录数据清洗
This commit is contained in:
@@ -1488,4 +1488,39 @@ class Adapter implements WeChatServiceInterface
|
||||
}
|
||||
|
||||
|
||||
public function syncCallRecording()
|
||||
{
|
||||
$sql = "insert into ck_call_recording(`id`,`phone`,`isCallOut`,`companyId`,`callType`,`beginTime`,`endTime`,`createTime`)
|
||||
SELECT
|
||||
c.id id,
|
||||
c.phone phone,
|
||||
c.isCallOut isCallOut,
|
||||
a.departmentId companyId,
|
||||
c.callType callType,
|
||||
c.beginTime beginTime,
|
||||
c.endTime endTime,
|
||||
c.callBeginTime createTime
|
||||
FROM
|
||||
s2_call_recording c
|
||||
LEFT JOIN s2_company_account a ON c.deviceOwnerId = a.id
|
||||
ORDER BY c.id DESC
|
||||
LIMIT ?, ?
|
||||
ON DUPLICATE KEY UPDATE
|
||||
id=VALUES(id),
|
||||
phone=VALUES(phone),
|
||||
isCallOut=VALUES(isCallOut),
|
||||
companyId=VALUES(companyId)";
|
||||
|
||||
$offset = 0;
|
||||
$limit = 2000;
|
||||
$usleepTime = 50000;
|
||||
do {
|
||||
$affected = Db::execute($sql, [$offset, $limit]);
|
||||
$offset += $limit;
|
||||
if ($affected > 0) {
|
||||
usleep($usleepTime);
|
||||
}
|
||||
} while ($affected > 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user