Ver Fonte

init....

vali há 6 anos atrás
pai
commit
93868bfb37

+ 29 - 0
application/service/controller/Ext.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace app\service\controller;
+
+use think\cache\driver\Redis;
+use think\Request;
+
+/**
+ * 客服系统 Event 接口
+ */
+class Ext extends Common
+{
+    public function __construct(Request $request = null)
+    {
+        parent::__construct($request);
+
+        // 验证token.
+        $this->verifyToken();
+    }
+
+    public function allConversation()
+    {
+
+
+
+    }
+
+
+}

+ 25 - 0
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -623,6 +623,7 @@ class Events
                 'task' => 0,
                 'intime' => time(),
                 'signature' => $kfinfo['signature'],
+                'kf_token' => $kfinfo['token'],
                 'status' => 2, // 1为在线(接收分配、接收消息)2为隐身(不接收分配、只接收消息)3、休息
                 'user_info' => [],  //在会话的用户cid  key为clientid ,值为工单号               ///////弃用 改为hash数据了
             ];
@@ -637,6 +638,7 @@ class Events
         $_SESSION['uid'] = $message['uid'];
         $_SESSION['name'] = $message['name'];
         $_SESSION['client_id'] = $client_id;
+        $_SESSION['kf_token'] = $kfinfo['token'];
 
         Gateway::joinGroup($client_id, 'group_' . $message['group']);
 
@@ -2476,5 +2478,28 @@ class Events
         return false;
     }
 
+
+    //公共请求接口
+    public static function getApiData($url, $paras, $api_token, $user_token)
+    {
+        if (empty($user_token)) {
+            if (isset($_SESSION['kf_token'])) {
+                $user_token = $_SESSION['kf_token'];
+            } else {
+                return ['status' => 0, 'msg' => 'token empty error', 'data' => []];
+            }
+        }
+
+        
+
+
+    }
+
+    //api token 生成
+    public static function apiTokenMake($module, $controller, $action)
+    {
+        return md5(strtolower($action . 'Customer-Service' . $controller . $module));
+    }
+
 }