def save(self, **kwargs): self.update_time = utc_now() return super(Node, self).save(**kwargs)
def modify(self, **kwargs): kwargs.update({'set__update_time': utc_now()}) return super(Node, self).update(**kwargs)
def update(self, **kwargs): kwargs.update({'set__update_time': utc_now()}) return super(Call, self).update(**kwargs)
def modify(self, **kwargs): kwargs.update({"set__update_time": utc_now()}) return super(Express, self).modify(**kwargs)
def move_express(expr_cursor): i = 0 # ==> 迁移express for doc in expr_cursor: if mc_expr_new.find_one({'number': doc['expr_num']}): print(('运单[%s]已迁移.' % doc['expr_num'])) continue i += 1 print(('%s, %s, %s, %s' % (i, doc['expr_num'], doc['status'], doc['shop'].get('name')))) shop_id = doc['shop'].get('id') if shop_id == 15081 or (shop_id is None and doc['source'] == 'PHH'): shop_id = '56c2d708a785c90ab0014d06' expr_record = { "number": doc['expr_num'], "third_party": { "order_id": doc['source_order_id'], "name": doc['source'] }, "status": ss[doc['status']], "creator": { "tel": doc['shop'].get('tel', ''), "id": shop_id, "m_type": "", "name": doc['shop'].get('name', '') }, "assignee": { "id": doc['courier'].get('id', ''), "name": doc['courier'].get('name', ''), "tel": doc['courier'].get('tel', ''), "m_type": "parttime" }, "watchers": [{ "id": doc['courier'].get('id', ''), "name": doc['courier'].get('name', ''), "tel": doc['courier'].get('tel', ''), "m_type": "parttime" }, { "id": doc['urban_driver'].get('id', ''), "name": doc['urban_driver'].get('name', ''), "tel": doc['urban_driver'].get('tel', ''), "m_type": "area_manager" }], "node": { "node_n": { "real_tel": doc['receiver'].get('real_tel', ''), "name": doc['receiver'].get('name', ''), "tel": doc['receiver'].get('tel', ''), "addr": doc['receiver'].get('address', ''), "lat": doc['receiver'].get('lat', 0.0), "lng": doc['receiver'].get('lng', 0.0), "fence": { "id": doc['node']['id'], "name": doc['node']['name'] }, # "msg": doc['receiver'].get('msg', '') }, "node_0": { "name": "", "tel": "", "addr": "", "lat": 0.0, "lng": 0.0 } }, "fee": { "fh": doc['fee']['cost'], "ps": doc['fee']['order'] }, "times": {}, "create_time": doc['create_time'], "update_time": doc.get('update_time', utc_now()), "remark": "" } mc_expr_new.insert(expr_record)