Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
jd_data_process
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
d95b6025
authored
Oct 18, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update class
parent
0be98dd6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
test5.py
test5.py
View file @
d95b6025
...
@@ -239,6 +239,34 @@ def process_unit_str(attr_name: str) -> str:
...
@@ -239,6 +239,34 @@ def process_unit_str(attr_name: str) -> str:
return
unit_str
return
unit_str
def
update_pop_class
():
ans
=
get_pop_class
()
data
=
ans
[
"jingdong_vender_category_getFullValidCategoryResultByVenderId_responce"
][
"returnType"
][
"list"
]
config
=
config_dev
db
=
pymysql
.
connect
(
host
=
config
[
"mysql"
][
"host"
],
port
=
config
[
"mysql"
][
"port"
],
user
=
config
[
"mysql"
][
"user"
],
database
=
config
[
"mysql"
][
"database"
],
password
=
config
[
"mysql"
][
"password"
])
cursor
=
db
.
cursor
()
for
i
in
range
(
len
(
data
)):
parent_id
=
data
[
i
][
"fid"
]
class_id
=
data
[
i
][
"id"
]
class_name
=
data
[
i
][
"name"
]
depth
=
data
[
i
][
"lev"
]
status
=
1
platform
=
3
create_time
=
int
(
time
.
time
())
# sql = "insert into lie_shop_class (parent_id, class_id, class_name, depth, status, platform, create_time) values (%s, %s, %s, %s, %s, %s, %s)"
select_sql
=
"select id from lie_shop_class where platform = 3 and class_id =
%
s"
cursor
.
execute
(
query
=
select_sql
)
db_result
=
cursor
.
fetchall
()
if
len
(
db_result
)
==
0
:
sql
=
"insert into lie_shop_class (parent_id, class_id, class_name, depth, status, platform, create_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
cursor
.
execute
(
query
=
sql
,
args
=
(
parent_id
,
class_id
,
class_name
,
depth
,
status
,
platform
,
create_time
))
db
.
commit
()
print
(
sql
%
(
parent_id
,
class_id
,
class_name
,
depth
,
status
,
platform
,
create_time
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
handle_pop_unit
()
update_pop_class
()
\ No newline at end of file
\ No newline at end of file
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