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
16a37cad
authored
Oct 28, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add handle unit
parent
7ad48f6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
crontab.py
crontab.py
View file @
16a37cad
...
@@ -441,6 +441,31 @@ def update_vc_ext_redis(conf: dict):
...
@@ -441,6 +441,31 @@ def update_vc_ext_redis(conf: dict):
print
(
"jd_ext_attr"
,
key
,
value
)
print
(
"jd_ext_attr"
,
key
,
value
)
def
handle_default_unit
(
conf
:
dict
):
"""
保持unit与default_unit一致。
"""
host
=
conf
[
"mysql"
][
"host"
]
port
=
conf
[
"mysql"
][
"port"
]
user
=
conf
[
"mysql"
][
"user"
]
password
=
conf
[
"mysql"
][
"password"
]
database
=
conf
[
"mysql"
][
"database"
]
db
=
pymysql
.
connect
(
host
=
host
,
port
=
port
,
user
=
user
,
password
=
password
,
database
=
database
)
cursor
=
db
.
cursor
()
select_sql
=
"select id, unit from lie_shop_attr where platform = 1 and unit = '' and default_unit != ''"
cursor
.
execute
(
query
=
select_sql
)
db_result
=
cursor
.
fetchall
()
for
i
in
range
(
len
(
db_result
)):
id
=
db_result
[
i
][
0
]
update_sql
=
"update lie_shop_attr set default_unit = '' where id =
%
s"
cursor
.
execute
(
query
=
update_sql
,
args
=
(
id
,))
db
.
commit
()
print
(
update_sql
%
(
id
))
"""
"""
执行命令
执行命令
线上:python3 crontab.py prod
线上:python3 crontab.py prod
...
@@ -467,5 +492,6 @@ if __name__ == '__main__':
...
@@ -467,5 +492,6 @@ if __name__ == '__main__':
update_vc_ext_redis
(
config
)
update_vc_ext_redis
(
config
)
print
(
"========================> redis中拓展参数更新完毕"
)
print
(
"========================> redis中拓展参数更新完毕"
)
handle_vc_unit
(
config
)
handle_vc_unit
(
config
)
handle_default_unit
(
config
)
print
(
"========================> 单位处理完毕"
)
print
(
"========================> 单位处理完毕"
)
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