/** * 用户注册信息存入 * @param [type] $email [description] * @param [type] $username [description] * @param [type] $password [description] * @return [type] [description] */ public static function getRegisterInfo($email, $username, $password) { $userkey = "u" . StringTools::getSui(); $addtime = StringTools::getDateKu(); // $res = DB::insert('insert into users (username, addtime,password,userkey,email) values (?, ?, ?, ?, ?)', [$username, $addtime,$password,$userkey,$email]); $res = DB::table('users')->insert(['username' => $username, 'addtime' => $addtime, 'password' => $password, 'userkey' => $userkey, 'email' => $email]); if ($res == "1") { return $userkey; } else { return "error"; } }
/** * 添加文章的一级回复 * @param [type] $userkey [description] * @param [type] $content [description] * @param [type] $articlekey [description] */ public static function addFristReply($userkey, $userkeybei, $content, $articlekey) { // 一级回复的key $replykey = "reply" . StringTools::getSui(); // 一级回复生成时间 $addtime = StringTools::getDateKu(); // 存入数据库 $res = DB::table('reply')->insert(['userkey_pin' => $userkey, 'userkey_bei' => $userkeybei, 'reply_key' => $replykey, 'content' => $content, 'article_key' => $articlekey, 'addtime' => $addtime, 'status' => '1']); if ($res == "1") { return "success"; } else { return "faild"; } }