err:=o.Raw("SELECT count(*) FROM blog where delflag = 0 and user_id =? ",uid).QueryRow(&totalItem)//获取总条数
iferr!=nil{
return
}
user:=&models.User{Id:uid}
err=o.Read(user)
iferr!=nil{
return
}
user.BlogCount=totalItem
o.Update(user,"BlogCount")
return
}
funcCountBrows(uidint64){
o:=orm.NewOrm()
browses:=0
o.Raw("UPDATE `user` SET `blog_browes` = (select SUM(browses) browses from blog where user_id = ?1) WHERE `id` = ?2 ",uid,uid).QueryRow(&browses)//获取总条数