mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-06-28 15:45:35 +08:00
修复文章排序错误
This commit is contained in:
parent
2416af4528
commit
00b4ffac2a
@ -179,8 +179,8 @@ func (b *Blog) Save(cols ...string) error {
|
|||||||
|
|
||||||
if b.OrderIndex <= 0 {
|
if b.OrderIndex <= 0 {
|
||||||
blog := NewBlog()
|
blog := NewBlog()
|
||||||
if err :=o.QueryTable(b.TableNameWithPrefix()).OrderBy("-blog_id").One(blog,"blog_id");err == nil{
|
if err := o.QueryTable(blog.TableNameWithPrefix()).OrderBy("-blog_id").Limit(1).One(blog,"blog_id");err == nil{
|
||||||
b.OrderIndex = b.BlogId + 1;
|
b.OrderIndex = blog.BlogId + 1;
|
||||||
}else{
|
}else{
|
||||||
c,_ := o.QueryTable(b.TableNameWithPrefix()).Count()
|
c,_ := o.QueryTable(b.TableNameWithPrefix()).Count()
|
||||||
b.OrderIndex = int(c) + 1
|
b.OrderIndex = int(c) + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user