First commit
This commit is contained in:
50
app/im/controller/BaseMessage.php
Executable file
50
app/im/controller/BaseMessage.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Longbing [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright Chengdu longbing Technology Co., Ltd.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Website http://longbing.org/
|
||||
// +----------------------------------------------------------------------
|
||||
// | Sales manager: +86-13558882532 / +86-13330887474
|
||||
// | Technical support: +86-15680635005
|
||||
// | After-sale service: +86-17361005938
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\im\controller;
|
||||
|
||||
|
||||
class BaseMessage
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $server
|
||||
* @param $client_id
|
||||
* @param $action
|
||||
* @param bool $status
|
||||
* @param string $message
|
||||
* @param array $data
|
||||
* @功能说明:发送消息方式
|
||||
* @author jingshuixian
|
||||
* @DataTime: 2020/1/13 13:53
|
||||
*/
|
||||
public function sendServerMsg($server, $client_id , $action , $status = true, $message = '' , $data = []){
|
||||
|
||||
$dataStr = json_encode(
|
||||
[
|
||||
'action' => $action ,
|
||||
'status' => $status ,
|
||||
'message'=> $message ,
|
||||
'data' => $data,
|
||||
'time' => time()
|
||||
]
|
||||
);
|
||||
|
||||
$server->push($client_id , $dataStr) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user