Commit b6431d4e by root

fix

parents a5de8e2e 602ef24d
...@@ -15,4 +15,4 @@ fk_company="https://oapi.dingtalk.com/robot/send?access_token=231bee055924688720 ...@@ -15,4 +15,4 @@ fk_company="https://oapi.dingtalk.com/robot/send?access_token=231bee055924688720
api_url="http://api.ichunt.com/" api_url="http://api.ichunt.com/"
[Fengkong_domain] [Fengkong_domain]
go_url="http://192.168.2.179:8000" go_url="http://172.18.137.41:8000"
\ No newline at end of file \ No newline at end of file
package InvoiceCompany package InvoiceCompany
import ( import (
_ "encoding/json" _ "encoding/json"
...@@ -30,4 +30,3 @@ type Company struct { ...@@ -30,4 +30,3 @@ type Company struct {
CreateTime int `db:"create_time"` CreateTime int `db:"create_time"`
UpdateTime int `db:"update_time"` UpdateTime int `db:"update_time"`
} }
...@@ -50,19 +50,10 @@ func main() { ...@@ -50,19 +50,10 @@ func main() {
//初始化db //初始化db
initDb(util.Configs.Liexin_databases.Dns) initDb(util.Configs.Liexin_databases.Dns)
updateData()
//t1 := time.NewTimer(time.Second * 60) updateData()
//t1 := time.NewTimer(time.Hour * 12) // 定时12小时
fmt.Println("任务执行成功")
//for {
// select {
// case <-t1.C:
// fmt.Println("ticker...")
// updateData()
// t1.Reset(time.Second * 60)
// //t1.Reset(time.Hour * 12)
// }
//}
} }
// 修改DB // 修改DB
...@@ -78,12 +69,12 @@ func updateData() (err error) { ...@@ -78,12 +69,12 @@ func updateData() (err error) {
for row.Next() { for row.Next() {
var company InvoiceCompany.Company var company InvoiceCompany.Company
row.StructScan(&company) row.StructScan(&company)
fmt.Println(company)
// 拉取风控公司信息 // 拉取风控公司信息
url := util.Configs.Fengkong_domain.GoUrl + "/kaopu-server/http/member/company_info/" + company.ComName url := util.Configs.Fengkong_domain.GoUrl + "/kaopu-server/http/member/company_info/" + company.ComName
resp, err := http.Get(url) resp, err := http.Get(url)
fmt.Println(err)
if err != nil { if err != nil {
logger.Info("请求风控接口失败,错误原因: ", err.Error()) logger.Info("请求风控接口失败,错误原因: ", err.Error())
return err return err
...@@ -92,7 +83,7 @@ fmt.Println(err) ...@@ -92,7 +83,7 @@ fmt.Println(err)
defer resp.Body.Close() defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
erp_com_sn := gjson.Get(string(body), "com_credit.erp_company_code").String() // ERP编码 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() // 公司地址 com_addr := gjson.Get(string(body), "com_basic_info.com_address").String() // 公司地址
establishment_time := gjson.Get(string(body), "com_basic_info.establishment_time").Int() // 成立时间 establishment_time := gjson.Get(string(body), "com_basic_info.establishment_time").Int() // 成立时间
...@@ -124,11 +115,12 @@ fmt.Println(string(body)) ...@@ -124,11 +115,12 @@ fmt.Println(string(body))
// 已评分的推送钉钉通知 // 已评分的推送钉钉通知
if total_credit_score > 0 { 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)
} }
} }
row.Close()
return return
} }
......
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