소스 검색

simple usage of x (#3144)

tags/v1.4.0-rc1
Lunny Xiao 6 년 전
부모
커밋
956354885a
1개의 변경된 파일1개의 추가작업 그리고 4개의 파일을 삭제
  1. 1
    4
      models/attachment.go

+ 1
- 4
models/attachment.go 파일 보기

@@ -31,11 +31,8 @@ type Attachment struct {

// IncreaseDownloadCount is update download count + 1
func (a *Attachment) IncreaseDownloadCount() error {
sess := x.NewSession()
defer sess.Close()

// Update download count.
if _, err := sess.Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {
if _, err := x.Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {
return fmt.Errorf("increase attachment count: %v", err)
}


Loading…
취소
저장