Browse Source

Merge branch 'master' of http://git.bocai108.com:10180/Ethan/Customer-Service

Jonlin 6 years ago
parent
commit
142a21bfcc

+ 9 - 1
application/index/controller/Index.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace app\index\controller;
 
 use think\Controller;
@@ -14,7 +15,7 @@ class Index extends Controller
     public function chat()
     {
         // 跳转到移动端
-        if(request()->isMobile()){
+        if (request()->isMobile()) {
             $param = http_build_query([
                 'id' => input('param.id'),
                 'name' => input('param.name'),
@@ -48,4 +49,11 @@ class Index extends Controller
 
         return $this->fetch();
     }
+
+    public function systime()
+    {
+        $time = time();
+        return json(['code' => 1, 'data' => ['time' => $time], 'msg' => '成功']);
+    }
+
 }

+ 6 - 0
application/index/controller/Register.php

@@ -8,6 +8,7 @@
 namespace app\index\controller;
 
 use think\Controller;
+use think\Db;
 
 class Register extends Controller
 {
@@ -114,6 +115,11 @@ class Register extends Controller
         }
 
 
+        $old = Db::name('accounts')->where(['account_name'=>$nowuid])->find();
+        if ($old){
+            return json(['code' => 1, 'data' => ['id' => $old['id'], 'name' => $nowuid, 'token' => $old['token'], 'avatar' => $avatar], 'msg' => '注册成功']);
+        }
+
         $now = time();
         $token = md5(uniqid() . rand(10000, 50000));
         $newdata = [

+ 5 - 1
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -241,7 +241,7 @@ class Events
      */
     public static function onMessage($client_id, $message)
     {
-        if ($message == '{"type":"ping"}') {
+        if ($message == '{"type":"ping"}' || $message == '{"message_type":"ping"}' ) {
             Gateway::sendToCurrentClient('{"type":"pong"}');
             return;
         } else {
@@ -620,6 +620,7 @@ class Events
                     'system' => Gateway::get_os(),
                     'ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '',
                     'group' => $message['group'],
+                    'intime' => time(),
                     'client_id' => $client_id
                 ];
 
@@ -667,6 +668,8 @@ class Events
     {
         $isKefuoff = isset($_SESSION['iskefu']) ? $_SESSION['iskefu'] : 0;
         $uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : false;
+        echo "下线:$uid  - $client_id - $isKefuoff \n";
+
         if (empty($uid)) {
             return;
         }
@@ -1085,6 +1088,7 @@ class Events
                 'system' => $res['data']['3']['system'],
                 'browse' => $res['data']['3']['browse'],
                 'status' => 1,
+                'intime'=>$res['data']['3']['intime'],
                 'end_time' => 0
             ];
             $hisSession = self::$db->select('*')->from('ws_service_log')->where('user_id=:user_id and kf_id=:kf_id and group_id=:group_id and status in (1,3)')->bindValues(array('user_id' => $res['data']['3']['id'], 'kf_id' => intval(ltrim($res['data']['0'], 'KF')), 'group_id' => $group))->row();