|
@@ -18,15 +18,15 @@ abstract class base_room extends base_info
|
|
|
protected $mParticipants;
|
|
|
protected $mRoomType;
|
|
|
protected $mod_room;
|
|
|
- protected $mCurRespMsgs;
|
|
|
+ protected $mRelayMsgs;
|
|
|
|
|
|
public function __construct($cinfos, $participants = [])
|
|
|
{
|
|
|
parent::__construct($cinfos);
|
|
|
|
|
|
$this->mRoomid = $this->room_id();
|
|
|
- $this->mCurRespMsgs['return'] = [];
|
|
|
- $this->mCurRespMsgs['broadcast'] = [];
|
|
|
+ $this->mRelayMsgs['users'] = [];
|
|
|
+ $this->mRelayMsgs['broadcast'] = [];
|
|
|
|
|
|
$this->mParticipants = $participants;
|
|
|
$this->mod_room = Model('room');
|
|
@@ -128,8 +128,8 @@ abstract class base_room extends base_info
|
|
|
if($type == false || $content == false) return false;
|
|
|
|
|
|
$this->record_message($userinfo['userid'],$type,$content);
|
|
|
- $this->add_broad('message',['from' => $userinfo,'type' => $input['type'],'content' => $content]);
|
|
|
- $this->add_return([$user],'message',['from' => $userinfo,'type' => $input['type'],'content' => $content]);
|
|
|
+ $this->relay_broadcast('message',['from' => $userinfo,'type' => $input['type'],'content' => $content]);
|
|
|
+ $this->relay_users([$user],'message',['from' => $userinfo,'type' => $input['type'],'content' => $content]);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -161,27 +161,28 @@ abstract class base_room extends base_info
|
|
|
$mod_room->addRoomMsg(['room_id' => $this->mRoomid,'member_id' => $userid, 'type' => $type,'msg' => $content,'add_time' => time()]);
|
|
|
}
|
|
|
|
|
|
- public function return_msgs()
|
|
|
+ public function relay_users_msgs()
|
|
|
{
|
|
|
- return $this->mCurRespMsgs['return'];
|
|
|
+ return $this->mRelayMsgs['users'];
|
|
|
}
|
|
|
- public function broadcast_msgs()
|
|
|
+ public function relay_broadcast_msgs()
|
|
|
{
|
|
|
- return $this->mCurRespMsgs['broadcast'];
|
|
|
+ return $this->mRelayMsgs['broadcast'];
|
|
|
}
|
|
|
|
|
|
protected function clear()
|
|
|
{
|
|
|
- $this->mCurRespMsgs['return'] = [];
|
|
|
- $this->mCurRespMsgs['broadcast'] = [];
|
|
|
+ $this->mRelayMsgs['users'] = [];
|
|
|
+ $this->mRelayMsgs['broadcast'] = [];
|
|
|
}
|
|
|
|
|
|
- protected function add_return(array $users, $op, $content)
|
|
|
+ protected function relay_users(array $users, $op, $content)
|
|
|
{
|
|
|
$msg = [];
|
|
|
|
|
|
$msg['act'] = "room";
|
|
|
$msg['op'] = "relay";
|
|
|
+ $msg['msgtype'] = "message";
|
|
|
$msg['relay_type'] = "roomusers";
|
|
|
$msg['receivers'] = $users;
|
|
|
$msg['room'] = $this->mRoomid;
|
|
@@ -192,28 +193,29 @@ abstract class base_room extends base_info
|
|
|
$msg['body']['room'] = $this->mRoomid;
|
|
|
$msg['body']['content'] = $content;
|
|
|
|
|
|
- $this->mCurRespMsgs['return'][] = $msg;
|
|
|
+ $this->mRelayMsgs['users'][] = $msg;
|
|
|
}
|
|
|
|
|
|
- protected function add_broad($op,$content)
|
|
|
+ protected function relay_broadcast($op, $content)
|
|
|
{
|
|
|
$msg = [];
|
|
|
|
|
|
$msg['act'] = "room";
|
|
|
$msg['op'] = "relay";
|
|
|
+ $msg['msgtype'] = "message";
|
|
|
$msg['relay_type'] = "room";
|
|
|
- $msg['receivers'] = [];
|
|
|
$msg['room'] = $this->mRoomid;
|
|
|
+ $msg['receivers'] = [];
|
|
|
$msg['receiver_type'] = $this->room_type();
|
|
|
|
|
|
-
|
|
|
$msg['body']['act'] = 'room';
|
|
|
$msg['body']['op'] = $op;
|
|
|
$msg['body']['room'] = $this->mRoomid;
|
|
|
$msg['body']['content'] = $content;
|
|
|
|
|
|
- $this->mCurRespMsgs['broadcast'][] = $msg;
|
|
|
+ $this->mRelayMsgs['broadcast'][] = $msg;
|
|
|
}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
protected function find($userid)
|
|
|
{
|