chat_add
This commit is contained in:
17
extend/chat/model/Base.php
Normal file
17
extend/chat/model/Base.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace extend\chat\model;
|
||||
|
||||
use GatewayWorker\Lib\Gateway;
|
||||
use extend\chat\model\OnbocChat;
|
||||
use extend\chat\model\ShoppingChat;
|
||||
class Base
|
||||
{
|
||||
public function handles($client_id, $message)
|
||||
{
|
||||
if(empty($message['type']) || empty($message['operate_type']) || empty($message['user_id']) || empty($message['shop_id'])) {
|
||||
Gateway::sendToClient($client_id, json_encode(['msg' => '参数不完整']));
|
||||
return;
|
||||
}
|
||||
call_user_func_array(['extend\chat\model\\' . $message['type'], $message['operate_type']], [$client_id, $message]);
|
||||
}
|
||||
}
|
||||
24
extend/chat/model/OnbocChat.php
Normal file
24
extend/chat/model/OnbocChat.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace extend\chat\model;
|
||||
|
||||
use ba\Exception;
|
||||
use ba\Random;
|
||||
use support\Redis;
|
||||
use support\think\Db;
|
||||
use GatewayWorker\Lib\Gateway;
|
||||
use support\Log;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 管理端小程序
|
||||
*/
|
||||
class OnbocChat extends Base
|
||||
{
|
||||
// 初始化
|
||||
public static function init(string $client_id, array $message):void
|
||||
{
|
||||
print_r(date('H:i:s') . '--初始化运营聊天' . $client_id . $client_id . "\r\n");
|
||||
}
|
||||
|
||||
}
|
||||
25
extend/chat/model/ShoppingChat.php
Normal file
25
extend/chat/model/ShoppingChat.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace extend\chat\model;
|
||||
|
||||
use Exception;
|
||||
use ba\Random;
|
||||
use support\Redis;
|
||||
use support\think\Db;
|
||||
use GatewayWorker\Lib\Gateway;
|
||||
use support\Log;
|
||||
|
||||
/**
|
||||
* 用户端
|
||||
*/
|
||||
class ShoppingChat extends Base
|
||||
{
|
||||
|
||||
// 初始化
|
||||
public static function init(string $client_id, array $message):void
|
||||
{
|
||||
print_r( date('H:i:s') . '--初始化运用户聊天' . $client_id . "\r\n");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user