Browse Source

修改文章bug

layui
mail_yanpeng@163.com 6 years ago
parent
commit
b3787c2b17
  1. 2
      models/DataInit.go
  2. 4
      service/BlogService.go
  3. 6
      static/css/me.css
  4. 2
      views/ublogs.html
  5. 2
      views/ulike.html

2
models/DataInit.go

@ -23,6 +23,6 @@ func RegistDB() {
//orm.RegisterDriver(_SQLITE3_DRIVER,orm.DRSqlite)
//orm.RegisterDataBase("default",_SQLITE3_DRIVER,_DB_NAME,10)
orm.RegisterModel(new(Attachment),new(User),new(Blog),new(NLabel),new(Note),new(NoteColl),new(Category),new(Like),new(Comment))
orm.RegisterModel(new(User),new(Blog),new(NLabel),new(Note),new(NoteColl),new(Category),new(Like),new(Comment))
orm.RegisterDataBase("default", "mysql", "root:booszy@tcp(127.0.0.1:3306)/beeblog?charset=utf8&loc=Local", 30)
}

4
service/BlogService.go

@ -156,7 +156,7 @@ func SaveBlog(blog *models.Blog, strs []string) error {
func EditBlog(blog *models.Blog, strs []string) error {
o := orm.NewOrm()
o.Begin()
id, eror := o.Update(blog)
_, eror := o.Update(blog)
if eror != nil {
o.Rollback()
return eror
@ -165,7 +165,7 @@ func EditBlog(blog *models.Blog, strs []string) error {
if strs != nil && len(strs) > 0 {
nlabels := make([]*models.NLabel, len(strs))
for i := 0; i < len(strs); i++ {
nlabels[i] = &models.NLabel{Title: strs[i], BlogId: id, UserId: blog.UserId}
nlabels[i] = &models.NLabel{Title: strs[i], BlogId: blog.Id, UserId: blog.UserId}
}
if _, err := o.InsertMulti(len(nlabels), nlabels); err != nil {
o.Rollback()

6
static/css/me.css

@ -65,6 +65,12 @@
height: 110px;
padding: 0 4%;
}
.me-blog-footer{
height: 110px;
padding: 0 4%;
margin-left: 290px;
}
.info-header{
flex: 1;
}

2
views/ublogs.html

@ -49,7 +49,7 @@
</nav>
</div>
</div>
<div class="me-footer">
<div class="me-blog-footer">
{{template "footer"}}
</div>
</div>

2
views/ulike.html

@ -48,7 +48,7 @@
</nav>
</div>
</div>
<div class="me-footer">
<div class="me-blog-footer">
{{template "footer"}}
</div>
</div>

Loading…
Cancel
Save