修改文件类型匹配策略
This commit is contained in:
parent
4063e369bd
commit
c9e4e842d9
13
global.go
13
global.go
@ -115,7 +115,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ALL 跟search函数搭配
|
// ALL 跟search函数搭配
|
||||||
// friends.Search(openwechat.ALL, )
|
//
|
||||||
|
// friends.Search(openwechat.ALL, )
|
||||||
const ALL = 0
|
const ALL = 0
|
||||||
|
|
||||||
// 性别
|
// 性别
|
||||||
@ -137,11 +138,11 @@ const (
|
|||||||
|
|
||||||
const TimeFormat = "Mon Jan 02 2006 15:04:05 GMT+0800 (中国标准时间)"
|
const TimeFormat = "Mon Jan 02 2006 15:04:05 GMT+0800 (中国标准时间)"
|
||||||
|
|
||||||
var imageType = map[string]bool{
|
var imageType = map[string]struct{}{
|
||||||
"bmp": true,
|
"bmp": {},
|
||||||
"png": true,
|
"png": {},
|
||||||
"jpeg": true,
|
"jpeg": {},
|
||||||
"jpg": true,
|
"jpg": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
var videoType = "mp4"
|
var videoType = "mp4"
|
||||||
|
@ -81,9 +81,10 @@ const (
|
|||||||
// 微信匹配文件类型策略
|
// 微信匹配文件类型策略
|
||||||
func getMessageType(filename string) string {
|
func getMessageType(filename string) string {
|
||||||
ext := getFileExt(filename)
|
ext := getFileExt(filename)
|
||||||
if imageType[ext] {
|
if _, ok := imageType[ext]; ok {
|
||||||
return pic
|
return pic
|
||||||
} else if ext == videoType {
|
}
|
||||||
|
if ext == videoType {
|
||||||
return video
|
return video
|
||||||
}
|
}
|
||||||
return doc
|
return doc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user