Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang-queue-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b6431d4e
authored
Sep 14, 2020
by
root
Browse files
Options
_('Browse Files')
Download
Plain Diff
fix
parents
a5de8e2e
602ef24d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
21 deletions
config/config.toml.pro.demo
dal/user/InvoiceCompany/InvoiceCompany.go
user/company/main.go
config/config.toml.pro.demo
View file @
b6431d4e
...
...
@@ -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
dal/user/InvoiceCompany/InvoiceCompany.go
View file @
b6431d4e
package
InvoiceCompany
package
InvoiceCompany
import
(
_
"encoding/json"
...
...
@@ -30,4 +30,3 @@ type Company struct {
CreateTime
int
`db:"create_time"`
UpdateTime
int
`db:"update_time"`
}
user/company/main.go
View file @
b6431d4e
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment