政企超链接开始集成
This commit is contained in:
parent
3dda86d170
commit
4597a0a50d
@ -420,8 +420,14 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
|
|||||||
header.Set("Cache-Control", "no-cache")
|
header.Set("Cache-Control", "no-cache")
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Index(path, ".m3u8") != -1 {
|
t := strings.LastIndex(path, ".")
|
||||||
header.Add("Content-Type", "audio/mpegurl")
|
if t != -1 {
|
||||||
|
tt := path[t:]
|
||||||
|
|
||||||
|
if MimeMaps[tt] != "" {
|
||||||
|
|
||||||
|
header.Add("Content-Type", MimeMaps[tt])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//w.Write(data)
|
//w.Write(data)
|
||||||
|
@ -3,6 +3,10 @@ package app
|
|||||||
import (
|
import (
|
||||||
. "../../../hotime"
|
. "../../../hotime"
|
||||||
. "../../common"
|
. "../../common"
|
||||||
|
"fmt"
|
||||||
|
"github.com/xuri/excelize"
|
||||||
|
"os"
|
||||||
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,6 +29,80 @@ var analyseCtr = Ctr{
|
|||||||
res["n_item_data"] = res.GetMap("n_item_data")
|
res["n_item_data"] = res.GetMap("n_item_data")
|
||||||
this.Display(0, res)
|
this.Display(0, res)
|
||||||
},
|
},
|
||||||
|
"home_excel": func(this *Context) {
|
||||||
|
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||||
|
if orgId == 0 {
|
||||||
|
this.Display(3, "参数错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res := this.Db.Get("org_analyse", "*", Map{"org_id": orgId})
|
||||||
|
if res == nil {
|
||||||
|
this.Display(4, "找不到该数据")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
homeData := res.GetMap("home_data")
|
||||||
|
sixItemData := res.GetMap("six_item_data")
|
||||||
|
threeItemData := res.GetMap("three_item_data")
|
||||||
|
nItemData := res.GetMap("n_item_data")
|
||||||
|
|
||||||
|
filePath := "temp/home" + ObjToStr(orgId) + ".xlsx"
|
||||||
|
f, e := excelize.OpenFile(this.Config.GetString("tpt") + "/" + filePath)
|
||||||
|
if e != nil {
|
||||||
|
f = excelize.NewFile()
|
||||||
|
// 创建一个工作表
|
||||||
|
f.NewSheet("IEDC全局分析")
|
||||||
|
// 创建一个工作表
|
||||||
|
f.NewSheet("“6”项量化")
|
||||||
|
f.NewSheet("“3”项定性")
|
||||||
|
f.NewSheet("“N”项特色")
|
||||||
|
f.DeleteSheet("Sheet1")
|
||||||
|
// 设置单元格的值
|
||||||
|
f.SetCellValue("IEDC全局分析", "A1", "指标项")
|
||||||
|
f.SetCellValue("IEDC全局分析", "B1", "指标值")
|
||||||
|
// 设置单元格的值
|
||||||
|
f.SetCellValue("“6”项量化", "A1", "指标项")
|
||||||
|
f.SetCellValue("“6”项量化", "B1", "指标值")
|
||||||
|
// 设置单元格的值
|
||||||
|
f.SetCellValue("“3”项定性", "A1", "指标项")
|
||||||
|
f.SetCellValue("“3”项定性", "B1", "指标值")
|
||||||
|
// 设置单元格的值
|
||||||
|
f.SetCellValue("“N”项特色", "A1", "指标项")
|
||||||
|
f.SetCellValue("“N”项特色", "B1", "指标值")
|
||||||
|
|
||||||
|
os.MkdirAll(this.Config.GetString("tpt")+"/temp/", os.ModeDir)
|
||||||
|
// 根据指定路径保存文件
|
||||||
|
if err := f.SaveAs(this.Config.GetString("tpt") + "/" + filePath); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
this.Display(4, "输出异常")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
run := func(str string, data Map, f *excelize.File) {
|
||||||
|
var keys []string
|
||||||
|
for k := range data {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
//按字典升序排列
|
||||||
|
sort.Strings(keys)
|
||||||
|
for k, v := range keys {
|
||||||
|
// 设置单元格的值
|
||||||
|
f.SetCellValue(str, "A"+ObjToStr(k+2), v)
|
||||||
|
f.SetCellValue(str, "B"+ObjToStr(k+2), data[v])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run("IEDC全局分析", homeData, f)
|
||||||
|
run("“6”项量化", sixItemData, f)
|
||||||
|
run("“3”项定性", threeItemData, f)
|
||||||
|
run("“N”项特色", nItemData, f)
|
||||||
|
//f.SetCellValue("Sheet1", "B2", 100)
|
||||||
|
|
||||||
|
f.Save()
|
||||||
|
this.Resp.Header().Set("Location", "/"+filePath)
|
||||||
|
this.Resp.WriteHeader(307) //关键在这里!
|
||||||
|
this.Display(0, filePath)
|
||||||
|
},
|
||||||
"home1_data": func(this *Context) {
|
"home1_data": func(this *Context) {
|
||||||
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||||
if orgId == 0 {
|
if orgId == 0 {
|
||||||
@ -83,7 +161,6 @@ var analyseCtr = Ctr{
|
|||||||
this.Display(3, "参数错误")
|
this.Display(3, "参数错误")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
res := this.Db.Get("industry_analyse", "*", Map{"AND": Map{"org_id": orgId, "industry_id": industryId}})
|
res := this.Db.Get("industry_analyse", "*", Map{"AND": Map{"org_id": orgId, "industry_id": industryId}})
|
||||||
if res == nil {
|
if res == nil {
|
||||||
this.Display(4, "找不到该数据")
|
this.Display(4, "找不到该数据")
|
||||||
@ -95,7 +172,67 @@ var analyseCtr = Ctr{
|
|||||||
res["home_name"] = res1.GetString("name")
|
res["home_name"] = res1.GetString("name")
|
||||||
this.Display(0, res)
|
this.Display(0, res)
|
||||||
},
|
},
|
||||||
|
"industry_excel": func(this *Context) {
|
||||||
|
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||||
|
industryId := ObjToInt(this.Req.FormValue("industry_id"))
|
||||||
|
if orgId == 0 || industryId == 0 {
|
||||||
|
this.Display(3, "参数错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res := this.Db.Get("industry_analyse", "*", Map{"AND": Map{"org_id": orgId, "industry_id": industryId}})
|
||||||
|
if res == nil {
|
||||||
|
this.Display(4, "找不到该数据")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res["data"] = res.GetMap("data")
|
||||||
|
//res1 := this.Db.Get("org_analyse", "name,home_data", Map{"org_id": orgId})
|
||||||
|
//res["home"] = res1.GetMap("home_data")
|
||||||
|
//res["home_name"] = res1.GetString("name")
|
||||||
|
|
||||||
|
filePath := "temp/industry" + ObjToStr(industryId) + "x" + ObjToStr(orgId) + ".xlsx"
|
||||||
|
|
||||||
|
f, e := excelize.OpenFile(this.Config.GetString("tpt") + "/" + filePath)
|
||||||
|
if e != nil {
|
||||||
|
f = excelize.NewFile()
|
||||||
|
|
||||||
|
// 创建一个工作表
|
||||||
|
f.NewSheet(res.GetString("name"))
|
||||||
|
|
||||||
|
f.DeleteSheet("Sheet1")
|
||||||
|
// 设置单元格的值
|
||||||
|
f.SetCellValue(res.GetString("name"), "A1", "指标项")
|
||||||
|
f.SetCellValue(res.GetString("name"), "B1", "指标值")
|
||||||
|
|
||||||
|
os.MkdirAll(this.Config.GetString("tpt")+"/temp/", os.ModeDir)
|
||||||
|
|
||||||
|
// 根据指定路径保存文件
|
||||||
|
if err := f.SaveAs(this.Config.GetString("tpt") + "/" + filePath); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
this.Display(4, "输出异常")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run := func(str string, data Map, f *excelize.File) {
|
||||||
|
var keys []string
|
||||||
|
for k := range data {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
//按字典升序排列
|
||||||
|
sort.Strings(keys)
|
||||||
|
for k, v := range keys {
|
||||||
|
// 设置单元格的值
|
||||||
|
f.SetCellValue(str, "A"+ObjToStr(k+2), v)
|
||||||
|
f.SetCellValue(str, "B"+ObjToStr(k+2), data[v])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(res.GetString("name"), res.GetMap("data"), f)
|
||||||
|
//f.SetCellValue("Sheet1", "B2", 100)
|
||||||
|
f.Save()
|
||||||
|
this.Resp.Header().Set("Location", "/"+filePath)
|
||||||
|
this.Resp.WriteHeader(307) //关键在这里!
|
||||||
|
this.Display(0, filePath)
|
||||||
|
},
|
||||||
"map": func(this *Context) {
|
"map": func(this *Context) {
|
||||||
|
|
||||||
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||||
@ -188,6 +325,7 @@ var analyseCtr = Ctr{
|
|||||||
pageSize := ObjToInt(this.Req.FormValue("pageSize"))
|
pageSize := ObjToInt(this.Req.FormValue("pageSize"))
|
||||||
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||||
search := this.Req.FormValue("search")
|
search := this.Req.FormValue("search")
|
||||||
|
sort := this.Req.FormValue("sort")
|
||||||
where := Map{"state": 0}
|
where := Map{"state": 0}
|
||||||
levelStr := this.Req.FormValue("level")
|
levelStr := this.Req.FormValue("level")
|
||||||
if levelStr != "" {
|
if levelStr != "" {
|
||||||
@ -206,7 +344,12 @@ var analyseCtr = Ctr{
|
|||||||
if len(where) > 1 {
|
if len(where) > 1 {
|
||||||
where = Map{"AND": where}
|
where = Map{"AND": where}
|
||||||
}
|
}
|
||||||
where["ORDER"] = "score DESC"
|
if sort != "" {
|
||||||
|
where["ORDER"] = sort
|
||||||
|
} else {
|
||||||
|
where["ORDER"] = "score DESC"
|
||||||
|
}
|
||||||
|
|
||||||
if page == 0 {
|
if page == 0 {
|
||||||
page = 1
|
page = 1
|
||||||
}
|
}
|
||||||
@ -231,28 +374,29 @@ var analyseCtr = Ctr{
|
|||||||
res["upload_data"] = res.GetMap("upload_data")
|
res["upload_data"] = res.GetMap("upload_data")
|
||||||
res["collect_data"] = res.GetMap("collect_data")
|
res["collect_data"] = res.GetMap("collect_data")
|
||||||
res["collect_data"] = res.GetMap("collect_data")
|
res["collect_data"] = res.GetMap("collect_data")
|
||||||
if res.GetMap("collect_data") == nil && page == 1 {
|
//if res.GetMap("collect_data") == nil && page == 1 {
|
||||||
go func(res Map, this *Context) {
|
// go func(res Map, this *Context) {
|
||||||
path := "company/" + Md5(res.GetString("name")) + time.Now().Format("/200601021504.json")
|
// path := "company/" + Md5(res.GetString("name")) + time.Now().Format("/200601021504.json")
|
||||||
|
//
|
||||||
data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path)
|
// data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path)
|
||||||
|
//
|
||||||
if len(data) != 0 {
|
// if len(data) != 0 {
|
||||||
data["path"] = path
|
// data["path"] = path
|
||||||
this.Db.Update("company", Map{"collect_data": data.ToJsonString(),
|
// this.Db.Update("company", Map{"collect_data": data.ToJsonString(),
|
||||||
"address": data.GetString("companyAddress"),
|
// "address": data.GetString("companyAddress"),
|
||||||
"sn": data.GetString("creditNo"),
|
// "sn": data.GetString("creditNo"),
|
||||||
"unit": data.GetString("authority"),
|
// "unit": data.GetString("authority"),
|
||||||
}, Map{"id": res.GetCeilInt("id")})
|
// }, Map{"id": res.GetCeilInt("id")})
|
||||||
res["collect_data"] = data
|
// res["collect_data"] = data
|
||||||
}
|
// }
|
||||||
}(res, this)
|
// }(res, this)
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Display(0, Map{"count": count, "pageSize": pageSize, "data": companys})
|
this.Display(0, Map{"count": count, "pageSize": pageSize, "data": companys})
|
||||||
},
|
},
|
||||||
|
|
||||||
"company": func(this *Context) {
|
"company": func(this *Context) {
|
||||||
id := ObjToInt(this.Req.FormValue("id"))
|
id := ObjToInt(this.Req.FormValue("id"))
|
||||||
if id == 0 {
|
if id == 0 {
|
||||||
|
@ -39,7 +39,7 @@ var User = Ctr{
|
|||||||
|
|
||||||
t := time.Now().Unix()
|
t := time.Now().Unix()
|
||||||
|
|
||||||
questions := this.Db.Select("question", "*", Map{"AND": Map{"org_id": user.GetCeilInt("org_id"), "start_time[<=]": t, "end_time[>=]": t, "state": 0}})
|
questions := this.Db.Select("question", "*", Map{"AND": Map{"org_id": user.GetCeilInt("org_id"), "state": 0}})
|
||||||
re := []Map{}
|
re := []Map{}
|
||||||
|
|
||||||
for _, v := range questions {
|
for _, v := range questions {
|
||||||
|
BIN
example/iedc.exe
BIN
example/iedc.exe
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title></title><style>body{
|
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title></title><style>body{
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}</style><link href="css/chunk-04e35d82.5cc24c46.css" rel="prefetch"><link href="css/chunk-10a72523.993d1e17.css" rel="prefetch"><link href="css/chunk-1968ce68.26f55e87.css" rel="prefetch"><link href="css/chunk-2c0b72c6.f9cf649c.css" rel="prefetch"><link href="css/chunk-3d8462ce.26cbd584.css" rel="prefetch"><link href="css/chunk-6feafdad.c460e209.css" rel="prefetch"><link href="js/chunk-04e35d82.054c5f8b.js" rel="prefetch"><link href="js/chunk-10a72523.f9d2509e.js" rel="prefetch"><link href="js/chunk-1968ce68.99a1cb89.js" rel="prefetch"><link href="js/chunk-2c0b72c6.fa1690a2.js" rel="prefetch"><link href="js/chunk-3d8462ce.ac9d69b2.js" rel="prefetch"><link href="js/chunk-6feafdad.545f8201.js" rel="prefetch"><link href="js/chunk-78ba61e2.520b239c.js" rel="prefetch"><link href="js/chunk-a2efa204.7909c937.js" rel="prefetch"><link href="js/chunk-d83135a2.4680b3b0.js" rel="prefetch"><link href="css/app.5e2eb449.css" rel="preload" as="style"><link href="js/app.a381d207.js" rel="preload" as="script"><link href="css/app.5e2eb449.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but hotime doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/app.a381d207.js"></script></body></html>
|
}</style><link href="css/chunk-04e35d82.5cc24c46.css" rel="prefetch"><link href="css/chunk-10a72523.993d1e17.css" rel="prefetch"><link href="css/chunk-1968ce68.26f55e87.css" rel="prefetch"><link href="css/chunk-2c0b72c6.f9cf649c.css" rel="prefetch"><link href="css/chunk-3d8462ce.26cbd584.css" rel="prefetch"><link href="css/chunk-6feafdad.c460e209.css" rel="prefetch"><link href="js/chunk-04e35d82.054c5f8b.js" rel="prefetch"><link href="js/chunk-10a72523.f9d2509e.js" rel="prefetch"><link href="js/chunk-1968ce68.99a1cb89.js" rel="prefetch"><link href="js/chunk-2c0b72c6.fa1690a2.js" rel="prefetch"><link href="js/chunk-3d8462ce.ac9d69b2.js" rel="prefetch"><link href="js/chunk-6feafdad.545f8201.js" rel="prefetch"><link href="js/chunk-78ba61e2.520b239c.js" rel="prefetch"><link href="js/chunk-a2efa204.7909c937.js" rel="prefetch"><link href="js/chunk-d83135a2.4680b3b0.js" rel="prefetch"><link href="css/app.1c7362c1.css" rel="preload" as="style"><link href="js/app.3612dc2e.js" rel="preload" as="script"><link href="css/app.1c7362c1.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but hotime doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/app.3612dc2e.js"></script></body></html>
|
Loading…
Reference in New Issue
Block a user