Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
中
中电中采
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZGC_INDEX
中电中采
Commits
693e034b
Commit
693e034b
authored
Apr 08, 2021
by
rico.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
b64173e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
API数据处理func.py
API数据处理func.py
+6
-2
Excel数据处理func.py
Excel数据处理func.py
+10
-5
No files found.
API数据处理func.py
View file @
693e034b
...
...
@@ -1415,16 +1415,17 @@ def create_to_db(path,std_value_dict):
if
category
in
computer_cat
:
cpu_attr_list
=
[]
for
cpu
in
new_df
[
'CPU型号'
]
.
tolist
():
for
index
,
row
in
df
.
iterrows
():
cpu
=
tuple
(
std_value_dict
[
int
(
row
[
'id'
])][
'CPU型号'
])[
0
]
if
'飞腾'
in
cpu
or
'龙芯'
in
cpu
or
'兆芯'
in
cpu
:
pass
else
:
cpu
=
cpu
.
split
(
'-'
)[
0
]
cpu_attr_list
.
append
(
cpu
)
new_df
[
'CPU属性'
]
=
cpu_attr_list
else
:
continue
...
...
@@ -1463,6 +1464,9 @@ def create_to_db(path,std_value_dict):
continue
else
:
name
+=
" "
try
:
name
+=
str
(
tuple
(
std_value_dict
[
id_
][
spu_param
])[
0
])
except
:
name
+=
str
(
row
[
spu_param
])
name
=
name
+
" "
+
str
(
row
[
'zi_subcategoryname'
])
#spu名称
...
...
Excel数据处理func.py
View file @
693e034b
...
...
@@ -1378,7 +1378,8 @@ def create_to_db(path,std_value_dict):
id_
=
int
(
row
[
'id'
])
skuname
=
''
brandname
=
row
[
'zi_brandname'
]
cursor_zi_new
.
execute
(
f
"select id from p_brand where name = '{brandname}' and id not in (select distinct pid from p_brand)"
)
#cursor_zi_new.execute(f"select id from p_brand where name = '{brandname}' and id not in (select distinct pid from p_brand)")
cursor_zi_new
.
execute
(
f
"select id from p_brand where name = '{brandname}'"
)
brand_code
=
cursor_zi_new
.
fetchone
()[
0
]
cursor_zi_new
.
execute
(
f
"select pid from p_brand where id = {brand_code}"
)
...
...
@@ -1556,16 +1557,17 @@ def create_to_db(path,std_value_dict):
if
category
in
computer_cat
:
cpu_attr_list
=
[]
for
cpu
in
new_df
[
'CPU型号'
]
.
tolist
():
for
index
,
row
in
df
.
iterrows
():
cpu
=
tuple
(
std_value_dict
[
int
(
row
[
'id'
])][
'CPU型号'
])[
0
]
if
'飞腾'
in
cpu
or
'龙芯'
in
cpu
or
'兆芯'
in
cpu
:
pass
else
:
cpu
=
cpu
.
split
(
'-'
)[
0
]
cpu_attr_list
.
append
(
cpu
)
new_df
[
'CPU属性'
]
=
cpu_attr_list
else
:
continue
...
...
@@ -1604,6 +1606,9 @@ def create_to_db(path,std_value_dict):
continue
else
:
name
+=
" "
try
:
name
+=
str
(
tuple
(
std_value_dict
[
id_
][
spu_param
])[
0
])
except
:
name
+=
str
(
row
[
spu_param
])
name
=
name
+
" "
+
str
(
row
[
'zi_subcategoryname'
])
#spu名称
...
...
@@ -1870,7 +1875,7 @@ def price_to_db(batch, channel_alias):
sku_list
=
df
[
'productcode'
]
.
tolist
()
source_name_list
=
df
[
'name'
]
.
replace
(
"'"
,
"''"
)
.
tolist
()
price_list
=
df
[
'
url_
price'
]
.
replace
(
"['"
,
""
)
.
replace
(
"']"
,
""
)
.
tolist
()
price_list
=
df
[
'price'
]
.
replace
(
"['"
,
""
)
.
replace
(
"']"
,
""
)
.
tolist
()
url_list
=
df
[
'url'
]
.
replace
(
"['"
,
""
)
.
replace
(
"']"
,
""
)
.
tolist
()
channelId_list
=
[
sup_en2code_dict
[
ele
]
for
ele
in
df
[
'channel_alias'
]
.
tolist
()]
...
...
@@ -2122,7 +2127,7 @@ def get_data_all():
mssql
=
MSSQL
(
'123.57.45.119'
,
'ZI_Service'
)
cursor_zi_service
=
mssql
.
_cur
cursor_zi_service
.
execute
(
f
"select
*
from product_all where state = '9' and (cal_price is Null or new_name is Null)"
)
cursor_zi_service
.
execute
(
f
"select
id,productcode
from product_all where state = '9' and (cal_price is Null or new_name is Null)"
)
data
=
cursor_zi_service
.
fetchall
()
df
=
pd
.
DataFrame
(
data
,
columns
=
[
tuple
[
0
]
for
tuple
in
cursor_zi_service
.
description
])
...
...
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