huangdong 6 anni fa
parent
commit
3e5b817620

+ 20 - 12
helper/room/tpl_group_home.php

@@ -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);
+    }
 }

+ 33 - 44
mobile/control/festval.php

@@ -260,49 +260,43 @@ class festvalControl extends mobileControl
     //不需要登录 点击里面的按钮需要登录
     public function double11_stepsOp()
     {
-        $from = strtotime("2018-08-14");//2018-11-05
-        $to   = strtotime("2018-12-18");//2018-11-12
-        if(!$this->activity_validate($from,$to)){
-            return self::outsuccess(null,'festival/end/index');
-        }
-        else
-        {
-            $userSteps = $this->userSteps_ranking($from,$to);
-
-            $user_first = $user_second = $user_third = $user_list = [];
-            $last_steps = 0;
-            for($i=1;$i<=8;$i++)
-            {
-                if($i == 1) {
-                    $user_first  = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1);
-                    $last_steps = $user_first["steps"];
-                }elseif($i == 2) {
-                    $user_second = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1,$last_steps);
-                    $last_steps = $user_second["steps"];
-                }elseif($i == 3) {
-                    $user_third  = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1,$last_steps);
-                    $last_steps = $user_third["steps"];
-                }else{
-                    $user_item = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1,$last_steps);
-                    $last_steps = $user_item["steps"];
-                    $user_list[] =$user_item;
-                }
-            }
+        $from = strtotime("2018-11-04");//2018-11-05
+        $to   = strtotime("2018-11-13");//2018-11-12
+        $userSteps = $this->userSteps_ranking($from,$to);
 
-            if(session_helper::isapp()) {
-                $url = schema_helper::openurl("我的捐步" ,BASE_SITE_URL."/mobile/index.php?act=member_talk&op=steps_detail");
-            } else {
-                $url = BASE_SITE_URL."/mobile/index.php?act=member_talk&op=steps_detail";
+        $user_first = $user_second = $user_third = $user_list = [];
+        $last_steps = 0;
+        for($i=1;$i<=8;$i++)
+        {
+            if($i == 1) {
+                $user_first  = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1);
+                $last_steps = $user_first["steps"];
+            }elseif($i == 2) {
+                $user_second = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1,$last_steps);
+                $last_steps = $user_second["steps"];
+            }elseif($i == 3) {
+                $user_third  = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1,$last_steps);
+                $last_steps = $user_third["steps"];
+            }else{
+                $user_item = isset($userSteps[$i-1]) ? $userSteps[$i-1] : $this->fake_user($i-1,$last_steps);
+                $last_steps = $user_item["steps"];
+                $user_list[] =$user_item;
             }
+        }
 
-            return self::outsuccess([
-                "user_first" =>$user_first,
-                "user_second"=>$user_second,
-                "user_third" =>$user_third,
-                "user_steps" =>$user_list,
-                "steps_url"  =>$url
-            ],'festival/double11/steps');
+        if(session_helper::isapp()) {
+            $url = schema_helper::openurl("我的捐步" ,BASE_SITE_URL."/mobile/index.php?act=member_talk&op=steps_detail");
+        } else {
+            $url = BASE_SITE_URL."/mobile/index.php?act=member_talk&op=steps_detail";
         }
+
+        return self::outsuccess([
+            "user_first" =>$user_first,
+            "user_second"=>$user_second,
+            "user_third" =>$user_third,
+            "user_steps" =>$user_list,
+            "steps_url"  =>$url
+        ],'festival/double11/steps');
     }
 
     private function userSteps_ranking($from,$to)
@@ -371,11 +365,6 @@ class festvalControl extends mobileControl
         }
         return $arr[$index];
     }
-
-    public function double11_gameOp()
-    {
-        //
-    }
 }
 
 class festval_support extends storage

+ 2 - 1
mobile/control/index.php

@@ -94,6 +94,7 @@ class indexControl extends specialControl
         $talk_type = trim($_GET['talk_type']);
         $talk_id  = intval($_GET['talk_id']);
         $relay_id = intval($_GET['relay_id']);
+        $open_talk = intval($_GET['open_talk']);
 
         if($talk_id <= 0) {
             return self::outerr(errcode::ErrParamter);
@@ -108,7 +109,7 @@ class indexControl extends specialControl
 
         $is_app = intval(session_helper::isapp());
         $user = session_helper::memberid();
-        $param = ["talk_type" => $talk_type, "talk_id"   => $talk_id , "member_id" => $user,"room_name"=>"","room_avatar"=>"","relay_id"=>$relay_id,"is_app"=>$is_app];
+        $param = ["talk_type" => $talk_type, "talk_id"   => $talk_id , "member_id" => $user,"room_name"=>"","room_avatar"=>"","relay_id"=>$relay_id,"is_app"=>$is_app,"open_talk"=>$open_talk];
 
         if(!session_helper::logined())
         {

+ 15 - 0
mobile/templates/default/talk/homepage_room.php

@@ -111,6 +111,8 @@
             var relay_id = <?php echo $output['param']['relay_id'];  ?>;
             var room_name = '<?php echo $output['param']['room_name'];  ?>';
             var room_avatar = '<?php echo $output['param']['room_avatar'];  ?>';
+            var open_talk = <?php echo $output['param']['open_talk']; ?>;
+            var is_room_member = <?php echo $output['tpl']->get_is_room_member(); ?>;
 
             if(is_app) {
                 var jsBridge = new Bridge();
@@ -127,6 +129,19 @@
                             return;
                         }
                         else {
+                            if(open_talk>0 && is_room_member>0){
+                                var jsonobject = {
+                                    action:"chat_to",
+                                    params:{
+                                        talk_type:"room",
+                                        talk_id:talk_id,
+                                        name:'<?php echo str_replace("'","",$output['param']['room_name'])?>'
+                                    }
+                                };
+                                jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
+                                return;
+                            }
+
                             sessionStorage.setItem('is_reload','true');
                             window.location.reload();
                         }

+ 1 - 1
mobile/templates/default/talk/official_rooms.php

@@ -181,7 +181,7 @@
 
         $(document).on('click','.room-detail',function(){
             var id = $(this).attr('data-room-id');
-            window.location.href = "/mobile/index.php?act=index&op=room_index&talk_type=room&talk_id="+id;
+            window.location.href = "/mobile/index.php?act=index&op=room_index&talk_type=room&talk_id="+id+"&open_talk=1";
         });
     });
 </script>