Commit b6431d4e by root

fix

parents a5de8e2e 602ef24d
......@@ -15,4 +15,4 @@ fk_company="https://oapi.dingtalk.com/robot/send?access_token=231bee055924688720
api_url="http://api.ichunt.com/"
[Fengkong_domain]
go_url="http://192.168.2.179:8000"
\ No newline at end of file
go_url="http://172.18.137.41:8000"
\ No newline at end of file
package InvoiceCompany
package InvoiceCompany
import (
_ "encoding/json"
......@@ -6,28 +6,27 @@ import (
)
type Company struct {
Id int `db:"id"`
ComSn string `db:"com_sn"`
ErpComSn string `db:"erp_com_sn"`
ComName string `db:"com_name"`
ComAddr string `db:"com_addr"`
EstablishmentTime int `db:"establishment_time"`
RegisteredCapital float64 `db:"registered_capital"`
ComOrganization string `db:"com_organization"`
LegalRepresentative string `db:"legal_representative"`
FiveLegalChange int `db:"five_legal_change"`
TwoYearsNoLawsuit string `db:"two_years_no_lawsuit"`
TotalCreditScore float64 `db:"total_credit_score"`
IchuntHuntingCore int `db:"ichunt_hunting_core"`
BlacklistHit string `db:"blacklist_hit"`
RiskType string `db:"risk_type"`
IsKefuCertified string `db:"is_kefu_certified"`
Id int `db:"id"`
ComSn string `db:"com_sn"`
ErpComSn string `db:"erp_com_sn"`
ComName string `db:"com_name"`
ComAddr string `db:"com_addr"`
EstablishmentTime int `db:"establishment_time"`
RegisteredCapital float64 `db:"registered_capital"`
ComOrganization string `db:"com_organization"`
LegalRepresentative string `db:"legal_representative"`
FiveLegalChange int `db:"five_legal_change"`
TwoYearsNoLawsuit string `db:"two_years_no_lawsuit"`
TotalCreditScore float64 `db:"total_credit_score"`
IchuntHuntingCore int `db:"ichunt_hunting_core"`
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"`
CreateTime int `db:"create_time"`
UpdateTime int `db:"update_time"`
}
......@@ -50,19 +50,10 @@ func main() {
//初始化db
initDb(util.Configs.Liexin_databases.Dns)
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)
// }
//}
updateData()
fmt.Println("任务执行成功")
}
// 修改DB
......@@ -78,12 +69,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 +83,7 @@ fmt.Println(err)
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,11 +115,12 @@ fmt.Println(string(body))
// 已评分的推送钉钉通知
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
}
......
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