Procházet zdrojové kódy

:construction: add snow id

Bhikkhu-Kosalla před 4 roky
rodič
revize
9036e4c284

+ 1 - 1
public/app/channal/channal.js

@@ -60,7 +60,7 @@ function my_channal_list() {
 						html += '<div style="max-width:2em;flex:1;"><input type="checkbox" /></div>';
 						html += "<div style='flex:0.5;'>" + key++ + "</div>";
 						html += "<div style='flex:2;'>";
-						html += "<guide url='../channal/card.php' gid='" + iterator.id + "'>";
+						html += "<guide url='../channal/card.php' gid='" + iterator.uid + "'>";
 						html += iterator.name;
 						html += "</guide>";
 						html += "</div>";

+ 5 - 2
public/app/channal/my_channal_put.php

@@ -4,12 +4,15 @@ require_once "../config.php";
 require_once "../public/_pdo.php";
 require_once '../public/function.php';
 require_once '../hostsetting/function.php';
+require_once __DIR__."/../public/snowflakeid.php";
+$snowflake = new SnowFlakeId();
+
 $respond=array("status"=>0,"message"=>"");
 if(isset($_COOKIE["userid"])){
 	PDO_Connect(_FILE_DB_CHANNAL_,_DB_USERNAME_,_DB_PASSWORD_);
-	$query="INSERT INTO "._TABLE_CHANNEL_." ( uid,  owner_uid  , editor_id, name  , summary ,  status  , lang, create_time , modify_time    )  VALUES  ( ?,? , ? , ? , ? , ? , ? , ? , ?  ) ";
+	$query="INSERT INTO "._TABLE_CHANNEL_." ( id, uid,  owner_uid  , editor_id, name  , summary ,  status  , lang, create_time , modify_time    )  VALUES  ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ?  ) ";
 	$sth = $PDO->prepare($query);
-	$sth->execute(array(UUID::v4() , $_COOKIE["user_uid"] , $_COOKIE["user_id"] , $_POST["name"] , "" , $_POST["status"] ,$_POST["lang"]  ,  mTime() ,  mTime() ));
+	$sth->execute(array($snowflake->id() , UUID::v4() , $_COOKIE["user_uid"] , $_COOKIE["user_id"] , $_POST["name"] , "" , $_POST["status"] ,$_POST["lang"]  ,  mTime() ,  mTime() ));
 	$respond=array("status"=>0,"message"=>"");
 	if (!$sth || ($sth && $sth->errorCode() != 0)) {
 		$error = PDO_ErrorInfo();