Skip to content

Commit

Permalink
fix #11
Browse files Browse the repository at this point in the history
  • Loading branch information
greycodee committed Jul 25, 2022
1 parent a9526dd commit 20e758e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions db/wcdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,12 @@ func (wcdb WCDB) getMediaPath(chat ChatDetailListRow) ChatDetailListRow {
chat.MediaPath = wcdb.enmicromsg.formatImagePath(chat.ImgPath)
chat.MediaBCKPath = wcdb.enmicromsg.formatImageBCKPath(chat)
chat.MediaSourcePath = wcdb.wxfileindex.GetImgPath(chat.MsgId)
break
case 34:
// 语音
chat.MediaPath = wcdb.enmicromsg.formatVoicePath(chat.ImgPath)
break
case 43:
// 视频
chat.MediaPath = wcdb.enmicromsg.formatVideoPath(chat.ImgPath)
break
case 1090519089:
fileInfo := FileInfo{}
filepath, fileSize := wcdb.wxfileindex.GetFilePath(chat.MsgId)
Expand Down
8 changes: 4 additions & 4 deletions db/wxfileindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ type WxFileIndex struct {
func OpenWxFileIndex(dbPath string) *WxFileIndex {
db, err := sql.Open("sqlite3", dbPath)
if err != nil {
log.Fatal(err)
log.Printf("未查询到 WxFileIndex.db 文件,%s", err)
}
// 查询表名
var tableName string
querySql := "SELECT name _id FROM sqlite_master WHERE type ='table' limit 1"
err = db.QueryRow(querySql).Scan(&tableName)
if err != nil {
log.Printf("未查询到图片索引表名,%s", err)
log.Fatal(err)
// log.Fatal(err)
} else {
log.Printf("文件索引表名: %s", tableName)
}
log.Printf("文件索引表名: %s", tableName)
log.Printf("请打开 WxFileIndex.db 确认 %s 表里是否有数据,如果没有数据,请删除该表", tableName)
return &WxFileIndex{dbPath, db, tableName}
}

Expand Down

0 comments on commit 20e758e

Please sign in to comment.