把c.JSON(http.StatusOK,res)
替换成
resByte,_:=json.Marshal(res)
//
//c.JSON(http.StatusOK,res)
c.Header("Content-Disposition", "attachment; filename=file-name.txt")
c.Data(http.StatusOK, "application/octet-stream", resByte)
让它返回blob类型 大概是这样子的。