Пример #1
0
 public function Inset_New_Article($bookname, $article_title, $content)
 {
     $article = new article();
     $bookinfo = new bookinfo();
     $Pinyin = new TransPinyin();
     $bookname_pinyin = $Pinyin->Pinyin($bookname);
     $bookid = $article->Get_Book_Id($bookname);
     $update = date("Y-m-d H:i:s", time());
     //插入article表 章节信息
     $return_status = $article->find()->createCommand()->insert('article', ['bookid' => $bookid, 'article_title' => $article_title, 'update' => $update])->execute();
     //获取本小说最后一章节articleid
     $Get_Article_Last_Id = $article->Get_Last_Article_Id($bookid);
     //创建目录且写入文本
     self::mkdir_and_write($bookname_pinyin, $Get_Article_Last_Id, $content);
     echo '写入路径->novel_directory/' . $bookname_pinyin . '/' . $Get_Article_Last_Id . '.txt' . "\n";
     //更新bookinfo信息
     $return_status = self::Update_Book_Info($bookid, $Get_Article_Last_Id, $article_title);
     if ($return_status) {
         echo '更新info信息成功->《' . $bookname . '》最新章节->' . $article_title . "\n";
     }
     // exit;
 }
Пример #2
0
 public function Get_Last_Article_Id($bookid)
 {
     $article = new article();
     $article_Array = $article->find()->where(['bookid' => $bookid])->orderBy('id desc')->asArray()->one();
     return $article_Array['id'];
 }