Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
ZHOUXINGYU_project
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
zhou
ZHOUXINGYU_project
Commits
fe6dac33
Commit
fe6dac33
authored
Jan 07, 2020
by
sanlu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加了返回错误类产品到回馈表中和进入页面数据置9的功能
parent
b09a5e32
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
560 additions
and
5 deletions
+560
-5
ZH_SN_data_2020-01-07.xlsx
api_data/ZH_SN_data_2020-01-07.xlsx
+0
-0
ZH_SN_data_dict_2020-01-07.txt
api_data/ZH_SN_data_dict_2020-01-07.txt
+0
-0
ZH_SN_no_category_data_2019-12-27.xlsx
api_data/ZH_SN_no_category_data_2019-12-27.xlsx
+0
-0
ZH_SN_no_category_data_2020-01-07.xlsx
api_data/ZH_SN_no_category_data_2020-01-07.xlsx
+0
-0
main_merge copy.py
main_merge copy.py
+514
-0
main_merge.py
main_merge.py
+27
-2
test.py
test.py
+19
-3
No files found.
api_data/ZH_SN_data_2020-01-07.xlsx
0 → 100644
View file @
fe6dac33
File added
api_data/ZH_SN_data_dict_2020-01-07.txt
0 → 100644
View file @
fe6dac33
File added
api_data/ZH_SN_no_category_data_2019-12-27.xlsx
View file @
fe6dac33
No preview for this file type
api_data/ZH_SN_no_category_data_2020-01-07.xlsx
0 → 100644
View file @
fe6dac33
File added
main_merge copy.py
0 → 100644
View file @
fe6dac33
This diff is collapsed.
Click to expand it.
main_merge.py
View file @
fe6dac33
...
@@ -255,8 +255,29 @@ def param_extract_function(data_table,channel):
...
@@ -255,8 +255,29 @@ def param_extract_function(data_table,channel):
update_table_df
.
to_excel
(
'update_data_test.xlsx'
)
update_table_df
.
to_excel
(
'update_data_test.xlsx'
)
update_table_df
.
to_sql
(
'Product_Parameter_Process'
,
sql_ZIdatabase
.
engine
,
if_exists
=
'append'
,
index
=
False
)
update_table_df
.
to_sql
(
'Product_Parameter_Process'
,
sql_ZIdatabase
.
engine
,
if_exists
=
'append'
,
index
=
False
)
product_table
.
to_sql
(
'Product_Api_Data'
,
sql_ZIdatabase
.
engine
,
if_exists
=
'append'
,
index
=
False
)
product_table
.
to_sql
(
'Product_Api_Data'
,
sql_ZIdatabase
.
engine
,
if_exists
=
'append'
,
index
=
False
)
update_sku_list
=
set
(
list
(
product_table
[
'SKU'
]))
channel_sql
=
sql_find
(
database
=
f
'ZH_{channel}'
)
for
sku
in
update_sku_list
:
channel_sql
.
cursor
.
execute
(
f
"update product_all set state='9' where sku={sku}"
)
return
update_table_df
return
update_table_df
def
return_error
(
table
):
sql_zi_zh
=
sql_find
(
'zi_zh'
,
False
)
NowTime
=
time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
,
time
.
localtime
())
#table = pd.read_excel('api_data/ZH_SN_no_category_data_2019-12-27.xlsx', dtype = {'SKU' : str})
table
=
table
[[
'SKU'
,
'产品名称'
,
'url'
,
'来源'
]]
l
=
len
(
table
)
create_time_list
=
[]
remark_list
=
[]
for
i
in
range
(
l
):
create_time_list
.
append
(
NowTime
)
remark_list
.
append
(
'类别对应错误'
)
table
[
'remark'
]
=
remark_list
table
[
'create_time'
]
=
create_time_list
table
.
columns
=
[
'sku'
,
'name'
,
'url'
,
'source'
,
'remark'
,
'create_time'
]
table
.
to_sql
(
'API_returnErrorData'
,
sql_zi_zh
.
engine
,
if_exists
=
'append'
,
index
=
False
)
class
data_fetch
():
class
data_fetch
():
def
__init__
(
self
,
model
=
'LXWL_model'
,
localhost
=
True
,
source
=
'ZH_LXWL'
):
def
__init__
(
self
,
model
=
'LXWL_model'
,
localhost
=
True
,
source
=
'ZH_LXWL'
):
'''
'''
...
@@ -384,7 +405,10 @@ class data_fetch():
...
@@ -384,7 +405,10 @@ class data_fetch():
symbol
=
1
symbol
=
1
self
.
sql_LXWL
.
cursor
.
execute
(
f
"select price from product_price where sku='{sku}'"
)
self
.
sql_LXWL
.
cursor
.
execute
(
f
"select price from product_price where sku='{sku}'"
)
try
:
price
=
self
.
sql_LXWL
.
cursor
.
fetchone
()[
0
]
price
=
self
.
sql_LXWL
.
cursor
.
fetchone
()[
0
]
except
TypeError
:
price
=
decimal
.
Decimal
(
0
)
data
.
append
(
price
)
data
.
append
(
price
)
data
.
append
(
ZIname
)
data
.
append
(
ZIname
)
...
@@ -500,6 +524,7 @@ class data_fetch():
...
@@ -500,6 +524,7 @@ class data_fetch():
data_table
.
to_excel
(
f
'api_data/{self.source}_data_{StyleTime}.xlsx'
)
data_table
.
to_excel
(
f
'api_data/{self.source}_data_{StyleTime}.xlsx'
)
no_category_table
=
data_table
[
data_table
[
'指数子类编码'
]
==
'没有匹配的指数子类编码'
]
no_category_table
=
data_table
[
data_table
[
'指数子类编码'
]
==
'没有匹配的指数子类编码'
]
no_category_table
.
to_excel
(
f
'api_data/{self.source}_no_category_data_{StyleTime}.xlsx'
)
no_category_table
.
to_excel
(
f
'api_data/{self.source}_no_category_data_{StyleTime}.xlsx'
)
return_error
(
no_category_table
)
data_table
=
data_table
[
data_table
[
'指数子类编码'
]
!=
'没有匹配的指数子类编码'
]
data_table
=
data_table
[
data_table
[
'指数子类编码'
]
!=
'没有匹配的指数子类编码'
]
#self.data_table_80 = data_table[data_table['指数子类编码'].isin(self.class_80['指数编码'].tolist())]
#self.data_table_80 = data_table[data_table['指数子类编码'].isin(self.class_80['指数编码'].tolist())]
#self.data_table_80.to_excel(f'api_data/{self.source}_data_80_{StyleTime}.xlsx')
#self.data_table_80.to_excel(f'api_data/{self.source}_data_80_{StyleTime}.xlsx')
...
@@ -508,7 +533,7 @@ class data_fetch():
...
@@ -508,7 +533,7 @@ class data_fetch():
return
data_table
return
data_table
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
channel
=
'
OFS
'
channel
=
'
SN
'
data_api
=
data_fetch
(
model
=
'LXWL_model'
,
localhost
=
False
,
source
=
f
'ZH_{channel}'
)
data_api
=
data_fetch
(
model
=
'LXWL_model'
,
localhost
=
False
,
source
=
f
'ZH_{channel}'
)
data_api_table
=
data_api
.
run
()
data_api_table
=
data_api
.
run
()
#param_extract_function(data_api_table,channel)
#param_extract_function(data_api_table,channel)
\ No newline at end of file
test.py
View file @
fe6dac33
from
lstm_predict
import
LSTMNER
import
pandas
as
pd
import
time
from
function
import
*
model
=
LSTMNER
(
'0101'
)
def
return_error
(
table
):
model
.
param_extract
(
'联想 ThinkPad E580 ThinkPad E580(02CD)15.6英寸轻薄窄边框笔记本电脑(i5-8250U 8G 256G PCIeSSD+1T 2G独显 FHD)黑色(计价单位:台)'
)
sql_zi_zh
=
sql_find
(
'zi_zh'
,
False
)
\ No newline at end of file
NowTime
=
time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
,
time
.
localtime
())
#table = pd.read_excel('api_data/ZH_SN_no_category_data_2019-12-27.xlsx', dtype = {'SKU' : str})
table
=
table
[[
'SKU'
,
'产品名称'
,
'url'
,
'来源'
]]
l
=
len
(
table
)
create_time_list
=
[]
remark_list
=
[]
for
i
in
range
(
l
):
create_time_list
.
append
(
NowTime
)
remark_list
.
append
(
'类别对应错误'
)
table
[
'remark'
]
=
remark_list
table
[
'create_time'
]
=
create_time_list
table
.
columns
=
[
'sku'
,
'name'
,
'url'
,
'source'
,
'remark'
,
'create_time'
]
table
.
to_sql
(
'API_returnErrorData'
,
sql_zi_zh
.
engine
,
if_exists
=
'append'
,
index
=
False
)
\ 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