修改文件类型匹配策略

This commit is contained in:
eatmoreapple 2022-12-09 22:06:47 +08:00
parent 4063e369bd
commit c9e4e842d9
2 changed files with 10 additions and 8 deletions

View File

@ -115,7 +115,8 @@ var (
)
// ALL 跟search函数搭配
// friends.Search(openwechat.ALL, )
//
// friends.Search(openwechat.ALL, )
const ALL = 0
// 性别
@ -137,11 +138,11 @@ const (
const TimeFormat = "Mon Jan 02 2006 15:04:05 GMT+0800 (中国标准时间)"
var imageType = map[string]bool{
"bmp": true,
"png": true,
"jpeg": true,
"jpg": true,
var imageType = map[string]struct{}{
"bmp": {},
"png": {},
"jpeg": {},
"jpg": {},
}
var videoType = "mp4"

View File

@ -81,9 +81,10 @@ const (
// 微信匹配文件类型策略
func getMessageType(filename string) string {
ext := getFileExt(filename)
if imageType[ext] {
if _, ok := imageType[ext]; ok {
return pic
} else if ext == videoType {
}
if ext == videoType {
return video
}
return doc