huangdong před 6 roky
rodič
revize
aacc9debf2
1 změnil soubory, kde provedl 39 přidání a 37 odebrání
  1. 39 37
      mobile/control/index.php

+ 39 - 37
mobile/control/index.php

@@ -92,7 +92,7 @@ class indexControl extends specialControl
     public function room_indexOp()
     {
         $talk_type = trim($_GET['talk_type']);
-        $talk_id  = intval($_GET['talk_id']);
+        $talk_id = intval($_GET['talk_id']);
         $relay_id = intval($_GET['relay_id']);
         $open_talk = intval($_GET['open_talk']);
 
@@ -100,57 +100,59 @@ class indexControl extends specialControl
             return self::outerr(errcode::ErrParamter);
         }
 
-        if(session_helper::need_wechat_author()) {
-            $author = new thrid_author\wxauthor();
-            $url = url_helper::room_detail_url($talk_type,$talk_id,$relay_id);
-            $url = $author->enter($url);
-            return self::outsuccess(['direct_uri' => $url],"redirect");
-        }
-
         $is_app = intval(session_helper::isapp());
+        $from_wechat = util::from_wechat();
         $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,"open_talk"=>$open_talk];
 
-        if(!session_helper::logined())
+        //app内打开请求授权登录
+        if(($is_app || !$from_wechat) && $user<= 0)
         {
             if($talk_type == "room") {
                 return self::outsuccess(['tpl' => null,"param" => $param],'talk/homepage_room');
-            } elseif($talk_type == 'chatwo') {
+            }elseif($talk_type == 'chatwo') {
                 return self::outsuccess(['tpl' => null,"param" => $param],'talk/homepage_chatwo');
-            } else {
+            }else {
                 return self::outerr(errcode::ErrParamter);
             }
         }
-        else
+
+        //微信内打开使用授权判断
+        if(session_helper::need_wechat_author()) {
+            $author = new thrid_author\wxauthor();
+            $url = url_helper::room_detail_url($talk_type,$talk_id,$relay_id);
+            $url = $author->enter($url);
+            return self::outsuccess(['direct_uri' => $url],"redirect");
+        }
+
+
+        if($talk_type == "room")
         {
-            if($talk_type == "room")
-            {
-                try {
-                    $room_id = $talk_id;
-                    $tpl = new room\tpl_group_home($user,$talk_id,$relay_id,$open_talk);
-                    $param["room_name"] = $tpl->get_room_info()->name();
-                    $param["room_avatar"] = $tpl->get_room_info()->avatar();
-                    return self::outsuccess(['tpl' => $tpl,"param" => $param],'talk/homepage_room');
-                } catch (Exception $ex) {
-                    Log::record("member_talk.room_detail error: room_id={$room_id} user={$user}",Log::ERR);
-                    return self::outerr(errcode::ErrParamter);
-                }
-            }
-            elseif($talk_type == 'chatwo')
-            {
-                try {
-                    $other = $talk_id;
-                    $tpl = new room\tpl_chatwo_home($user,$other);
-                    return self::outsuccess(['tpl' => $tpl,"param"=>$param],'talk/homepage_chatwo');
-                } catch (Exception $ex) {
-                    Log::record("member_talk.room_detail error: other={$other} user={$user}",Log::ERR);
-                    return self::outerr(errcode::ErrParamter);
-                }
+            try {
+                $room_id = $talk_id;
+                $tpl = new room\tpl_group_home($user,$talk_id,$relay_id,$open_talk);
+                $param["room_name"] = $tpl->get_room_info()->name();
+                $param["room_avatar"] = $tpl->get_room_info()->avatar();
+                return self::outsuccess(['tpl' => $tpl,"param" => $param],'talk/homepage_room');
+            } catch (Exception $ex) {
+                Log::record("member_talk.room_detail error: room_id={$room_id} user={$user}",Log::ERR);
+                return self::outerr(errcode::ErrParamter);
             }
-            else
-            {
+        }
+        elseif($talk_type == 'chatwo')
+        {
+            try {
+                $other = $talk_id;
+                $tpl = new room\tpl_chatwo_home($user,$other);
+                return self::outsuccess(['tpl' => $tpl,"param"=>$param],'talk/homepage_chatwo');
+            } catch (Exception $ex) {
+                Log::record("member_talk.room_detail error: other={$other} user={$user}",Log::ERR);
                 return self::outerr(errcode::ErrParamter);
             }
         }
+        else
+        {
+            return self::outerr(errcode::ErrParamter);
+        }
     }
 }