|
@@ -21,12 +21,12 @@ class tpl_group_home
|
|
|
private $mod_room = null;
|
|
|
private $room_info = null;
|
|
|
private $cur_user = 0;
|
|
|
- private $room_id = 0;
|
|
|
+ private $room_id = 0;
|
|
|
private $participants = [];
|
|
|
|
|
|
public function __construct($user, $room_id)
|
|
|
{
|
|
|
- if($room_id <= 0){
|
|
|
+ if ($room_id <= 0) {
|
|
|
throw new Exception("聊天参数有误");
|
|
|
}
|
|
|
$this->mod_room = Model('room');
|
|
@@ -46,10 +46,9 @@ class tpl_group_home
|
|
|
{
|
|
|
$html = "";
|
|
|
$url = RESOURCE_SITE_URL. "/mobile/talk/images/cover.png";
|
|
|
- $html .= "<div class=\"cover\">
|
|
|
+ $html.="<div class=\"cover\">
|
|
|
<img src=\" {$url} \" alt=\"cover\">
|
|
|
- </div>";
|
|
|
-
|
|
|
+ </div>";
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
@@ -64,22 +63,29 @@ class tpl_group_home
|
|
|
$avartar = $this->room_info->avatar();
|
|
|
$desc = $this->room_info->room_desc();
|
|
|
|
|
|
- $html = '';
|
|
|
- $html .= "<div class=\"group_avatar\">
|
|
|
+ $html ="<div class=\"group_avatar\">
|
|
|
<img src=\"{$avartar}\" class='g_avatar' alt=\"group_avatar\">
|
|
|
- </div>
|
|
|
- <div class=\"group_name\">
|
|
|
+ </div>
|
|
|
+ <div class=\"group_name\">
|
|
|
<h3>{$name}</h3>
|
|
|
+ <span class=\"certification_logo\"></span>
|
|
|
<p>{$desc}</p>
|
|
|
- </div>
|
|
|
- <div class='qrcode_btn'></div>";
|
|
|
+ </div>";
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function show_qrcode_btn()
|
|
|
+ {
|
|
|
+ if(isset($this->participants[$this->cur_user])){
|
|
|
+ echo "<div class='qrcode_btn'></div>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function show_group_notice()
|
|
|
{
|
|
|
$html = "";
|
|
|
-
|
|
|
$notice = $this->room_info->notice();
|
|
|
if(empty($notice))
|
|
|
{
|
|
@@ -93,11 +99,31 @@ class tpl_group_home
|
|
|
<p class=\"text_overflow\">【公告】{$notice}</p>
|
|
|
</div>";
|
|
|
}
|
|
|
+ echo $html;
|
|
|
+ }
|
|
|
|
|
|
+ public function show_group_activity()
|
|
|
+ {
|
|
|
+ $html = "";
|
|
|
+ if(isset($this->participants[$this->cur_user])){
|
|
|
+ $html.="<div class=\"weui-flex__item group_bonus\">
|
|
|
+ <a href=\"/mobile/index.php?act=member_talk&op=share_bonus&room_id={$this->room_id}\">
|
|
|
+ <img src=\"".RESOURCE_SITE_URL."/mobile/talk/images/group_bonus.png\" alt=\"\">
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-flex__item group_goods\">
|
|
|
+ <img src=\"".RESOURCE_SITE_URL."/mobile/talk/images/group_goods.png\" alt=\"\">
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-flex__item group_sport\">
|
|
|
+ <img src=\"".RESOURCE_SITE_URL."/mobile/talk/images/group_sport.png\" alt=\"\">
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
|
- private function isManager($user) {
|
|
|
+
|
|
|
+ private function isManager($user)
|
|
|
+ {
|
|
|
return intval($user) === $this->room_info->owner();
|
|
|
}
|
|
|
|
|
@@ -105,18 +131,17 @@ class tpl_group_home
|
|
|
{
|
|
|
$html = '';
|
|
|
|
|
|
- if (!empty($this->participants))
|
|
|
- {
|
|
|
+ if (!empty($this->participants) && isset($this->participants[$this->cur_user])) {
|
|
|
$i = 1;
|
|
|
$cnt = count($this->participants);
|
|
|
- foreach ($this->participants as $uids => $member)
|
|
|
- {
|
|
|
- if($i < $cnt) {
|
|
|
+ foreach ($this->participants as $uids => $member) {
|
|
|
+ if ($i < $cnt) {
|
|
|
$div_head = "<div class=\"weui-flex__item\" data-member-id={$member['userid']}>";
|
|
|
} else {
|
|
|
$div_head = "<div class=\"weui-flex__item\" data-member-id={$member['userid']} data-last='true'> ";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
if($this->isManager($uids))
|
|
|
{
|
|
|
$head = "<img src=\"{$member['avatar']}\" alt=\"\">
|
|
@@ -139,15 +164,13 @@ class tpl_group_home
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (isset($this->participants[$this->cur_user]))
|
|
|
- {
|
|
|
+ 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))
|
|
|
- {
|
|
|
+ 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>";
|
|
@@ -158,18 +181,16 @@ class tpl_group_home
|
|
|
public function show_group_body()
|
|
|
{
|
|
|
$html = "";
|
|
|
+ if (!empty($this->room_info) && isset($this->participants[$this->cur_user])) {
|
|
|
+ $avartar = $this->room_info->avatar();
|
|
|
+ $name = $this->room_info->has_name() ? $this->room_info->name() : "未命名";
|
|
|
+ $notice = empty($this->room_info->notice()) ? "未设置" : "已设置";
|
|
|
+ $desc = empty($this->room_info->room_desc()) ? "未设置" : "已设置";
|
|
|
+ $level = $this->room_info->level() == 0 ? "未认证" : "已认证";
|
|
|
+ $apply = 17 > 0 ? "待处理" . 17 : "";
|
|
|
|
|
|
- if($this->room_info->has_name()){
|
|
|
- $name = $this->room_info->name();
|
|
|
- }else{
|
|
|
- $name = "未命名";
|
|
|
- }
|
|
|
- $avartar = $this->room_info->avatar();
|
|
|
- $notice = empty($this->room_info->notice()) ? "未设置" : "已设置";
|
|
|
- $desc = empty($this->room_info->room_desc()) ? "未设置" : "已设置";
|
|
|
- $level = $this->room_info->level() == 0 ? "未认证" : "已认证";
|
|
|
|
|
|
- $html .= "<a class=\"weui-cell weui-cell_access\" id='edit_group_name' href=\"javascript:;\">
|
|
|
+ $html .= "<a class=\"weui-cell weui-cell_access\" id='edit_group_name' href=\"javascript:;\">
|
|
|
<div class=\"weui-cell__bd\">
|
|
|
<p>群名称</p>
|
|
|
</div>
|
|
@@ -188,25 +209,33 @@ class tpl_group_home
|
|
|
|
|
|
<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\">
|
|
|
<div class=\"weui-cell__bd\">
|
|
|
- <p>企业认证</p>
|
|
|
+ <p>群认证</p>
|
|
|
</div>
|
|
|
<div class=\"weui-cell__ft\">{$level}</div>
|
|
|
</a>";
|
|
|
+ }
|
|
|
|
|
|
- if($this->isManager($this->cur_user))
|
|
|
- {
|
|
|
- $html .= "<a 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>
|
|
|
- </a>
|
|
|
- <a 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>
|
|
|
- </a>";
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
+ $html.="<a 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>
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <a 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>
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <a 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-apply-btn\">{$apply}</div>
|
|
|
+ </a>";
|
|
|
}
|
|
|
|
|
|
echo $html;
|
|
@@ -216,8 +245,7 @@ class tpl_group_home
|
|
|
{
|
|
|
$html = "";
|
|
|
|
|
|
- if(!empty($this->participants))
|
|
|
- {
|
|
|
+ if (!empty($this->participants) && isset($this->participants[$this->cur_user])) {
|
|
|
$html .= "
|
|
|
<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id='edit_nickname'>
|
|
|
<div class=\"weui-cell__bd\">
|
|
@@ -227,8 +255,7 @@ class tpl_group_home
|
|
|
</a>";
|
|
|
}
|
|
|
|
|
|
- if($this->isManager($this->cur_user))
|
|
|
- {
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
$html .= "
|
|
|
<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id='change_owner' >
|
|
|
<div class=\"weui-cell__bd\">
|
|
@@ -240,6 +267,84 @@ class tpl_group_home
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function show_group_footer()
|
|
|
+ {
|
|
|
+ $html = "";
|
|
|
+ if(isset($this->participants[$this->cur_user]))
|
|
|
+ {
|
|
|
+
|
|
|
+ $html .="<div class=\"weui-cells\">";
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
+ $pwd = $this->room_info->passwd();
|
|
|
+ if($pwd)
|
|
|
+ {
|
|
|
+ $html .= "<div class=\"weui-cell weui-cell_switch\" href=\"javascript:;\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>群密码</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\">
|
|
|
+ <label for=\"talk_top\" class=\"weui-switch-cp\">
|
|
|
+ <input id=\"talk_top\" class=\"weui-switch-cp__input\" type=\"checkbox\" checked='{$pwd}'>
|
|
|
+ <div class=\"weui-switch-cp__box\"></div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $html .= "<div class=\"weui-cell weui-cell_switch\" href=\"javascript:;\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>群密码</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\">
|
|
|
+ <label for=\"talk_top\" class=\"weui-switch-cp\">
|
|
|
+ <input id=\"talk_top\" class=\"weui-switch-cp__input\" type=\"checkbox\">
|
|
|
+ <div class=\"weui-switch-cp__box\"></div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $html .="<div class=\"weui-cell weui-cell_switch\" href=\"javascript:;\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>置顶聊天</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\">
|
|
|
+ <label for=\"talk_top\" class=\"weui-switch-cp\">
|
|
|
+ <input id=\"talk_top\" class=\"weui-switch-cp__input\" type=\"checkbox\">
|
|
|
+ <div class=\"weui-switch-cp__box\"></div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell weui-cell_switch\" href=\"javascript:;\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>消息免打扰</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\">
|
|
|
+ <label for=\"no_disturb\" class=\"weui-switch-cp\">
|
|
|
+ <input id=\"no_disturb\" class=\"weui-switch-cp__input\" type=\"checkbox\">
|
|
|
+ <div class=\"weui-switch-cp__box\"></div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isset($this->participants[$this->cur_user]))
|
|
|
+ {
|
|
|
+ $html.="<div class=\"weui-cells\">
|
|
|
+ <a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"hide_msg\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>清空聊天记录</p>
|
|
|
+ </div>
|
|
|
+ </a>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ echo $html;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function show_footer_btn()
|
|
|
{
|
|
|
$html = "";
|
|
@@ -259,7 +364,23 @@ class tpl_group_home
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //todo 申请加入此群按钮
|
|
|
+ $pwd = $this->room_info->passwd();
|
|
|
+ if($pwd){
|
|
|
+ $html .= "
|
|
|
+ <div class=\"quit\" id=\"add_group_pwd\">
|
|
|
+ <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\">密码入群</a>
|
|
|
+ </div>
|
|
|
+ <div class=\"quit\" id=\"add_group_apply\">
|
|
|
+ <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\">申请加群</a>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $html .= "
|
|
|
+ <div class=\"quit\" id=\"add_group\">
|
|
|
+ <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\">立即入群</a>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
}
|
|
|
echo $html;
|
|
|
}
|