-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathDistribute.php
More file actions
102 lines (93 loc) · 2.35 KB
/
Distribute.php
File metadata and controls
102 lines (93 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* Chat room message distribution
*/
namespace RongCloud\Lib\Chatroom\Distribute;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Distribute {
/**
* Stop the chat room message distribution path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Distribute/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for verification
*
* @var string
* Configuration file for verification
*
* @var string
*
*/
private $verify = '';
/**
* Distribute constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Stop chatroom message distribution
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//chatroom id
* ];
* @return mixed|null
*/
public function stop(array $Chatroom=[]){
$conf = $this->conf['stop'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Restore chatroom message distribution
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//chatroom id
* ];
* @return mixed|null
*/
public function resume(array $Chatroom=[]){
$conf = $this->conf['resume'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
}