Kaynağa Gözat

在studio中显示频道共享channel

visuddhinanda 5 yıl önce
ebeveyn
işleme
8459c05dc2
2 değiştirilmiş dosya ile 32 ekleme ve 7 silme
  1. 20 4
      app/channal/get.php
  2. 12 3
      app/studio/js/render.js

+ 20 - 4
app/channal/get.php

@@ -5,16 +5,27 @@ require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once '../ucenter/function.php';
 
-$_userinfo = new UserInfo();
+# 找我加入的群
+PDO_Connect("sqlite:"._FILE_DB_GROUP_);
+$query = "SELECT group_id from group_member where user_id = ?  limit 0,100";
+$my_group = PDO_FetchAll($query,array($_COOKIE["userid"]));
+$userList = array();
+$userList[] = $_COOKIE["userid"];
+foreach ($my_group as $key => $value) {
+	# code...
+	$userList[]=$value["group_id"];
+}
 
+//找自己的
 PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
-$query = "SELECT * from channal where owner = ?   limit 0,100";
+$query = "SELECT * from channal where owner = ?  limit 0,100";
 $Fetch_my = PDO_FetchAll($query,array($_COOKIE["userid"]));
 
+$place_holders = implode(',', array_fill(0, count($userList), '?'));
 # 找协作的
 $Fetch_coop = array();
-$query = "SELECT channal_id FROM cooperation WHERE  user_id = ? ";
-$coop_channal = PDO_FetchAll($query,array($_COOKIE["userid"]));
+$query = "SELECT channal_id FROM cooperation WHERE  user_id IN ($place_holders) ";
+$coop_channal = PDO_FetchAll($query,$userList);
 if(count($coop_channal)>0){
     foreach ($coop_channal as $key => $value) {
         # code...
@@ -26,6 +37,11 @@ if(count($coop_channal)>0){
     $Fetch_coop = PDO_FetchAll($query,$channal);
 }
 $all = array_merge_recursive($Fetch_my,$Fetch_coop);
+
+
+
+$_userinfo = new UserInfo();
+
 $output = array();
 foreach ($all as $key => $value) {
     # code...

+ 12 - 3
app/studio/js/render.js

@@ -1412,7 +1412,9 @@ function renderWordParBlockInner(elementBlock) {
 				output += render_tran_sent_block(book, paragraph, sent_begin, word_id, 0, true);
 				if (_my_channal != null) {
 					for (const iterator of _my_channal) {
-						output += render_tran_sent_block(book, paragraph, sent_begin, word_id, iterator.id, false);
+						if (iterator.status > 0) {
+							output += render_tran_sent_block(book, paragraph, sent_begin, word_id, iterator.id, false);
+						}
 					}
 				}
 				//句子预览结束
@@ -1562,7 +1564,9 @@ function renderWordParBlockInner(elementBlock) {
 	output += render_tran_sent_block(book, paragraph, sent_begin, word_id, 0, true);
 	if (_my_channal != null) {
 		for (const iterator of _my_channal) {
-			output += render_tran_sent_block(book, paragraph, sent_begin, word_id, iterator.id, false);
+			if (iterator.status > 0) {
+				output += render_tran_sent_block(book, paragraph, sent_begin, word_id, iterator.id, false);
+			}
 		}
 	}
 
@@ -1701,7 +1705,12 @@ function render_tran_sent_block(book, para, begin, end, channal = 0, readonly =
 		output += "<span>";
 
 		if (thischannal) {
-			output += thischannal.name + "-" + thischannal.lang;
+			output += thischannal.name + "-" + thischannal.lang + "@";
+			if (thischannal.username == getCookie("username")) {
+				output += "你的";
+			} else {
+				output += thischannal.nickname;
+			}
 		} else {
 			output += "未知的频道名";
 		}