فهرست منبع

支持新建账户自动增加两个channel

visuddhinanda 4 سال پیش
والد
کامیت
e63ab58abd
1فایلهای تغییر یافته به همراه24 افزوده شده و 1 حذف شده
  1. 24 1
      app/db/user.php

+ 24 - 1
app/db/user.php

@@ -1,6 +1,7 @@
 <?php
 require_once "../path.php";
 require_once "../db/table.php";
+require_once "../db/channel.php";
 require_once "../public/function.php";
 // Require Composer's autoloader.
 require_once '../../vendor/autoload.php';
@@ -119,7 +120,29 @@ class User extends Table
 				$data["create_time"] = mTime();
 				$data["modify_time"] = mTime();
 				$data["setting"] = "{}";
-				echo json_encode($this->_create($data,["userid","username","email","password","nickname","setting","create_time","modify_time"]), JSON_UNESCAPED_UNICODE);
+				$result = $this->_create($data,["userid","username","email","password","nickname","setting","create_time","modify_time"]);
+				if($result["ok"]){
+					$channel = new Channel($this->redis);
+					$newChannel1 = $channel->create(["owner"=>$data["userid"],
+													"lang"=>$data["lang"],
+													"name"=>$data["username"],
+													"lang"=>$data["lang"],
+													"status"=>30,
+													"summary"=>""
+													]);
+					$newChannel2 = $channel->create(["owner"=>$data["userid"],
+													"lang"=>$data["lang"],
+													"name"=>"draft",
+													"lang"=>$data["lang"],
+													"status"=>10,
+													"summary"=>""
+													]);
+					echo json_encode($newChannel1, JSON_UNESCAPED_UNICODE);
+					
+				}else{
+					echo json_encode($result, JSON_UNESCAPED_UNICODE);
+				}
+				
 			}else{
 				$this->result["ok"]=false;
 				$this->result["message"]="email_is_exist";