更新研发

This commit is contained in:
hoteas
2022-01-26 11:45:17 +08:00
parent b2e9701826
commit 73bf691ccc
41 changed files with 10212 additions and 23 deletions
+51 -3
View File
@@ -25,6 +25,7 @@ var analyseCtr = Ctr{
res["n_item_data"] = res.GetMap("n_item_data")
this.Display(0, res)
},
"ctg": func(this *Context) {
orgId := ObjToInt(this.Req.FormValue("org_id"))
ctgID := ObjToInt(this.Req.FormValue("ctg_id"))
@@ -43,9 +44,49 @@ var analyseCtr = Ctr{
res["home"] = res1.GetMap("home_data")
this.Display(0, res)
},
"industrys": func(this *Context) {
orgId := ObjToInt(this.Req.FormValue("org_id"))
if orgId == 0 {
this.Display(3, "参数错误")
return
}
res := this.Db.Select("industry_analyse", "industry_id,name", Map{"org_id": orgId})
if res == nil {
this.Display(4, "找不到该数据")
return
}
this.Display(0, res)
},
"industry": 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")
this.Display(0, res)
},
"map": 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
//}
page := ObjToInt(this.Req.FormValue("page"))
pageSize := ObjToInt(this.Req.FormValue("pageSize"))
search := this.Req.FormValue("search")
@@ -54,6 +95,12 @@ var analyseCtr = Ctr{
if levelStr != "" {
where["level"] = ObjToInt(levelStr)
}
if orgId != 0 {
where["org_id"] = orgId
}
if industryId != 0 {
where["industry_id"] = industryId
}
if search != "" {
where["name[~]"] = search
@@ -70,8 +117,8 @@ var analyseCtr = Ctr{
}
count := this.Db.Count("company", where)
res := this.Db.Page(page, pageSize).PageSelect("company", Map{"[><]category": "company.category_id=category.id"},
"company.id,company.name,company.level,company.address,company.score,company.lat,company.lng,company.category_id,category.name AS category_name",
res := this.Db.Page(page, pageSize).PageSelect("company", Map{"[><]industry": "company.industry_id=industry.id"},
"company.id,company.name,company.level,company.address,company.score,company.lat,company.lng,company.category_id,industry.name AS industry_name,company.industry_id",
where)
this.Display(0, Map{"count": count, "pageSize": pageSize, "data": res})
@@ -92,6 +139,7 @@ var analyseCtr = Ctr{
}
this.Display(0, "更新成功")
},
"companys": func(this *Context) {
page := ObjToInt(this.Req.FormValue("page"))
@@ -149,7 +197,7 @@ var analyseCtr = Ctr{
res["upload_data"] = res.GetMap("upload_data")
res["collect_data"] = res.GetMap("collect_data")
if res.GetMap("collect_data") == nil {
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)
if len(data) != 0 {