|
|
@@ -139,6 +139,15 @@ class Events
|
|
|
// 客服初始化
|
|
|
case 'init':
|
|
|
$kfList = self::$global->kfList;
|
|
|
+
|
|
|
+ //客服登陆验证 不符合的直接断掉
|
|
|
+ $logcheck = true ; //开发时使用
|
|
|
+ //$logcheck = self::KfloginChedk($client_id, $message);
|
|
|
+ if (!$logcheck) {
|
|
|
+ Gateway::closeCurrentClient();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
// 如果该客服未在内存中记录则记录
|
|
|
if (!isset($kfList[$message['group']]) || !array_key_exists($message['uid'], $kfList[$message['group']])) {
|
|
|
|
|
|
@@ -325,6 +334,24 @@ class Events
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //客服登陆验证
|
|
|
+ public static function KfloginChedk($client, $messageArray)
|
|
|
+ {
|
|
|
+ $uid = isset($messageArray['uid']) ? ($messageArray['uid']) : '';
|
|
|
+ $token = isset($messageArray['token']) ? ($messageArray['token']) : '';
|
|
|
+ if (empty($uid) || empty($token)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $expire_time_vali = time() - 60 * 60 * 24 * 3;
|
|
|
+
|
|
|
+ $kfid = intval(substr($uid, 2));
|
|
|
+ $ret = self::$db->select('*')->from('ws_users')->where('id= :id and token=:token and expire_time>=:expire_time')->bindValues(array('id' => $kfid, 'token' => $token, 'expire_time' => $expire_time_vali))->row();
|
|
|
+ if ($ret) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
//用户发送邦定用户事件
|
|
|
public static function userInitEnt($client_id, $message)
|
|
|
{
|
|
|
@@ -816,7 +843,7 @@ class Events
|
|
|
$conversationId = self::$db->insert('ws_service_log')->cols($serviceLog)->query();
|
|
|
} else {
|
|
|
self::$db->update('ws_service_log')->cols(['status' => 1])->where('servicelog_id=' . $hisSession['servicelog_id'])->query();
|
|
|
- $conversationId = $hisSession['servicelog_id'];
|
|
|
+ $conversationId = $hisSession['servicelog_id'];
|
|
|
}
|
|
|
unset($serviceLog);
|
|
|
|