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.RegisterDriver(_SQLITE3_DRIVER,orm.DRSqlite)
//orm.RegisterDataBase("default",_SQLITE3_DRIVER,_DB_NAME,10) //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) 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 { func EditBlog(blog *models.Blog, strs []string) error {
o := orm.NewOrm() o := orm.NewOrm()
o.Begin() o.Begin()
id, eror := o.Update(blog) _, eror := o.Update(blog)
if eror != nil { if eror != nil {
o.Rollback() o.Rollback()
return eror return eror
@ -165,7 +165,7 @@ func EditBlog(blog *models.Blog, strs []string) error {
if strs != nil && len(strs) > 0 { if strs != nil && len(strs) > 0 {
nlabels := make([]*models.NLabel, len(strs)) nlabels := make([]*models.NLabel, len(strs))
for i := 0; i < len(strs); i++ { 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 { if _, err := o.InsertMulti(len(nlabels), nlabels); err != nil {
o.Rollback() o.Rollback()

6
static/css/me.css

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

2
views/ublogs.html

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

2
views/ulike.html

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

Loading…
Cancel
Save