#!/usr/bin/python
|
# -*- coding: utf-8 -*-
|
# @todo: VIP等级信息
|
|
import CommFunc
|
import DBOperate
|
import ConfigParser
|
|
import time
|
import mylog
|
import logging
|
|
cfg = ConfigParser.ConfigParser()
|
cfg.read("../../InterfaceConfig.php")
|
ServerPath = cfg.get("ServerInfo", "ServerPath")
|
|
class CrossPlayer():
|
|
def __init__(self):
|
self.playerLV = 0
|
self.fightPower = 0
|
return
|
|
def getVIPLVInfo(argvDict):
|
|
gteVIPLV = CommFunc.toInt(argvDict.get("gteVIPLV"), 1)
|
topLimitCount = CommFunc.toInt(argvDict.get("topLimitCount"), 3)
|
dboper = DBOperate.DBOper(ServerPath)
|
col = dboper.db["tagDBPlayer"]
|
spec = {"VIPLv":{"$gte":1}}
|
fields = {'_id':0, "AccID":1, "PlayerName":1, "ExAttr9":1, "VIPLv":1}
|
findRet = col.find(spec, fields).sort([("VIPLv", -1), ("ExAttr9", 1)])
|
|
vipPlayerCountTotal = 0
|
drList = []
|
vipLVCountDict = {}
|
for docInfo in findRet:
|
#AccID = docInfo["AccID"]
|
#PlayerName = docInfo["PlayerName"]
|
VIPLv = docInfo["VIPLv"]
|
ExAttr9 = docInfo["ExAttr9"]
|
vipLVCountDict[VIPLv] = vipLVCountDict.get(VIPLv, 0) + 1
|
vipPlayerCountTotal += 1
|
|
if VIPLv < gteVIPLV:
|
continue
|
|
if topLimitCount <= 0:
|
continue
|
|
docInfo["ExAttr9"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ExAttr9)) if ExAttr9 else ""
|
drList.append(docInfo)
|
topLimitCount -= 1
|
|
# 关闭
|
dboper.close()
|
|
printStr = ""
|
|
vipLVList = vipLVCountDict.keys()
|
vipLVList.sort(reverse=True)
|
printStr += "%s: %s人<br/>" % (_(u"VIP等级人数汇总"), vipPlayerCountTotal)
|
for vipLV in vipLVList:
|
printStr += "VIP%s - %s人 , " % (vipLV, vipLVCountDict[vipLV])
|
printStr += "<br/>"
|
|
# 表格输出
|
printStr += CommFunc.editTableHtml(drList, ["AccID", "PlayerName", "VIPLv", "ExAttr9"], _(u"编号"),
|
styleInfo={"AccID":{"align":"right", "title":_(u"账号")},
|
"PlayerName":{"align":"right", "title":_(u"玩家名")},
|
"ExAttr9":{"align":"right", "title":_(u"提升VIP等级时间")},
|
})
|
|
# 只会返回最后一个print的内容
|
print printStr
|
return
|
|
def main():
|
CommFunc.setdefaultencoding()
|
argvDict = CommFunc.parse_args()
|
mylog.InitMyLog(argvDict.get("eventType", ""))
|
CommFunc.gettextInstall(argvDict.get("lang", ""))
|
getVIPLVInfo(argvDict)
|
return
|
|
if __name__ == "__main__":
|
try:
|
main()
|
except:
|
CommFunc.printExceptionError()
|