Commit a5de8e2e by root

提交

parent 7d628cbf
......@@ -22,6 +22,11 @@ type Company struct {
BlacklistHit string `db:"blacklist_hit"`
RiskType string `db:"risk_type"`
IsKefuCertified string `db:"is_kefu_certified"`
CustomerEn string `db:"customer_en"`
CustomerType int `db:"customer_type"`
ProductUseClassoneSn int `db:"product_use_classone_sn"`
ProductUseClasstwoSn int `db:"product_use_classtwo_sn"`
CustomerWebsite string `db:"customer_website"`
CreateTime int `db:"create_time"`
UpdateTime int `db:"update_time"`
}
......
No preview for this file type
......@@ -50,19 +50,19 @@ func main() {
//初始化db
initDb(util.Configs.Liexin_databases.Dns)
//t1 := time.NewTimer(time.Second * 10)
t1 := time.NewTimer(time.Hour * 12) // 定时12小时
for {
select {
case <-t1.C:
fmt.Println("ticker...")
updateData()
//t1.Reset(time.Second * 10)
t1.Reset(time.Hour * 12)
}
}
updateData()
//t1 := time.NewTimer(time.Second * 60)
//t1 := time.NewTimer(time.Hour * 12) // 定时12小时
//for {
// select {
// case <-t1.C:
// fmt.Println("ticker...")
// updateData()
// t1.Reset(time.Second * 60)
// //t1.Reset(time.Hour * 12)
// }
//}
}
// 修改DB
......@@ -78,12 +78,12 @@ func updateData() (err error) {
for row.Next() {
var company InvoiceCompany.Company
row.StructScan(&company)
fmt.Println(company)
// 拉取风控公司信息
url := util.Configs.Fengkong_domain.GoUrl + "/kaopu-server/http/member/company_info/" + company.ComName
resp, err := http.Get(url)
fmt.Println(err)
if err != nil {
logger.Info("请求风控接口失败,错误原因: ", err.Error())
return err
......@@ -92,7 +92,7 @@ func updateData() (err error) {
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
erp_com_sn := gjson.Get(string(body), "com_credit.erp_company_code").String() // ERP编码
com_addr := gjson.Get(string(body), "com_basic_info.com_address").String() // 公司地址
establishment_time := gjson.Get(string(body), "com_basic_info.establishment_time").Int() // 成立时间
......@@ -124,7 +124,7 @@ func updateData() (err error) {
// 已评分的推送钉钉通知
if total_credit_score > 0 {
ding.Send(util.Configs.Ding_msg.FkCompany, "任务告警", "获取风控公司信息成功,公司名称:"+company.ComName, mobile, isAtAll)
//ding.Send(util.Configs.Ding_msg.FkCompany, "任务告警", "获取风控公司信息成功,公司名称:"+company.ComName, mobile, isAtAll)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment