简阳版本

This commit is contained in:
hoteas 2022-02-19 21:38:17 +08:00
parent 181295e54e
commit a23037a437
5 changed files with 48 additions and 51 deletions

View File

@ -10,11 +10,13 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
gourl "net/url" gourl "net/url"
"strings" "strings"
"time" "time"
) )
func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) { func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
timeLocation, _ := time.LoadLocation("Etc/GMT") timeLocation, _ := time.LoadLocation("Etc/GMT")
datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 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) signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)

View File

@ -3,7 +3,6 @@ package app
import ( import (
. "../../../hotime" . "../../../hotime"
. "../../common" . "../../common"
"fmt"
"time" "time"
) )
@ -15,15 +14,15 @@ var analyseCtr = Ctr{
this.Display(3, "参数错误") this.Display(3, "参数错误")
return 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 { if res == nil {
this.Display(4, "找不到该数据") this.Display(4, "找不到该数据")
return return
} }
res["home_data"] = res.GetMap("home_data") res["home_data"] = res.GetMap("home_data")
//res["six_item_data"] = res.GetMap("six_item_data") res["six_item_data"] = res.GetMap("six_item_data")
//res["three_item_data"] = res.GetMap("three_item_data") res["three_item_data"] = res.GetMap("three_item_data")
//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)
}, },
"home1_data": func(this *Context) { "home1_data": func(this *Context) {
@ -142,25 +141,25 @@ var analyseCtr = Ctr{
for _, res := range companys { for _, res := range companys {
res["collect_data"] = res.GetMap("collect_data") res["collect_data"] = res.GetMap("collect_data")
if res.GetMap("collect_data") == nil { //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) // data := getCompany(res.GetString("name"), this.Config.GetString("tpt")+"/"+path)
//
if len(data) != 0 { // if len(data) != 0 {
data["path"] = path // data["path"] = path
re := this.Db.Update("company", Map{"collect_data": data.ToJsonString(), // re := 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")})
fmt.Println(re) // fmt.Println(re)
res["collect_data"] = data // res["collect_data"] = data
res["address"] = data.GetString("companyAddress") // res["address"] = data.GetString("companyAddress")
res["sn"] = data.GetString("creditNo") // res["sn"] = data.GetString("creditNo")
res["unit"] = data.GetString("authority") // res["unit"] = data.GetString("authority")
} // }
} //}
} }
@ -230,21 +229,21 @@ 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 { //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) // 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
} // }
} //}
} }
@ -312,7 +311,7 @@ var analyseCtr = Ctr{
} }
uploadData := res.GetMap("upload_data") 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 { for _, v := range tags {
v["value"] = uploadData[v.GetString("sn")] v["value"] = uploadData[v.GetString("sn")]
} }

View File

@ -14,22 +14,18 @@ var tagCtr = Ctr{
// return // return
//} //}
data := Map{} data := Map{}
run := func(id int) []Map { run := func(t int) []Map {
//upCtg:=this.Db.Select("tag_ctg","*",Map{"parent_id":id}) //upCtg:=this.Db.Select("tag_ctg","*",Map{"parent_id":id})
//for _,v:=range upCtg{ //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 //v["tag"]=upTag
//} //}
return upTag return upTag
} }
upCtg := this.Db.Select("tag_ctg", "*", Map{"parent_id": 1})
for _, v := range upCtg { data["upload"] = run(1)
upTag := this.Db.Select("tag", "*", Map{"tag_ctg_id": v.GetCeilInt("id")})
v["tag"] = upTag
}
data["upload"] = upCtg
data["api"] = run(2) data["api"] = run(2)
data["analyse"] = run(3) data["analyse"] = run(0)
this.Display(0, data) this.Display(0, data)
}, },

View File

@ -24,7 +24,7 @@
"db": { "db": {
"mysql": { "mysql": {
"host": "192.168.6.253", "host": "192.168.6.253",
"name": "xhxyy", "name": "iedc_dev",
"password": "dasda8454456", "password": "dasda8454456",
"port": "3306", "port": "3306",
"prefix": "", "prefix": "",
@ -43,7 +43,7 @@
"5": "数据结果异常" "5": "数据结果异常"
}, },
"mode": 3, "mode": 3,
"port": "8080", "port": "8081",
"sessionName": "HOTIME", "sessionName": "HOTIME",
"tpt": "tpt" "tpt": "tpt"
} }

Binary file not shown.