|
@@ -24,8 +24,9 @@ class tpl_group_home
|
|
|
private $cur_user = 0;
|
|
|
private $room_id = 0;
|
|
|
private $participants = [];
|
|
|
+ private $relay_id = null;
|
|
|
|
|
|
- public function __construct($user, $room_id)
|
|
|
+ public function __construct($user, $room_id,$relay_id=0)
|
|
|
{
|
|
|
if ($room_id <= 0) {
|
|
|
throw new Exception("聊天参数有误");
|
|
@@ -33,6 +34,7 @@ class tpl_group_home
|
|
|
$this->mod_room = Model('room');
|
|
|
$this->room_id = $room_id;
|
|
|
$this->cur_user = intval($user);
|
|
|
+ $this->relay_id = intval($relay_id);
|
|
|
|
|
|
$room = $this->mod_room->getRoom($room_id);
|
|
|
if(empty($room)) throw new Exception("房间不存在");
|
|
@@ -53,6 +55,10 @@ class tpl_group_home
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
|
+ public function get_room_info(){
|
|
|
+ return $this->room_info;
|
|
|
+ }
|
|
|
+
|
|
|
public function show_group_header()
|
|
|
{
|
|
|
if($this->room_info->has_name()){
|
|
@@ -69,14 +75,18 @@ class tpl_group_home
|
|
|
</div>
|
|
|
<div class=\"group_name\">
|
|
|
<h3>
|
|
|
- {$name}";
|
|
|
- if($this->room_info->level() > 0) {
|
|
|
- $html.= "<span class='certification_logo'></span>";
|
|
|
- };
|
|
|
- $html.= "</h3>";
|
|
|
+ {$name}";
|
|
|
|
|
|
- $html.= "<p>{$desc}</p>
|
|
|
+ if($this->room_info->level() > 0) {
|
|
|
+ $html.= "<span class='certification_logo'></span>
|
|
|
+ </h3><p>{$desc}</p>
|
|
|
+ </div>";
|
|
|
+ }else{
|
|
|
+ $html.= "
|
|
|
+ </h3><p>未认证</p>
|
|
|
</div>";
|
|
|
+ }
|
|
|
+
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
@@ -93,8 +103,8 @@ class tpl_group_home
|
|
|
$notice = $this->room_info->notice();
|
|
|
if(empty($notice))
|
|
|
{
|
|
|
- $html.= "<div class=\"group_notice_board\" style=\"display: none;\">
|
|
|
- <p class=\"text_overflow\"></p>
|
|
|
+ $html.= "<div class=\"group_notice_board\">
|
|
|
+ <p class=\"text_overflow\">【公告】</p>
|
|
|
</div>";
|
|
|
}
|
|
|
else
|
|
@@ -134,14 +144,22 @@ class tpl_group_home
|
|
|
return intval($user) === $this->room_info->owner();
|
|
|
}
|
|
|
|
|
|
+ private function isFromQr(){
|
|
|
+ return ($this->relay_id > 0 && isset($this->participants[$this->relay_id]));
|
|
|
+ }
|
|
|
+
|
|
|
public function show_members()
|
|
|
{
|
|
|
$html = '';
|
|
|
|
|
|
- if (!empty($this->participants) && isset($this->participants[$this->cur_user])) {
|
|
|
+ if (!empty($this->participants) && isset($this->participants[$this->cur_user]))
|
|
|
+ {
|
|
|
+ //对内展示
|
|
|
$i = 1;
|
|
|
$cnt = count($this->participants);
|
|
|
- foreach ($this->participants as $uids => $member) {
|
|
|
+
|
|
|
+ foreach ($this->participants as $uids => $member)
|
|
|
+ {
|
|
|
if ($i < $cnt) {
|
|
|
$div_head = "<div class=\"weui-flex__item member-detail\" data-member-id={$member['userid']}>";
|
|
|
} else {
|
|
@@ -169,30 +187,53 @@ class tpl_group_home
|
|
|
|
|
|
$i++;
|
|
|
}
|
|
|
- } else {
|
|
|
- foreach ($this->participants as $uids => $member) {
|
|
|
- if($this->isManager($member['userid']))
|
|
|
+
|
|
|
+ if (isset($this->participants[$this->cur_user])) {
|
|
|
+ $html .= "<div class=\"weui-flex__item\">
|
|
|
+ <img src=\"" . RESOURCE_SITE_URL . "/mobile/talk/images/add_member.png\" id=\"add_member\" alt=\"\">
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
+ $html .= "<div class=\"weui-flex__item\">
|
|
|
+ <img src=\"" . RESOURCE_SITE_URL . "/mobile/talk/images/del_member.png\" id=\"del_member\" alt=\"\">
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //对外展示 有在群中的relay_id则显示对应用户 or 默认管理员
|
|
|
+ if($this->relay_id > 0 && isset($this->participants[$this->relay_id]) )
|
|
|
+ {
|
|
|
+ foreach ($this->participants as $uids => $member)
|
|
|
{
|
|
|
- $html .= "<div class=\"weui-flex__item member-detail\" data-member-id={$member['userid']} data-last='true'>
|
|
|
+
|
|
|
+ if($this->relay_id == $member['userid']) {
|
|
|
+ $html .= "<div class=\"weui-flex__item member-detail\" data-member-id={$member['userid']} data-last='true'>
|
|
|
+ <img src=\"{$member['avatar']}\" alt=\"\">
|
|
|
+ <p>{$member['nickname']}</p>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach ($this->participants as $uids => $member)
|
|
|
+ {
|
|
|
+ if($this->isManager($member['userid']))
|
|
|
+ {
|
|
|
+ $html .= "<div class=\"weui-flex__item member-detail\" data-member-id={$member['userid']} data-last='true'>
|
|
|
<img src=\"{$member['avatar']}\" alt=\"\">
|
|
|
<p>{$member['nickname']}</p>
|
|
|
<span class=\"admin\">管理员</span>
|
|
|
</div>";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (isset($this->participants[$this->cur_user])) {
|
|
|
- $html .= "<div class=\"weui-flex__item\">
|
|
|
- <img src=\"" . RESOURCE_SITE_URL . "/mobile/talk/images/add_member.png\" id=\"add_member\" alt=\"\">
|
|
|
- </div>";
|
|
|
- }
|
|
|
|
|
|
- if ($this->isManager($this->cur_user)) {
|
|
|
- $html .= "<div class=\"weui-flex__item\">
|
|
|
- <img src=\"" . RESOURCE_SITE_URL . "/mobile/talk/images/del_member.png\" id=\"del_member\" alt=\"\">
|
|
|
- </div>";
|
|
|
- }
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
@@ -228,11 +269,18 @@ class tpl_group_home
|
|
|
$html.= "<div class=\"weui-cells\">";
|
|
|
$html.= $this->room_name_btn($click,$name);
|
|
|
$html.= $this->room_avatar_btn($avartar);
|
|
|
- $html.= $this->room_cert_btn($click,$level);
|
|
|
+ $html.= $this->room_nickname_btn();
|
|
|
$html.= "</div>";
|
|
|
|
|
|
- $html.= $this->room_manager_btn($desc,$notice,$apply,$cnt);
|
|
|
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
+ $html .= "<div class=\"weui-cells\">";
|
|
|
+// $html.= $this->room_desc_btn($desc);
|
|
|
+// $html.= $this->room_notice_btn($notice);
|
|
|
+ $html.= $this->room_cert_btn($click,$level);
|
|
|
+ $html.= $this->room_apply_btn($apply,$cnt);
|
|
|
+ $html.="</div>";
|
|
|
+ }
|
|
|
}
|
|
|
echo $html;
|
|
|
}
|
|
@@ -271,9 +319,7 @@ class tpl_group_home
|
|
|
}
|
|
|
|
|
|
private function room_cert_btn($click,$level)
|
|
|
- { if(!$this->isManager($this->cur_user)){
|
|
|
- return "";
|
|
|
- }
|
|
|
+ {
|
|
|
if($click){
|
|
|
$html = "<div class=\"weui-cell weui-cell_access\" id=\"group_AC\">
|
|
|
<div class=\"weui-cell__bd\">
|
|
@@ -292,71 +338,73 @@ class tpl_group_home
|
|
|
return $html;
|
|
|
}
|
|
|
|
|
|
- private function room_manager_btn($desc,$notice,$apply,$cnt){
|
|
|
- if ($this->isManager($this->cur_user))
|
|
|
- {
|
|
|
- $html = "<div class=\"weui-cells\">";
|
|
|
- $html.= "<div class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"edit_room_notice\">
|
|
|
- <div class=\"weui-cell__bd\">
|
|
|
- <p>群公告</p>
|
|
|
- </div>
|
|
|
- <div class=\"weui-cell__ft\" id=\"room-notice-btn\">{$notice}</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"edit_room_desc\">
|
|
|
- <div class=\"weui-cell__bd\">
|
|
|
- <p>群介绍</p>
|
|
|
- </div>
|
|
|
- <div class=\"weui-cell__ft\" id=\"room-desc-btn\">{$desc}</div>
|
|
|
- </div>
|
|
|
- ";
|
|
|
+ private function room_notice_btn($notice){
|
|
|
+ $html = "<div class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"edit_room_notice\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>群公告</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\" id=\"room-notice-btn\">{$notice}</div>
|
|
|
+ </div>";
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
|
|
|
- if ($cnt > 0)
|
|
|
- {
|
|
|
- $html.="
|
|
|
- <div class=\"weui-cell weui-cell_access\">
|
|
|
- <div class=\"weui-cell__bd\">
|
|
|
- <p>入群申请</p>
|
|
|
- </div>
|
|
|
- <div class=\"weui-cell__ft\" id=\"room-apply-btn\" style=\"color: #FF4E4E\">{$apply}</div>
|
|
|
- </div>";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $html.="
|
|
|
- <div class=\"weui-cell weui-cell_access\">
|
|
|
- <div class=\"weui-cell__bd\">
|
|
|
- <p>入群申请</p>
|
|
|
- </div>
|
|
|
- <div class=\"weui-cell__ft\">{$apply}</div>
|
|
|
- </div>";
|
|
|
- }
|
|
|
- $html .="</div>";
|
|
|
- }else{
|
|
|
- $html = "";
|
|
|
+ private function room_desc_btn($desc){
|
|
|
+ $html = "<div class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"edit_room_desc\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>群介绍</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\" id=\"room-desc-btn\">{$desc}</div>
|
|
|
+ </div>";
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function room_apply_btn($apply,$cnt)
|
|
|
+ {
|
|
|
+ if ($cnt > 0)
|
|
|
+ {
|
|
|
+ $html ="
|
|
|
+ <div class=\"weui-cell weui-cell_access\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>入群申请</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\" id=\"room-apply-btn\" style=\"color: #FF4E4E\">{$apply}</div>
|
|
|
+ </div>";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $html ="
|
|
|
+ <div class=\"weui-cell weui-cell_access\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>入群申请</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\">{$apply}</div>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function room_nickname_btn()
|
|
|
+ {
|
|
|
+ $html = "
|
|
|
+ <div class=\"weui-cells\">
|
|
|
+ <div class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id='edit_nickname'>
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>我在本群的昵称</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft group-nickname\">{$this->participants[$this->cur_user]['nickname']}</div>
|
|
|
+ </div>
|
|
|
+ </div>";
|
|
|
|
|
|
return $html;
|
|
|
}
|
|
|
|
|
|
- public function show_personal_settings()
|
|
|
+ public function change_manager_btn()
|
|
|
{
|
|
|
$html = "";
|
|
|
|
|
|
if (!empty($this->participants) && isset($this->participants[$this->cur_user])) {
|
|
|
- $html .= "
|
|
|
- <div class=\"weui-cells\">
|
|
|
- <div class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id='edit_nickname'>
|
|
|
- <div class=\"weui-cell__bd\">
|
|
|
- <p>我在本群的昵称</p>
|
|
|
- </div>
|
|
|
- <div class=\"weui-cell__ft group-nickname\">{$this->participants[$this->cur_user]['nickname']}</div>
|
|
|
- </div>
|
|
|
- </div>";
|
|
|
- }
|
|
|
-
|
|
|
- if ($this->isManager($this->cur_user)) {
|
|
|
- $html .= "
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
+ $html .= "
|
|
|
<div class=\"weui-cells\">
|
|
|
<div class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id='change_owner' >
|
|
|
<div class=\"weui-cell__bd\">
|
|
@@ -364,8 +412,8 @@ class tpl_group_home
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>";
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
@@ -465,7 +513,8 @@ class tpl_group_home
|
|
|
else
|
|
|
{
|
|
|
$pwd = $this->room_info->passwd();
|
|
|
- if($pwd){
|
|
|
+ $from_qr = $this->isFromQr();
|
|
|
+ if($pwd && !$from_qr){
|
|
|
$html .= "
|
|
|
<div class=\"join_item_btn\">
|
|
|
<div class=\"quit\" id=\"add_group_pwd\">
|
|
@@ -481,7 +530,7 @@ class tpl_group_home
|
|
|
$html .= "
|
|
|
<div class=\"join_item_btn\">
|
|
|
<div class=\"quit\" id=\"add_group\">
|
|
|
- <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\">立即入群</a>
|
|
|
+ <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\" data-relay-id='{$this->relay_id}'>立即入群</a>
|
|
|
</div>
|
|
|
</div>";
|
|
|
}
|
|
@@ -500,13 +549,13 @@ class tpl_group_home
|
|
|
// $save_path = BASE_UPLOAD_PATH."/room/qrcodes/{$this->room_id}_{$this->cur_user}.png";
|
|
|
// $qrcode_path = BASE_SITE_URL . "/data/upload/room/qrcodes/{$this->room_id}_{$this->cur_user}.png?v=" . time();
|
|
|
|
|
|
- $url = author_url::room_detail_url('room',$this->room_id);
|
|
|
- $save_path = BASE_UPLOAD_PATH."/room/qrcodes/{$this->room_id}.png";
|
|
|
- $qrcode_path = BASE_SITE_URL . "/data/upload/room/qrcodes/{$this->room_id}.png?v=" . time();
|
|
|
+ $url = url_helper::room_detail_url('room',$this->room_id,$this->cur_user);
|
|
|
+// $save_path = BASE_UPLOAD_PATH."/room/qrcodes/{$this->room_id}.png";
|
|
|
+// $qrcode_path = BASE_SITE_URL . "/data/upload/room/qrcodes/{$this->room_id}.png?v=" . time();
|
|
|
|
|
|
- if(!file_exists($save_path)) {
|
|
|
- util::qrcode_path($url, $save_path);
|
|
|
- }
|
|
|
+// if(!file_exists($save_path)) {
|
|
|
+// util::qrcode_path($url, $save_path);
|
|
|
+// }
|
|
|
|
|
|
$html = "<div class=\"qrcode\">
|
|
|
<div class=\"qrcode_info\">
|
|
@@ -516,9 +565,7 @@ class tpl_group_home
|
|
|
<p>$desc</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class=\"group_qrcode\">
|
|
|
- <img src=\"$qrcode_path\" alt=\"\">
|
|
|
- </div>
|
|
|
+ <div class=\"group_qrcode\" id='show-qrcode' data-qrcode-url=\"{$url}\"></div>
|
|
|
<p class=\"prompt\">
|
|
|
扫一扫上面的二维码图案。加入群聊
|
|
|
</p>
|