Browse Source

新建用户无法建立channel

visuddhinanda@gmail.com 4 years ago
parent
commit
d9067c7712

+ 6 - 4
public/app/db/channel.php

@@ -37,15 +37,17 @@ class Channel extends Table
 			}
 			$json = file_get_contents('php://input');
 			$data = json_decode($json,true);
-			$data["owner"] = $_COOKIE["userid"];			
+			$data["owner_uid"] = $_COOKIE["user_uid"];
+			$data["editor_id"] = $_COOKIE["user_id"];
 		}
 
-		$isExist = $this->medoo->has($this->table,["owner"=>$data["owner"],"name"=>$data["name"]]);
+		$isExist = $this->medoo->has($this->table,["owner_uid"=>$data["owner_uid"],"name"=>$data["name"]]);
 		if(!$isExist){
-			$data["id"] = UUID::v4();
+			$data["id"] = $this->SnowFlake->id();
+			$data["uid"] = UUID::v4();
 			$data["create_time"] = mTime();
 			$data["modify_time"] = mTime();
-			$result =  $this->_create($data,["id","owner","lang","name","summary","status","create_time","modify_time"]);
+			$result =  $this->_create($data,["id","uid","owner_uid",'editor_id',"lang","name","summary","status","create_time","modify_time"]);
 		}
 		else{
 			$this->result["ok"]=false;

+ 1 - 1
public/app/db/table.php

@@ -60,7 +60,7 @@ class Table
 			$updateDate
 		);
 
-		$updateDate["id"] = $this->medoo->id();
+		//$updateDate["id"] = $newData;
 		$this->result["data"] = $updateDate;
 		return $this->result;
 	}

+ 11 - 2
public/app/db/user.php

@@ -129,15 +129,24 @@ class User extends Table
 				$data["setting"] = "{}";
 				$result = $this->_create($data,["userid","username","email","password","nickname","setting","create_time","modify_time"]);
 				if($result["ok"]){
+                    $newUserId = $this->medoo->get(
+                        $this->table,
+                        'id',
+                        ["userid"=>$data['userid']]
+                    );
 					$channel = new Channel($this->redis);
-					$newChannel1 = $channel->create(["owner"=>$data["userid"],
+					$newChannel1 = $channel->create([
+                                                    "owner_uid"=>$data["userid"],
+                                                    "editor_id"=>$newUserId,
 													"lang"=>$data["lang"],
 													"name"=>$data["username"],
 													"lang"=>$data["lang"],
 													"status"=>30,
 													"summary"=>""
 													]);
-					$newChannel2 = $channel->create(["owner"=>$data["userid"],
+					$newChannel2 = $channel->create([
+                                                    "owner_uid"=>$data["userid"],
+                                                    "editor_id"=>$newUserId,
 													"lang"=>$data["lang"],
 													"name"=>"draft",
 													"lang"=>$data["lang"],

+ 2 - 2
public/app/ucenter/index.php

@@ -410,8 +410,8 @@ if ($op == "new") {
 
 					<div>
 						<span id='tip_password' class='form_field_name'><?php echo $_local->gui->password; ?></span>
-						<input type="password" name="password" placeholder="密码" value="<?php echo $post_password; ?>" />
-						<input type="password" name="repassword" placeholder="再次输入密码" value="<?php echo $post_password; ?>" />
+						<input type="password" name="password" placeholder="<?php echo $_local->gui->password; ?>" value="<?php echo $post_password; ?>" />
+						<input type="password" name="repassword" placeholder="<?php echo $_local->gui->password_again; ?>" value="<?php echo $post_password; ?>" />
 					</div>
 					<div class="form_help">
 					<?php echo $_local->gui->password_demond; ?>

+ 2 - 2
public/app/ucenter/reset.php

@@ -201,8 +201,8 @@ if (!isset($_GET["token"])) {
 					<div>
 						<div>
 							<span id='tip_password' class='form_field_name'><?php echo $_local->gui->password; ?></span>
-							<input type="password" id="password" maxlength="32" name="password" placeholder="密码" value="" />
-							<input type="password" id="repassword" maxlength="32" name="repassword" placeholder="再次输入密码" value="" />
+							<input type="password" id="password" maxlength="32" name="password" placeholder="<?php echo $_local->gui->password; ?>" value="" />
+							<input type="password" id="repassword" maxlength="32" name="repassword" placeholder="<?php echo $_local->gui->password_again; ?>" value="" />
 						</div>
 						<div class="form_help">至少6个字符</div>
 						<div id="error_password" class="form_error"></div>

+ 2 - 2
public/app/ucenter/sign_up.php

@@ -216,8 +216,8 @@ require_once "../redis/function.php";
 					<div>
 						<div>
 							<span id='tip_password' class='form_field_name'><?php echo $_local->gui->password; ?></span>
-							<input type="password" id="password"  maxlength="32"  name="password"  value="" />
-							<input type="password" id="repassword" maxlength="32"  name="repassword" placeholder="再次输入密码" value="" />
+							<input type="password" id="password"  maxlength="32"  name="password" placeholder="<?php echo $_local->gui->password; ?>" value="" />
+							<input type="password" id="repassword" maxlength="32"  name="repassword" placeholder="<?php echo $_local->gui->password_again; ?>" value="" />
 						</div>
 						<div class="form_help">
 						<?php echo $_local->gui->password_demond; ?>