| | |
| | | col = dboper.db["tagDBPlayer"] |
| | | TotalCount = col.count() |
| | | spec = {} |
| | | fields = {'_id':0, "AccID":1, "PlayerName":1, "LV":1, "CreateRoleTime":1, "ChangeCoinPointTotal":1, "VIPLv":1} |
| | | fields = {'_id':0, "AccID":1, "PlayerName":1, "PlayerID":1, "LV":1, "CreateRoleTime":1, "ChangeCoinPointTotal":1, "VIPLv":1} |
| | | Ret = col.find(spec, fields).sort([("LV", -1)]).limit(1000) |
| | | |
| | | retData = [] |
| | | accIDList = [] |
| | | for dataInfo in Ret: |
| | | retData.append(dataInfo) |
| | | accIDList.append(dataInfo["AccID"]) |
| | | |
| | | col = dboper.db["tagDSAccount"] |
| | | spec = {"ACCID":{"$in":accIDList}} |
| | | fields = {'_id':0, "ACCID":1, "ClientVersion":1} |
| | | accRet = col.find(spec, fields) |
| | | # 关闭 |
| | | dboper.close() |
| | | |
| | | retData = [] |
| | | for dataInfo in Ret: |
| | | retData.append(dataInfo) |
| | | accountInfo = {} # 账号表的关联信息 |
| | | for ad in accRet: |
| | | accID = ad.pop("ACCID", "") |
| | | if accID: |
| | | accountInfo[accID] = ad |
| | | |
| | | # 合并数据 |
| | | for dataInfo in retData: |
| | | accID = dataInfo["AccID"] |
| | | dataInfo.update(accountInfo.get(accID, {})) |
| | | |
| | | ret = {"OK":1, "Data":retData, "TotalCount":TotalCount} |
| | | logging.info("ret:%s" % ret) |