1
0
mirror of https://gitee.com/zhc02/timely_service.git synced 2025-08-01 12:17:59 +08:00
This commit is contained in:
柏尘 2019-12-17 13:50:17 +08:00
parent d30b63abc2
commit 681e925f7e
4 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ class Index extends Controller
if (!$uid || !$kefu_code ) {
return '参数错误';
}
$sql = "SELECT * FROM chat_log WHERE ( from_id = '{$uid}' and to_id ='{$kefu_code}') or (from_id = '{$kefu_code}' and to_id ='{$uid}') order by create_time";
$sql = "SELECT * FROM ty_chat_log WHERE ( from_id = '{$uid}' and to_id ='{$kefu_code}') or (from_id = '{$kefu_code}' and to_id ='{$uid}') order by create_time";
$list = Db::query($sql);
if (empty($list)) return json($list);
foreach ($list as $key => $item) {

View File

@ -40,7 +40,7 @@ class Kefu extends Base
if (!$uid || !$kefu_code ) {
return '参数错误';
}
$sql = "SELECT * FROM chat_log WHERE ( from_id = '{$kefu_code}' and to_id ='{$uid}') or (from_id = '{$uid}' and to_id ='{$kefu_code}') order by create_time";
$sql = "SELECT * FROM ty_chat_log WHERE ( from_id = '{$kefu_code}' and to_id ='{$uid}') or (from_id = '{$uid}' and to_id ='{$kefu_code}') order by create_time";
$list = Db::query($sql);
if (empty($list)) return json(['code'=>200,'data'=>$list,'msg'=>'操作成功']);
foreach ($list as $key => $item) {

View File

@ -14,6 +14,7 @@ use think\Exception;
use think\facade\Log;
use Logic\KefuLogic;
use exception\LogicException;
use Logic\ServiceLogic;
use exception\BaseException;
use Logic\QueueLogic;
use Logic\Visitor;
@ -54,7 +55,7 @@ class Event
* @param $fd 客户端标识
* @param $data 请求数据
*/
public static function kefuLogin($fd, $data, $server)
public static function kefuConnection($fd, $data, $server)
{
try {
@ -71,7 +72,6 @@ class Event
self::$kefu[$data['uid']]['visitor_fds'][$item['visitor_id']] = $item['client_id'];
}
}
Log::record('WebSocket请求开始数据信息[' . json_encode($frame) . ']');
QueueLogic::updateQueueingkefuClientid($kefu_code, $fd);
return self::reposon($fd, 200, '客服上线成功', [], 'kefu_online');
} catch (BaseException $e) {
@ -178,7 +178,7 @@ class Event
return self::reposon($fd, 200, $kefu_info['msg'], $kefu_info['data'], 'visitorToKefu');
} catch (Exception $e) {
Db::rollback();
Log::error('分配客服数据错误信息:' . $e->getMessage());
Log::info('分配客服数据错误信息:' . $e->getMessage());
//取消客服在线状态
KefuLogic::setKefuOnlineStatus(ltrim($kefu_info['data']['kefu_code'], 'KF_'), '', 0);
return self::reposon($fd, 401, '请重新尝试分配客服1', [], 'visitorToKefu');
@ -190,7 +190,7 @@ class Event
Db::commit();
} catch (BaseException $e) {
Db::rollback();
Log::error('分配客服数据错误信息:' . $e->getMessage());
Log::record('分配客服数据错误信息:' . $e->getMessage());
return self::reposon($fd, 402, '请重新尝试分配客服2', [], 'visitorToKefu');
}
unset($customer, $kefu_info);

View File

@ -17,7 +17,7 @@ use think\facade\Env;
return [
// 扩展自身配置
'host' => '0.0.0.0', // 监听地址
'port' => 9510, // 监听端口
'port' => 9111, // 监听端口
'type' => 'socket', // 服务类型 支持 socket http server
'mode' => '', // 运行模式 默认为SWOOLE_PROCESS
'sock_type' => '', // sock type 默认为SWOOLE_SOCK_TCP
@ -27,7 +27,7 @@ return [
'daemonize' => false,
'pid_file' => Env::get('runtime_path') . 'swoole_server.pid',
'log_file' => Env::get('runtime_path') . 'swoole_server.log',
'worker_num'=>1,
// 事件回调定义
'onOpen' => [new app\swoole\service\Service(),'onOpen'],
'onMessage' => [new app\swoole\service\Service(),'onMessage'],