| | |
| | | logger.Debug("上传到weedfs用时:", time.Since(t1)) |
| | | t1 = time.Now() |
| | | if e != nil { |
| | | fmt.Println(e.Error()) |
| | | logger.Debug("WeedFSClient.UploadFile err:", e) |
| | | return "", nil, e |
| | | } |
| | | |
| | |
| | | defer wg.Done() |
| | | tIStart := time.Now() |
| | | filename := head.Filename |
| | | fileExt := path.Ext(filename) |
| | | fileExt = strings.ToLower(fileExt) |
| | | if fileExt !=".jpg" && fileExt != ".jpeg" && fileExt != ".png" { |
| | | lock.Lock() |
| | | failList = append(failList, filename) |
| | | lock.Unlock() |
| | | return |
| | | } |
| | | file, err := head.Open() |
| | | fmt.Println(file, err, filename) |
| | | if err != nil { |
| | | lock.Lock() |
| | | failList = append(failList, filename) |
| | |
| | | addResult["failList"] = failList |
| | | addResult["fields"] = extNames |
| | | |
| | | if len(successList)>0 { |
| | | //if len(successList)>0 { |
| | | util.ResponseFormat(c, code.DbPersonUploadSuccess, addResult) |
| | | } else { |
| | | util.ResponseFormat(c, code.DbPersonUploadFail, addResult) |
| | | } |
| | | //} else { |
| | | // util.ResponseFormat(c, code.DbPersonUploadFail, addResult) |
| | | //} |
| | | } |
| | | |
| | | type EsPersonSave struct { |