fix post log
This commit is contained in:
parent
60879d0574
commit
97f9e90b92
|
@ -94,9 +94,28 @@ group by t1.mid,t1.type_id
|
|||
mid_docs_map[mid].append(doc)
|
||||
print("from, len(mid_docs_map): {}".format(len(mid_docs_map)))
|
||||
|
||||
reqs = list()
|
||||
for mid, docs in mid_docs_map.items():
|
||||
q = {"_id": mid}
|
||||
lis = list()
|
||||
for d in docs:
|
||||
lis.append({
|
||||
"desc": safe_get_str(d, "type_id"),
|
||||
"income": safe_get_int(d, "income")
|
||||
})
|
||||
up = {
|
||||
"$set": {
|
||||
"ut": int(time.time()),
|
||||
"week_from_dashboard": lis
|
||||
}
|
||||
}
|
||||
reqs.append(UpdateOne(q, up, upsert=True))
|
||||
ret = self.col_user_income.bulk_write(reqs)
|
||||
print("from, bulk_ret, match: {}, modify: {}, insert: {}, upsert: {}".format(ret.matched_count, ret.modified_count, ret.inserted_count, ret.upserted_count))
|
||||
|
||||
def proc(self):
|
||||
self.get_week_dashboard()
|
||||
# self.get_income_from_dashboard()
|
||||
self.get_income_from_dashboard()
|
||||
|
||||
|
||||
s = S()
|
||||
|
|
Loading…
Reference in New Issue