更新研发
This commit is contained in:
+68
-6
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
. "../../../hotime"
|
||||
. "../../common"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -117,11 +118,36 @@ var analyseCtr = Ctr{
|
||||
}
|
||||
count := this.Db.Count("company", where)
|
||||
|
||||
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",
|
||||
companys := this.Db.Page(page, pageSize).PageSelect("company", Map{"[><]industry": "company.industry_id=industry.id"},
|
||||
"company.id,company.collect_data,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})
|
||||
for _, res := range companys {
|
||||
|
||||
res["collect_data"] = res.GetMap("collect_data")
|
||||
if res.GetMap("collect_data") == nil {
|
||||
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 {
|
||||
data["path"] = path
|
||||
re := this.Db.Update("company", Map{"collect_data": data.ToJsonString(),
|
||||
"address": data.GetString("companyAddress"),
|
||||
"sn": data.GetString("creditNo"),
|
||||
"unit": data.GetString("authority"),
|
||||
}, Map{"id": res.GetCeilInt("id")})
|
||||
fmt.Println(re)
|
||||
res["collect_data"] = data
|
||||
res["address"] = data.GetString("companyAddress")
|
||||
res["sn"] = data.GetString("creditNo")
|
||||
res["unit"] = data.GetString("authority")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.Display(0, Map{"count": count, "pageSize": pageSize, "data": companys})
|
||||
},
|
||||
"updateCompany": func(this *Context) {
|
||||
lng := ObjToFloat64(this.Req.FormValue("lng"))
|
||||
@@ -144,12 +170,17 @@ var analyseCtr = Ctr{
|
||||
|
||||
page := ObjToInt(this.Req.FormValue("page"))
|
||||
pageSize := ObjToInt(this.Req.FormValue("pageSize"))
|
||||
|
||||
search := this.Req.FormValue("search")
|
||||
where := Map{}
|
||||
levelStr := this.Req.FormValue("level")
|
||||
if levelStr != "" {
|
||||
where["level"] = ObjToInt(levelStr)
|
||||
}
|
||||
industryId := ObjToInt(this.Req.FormValue("industry_id"))
|
||||
if industryId != 0 {
|
||||
where["industry_id"] = industryId
|
||||
}
|
||||
|
||||
if search != "" {
|
||||
where["name[~]"] = search
|
||||
@@ -166,11 +197,41 @@ var analyseCtr = Ctr{
|
||||
}
|
||||
count := this.Db.Count("company", where)
|
||||
|
||||
res := this.Db.Page(page, pageSize).PageSelect("company",
|
||||
"id,name,level,score,analyse->'$.MJSR' AS MJSR,analyse->'$.MJSS' AS MJSS,analyse->'$.RJSR' AS RJSR,analyse->'$.YFJFTRQD' AS YFJFTRQD,analyse->'$.DWNHSS' AS DWNHSS,analyse->'$.ZYWRWSS' AS ZYWRWSS,analyse->'$.FZZLZBZDF' AS FZZLZBZDF,analyse->'$.LSAQZBDF' AS LSAQZBDF,analyse->'$.XZFZZBDF' AS XZFZZBDF,analyse->'$.CYRCDF' AS CYRCDF,analyse->'$.ZJTXQLDF' AS ZJTXQLDF,analyse->'$.JGTZDF' AS JGTZDF",
|
||||
companys := this.Db.Page(page, pageSize).PageSelect("company",
|
||||
"*",
|
||||
where)
|
||||
for _, res := range companys {
|
||||
analyse := res.GetMap("analyse")
|
||||
if analyse != nil {
|
||||
for k, v := range analyse {
|
||||
if ADataType[k] != nil {
|
||||
analyse[ADataType.GetString(k)] = v
|
||||
}
|
||||
}
|
||||
res["analyse"] = analyse
|
||||
}
|
||||
res["upload_data"] = res.GetMap("upload_data")
|
||||
res["collect_data"] = res.GetMap("collect_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")
|
||||
|
||||
this.Display(0, Map{"count": count, "pageSize": pageSize, "data": res})
|
||||
data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path)
|
||||
|
||||
if len(data) != 0 {
|
||||
data["path"] = path
|
||||
this.Db.Update("company", Map{"collect_data": data.ToJsonString(),
|
||||
"address": data.GetString("companyAddress"),
|
||||
"sn": data.GetString("creditNo"),
|
||||
"unit": data.GetString("authority"),
|
||||
}, Map{"id": res.GetCeilInt("id")})
|
||||
res["collect_data"] = data
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.Display(0, Map{"count": count, "pageSize": pageSize, "data": companys})
|
||||
},
|
||||
"company": func(this *Context) {
|
||||
id := ObjToInt(this.Req.FormValue("id"))
|
||||
@@ -200,6 +261,7 @@ var analyseCtr = Ctr{
|
||||
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 {
|
||||
data["path"] = path
|
||||
this.Db.Update("company", Map{"collect_data": data.ToJsonString()}, Map{"id": res.GetCeilInt("id")})
|
||||
|
||||
+6
-1
@@ -13,6 +13,7 @@ import (
|
||||
// Project 管理端项目
|
||||
var Project = Proj{
|
||||
//"user": UserCtr,
|
||||
"tag": tagCtr,
|
||||
"analyse": analyseCtr,
|
||||
}
|
||||
|
||||
@@ -30,6 +31,10 @@ func getCompany(name, path string) Map {
|
||||
res := tencent.GetCompany("AKIDklZa1qBr3B0x1G643cg8B6UO5JZm2KX8o43G", "tdda7oro526h96dvicYkep1xsWFmHkt33xvqs2K", name)
|
||||
c := Map{}
|
||||
base := Map{}
|
||||
if res.GetInt("code") != 200 {
|
||||
|
||||
return base
|
||||
}
|
||||
if res.GetInt("code") == 200 {
|
||||
c = res.GetMap("data").GetMap("data")
|
||||
|
||||
@@ -60,7 +65,7 @@ func getCompany(name, path string) Map {
|
||||
|
||||
base["OtherCopyrightsInfo"] = data.GetMap("OtherCopyrightsInfo").GetInt("total")
|
||||
base["PatentsInfo"] = data.GetMap("PatentsInfo").GetInt("total")
|
||||
base["ProfileTags"] = data.GetMap("ProfileTags").GetSlice("data")
|
||||
base["ProfileTags"] = data.GetSlice("ProfileTags")
|
||||
base["SoftwareCopyrightsInfo"] = data.GetMap("SoftwareCopyrightsInfo").GetInt("total")
|
||||
base["TrademarksInfo"] = data.GetMap("TrademarksInfo").GetInt("total")
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../hotime"
|
||||
. "../../common"
|
||||
)
|
||||
|
||||
var tagCtr = Ctr{
|
||||
|
||||
"ctg_tree": func(this *Context) {
|
||||
//orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||
//if orgId == 0 {
|
||||
// this.Display(3, "参数错误")
|
||||
// return
|
||||
//}
|
||||
data := Map{}
|
||||
run := func(id int) []Map {
|
||||
//upCtg:=this.Db.Select("tag_ctg","*",Map{"parent_id":id})
|
||||
//for _,v:=range upCtg{
|
||||
upTag := this.Db.Select("tag", "*", Map{"tag_ctg_id": id})
|
||||
//v["tag"]=upTag
|
||||
//}
|
||||
return upTag
|
||||
}
|
||||
upCtg := this.Db.Select("tag_ctg", "*", Map{"parent_id": 1})
|
||||
for _, v := range upCtg {
|
||||
upTag := this.Db.Select("tag", "*", Map{"tag_ctg_id": v.GetCeilInt("id")})
|
||||
v["tag"] = upTag
|
||||
}
|
||||
data["upload"] = upCtg
|
||||
data["api"] = run(2)
|
||||
data["analyse"] = run(3)
|
||||
|
||||
this.Display(0, data)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user