hotime/example/app/init.go

81 lines
2.2 KiB
Go
Raw Normal View History

package app
import (
. "../../../hotime"
. "../../../hotime/common"
2022-01-22 21:13:19 +00:00
"../../dri/aliyun"
"../../dri/tencent"
"io/ioutil"
"os"
"path/filepath"
)
// Project 管理端项目
var Project = Proj{
//"user": UserCtr,
2022-02-14 11:10:58 +00:00
"tag": tagCtr,
2022-01-22 08:12:02 +00:00
"analyse": analyseCtr,
}
//生成随机码的4位随机数
func getCode() string {
//res := ""
//for i := 0; i < 4; i++ {
res := ObjToStr(RandX(1000, 9999))
//}
return res
}
2022-01-22 21:13:19 +00:00
func getCompany(name, path string) Map {
res := tencent.GetCompany("AKIDklZa1qBr3B0x1G643cg8B6UO5JZm2KX8o43G", "tdda7oro526h96dvicYkep1xsWFmHkt33xvqs2K", name)
c := Map{}
base := Map{}
2022-02-14 11:10:58 +00:00
if res.GetInt("code") != 200 {
return base
}
2022-01-22 21:13:19 +00:00
if res.GetInt("code") == 200 {
c = res.GetMap("data").GetMap("data")
base = c.GetMap("base")
base["allows"] = len(c.GetSlice("allows"))
base["branches"] = len(c.GetSlice("branches"))
base["changes"] = len(c.GetSlice("changes"))
base["employees"] = len(c.GetSlice("employees"))
base["exceptions"] = len(c.GetSlice("exceptions"))
base["mPledges"] = len(c.GetSlice("mPledges"))
base["originalName"] = len(c.GetSlice("originalName"))
base["partners"] = len(c.GetSlice("partners"))
base["pledges"] = len(c.GetSlice("pledges"))
base["punishes"] = len(c.GetSlice("punishes"))
base["shiXinItems"] = len(c.GetSlice("shiXinItems"))
base["spotChecks"] = len(c.GetSlice("spotChecks"))
base["taxCreditltems"] = len(c.GetSlice("taxCreditltems"))
base["zhiXingItems"] = len(c.GetSlice("zhiXingItems"))
base["contactInfo"] = c["contactInfo"]
base["industry"] = c["industry"]
base["liquidation"] = c["liquidation"]
}
aliyun.DefaultCompany.Init("06c6a07e89dd45c88de040ee1489eef7")
data := aliyun.DefaultCompany.GetCompanyOtherAll(name)
base["OtherCopyrightsInfo"] = data.GetMap("OtherCopyrightsInfo").GetInt("total")
base["PatentsInfo"] = data.GetMap("PatentsInfo").GetInt("total")
2022-02-14 11:10:58 +00:00
base["ProfileTags"] = data.GetSlice("ProfileTags")
2022-01-22 21:13:19 +00:00
base["SoftwareCopyrightsInfo"] = data.GetMap("SoftwareCopyrightsInfo").GetInt("total")
base["TrademarksInfo"] = data.GetMap("TrademarksInfo").GetInt("total")
if res.GetInt("code") == 200 {
data["base"] = c
}
_ = os.MkdirAll(filepath.Dir(path), os.ModeDir)
ioutil.WriteFile(path, []byte(data.ToJsonString()), os.ModePerm)
return base
}