|
@@ -24,6 +24,7 @@ class tpl_group_home
|
|
|
private $cur_user = 0;
|
|
|
private $room_id = 0;
|
|
|
private $participants = [];
|
|
|
+ private $relay_id = 0;
|
|
|
|
|
|
public function __construct($user, $room_id)
|
|
|
{
|
|
@@ -97,8 +98,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
|
|
@@ -138,14 +139,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 {
|
|
@@ -173,30 +182,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)
|
|
|
+ {
|
|
|
+
|
|
|
+ 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)
|
|
|
{
|
|
|
- $html .= "<div class=\"weui-flex__item member-detail\" data-member-id={$member['userid']} data-last='true'>
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
@@ -469,7 +501,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\">
|
|
@@ -485,7 +518,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>";
|
|
|
}
|
|
@@ -505,12 +538,12 @@ class tpl_group_home
|
|
|
// $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();
|
|
|
+// $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\">
|
|
@@ -520,9 +553,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>
|