|
@@ -31,6 +31,7 @@ class tpl_group_home
|
|
|
private $room_id = 0;
|
|
|
private $participants = [];
|
|
|
private $relay_id = null;
|
|
|
+ private $is_room_member = 0;
|
|
|
|
|
|
public function __construct($user, $room_id,$relay_id=0)
|
|
|
{
|
|
@@ -49,6 +50,8 @@ class tpl_group_home
|
|
|
if(empty($this->room_info)) throw new Exception("聊天参数有误");
|
|
|
|
|
|
$this->participants = factory::participants($this->room_id);
|
|
|
+
|
|
|
+ $this->is_room_member = isset($this->participants[$this->cur_user]) ? 1 : 0;
|
|
|
}
|
|
|
|
|
|
public function show_cover()
|
|
@@ -98,7 +101,7 @@ class tpl_group_home
|
|
|
|
|
|
public function show_qrcode_btn()
|
|
|
{
|
|
|
- if(isset($this->participants[$this->cur_user])){
|
|
|
+ if($this->is_room_member){
|
|
|
echo "<div class='qrcode_btn'></div>";
|
|
|
}
|
|
|
}
|
|
@@ -125,7 +128,7 @@ class tpl_group_home
|
|
|
public function show_group_activity()
|
|
|
{
|
|
|
$html = "<div class=\"group_handle weui-flex\">";
|
|
|
- if(isset($this->participants[$this->cur_user])){
|
|
|
+ if($this->is_room_member){
|
|
|
$isManager = $this->isManager($this->cur_user) ? 1 : 0;
|
|
|
$notice = empty($this->room_info->notice()) ? 0 : 1;
|
|
|
|
|
@@ -180,14 +183,14 @@ class tpl_group_home
|
|
|
{
|
|
|
$html = '';
|
|
|
|
|
|
- if (!empty($this->participants) && isset($this->participants[$this->cur_user]))
|
|
|
+ if (!empty($this->participants) && $this->is_room_member)
|
|
|
{
|
|
|
//对群内成员展示
|
|
|
if($limit > 0) {
|
|
|
//限制展示 5*5
|
|
|
$max = $limit - 1;//留一个位置给管理员
|
|
|
//留一个位置给加号
|
|
|
- if (isset($this->participants[$this->cur_user])) {
|
|
|
+ if ($this->is_room_member) {
|
|
|
$max = $max - 1;
|
|
|
}
|
|
|
//留一个位置给减号
|
|
@@ -242,7 +245,7 @@ class tpl_group_home
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (isset($this->participants[$this->cur_user])) {
|
|
|
+ if ($this->is_room_member) {
|
|
|
$html .= "<div class=\"weui-flex__item app_inshow\">
|
|
|
<img src=\"" . RESOURCE_SITE_URL . "/mobile/talk/images/add_member.png\" id=\"add_member\" alt=\"\">
|
|
|
</div>";
|
|
@@ -369,7 +372,7 @@ class tpl_group_home
|
|
|
public function show_group_body()
|
|
|
{
|
|
|
$html = "";
|
|
|
- if (!empty($this->room_info) && isset($this->participants[$this->cur_user])) {
|
|
|
+ if (!empty($this->room_info) && $this->is_room_member) {
|
|
|
$avartar = $this->room_info->avatar();
|
|
|
$name = $this->room_info->has_name() ? $this->room_info->name() : "未命名";
|
|
|
|
|
@@ -535,7 +538,7 @@ class tpl_group_home
|
|
|
{
|
|
|
$html = "";
|
|
|
|
|
|
- if (!empty($this->participants) && isset($this->participants[$this->cur_user])) {
|
|
|
+ if (!empty($this->participants) && $this->is_room_member) {
|
|
|
if ($this->isManager($this->cur_user)) {
|
|
|
$html .= "
|
|
|
<div class=\"weui-cells\">
|
|
@@ -553,7 +556,7 @@ class tpl_group_home
|
|
|
public function show_group_footer()
|
|
|
{
|
|
|
$html = "";
|
|
|
- if(isset($this->participants[$this->cur_user]))
|
|
|
+ if($this->is_room_member)
|
|
|
{
|
|
|
$html .="<div class=\"weui-cells\">";
|
|
|
|
|
@@ -620,7 +623,7 @@ class tpl_group_home
|
|
|
</div>";
|
|
|
}
|
|
|
|
|
|
- if(isset($this->participants[$this->cur_user]))
|
|
|
+ if($this->is_room_member)
|
|
|
{
|
|
|
$html.="<div class=\"weui-cells app_inshow\">
|
|
|
<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"hide_msg\">
|
|
@@ -645,7 +648,7 @@ class tpl_group_home
|
|
|
|
|
|
public function show_footer_leave_btn(){
|
|
|
$html = "";
|
|
|
- if (isset($this->participants[$this->cur_user]))
|
|
|
+ if ($this->is_room_member)
|
|
|
{
|
|
|
if($this->isManager($this->cur_user))
|
|
|
{
|
|
@@ -665,7 +668,7 @@ class tpl_group_home
|
|
|
public function show_footer_apply_btn()
|
|
|
{
|
|
|
$html = "";
|
|
|
- if (!isset($this->participants[$this->cur_user]))
|
|
|
+ if (!$this->is_room_member)
|
|
|
{
|
|
|
$pwd = $this->room_info->passwd();
|
|
|
$from_qr = $this->isFromQr();
|
|
@@ -726,7 +729,7 @@ class tpl_group_home
|
|
|
|
|
|
public function app_download()
|
|
|
{
|
|
|
- if(isset($this->participants[$this->cur_user]) && !session_helper::isapp())
|
|
|
+ if($this->is_room_member && !session_helper::isapp())
|
|
|
{
|
|
|
echo "<div class=\"fixed_bottom\">
|
|
|
<span class=\"flex_logo\"></span>
|
|
@@ -738,4 +741,9 @@ class tpl_group_home
|
|
|
</div>";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function get_is_room_member() {
|
|
|
+ return intval($this->is_room_member);
|
|
|
+ }
|
|
|
}
|