* [misc] add method to set doc html to doc content.

This commit is contained in:
sunhao
2024-11-28 10:52:57 +08:00
committed by 丁永亮
parent 7d9a4bafef
commit 18c6b1316d
+17
View File
@@ -801,6 +801,7 @@ class docModel extends model
$docs = $this->dao->select('t1.*,t2.title,t2.content,t2.type as contentType,t2.html')->from(TABLE_DOC)->alias('t1')
->leftJoin(TABLE_DOCCONTENT)->alias('t2')->on('t1.id=t2.doc && t1.version=t2.version')
->where('t2.type')->eq('doc')
->andWhere('t1.status')->ne('draft')
->andWhere('t2.html')->in(null)
->andWhere('t1.deleted')->eq('0')
->fetchAll('id');
@@ -815,6 +816,22 @@ class docModel extends model
return $ids;
}
/**
* 迁移文档,设置新编辑器文档的 html。
* Migrate doc, set doc html generated by new editor.
*
* @param int $docID
* @param int $version
* @param string $html
*/
public function migrateDoc(int $docID, int $version, string $html): bool
{
$this->dao->update(TABLE_DOCCONTENT)->set('html')->eq($html)->where('doc')->eq($docID)->andWhere('version')->eq($version)->exec();
if(dao::isError()) return false;
return true;
}
/**
* 过滤出有权限的文档列表。
* Filter docs which has privilege.