Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed Nov 26, 2018
1 parent b6626e4 commit f4a34e0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
4 changes: 3 additions & 1 deletion admin/manage-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
<?php
if ($pages->hasSaved || 'page_draft' == $pages->type) {
echo '<em class="status">' . _t('草稿') . '</em>';
} else if ('hidden' == $pages->status) {
}

if ('hidden' == $pages->status) {
echo '<em class="status">' . _t('隐藏') . '</em>';
}
?>
Expand Down
4 changes: 3 additions & 1 deletion admin/manage-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@
<?php
if ($posts->hasSaved || 'post_draft' == $posts->type) {
echo '<em class="status">' . _t('草稿') . '</em>';
} else if ('hidden' == $posts->status) {
}

if ('hidden' == $posts->status) {
echo '<em class="status">' . _t('隐藏') . '</em>';
} else if ('waiting' == $posts->status) {
echo '<em class="status">' . _t('待审核') . '</em>';
Expand Down
12 changes: 12 additions & 0 deletions var/Widget/Contents/Page/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ public function markPage()
$condition = $this->db->sql()->where('cid = ?', $page);

if ($this->db->query($condition->update('table.contents')->rows(array('status' => $status)))) {
// 处理草稿
$draft = $this->db->fetchRow($this->db->select('cid')
->from('table.contents')
->where('table.contents.parent = ? AND table.contents.type = ?',
$page, 'page_draft')
->limit(1));

if (!empty($draft)) {
$this->db->query($this->db->update('table.contents')->rows(array('status' => $status))
->where('cid = ?', $draft['cid']));
}

// 完成标记插件接口
$this->pluginHandle()->finishMark($status, $page, $this);

Expand Down
2 changes: 1 addition & 1 deletion var/Widget/Contents/Post/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function ___hasSaved()
return true;
}

$savedPost = $this->db->fetchRow($this->db->select('cid', 'modified')
$savedPost = $this->db->fetchRow($this->db->select('cid', 'modified', 'status')
->from('table.contents')
->where('table.contents.parent = ? AND (table.contents.type = ? OR table.contents.type = ?)',
$this->cid, 'post_draft', 'page_draft')
Expand Down
12 changes: 12 additions & 0 deletions var/Widget/Contents/Post/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,18 @@ public function markPost()
}
}

// 处理草稿
$draft = $this->db->fetchRow($this->db->select('cid')
->from('table.contents')
->where('table.contents.parent = ? AND table.contents.type = ?',
$post, 'post_draft')
->limit(1));

if (!empty($draft)) {
$this->db->query($this->db->update('table.contents')->rows(array('status' => $status))
->where('cid = ?', $draft['cid']));
}

// 完成标记插件接口
$this->pluginHandle()->finishMark($status, $post, $this);

Expand Down

0 comments on commit f4a34e0

Please sign in to comment.