Exemple #1
0
    def LoginInfo(self, p={}):
        '''登录用需要获得的信息汇总
        "opt_id":    15051
        "opt_id":    15050
        "opt_id":    18007
        "opt_id":    19011
        "opt_id":    13061
        '''
        startTime = time.time()
        optId = 10021
        #15051
        soldierTechs = Gcore.getMod('Book', self.uid).getTechs(1)  #兵种科技
        interTechs = Gcore.getMod('Book', self.uid).getTechs(2)  #内政科技
        re = {}

        #15051 科技信息
        re['TechInfo'] = {
            'SoldierTechs': soldierTechs,
            'InterTechs': interTechs
        }

        #15050 科技升级信息
        tech = Gcore.getMod('Book', self.uid).getUpgradingTech()
        flag = 1 if tech else 0
        re['UpdateTechInfo'] = {'IsUpgrading': flag, 'Tech': tech}

        #18007 未读邮件
        re['UnReadNum'] = Gcore.getMod('Mail', self.uid).countUnReadNum()

        #19011 好友申请
        applyNum = Gcore.getMod('Friend', self.uid).countApply()
        re['ApplyNum'] = applyNum

        #13061 查看背包物品
        bagSize = Gcore.getMod('Bag', self.uid).getBagSize()  #背包容量
        goods = Gcore.getMod('Bag', self.uid).getGoods(0)  #背包物品
        goods = Gcore.common.list2dict(goods, offset=0)
        re['BagInfo'] = {'GS': goods, 'Size': bagSize}
        #-----------------------------------
        runtime = time.time() - startTime
        if Gcore.TEST:  #调试计时
            row = {
                'UserId': self.uid,
                'OptId': 10021,
                'CallMethod': 'LoginUI.LoginInfo',
                'Param': '',
                'Response': '--skip',
                'Runtime': runtime,
                'RecordTime': Gcore.common.datetime(),
            }
            Gcore.getDB(0).insert('temp_runtime_log', row)
        #-------------------------------------
        return Gcore.out(optId, re)
Exemple #2
0
    def LoginInfo(self,p={}):
        '''登录用需要获得的信息汇总
        "opt_id":    15051
        "opt_id":    15050
        "opt_id":    18007
        "opt_id":    19011
        "opt_id":    13061
        '''
        startTime = time.time()
        optId = 10021
        #15051
        soldierTechs = Gcore.getMod('Book',self.uid).getTechs(1)#兵种科技
        interTechs = Gcore.getMod('Book',self.uid).getTechs(2)#内政科技     
        re = {}

        #15051 科技信息
        re['TechInfo'] = {'SoldierTechs':soldierTechs,'InterTechs':interTechs}
        
        #15050 科技升级信息
        tech = Gcore.getMod('Book',self.uid).getUpgradingTech()
        flag = 1 if tech else 0
        re['UpdateTechInfo'] =  {'IsUpgrading':flag,'Tech':tech}
        
        #18007 未读邮件
        re['UnReadNum'] = Gcore.getMod('Mail',self.uid).countUnReadNum()
        
        #19011 好友申请
        applyNum= Gcore.getMod('Friend',self.uid).countApply()
        re['ApplyNum'] = applyNum
        
        #13061 查看背包物品
        bagSize = Gcore.getMod('Bag',self.uid).getBagSize()#背包容量
        goods = Gcore.getMod('Bag',self.uid).getGoods(0)#背包物品
        goods = Gcore.common.list2dict(goods, offset=0)
        re['BagInfo'] = {'GS':goods,'Size':bagSize}
        #-----------------------------------
        runtime = time.time() - startTime
        if Gcore.TEST: #调试计时
            row = {
                     'UserId':self.uid,
                     'OptId':10021,
                     'CallMethod':'LoginUI.LoginInfo',
                     'Param':'',
                     'Response':'--skip',
                     'Runtime':runtime,
                     'RecordTime':Gcore.common.datetime(),
                     }
            Gcore.getDB(0).insert('temp_runtime_log', row)
        #-------------------------------------
        return Gcore.out(optId,re)
Exemple #3
0
 def __init__(self, uid, CacheAll=True):
     '''当别的地方调用的 Cache 为False 如mqManager拿tb_*表'''
     assert uid>0
     self.uid = uid
     self.db = Gcore.getDB(uid)
Exemple #4
0
 def __init__(self):
     '''注释'''
     self.db = Gcore.getDB()
     self.dictNotice = {}
Exemple #5
0
 def __init__(self):
     '''注释'''
     self.db = Gcore.getDB()
     self.dictNotice = {}
Exemple #6
0
 def __init__(self, uid, CacheAll=True):
     '''当别的地方调用的 Cache 为False 如mqManager拿tb_*表'''
     assert uid > 0
     self.uid = uid
     self.db = Gcore.getDB(uid)
Exemple #7
0
from os.path import dirname, abspath
system_root = dirname(dirname(abspath(__file__)))  #定义上层目录为根目录
import sys
sys.path.insert(0, system_root)  #把项目根目录加入默认库路径

import time
from sgLib.core import Gcore

tb_num = Gcore.config.TBNUM

limit_cnt = 1000
cnt = 0
curtime = time.time()
send_conn = None

db = Gcore.getDB()
GiveRatio = Gcore.loadCfg(1506).get('GiveRatio', 0.05)
#if Gcore.TEST:
#    GiveRatio = 1
while 1:
    print '第%s次循环' % (cnt + 1)
    start, n = cnt * limit_cnt, limit_cnt - 1
    table = 'tb_user'
    fields = ['HoldEndTime', 'HolderServerId', 'HolderId', "UserId"]
    if Gcore.TEST and 0:  #指定用户测试 暂时
        where = 'HolderId != 0 AND UserId IN (1005) LIMIT %s,%s' % (start, n)
    else:
        where = 'HolderId != 0 LIMIT %s,%s' % (start, n)
    rows = db.out_rows(table, fields, where)
    if not rows:
        break
Exemple #8
0
# -*- coding:utf-8 -*-
# author:Lizr
# date:2013-8-8
# 比武排名快照,用于发奖励,每天10点运行

import time
from os.path import dirname,abspath

system_root = dirname(dirname( abspath( __file__ ) ) ) #定义上层目录为根目录 
import sys;sys.path.insert(0,system_root)  #把项目根目录加入默认库路径 

curtime = time.time()
from sgLib.core import Gcore

#=====Content Begin=======

db = Gcore.getDB()
sql = 'INSERT INTO tb_rank_fight_last (RankId,UserId) SELECT RankId,UserId FROM tb_rank_fight ON DUPLICATE KEY UPDATE UserId = VALUES(UserId)'
db.execute(sql)

sql = 'UPDATE tb_rank_fight_last SET Rewarded=0,RewardTime=NOW()'
db.execute(sql)

runtime = time.time()-curtime
print 'Finish at:',Gcore.common.now()
print 'Total Runtime:', runtime
Exemple #9
0
 def __init__(self):
     self.db = Gcore.getDB()
     self.needReGiveIds = []