Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
kaopu-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
eb637bb9
authored
Dec 13, 2019
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加五年内法人变更的判断
parent
f540ba69
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
22 deletions
cmd/main.go
internal/dao/com_basicinfos.go
internal/logic/common.go
internal/logic/mobile_message.go
internal/logic/tianyancha.go
cmd/main.go
View file @
eb637bb9
package
main
import
"
fmt
"
import
"
kaopu-server/internal/logic
"
func
main
()
{
fmt
.
Print
(
1
)
logic
.
HttpGet
(
"北京百度网讯科技有限公司"
)
}
...
...
internal/dao/com_basicinfos.go
View file @
eb637bb9
...
...
@@ -50,8 +50,8 @@ func (d *dao)UpdateCompanyBaseInfoForTyc(c context.Context,updateInfo map[string
var
(
execSql
string
)
execSql
=
"update `lie_com_basicinfos` set `customer_property` = ?, `establishment_time` = ?, `five_legal_change` = ?, `registered_capital` = ?, `social_security_participants` = ?, `two_years_no_lawsuit` = ? , `tyc_select_num` = ? , `tianyancha_json` = ?, `com_address` = ?, `legal_representative` = ? where com_credits_id = ? "
row
,
err
:=
d
.
db
.
Exec
(
c
,
execSql
,
updateInfo
[
"customer_property"
],
updateInfo
[
"establishment_time"
],
updateInfo
[
"five_legal_change"
],
updateInfo
[
"registered_capital"
],
updateInfo
[
"social_security_participants"
],
updateInfo
[
"two_years_no_lawsuit"
],
updateInfo
[
"tyc_select_num"
],
updateInfo
[
"tianyancha_json"
],
updateInfo
[
"com_address"
],
updateInfo
[
"legal_representative"
],
updateInfo
[
"com_credits_id"
])
execSql
=
"update `lie_com_basicinfos` set `customer_property` = ?, `establishment_time` = ?, `five_legal_change` = ?, `registered_capital` = ?, `social_security_participants` = ?, `two_years_no_lawsuit` = ? , `tyc_select_num` = ? , `tianyancha_json` = ?, `com_address` = ?, `legal_representative` = ?
,com_organization = ?
where com_credits_id = ? "
row
,
err
:=
d
.
db
.
Exec
(
c
,
execSql
,
updateInfo
[
"customer_property"
],
updateInfo
[
"establishment_time"
],
updateInfo
[
"five_legal_change"
],
updateInfo
[
"registered_capital"
],
updateInfo
[
"social_security_participants"
],
updateInfo
[
"two_years_no_lawsuit"
],
updateInfo
[
"tyc_select_num"
],
updateInfo
[
"tianyancha_json"
],
updateInfo
[
"com_address"
],
updateInfo
[
"legal_representative"
],
updateInfo
[
"com_
organization"
],
updateInfo
[
"com_
credits_id"
])
if
err
!=
nil
{
log
.
Error
(
"updateScoresdb.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
...
...
internal/logic/common.go
View file @
eb637bb9
...
...
@@ -2253,4 +2253,10 @@ func StringIndex(stringDemo,stringKey string) int{
func
Int64TurnString
(
intval
int64
)(
stringval
string
)
{
return
strconv
.
FormatInt
(
intval
,
10
)
}
func
DateTurnInt64
(
datetime
string
)(
timestamp
int64
){
loc
,
_
:=
time
.
LoadLocation
(
"Asia/Shanghai"
)
timeObj
,
_
:=
time
.
ParseInLocation
(
"2006-01-02 15:04:05"
,
datetime
,
loc
)
return
timeObj
.
Unix
()
}
\ No newline at end of file
internal/logic/mobile_message.go
View file @
eb637bb9
package
logic
import
(
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
const
APIMD5STR
string
=
"fh6y5t4rr351d2c3bryi"
const
APIDOMAIN
string
=
"http://
api.liexin.com/msg/sendMessageByAuto
"
const
APIDOMAIN
string
=
"http://
localhost/phpinfo.php
"
func
sendMessage
(
mobile
,
content
string
){
func
SendMessage
(
mobile
int64
,
content
string
){
timeNow
:=
time
.
Now
()
.
Second
()
requestContent
,
_
:=
json
.
Marshal
(
map
[
string
]
string
{
"content"
:
content
})
requestTel
,
_
:=
json
.
Marshal
([]
string
{
mobile
})
requestbody
,
err
:=
json
.
Marshal
(
map
[
string
]
map
[
string
]
string
{
"form_params"
:
{
"data"
:
string
(
requestContent
),
"touser"
:
string
(
requestTel
),
"keyword"
:
"crm_notify_kefu"
,
"k1"
:
Int64TurnString
(
int64
(
timeNow
)),
"k2"
:
Md5
(
Md5
(
Int64TurnString
(
int64
(
timeNow
)))
+
APIMD5STR
),
"is_ignore"
:
"true"
,
},
requestTel
,
_
:=
json
.
Marshal
([]
int64
{
mobile
})
resp
,
err
:=
http
.
PostForm
(
APIDOMAIN
,
url
.
Values
{
"data"
:
{
string
(
requestContent
)},
"touser"
:
{
string
(
requestTel
)},
"keyword"
:
{
"crm_notify_kefu"
},
"k1"
:
{
Int64TurnString
(
int64
(
timeNow
))},
"k2"
:
{
Md5
(
Md5
(
Int64TurnString
(
int64
(
timeNow
)))
+
APIMD5STR
)},
"is_ignore"
:
{},
})
if
err
!=
nil
{
fmt
.
Print
(
err
)
}
resp
,
err
:=
http
.
Post
(
APIDOMAIN
,
"application/json"
,
bytes
.
NewBuffer
(
requestbody
))
defer
resp
.
Body
.
Close
()
}
internal/logic/tianyancha.go
View file @
eb637bb9
...
...
@@ -7,6 +7,7 @@ import (
"net/http"
"strconv"
"strings"
"time"
)
type
TianYanChaCompanyInfo
struct
{
...
...
@@ -16,6 +17,7 @@ type TianYanChaCompanyInfo struct {
RegCapital
string
`json:"regCapital"`
LegalPersonName
string
`json:"legalPersonName"`
RegLocation
string
`json:"regLocation"`
OrgNumber
string
`json:"orgNumber"`
}
type
ResultStruct
struct
{
...
...
@@ -28,6 +30,12 @@ type TotalResultStruct struct {
type
TotalNumResultStruct
struct
{
Total
int64
`json:"total"`
Items
[]
map
[
string
]
string
`json:"items"`
}
type
ChangeInfo
struct
{
ChangeTime
int64
`json:"changeTime"`
ChangeItem
int64
`json:"changeItem"`
}
const
TIANYANCHATOKEN
=
"ba7fd1d1-8ebd-4d4a-844a-d44d75815ad3"
...
...
@@ -41,7 +49,9 @@ const CHANGEINFO = "http://open.api.tianyancha.com/services/open/ic/changeinfo/
func
HttpGet
(
companyName
string
)(
returnDatas
map
[
string
]
string
)
{
var
totalNum
TotalResultStruct
var
companyTycInfo
ResultStruct
respBody
:=
BasicHttpGet
(
COMPANYINFOURL
,
companyName
)
json
.
Unmarshal
(
respBody
,
&
companyTycInfo
)
...
...
@@ -50,6 +60,7 @@ func HttpGet(companyName string)(returnDatas map[string]string) {
returnData
[
"establishment_time"
]
=
strconv
.
FormatFloat
((
companyTycInfo
.
Result
.
EstiblishTime
/
1000
),
'f'
,
-
1
,
64
)
returnData
[
"legal_representative"
]
=
companyTycInfo
.
Result
.
LegalPersonName
returnData
[
"com_address"
]
=
companyTycInfo
.
Result
.
RegLocation
returnData
[
"com_organization"
]
=
companyTycInfo
.
Result
.
OrgNumber
returnData
[
"tianyancha_json"
]
=
string
(
respBody
)
//公司性质
var
companyOrgType
string
...
...
@@ -77,7 +88,8 @@ func HttpGet(companyName string)(returnDatas map[string]string) {
}
returnData
[
"registered_capital"
]
=
strconv
.
FormatFloat
(
capitalNum
,
'f'
,
-
1
,
64
)
var
totalNum
TotalResultStruct
//------------------------------------两年内是否有法律诉讼---------------------------------------//
respBody
=
BasicHttpGet
(
LAWSUIT
,
companyName
)
json
.
Unmarshal
(
respBody
,
&
totalNum
)
returnData
[
"tianyancha_json"
]
+=
"||||"
+
string
(
respBody
)
...
...
@@ -86,11 +98,22 @@ func HttpGet(companyName string)(returnDatas map[string]string) {
}
else
{
returnData
[
"two_years_no_lawsuit"
]
=
"0"
}
//------------------------------------两年内是否有法律诉讼---------------------------------------//
//------------------------------------五年内法人变更---------------------------------------//
respBody
=
BasicHttpGet
(
CHANGEINFO
,
companyName
)
json
.
Unmarshal
(
respBody
,
&
totalNum
)
returnData
[
"tianyancha_json"
]
+=
"||||"
+
string
(
respBody
)
returnData
[
"five_legal_change"
]
=
strconv
.
FormatInt
(
totalNum
.
Result
.
Total
,
10
)
var
changeInfoNum
int64
changeInfoNum
=
0
for
_
,
v
:=
range
totalNum
.
Result
.
Items
{
if
strings
.
Contains
(
v
[
"changeItem"
],
"法人变更"
)
&&
(
DateTurnInt64
(
v
[
"changeTime"
])
+
(
365
*
86400
))
<
time
.
Now
()
.
Unix
()
{
changeInfoNum
++
}
}
returnData
[
"five_legal_change"
]
=
strconv
.
FormatInt
(
changeInfoNum
,
10
)
//------------------------------------五年内法人变更---------------------------------------//
return
returnData
}
...
...
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