|
|
@@ -405,7 +405,7 @@ class Events
|
|
|
'intime' => time(),
|
|
|
'signature' => $kfinfo['signature'],
|
|
|
'status' => 2, // 1为在线(接收分配、接收消息)2为隐身(不接收分配、只接收消息)3、休息
|
|
|
- 'user_info' => [], //在会话的用户cid key为clientid ,值为工单号
|
|
|
+ 'user_info' => [], //在会话的用户cid key为clientid ,值为工单号 ///////弃用 改为hash数据了
|
|
|
];
|
|
|
|
|
|
self::$redis->hset(self::KFINFOKEY, $uid, json_encode($newinfo, 256));
|
|
|
@@ -1196,9 +1196,8 @@ class Events
|
|
|
$nowTalking = $onlineKf = 0;
|
|
|
if (!empty($allkf)) {
|
|
|
foreach ($allkf as $kfuid => $val) {
|
|
|
- $tmp = json_decode($val, true);
|
|
|
$onlineKf++;
|
|
|
- $nowTalking += count($tmp['user_info']);
|
|
|
+ $nowTalking = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1490,15 +1489,9 @@ class Events
|
|
|
unset($oldlog['servicelog_id']);
|
|
|
|
|
|
///更新redis数据
|
|
|
- $kf_info_from['user_info'] = self::ArrayDataopt($kf_info_from['user_info'], $user_info['client_id'], 0);
|
|
|
- $kf_info_from['task'] = count($kf_info_from['user_info']);
|
|
|
- self::$redis->hset(self::KFINFOKEY, $fromkfuid, json_encode($kf_info_from, 256));
|
|
|
-
|
|
|
- ///////旧工单部分数据更新回库
|
|
|
- /// 查询工单会话总数.
|
|
|
+ self::updteKfTasksByservicd($fromkfuid, $serviceid, $user_info['client_id']);
|
|
|
|
|
|
self:: BeginTalk($toukfid, $uid, $groupidto, 0, $user_info);
|
|
|
-
|
|
|
self::servicetrutoother('OUT', $fromkfuid, $toukfid, $serviceid, $uid);
|
|
|
$newUserInfo = json_decode(self::$redis->hget(self::USERINFOKEY, $uid), true);
|
|
|
self::servicetrutoother('IN', $toukfid, $fromkfuid, $newUserInfo['serverid'], $uid);
|
|
|
@@ -1811,6 +1804,38 @@ class Events
|
|
|
self::$redis->hset($k, $clientid, $serviceid);
|
|
|
}
|
|
|
|
|
|
+ //有旧单时,更新连接ID
|
|
|
+ public static function updteKfTasksByservicd($kfuid, $serciceid, $newclientid, $opt = 1)
|
|
|
+ {
|
|
|
+ $tkey = self::getKfServiceKey($kfuid);
|
|
|
+ $all = self::getKfTasks($kfuid);
|
|
|
+
|
|
|
+ if ($opt == 1) {
|
|
|
+ if (empty($all)) {
|
|
|
+ self::$redis->hset($tkey, $newclientid, $serciceid);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ foreach ($all as $cid => $nowserverid) {
|
|
|
+ if ($nowserverid == $serciceid) {
|
|
|
+ self::$redis->hdel(self::getKfServiceKey($kfuid), $cid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self::$redis->hset($tkey, $newclientid, $serciceid);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ if (empty($all)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ foreach ($all as $cid => $nowserverid) {
|
|
|
+ if ($nowserverid == $serciceid) {
|
|
|
+ self::$redis->hdel(self::getKfServiceKey($kfuid), $cid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|