Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lzzzzl
/
param_data
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
9ccb4ad5
authored
Nov 10, 2020
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新attr_values mongo处理
parent
471629f8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
upload/param_mongo.py
upload/param_mongo.py
View file @
9ccb4ad5
...
@@ -47,9 +47,11 @@ class ParamMongo(Task):
...
@@ -47,9 +47,11 @@ class ParamMongo(Task):
mycol
.
save
(
mg_dt
)
mycol
.
save
(
mg_dt
)
def
update_mongo
(
self
,
data
):
def
update_mongo
(
self
,
data
):
count
=
0
class_db
=
self
.
DBConn
.
db_class
()
class_db
=
self
.
DBConn
.
db_class
()
for
row
in
data
:
for
row
in
data
:
try
:
try
:
count
+=
1
spu_id
=
row
[
0
]
spu_id
=
row
[
0
]
attr_values
=
json
.
loads
(
row
[
1
])
attr_values
=
json
.
loads
(
row
[
1
])
new_av_list
=
list
()
new_av_list
=
list
()
...
@@ -61,6 +63,8 @@ class ParamMongo(Task):
...
@@ -61,6 +63,8 @@ class ParamMongo(Task):
if
attr_name
and
attr_value
and
attr_unit
:
if
attr_name
and
attr_value
and
attr_unit
:
new_av_list
.
append
({
'attr_name'
:
attr_name
,
'attr_value'
:
attr_value
,
'attr_unit'
:
attr_unit
})
new_av_list
.
append
({
'attr_name'
:
attr_name
,
'attr_value'
:
attr_value
,
'attr_unit'
:
attr_unit
})
self
.
search_mongo
(
spu_id
,
new_av_list
)
self
.
search_mongo
(
spu_id
,
new_av_list
)
if
count
%
10000
==
0
:
print
(
count
)
except
:
except
:
traceback
.
print_exc
()
traceback
.
print_exc
()
...
...
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