Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
my-awesome-project
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
962072df
authored
Jun 25, 2024
by
larosa
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
modify func
parent
43ff94b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
9 deletions
release.py
release.py
View file @
962072df
import
json
import
mysql.connector
import
requests
url
=
"/sync/Address/updateAddress"
# 线上地址需要更改
def
ma
in
():
def
liex
in
():
db
=
mysql
.
connector
.
connect
(
host
=
"master.db2
.liexindev.me"
,
user
=
"liexin_crmv2
"
,
password
=
"liexin_crmv2
#zsyM"
,
database
=
"liexin_crmv2
"
host
=
"232.db
.liexindev.me"
,
user
=
"liexin
"
,
password
=
"liexin
#zsyM"
,
database
=
"liexin
"
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
"select
* from lie_company where com_category in (0, 1)
"
)
cursor
.
execute
(
"select
tax_title, business_license from lie_taxinfo
"
)
result
=
cursor
.
fetchall
()
for
row
in
result
:
pass
json_map
=
{
"company_name_cn"
:
row
[
0
],
# tax_title
"business_license"
:
row
[
1
],
# business_license
"source_system_id"
:
""
,
# ?????
"create_uid"
:
""
,
# ????
"create_name"
:
""
,
# ?????
"address_data"
:
[
{
"source_id"
:
"tax_id_"
,
"source_code"
:
""
,
"address_type"
:
""
,
"address"
:
""
},
{
"source_id"
:
""
,
"source_code"
:
""
,
"address_type"
:
""
,
"address"
:
""
},
{
"source_id"
:
""
,
"source_code"
:
""
,
"address_type"
:
""
,
"address"
:
""
}
]
}
#########################################################################
def
crm
():
db
=
mysql
.
connector
.
connect
(
host
=
"master.db2.liexindev.me"
,
user
=
"liexin_crmv2"
,
password
=
"liexin_crmv2#zsyM"
,
database
=
"liexin_crmv2"
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
"select com_name, business_license_src, creator_id, creator_name, id, com_addr from lie_company where com_category in (0, 1)"
)
result
=
cursor
.
fetchall
()
for
row
in
result
:
json_map
=
{
"company_name_cn"
:
row
[
0
],
# com_name
"business_license"
:
row
[
1
],
# business_license_src
"source_system_id"
:
"3"
,
"create_uid"
:
str
(
row
[
2
]),
# creator_id
"create_name"
:
row
[
3
],
# creator_name
"address_data"
:
[
{
"source_id"
:
"company_"
+
str
(
row
[
4
]),
# id
"source_code"
:
""
,
# ???? 为空
"address_type"
:
""
,
# 这个不确定
"address"
:
row
[
5
]
# com_addr
}
]
}
post_data_to_update_address
(
json_map
)
print
(
"-------------------------crm已更新!--------------------------------"
)
cursor
.
close
()
db
.
close
()
def
post_data_to_update_address
(
data
:
dict
):
response
=
requests
.
post
(
url
=
url
,
data
=
json
.
dumps
(
data
),
headers
=
{
"Content-Type"
:
"application/json"
})
print
(
"======="
+
str
(
response
.
status_code
)
+
"======"
)
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
pass
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