Browse Source

lang status 从channel获取

visuddhinanda 4 years ago
parent
commit
afe06eee60
1 changed files with 75 additions and 4 deletions
  1. 75 4
      public/app/studio/project.php

+ 75 - 4
public/app/studio/project.php

@@ -20,8 +20,13 @@ require_once __DIR__."/./book_list_en.inc";
 require_once __DIR__."/../ucenter/function.php";
 require_once __DIR__."/../ucenter/setting_function.php";
 require_once __DIR__."/../lang/function.php";
+require_once __DIR__."/../redis/function.php";
+require_once __DIR__."/../channal/function.php";
 require_once __DIR__."/../public/app/public/snowflakeid.php";
 
+# 雪花id
+$snowflake = new SnowFlakeId();
+
 $user_setting = get_setting();
 
 $sLang["1"] = "pali";
@@ -48,6 +53,10 @@ if ($_COOKIE["uid"]) {
     echo '<a href="../ucenter/index.php" target="_blank">' . $_local->gui->not_login . '</a>';
     exit;
 }
+
+$channelClass = new Channal(redis_connect());
+$channelInfo = $channelClass->getChannal($_POST['channal']);
+
 switch ($op) {
     case "create":
         //判断单词数量 太大的不能加载
@@ -150,7 +159,22 @@ switch ($op) {
                                     }
                                     $block_id = UUID::v4();
                                     $trans_block_id = UUID::v4();
-                                    $block_data[] = array($block_id, "", $_POST["channal"], $USER_ID, $book, $iPar, "_none_", $_POST["lang"], 10,mTime());
+                                    $block_data[] = array
+									(
+										$snowflake->id(),
+										$block_id, 
+										"", 
+										$_POST["channal"], 
+										$_COOKIE['userid'], 
+										$_COOKIE['uid'], 
+										$book, 
+										$iPar, 
+										"_none_", 
+										$channelInfo["lang"],
+										$channelInfo["status"],
+										mTime(),
+										mTime()
+									);
                                     $block_list[] = array("channal" => $_POST["channal"],
                                         "type" => 6, //word by word
                                         "book" => $res_book,
@@ -186,7 +210,22 @@ switch ($op) {
                                         $strXml .= "<style>{$result["style"]}</style>";
                                         $strXml .= "<status>0</status>";
                                         $strXml .= "</word>";
-                                        $wbw_data[] = array(UUID::v4(), $block_id, $book, $iPar, $result["wid"], $result["real"], $strXml, mTime(), 10, $_COOKIE['userid']);
+                                        $wbw_data[] = array
+										(
+											$snowflake->id(),
+											UUID::v4(), 
+											$block_id, 
+											$book, 
+											$iPar, 
+											$result["wid"], 
+											$result["real"], 
+											$strXml, 
+											mTime(), 
+											mTime(), 
+											$channelInfo["status"], 
+											$_COOKIE['userid'],
+											$_COOKIE['uid']
+										);
                                     }
                                 }
                             }
@@ -197,7 +236,23 @@ switch ($op) {
                             PDO_Connect(_FILE_DB_USER_WBW_,_DB_USERNAME_,_DB_PASSWORD_);
                             $PDO->beginTransaction();
 
-                            $query = "INSERT INTO "._TABLE_USER_WBW_BLOCK_." ( uid , parent_id , channel_uid , creator_uid , book_id , paragraph , style , lang , status , modify_time ,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,now())";
+                            $query = "INSERT INTO "._TABLE_USER_WBW_BLOCK_." 
+									( 
+										id,
+										uid , 
+										parent_id , 
+										channel_uid , 
+									 	creator_uid , 
+										editor_id,
+										book_id , 
+										paragraph , 
+									  	style , 
+									  	lang , 
+									  	status , 
+									  	create_time ,
+									  	modify_time 
+									) 
+									  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
                             $stmt = $PDO->prepare($query);
                             foreach ($block_data as $oneParam) {
                                 $stmt->execute($oneParam);
@@ -215,7 +270,23 @@ switch ($op) {
                             // 开始一个事务,关闭自动提交
 
                             $PDO->beginTransaction();
-                            $query = "INSERT INTO "._TABLE_USER_WBW_." ( uid , block_uid , book_id , paragraph , wid , word , data , modify_time , status , creator_uid ,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,now())";
+                            $query = "INSERT INTO "._TABLE_USER_WBW_." 
+										( 
+										  id,
+										  uid , 
+										  block_uid , 
+										  book_id , 
+										  paragraph , 
+										  wid , 
+										  word , 
+										  data , 
+										  create_time , 
+										  modify_time , 
+										  status , 
+										  creator_uid ,
+										  editor_id
+										)
+										  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
                             $stmt = $PDO->prepare($query);
                             foreach ($wbw_data as $oneParam) {
                                 $stmt->execute($oneParam);