diff --git a/dri/tencent/company.go b/dri/tencent/company.go index ab50acb..b1fb22a 100644 --- a/dri/tencent/company.go +++ b/dri/tencent/company.go @@ -10,11 +10,13 @@ import ( "io/ioutil" "net/http" gourl "net/url" + "strings" "time" ) func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) { + timeLocation, _ := time.LoadLocation("Etc/GMT") datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT") signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source) diff --git a/example/app/analyse.go b/example/app/analyse.go index 14d7a0d..2bd14e1 100644 --- a/example/app/analyse.go +++ b/example/app/analyse.go @@ -3,7 +3,6 @@ package app import ( . "../../../hotime" . "../../common" - "fmt" "time" ) @@ -15,15 +14,15 @@ var analyseCtr = Ctr{ this.Display(3, "参数错误") return } - res := this.Db.Get("org_analyse", "home_data", Map{"org_id": orgId}) + res := this.Db.Get("org_analyse", "*", Map{"org_id": orgId}) if res == nil { this.Display(4, "找不到该数据") return } res["home_data"] = res.GetMap("home_data") - //res["six_item_data"] = res.GetMap("six_item_data") - //res["three_item_data"] = res.GetMap("three_item_data") - //res["n_item_data"] = res.GetMap("n_item_data") + res["six_item_data"] = res.GetMap("six_item_data") + res["three_item_data"] = res.GetMap("three_item_data") + res["n_item_data"] = res.GetMap("n_item_data") this.Display(0, res) }, "home1_data": func(this *Context) { @@ -142,25 +141,25 @@ var analyseCtr = Ctr{ 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") - } - } + //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") + // } + //} } @@ -230,21 +229,21 @@ var analyseCtr = Ctr{ 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") - - 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 - } - } + //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 + // 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 + // } + //} } @@ -312,7 +311,7 @@ var analyseCtr = Ctr{ } uploadData := res.GetMap("upload_data") - tags := this.Db.Select("tag", "name,sn,`unit`,description", Map{"type": 0}) + tags := this.Db.Select("tag", "name,sn,`unit`,description", Map{"type": 1}) for _, v := range tags { v["value"] = uploadData[v.GetString("sn")] } diff --git a/example/app/tag.go b/example/app/tag.go index 25d25fb..a7306fb 100644 --- a/example/app/tag.go +++ b/example/app/tag.go @@ -14,22 +14,18 @@ var tagCtr = Ctr{ // return //} data := Map{} - run := func(id int) []Map { + run := func(t 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}) + upTag := this.Db.Select("tag", "*", Map{"type": t}) //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["upload"] = run(1) data["api"] = run(2) - data["analyse"] = run(3) + data["analyse"] = run(0) this.Display(0, data) }, diff --git a/example/config/config.json b/example/config/config.json index 0ea387d..0ba485a 100644 --- a/example/config/config.json +++ b/example/config/config.json @@ -24,7 +24,7 @@ "db": { "mysql": { "host": "192.168.6.253", - "name": "xhxyy", + "name": "iedc_dev", "password": "dasda8454456", "port": "3306", "prefix": "", @@ -43,7 +43,7 @@ "5": "数据结果异常" }, "mode": 3, - "port": "8080", + "port": "8081", "sessionName": "HOTIME", "tpt": "tpt" } \ No newline at end of file diff --git a/example/iedc.exe b/example/iedc.exe index 5d9ab63..aae22e1 100644 Binary files a/example/iedc.exe and b/example/iedc.exe differ