58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
|
from lib.all import *
|
||
|
|
||
|
|
||
|
class S:
|
||
|
def __init__(self):
|
||
|
self.col_account = MongoDB(
|
||
|
host="mongodb://root:Wishpal2024@dds-bp1da1ddd62bede41.mongodb.rds.aliyuncs.com:3717,dds-bp1da1ddd62bede42.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-77304659",
|
||
|
port=3717,
|
||
|
db="account",
|
||
|
collection="account"
|
||
|
)
|
||
|
self.col_login = MongoDB(
|
||
|
host="mongodb://root:Wishpal2024@dds-bp1da1ddd62bede41.mongodb.rds.aliyuncs.com:3717,dds-bp1da1ddd62bede42.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-77304659",
|
||
|
port=3717,
|
||
|
db="login",
|
||
|
collection="login"
|
||
|
)
|
||
|
print(self.col_account)
|
||
|
self.mysql_db_vas = Mysql(
|
||
|
"rm-bp11t1616a1kjvmx5.mysql.rds.aliyuncs.com", 3306, "vas", "root", "Wishpal2024"
|
||
|
)
|
||
|
|
||
|
def __del__(self):
|
||
|
self.col_account.close()
|
||
|
self.col_login.close()
|
||
|
self.mysql_db_vas.close()
|
||
|
|
||
|
def get_orders(self, mid):
|
||
|
sql = '''select id,order_status from vas_order where mid={}'''.format(mid)
|
||
|
rows = self.mysql_db_vas.query(sql)
|
||
|
return rows
|
||
|
|
||
|
# def get_login(self, mid):
|
||
|
# q = {
|
||
|
# "mid": mid
|
||
|
# }
|
||
|
# self.col_account
|
||
|
#
|
||
|
|
||
|
def proc_one(self, phone_hash):
|
||
|
q = {
|
||
|
"phone_hash": phone_hash
|
||
|
}
|
||
|
prj = {
|
||
|
"_id": 1,
|
||
|
"ct": 1,
|
||
|
}
|
||
|
docs = self.col_account.find(query=q, projection=prj)
|
||
|
|
||
|
for doc in docs:
|
||
|
mid = safe_get_int(doc, "_id")
|
||
|
orders = self.get_orders(mid)
|
||
|
print(mid, len(orders))
|
||
|
|
||
|
|
||
|
s = S()
|
||
|
s.proc_one("E067B7E9D67AF3F1A6987796AA8F511EA797CE5954973228410334F10F827BD1")
|