iedc-go/example/app/init.go
2022-01-23 05:13:19 +08:00

76 lines
2.2 KiB
Go

package app
import (
. "../../../hotime"
. "../../../hotime/common"
"../../dri/aliyun"
"../../dri/tencent"
"io/ioutil"
"os"
"path/filepath"
)
// Project 管理端项目
var Project = Proj{
//"user": UserCtr,
"analyse": analyseCtr,
}
//生成随机码的4位随机数
func getCode() string {
//res := ""
//for i := 0; i < 4; i++ {
res := ObjToStr(RandX(1000, 9999))
//}
return res
}
func getCompany(name, path string) Map {
res := tencent.GetCompany("AKIDklZa1qBr3B0x1G643cg8B6UO5JZm2KX8o43G", "tdda7oro526h96dvicYkep1xsWFmHkt33xvqs2K", name)
c := Map{}
base := Map{}
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")
base["ProfileTags"] = data.GetMap("ProfileTags").GetSlice("data")
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
}