Пример #1
0
def get_database():
    db = Connection('SmartHome').db
    return db
Пример #2
0
        self.biz_id = ''  # 业务号(返回)
        self.sign = ''  # 短信签名
        self.template = ''  # 短信模板代码
        self.content = ''  # 短信内容
        self.succ = False  # 是否成功
        self.reason = ''  #  find_password


class LogAppBehavior(Model):
    """记录app端用户操作日志"""
    def __init__(self):
        Model.__init__(self)
        self.user_id = ''  # user id 数据库记录id
        self.open_id = ''  # weixin
        self.platform = ''  # 平台
        self.datetime = ''  #
        self.timestamp = 0  #
        self.action_type = ''  # open,close,share,create,update,delete
        self.action_res_type = ''  # 操作的资源对象类型
        self.action_res_id = ''  # 操作资源对象编号
        self.content = ''  # 描述


from mantis.fundamental.nosql.mongo import Connection
if __name__ == '__main__':
    conn = Connection().conn
    coll = conn['TradeLog_Ctp_htqh-01']['send_order']
    rs = coll.find()
    for r in rs:
        print r
    # print type(rs)
Пример #3
0
def get_database():
    db = Connection('smartvision').db
    return db
Пример #4
0
def get_database():
    db = Connection('BlueEarth').db
    return db
Пример #5
0
# coding: utf-8

from mantis.fundamental.nosql.mongo import Connection
from mantis.BlueEarth import model
import csv

db = Connection('constant_reference').db
coll = db['lbs_cell']
# 初始化 lbs 基站数据库
csvfile = open('/tmp/cell.csv', 'rb')
reader = csv.reader(csvfile)
for row in reader:
    mcc, mnc, lac, cell, lat, lon, addr = row
    data = dict(mcc=int(mcc),
                mnc=int(mnc),
                lac=int(lac),
                cell=int(cell),
                lat=float(lac),
                lon=float(lon),
                addr=addr)
    coll.insert_one(data)