#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('player-retain')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') if params.get('start_time'): text_array.append("`create_time` >= %s") val_array.append( datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`create_time` <= %s") val_array.append( datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) if server_list and channel_list: sql = "(`channel_name` = %s and `s_uid` in%s)" server_list = tuple(server_list.split(','))
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('OD_distributoin')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): sql = '''SELECT sum(diff) as diff, sum(p_num) as p_num, sum(num) as num,type FROM OD_distributoin %s group by type %s''' text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') if params.get('c_type'): text_array.append("`c_type` = %s") val_array.append(params.get('c_type')) if params.get('status_flag'): text_array.append("`status_flag` = %s") val_array.append(params.get('status_flag')) # if params.get('server_list'): # pass # _sql = "(`channel_name` = %s and `s_uid` in%s)"
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default',('ltv-value')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset,limit,params): text_array = [] val_array = [] channel_list = params.get('channel_list','') server_list = params.get('server_list','') if params.get('start_time'): text_array.append("`create_time` >= %s") val_array.append(datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`create_time` <= %s") val_array.append(datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) # if params.get('server_list'): # _sql = "(`channel_name` = %s and `s_uid` in%s)" # __server_list = [] # for _server_list in params.get('server_list'): # _server_list = _server_list.split(',') # channel_name = _server_list[0] # del _server_list[0] # __server_list.append(_sql)
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from tornzen import caching db = DbAccessor('default', ('channels')) server_db = DbAccessor('default', ('servers_data')) CAHCE_KEY = 'CACHE:ONE-SERVER-MENU' @tornado.gen.coroutine def GetAll(): list_data = caching.get(CAHCE_KEY) if not list_data: list_data = yield db.FindAll(orderString=' name desc') caching.set(CAHCE_KEY, list_data, 100) return list_data @tornado.gen.coroutine def GetAllCS(): list_data = yield DbAccessor.Select( 'default', 'SELECT ch_s.id,ch_s.ch_id,sd.name, ch_s.s_uid,chs.name as channel_name FROM channel_server as ch_s left join servers_data as sd on ch_s.s_uid = sd.uid left join channels as chs on chs.id=ch_s.ch_id', ()) return list_data
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default',('action_player')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset,limit,params): text_array = [] val_array = [] channel_list = params.get('channel_list','') server_list = params.get('server_list','') if params.get('start_time'): text_array.append("`create_time` >= %s") val_array.append(datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`create_time` <= %s") val_array.append(datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) if server_list and channel_list: sql = "(`channel_name` = %s and `s_uid` in%s)" server_list = tuple(server_list.split(',')) __server_list = [] for channel_name in tuple(channel_list.split(',')): __server_list.append(sql) val_array.append(channel_name)
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime from tornzen import caching import time db = DbAccessor('default',('output-drain')) cm_db = DbAccessor('default',('cons-mode')) lcontribute = DbAccessor('default',('lcontribute')) lexplore = DbAccessor('default',('lexplore')) lequipments = DbAccessor('default',('lequipments')) litems = DbAccessor('default',('litems')) ldiamond = DbAccessor('default',('ldiamond')) lgold = DbAccessor('default',('lgold')) player_get = DbAccessor('default',('player_get')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset,limit,params): text_array = [] val_array = [] c_type = params.get('c_type',2) if c_type==1: _db = ldiamond elif c_type ==2: _db = lgold elif c_type==3: _db = litems elif c_type ==4:
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('daily_online')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params, count=None): sql = '''SELECT sum(num) as num, sum(avg) as avg,start_time FROM daily_online %s group by d_date order by start_time %s limit %s,%s''' text_array = [] val_array = [] if params.get('start_time'): text_array.append("`start_time` >= %s") val_array.append( datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`start_time` <= %s") val_array.append( datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) if params.get('server_list'):
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default',('hours_statistics')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(params): sql = '''SELECT sum(new_equip) as new_equip, sum(new_account) as new_account, sum(actoin) as actoin,sum(pay_account) as pay_account,sum(pay_income) as pay_income,hours,create_time FROM hours_statistics %s group by hours''' text_array = [] val_array = [] if params.get('start_time'): text_array.append("`create_time` >= %s") start_time = datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S") val_array.append(start_time) end_time = datetime.datetime(start_time.year, start_time.month, start_time.day,23, 59, 59) text_array.append("`create_time` <= %s") val_array.append(end_time) if params.get('server_list'): _sql = "(`channel_name` = %s and `s_uid` in%s)" __server_list = [] for _server_list in params.get('server_list'):
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('role-retain')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') if params.get('start_time'): text_array.append("`create_time` >= %s") val_array.append( datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`create_time` <= %s") val_array.append( datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) # if params.get('server_list'): # _sql = "(`channel_name` = %s and `s_uid` in%s)"
#coding import tornado.web from tornzen.database import DbAccessor from tornzen import caching from configs.app_code import * db = DbAccessor('default', ('roles')) CAHCE_KEY = 'CACHE:ONE-SYS-ROLE' @tornado.gen.coroutine def GetAll(): list_data = caching.get(CAHCE_KEY) if not list_data: list_data = yield db.FindAll('delete_flag = 0') caching.set(CAHCE_KEY, list_data, 10) return list_data @tornado.gen.coroutine def Get(cid): list_data = yield GetAll() for item_data in list_data: if item_data.get('id') == cid:
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('num_of_phy_pur')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') if params.get('start_time'): text_array.append("`d_date` >= %s") val_array.append(int(params.get('start_time', '').replace('-', ''))) if params.get('end_time'): text_array.append("`d_date` <= %s") val_array.append(int(params.get('end_time', '').replace('-', ''))) if params.get('vip_level'): text_array.append("`vip_level` = %s") val_array.append(params.get('vip_level')) if server_list and channel_list: sql = "(`channel_name` = %s and `s_uid` in%s)" server_list = tuple(server_list.split(','))
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('whale_player')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') if params.get('start_time'): text_array.append("`last_pay_time` >= %s") val_array.append( datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`last_pay_time` <= %s") val_array.append( datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) # if params.get('server_list'): # _sql = "(`channel_name` = %s and `s_uid` in%s)" # __server_list = []
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('mg_daily_chs')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] if params.get('start_time'): text_array.append("`create_time` >= %s") val_array.append( datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`create_time` <= %s") val_array.append( datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) if params.get('server_list'): text_array.append("`channel_name` in%s") val_array.append(params.get('server_list'))
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('equipment-retain')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] if params.get('start_time'): text_array.append("`create_time` >= %s") val_array.append( datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`create_time` <= %s") val_array.append( datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) if params.get('server_list'): text_array.append("`channel_name` in%s") val_array.append(params.get('server_list'))
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('currency_cond')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') if params.get('c_type'): text_array.append("`c_type` =%s") val_array.append(params.get('c_type')) # if params.get('server_list'): # _sql = "(`channel_name` = %s and `s_uid` in%s)" # __server_list = [] # for _server_list in params.get('server_list'): # _server_list = _server_list.split(',') # channel_name = _server_list[0] # del _server_list[0] # __server_list.append(_sql) # val_array.append(channel_name) # val_array.append(tuple(_server_list)) # text_array.append(' (' + (' or '.join(__server_list)) + ') ')
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from tornzen import caching from configs.app_code import * import datetime db = DbAccessor('default', ('daily_newspaper')) server_db = DbAccessor('default', ('mg_daily_serverspaper')) CAHCE_KEY = 'CACHE:ONE-SYS-MENU' #---------------------------------------------- # 添加分服日报数据 #----------------------------------------------- @tornado.gen.coroutine def Add(item): lastid = yield db.Insert(item) if (lastid > 0): FLushCache() return lastid #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = []
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default',('spirit_level')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset,limit,params, count = False): # sql = '''SELECT sl.*,a.t_num_owner FROM # (select s_uid, channel_name, server_name, level,num_owner, name from (select * from spirit_level %s order by d_date desc)b group by s_uid, channel_name, level %s %s) as sl left join # (select d_date,s_uid, channel_name, sum(num_owner)t_num_owner from # (select * from (select * from spirit_level %s order by d_date desc)d group by s_uid, channel_name,level)c # group by s_uid, channel_name)a # on sl.channel_name=a.channel_name and sl.s_uid= a.s_uid;''' sql = '''select sl.*,v.t_num_owner from (select count(*)num_owner,level,s_uid,ch,name from (select * from (SELECT * FROM player_own %s order by d_date desc)a group by uid)b group by level,s_uid,ch %s)as sl left join (select sum(count)t_num_owner,s_uid,ch from (select count(*)count,s_uid,ch from (select * from (SELECT * FROM player_own %s order by d_date desc)a group by uid)b group by level,s_uid,ch)c group by s_uid, ch)v on sl.ch=v.ch and sl.s_uid=v.s_uid %s %s''' # t_sql = '''select count(1)total from (select id from spirit_level %s group by s_uid, channel_name, level)t'''
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from tornzen import caching from configs.app_code import * import datetime story_medal = DbAccessor('default', ('cstory_adventure_medal')) cstory_adventure = DbAccessor('default', ('cstory_adventure')) cstory_adventure_playerlv = DbAccessor('default', ('cstory_adventure_playerlv')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') text_array.append("`onece` = %s") val_array.append(params.get('onece', 0)) if params.get('start_time'): text_array.append("`d_date` >= %s") val_array.append(int(params.get('start_time').replace('-', ''))) if params.get('end_time'): text_array.append("`d_date` <= %s") val_array.append(int(params.get('end_time').replace('-', ''))) if server_list and channel_list:
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('ad_datas')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params, count=None): sql = '''SELECT sum(num) as num, level FROM ad_level %s group by level order by level %s limit %s,%s''' text_array = [] val_array = [] channel_list = params.get('channel_list', '') server_list = params.get('server_list', '') if params.get('_type'): text_array.append("`type` = %s") val_array.append(params.get('_type')) if params.get('d_date'): text_array.append("`d_date` = %s") val_array.append(params.get('d_date')) # if params.get('start_time'): # text_array.append("`create_time` >= %s") # val_array.append(datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) # if params.get('end_time'):
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime superstarweekdb = DbAccessor('default', ('superstarweek')) superstarymdb = DbAccessor('default', ('superstarym')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): sql = '''select * from (SELECT count(distinct nodeid,pid)unlock_num,fname,fid,count(1)total_attr_num ,s_uid FROM superstars %s group by fid order by unlock_num desc, total_attr_num desc, id desc)a %s ''' t_sql = '''select count(1)count from (SELECT count(distinct nodeid,pid)unlock_num,fname,fid,count(1)total_attr_num FROM superstars %s group by fid order by unlock_num desc, total_attr_num desc)a ''' text_array = [] val_array = [] if params.get('s_uid'): text_array.append('`s_uid` = %s') val_array.append(params.get('s_uid')) whereString = ' and '.join(text_array) if whereString: whereString = ' where ' + whereString _limit = '' count = 0
#coding import tornado.web from tornzen.database import DbAccessor from tornzen import caching from configs.app_code import * import hashlib import datetime db = DbAccessor('default', ('users')) user_secontrol_db = DbAccessor('default', ('user_secontrol')) CAHCE_KEY = 'CACHE:ONE-SYS-ROLE' #----------------------------------------------------------------------- # 根据用户名 #----------------------------------------------------------------------- @tornado.gen.coroutine def GetByLoginName(login_name): list_data = yield db.FindByOffset(0, 1, 'login_name = %s', '', (login_name, )) if len(list_data) == 0: return None else: return list_data[0] @tornado.gen.coroutine def GetAll(): list_data = caching.get(CAHCE_KEY)
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime from tornzen import caching import time db = DbAccessor('default', ('guild_boss_record')) db_reward = DbAccessor('default', ('guild_boss_reward')) guild_production_cost_msg = DbAccessor('default', ('guild_production_cost_msg')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] if params.get('s_uid'): text_array.append("`s_uid` = %s") val_array.append(params.get('s_uid')) if params.get('guild_lv'): text_array.append("`guild_lv` in %s") val_array.append(params.get('guild_lv')) if params.get('prosperity_lv'): text_array.append("`prosperity_lv` in %s")
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default', ('overview')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset, limit, params): text_array = [] val_array = [] if params.get('start_time'): text_array.append("`create_time` >= %s") val_array.append( datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`create_time` <= %s") val_array.append( datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) if params.get('server_list'): _sql = "(`channel_name` = %s and `s_uid` in%s)" __server_list = []
#coding:utf8 import tornado.web from tornzen.database import DbAccessor from configs.app_code import * import datetime db = DbAccessor('default',('pay-points')) #---------------------------------------------- # 查找数据 #-------------------------------------------- @tornado.gen.coroutine def GetByFilter(offset,limit,params): text_array = [] val_array = [] channel_list = params.get('channel_list','') server_list = params.get('server_list','') sql_count = '''select count(1) as count from (SELECT id FROM pay_points %s group by pay_points)a''' sql_data = '''SELECT id,sum(pay_num) as pay_num, sum(amount_of_recharge)amount_of_recharge,pay_points FROM pay_points %s group by pay_points %s''' if params.get('start_time'): text_array.append("`pay_time` >= %s") val_array.append(datetime.datetime.strptime(params.get('start_time'), "%Y-%m-%d %H:%M:%S")) if params.get('end_time'): text_array.append("`pay_time` <= %s") val_array.append(datetime.datetime.strptime(params.get('end_time'), "%Y-%m-%d %H:%M:%S")) # if params.get('server_list'): # _sql = "(`ch` = %s and `s_uid` in%s)" # __server_list = [] # for _server_list in params.get('server_list'): # _server_list = _server_list.split(',') # channel_name = _server_list[0]
import tornado.web from tornzen.database import DbAccessor from tornzen import http, logger, utils, caching import hashlib db = DbAccessor('default', ('menus')) # DB = DbAccessor('default',('cpc-onto')) CAHCE_KEY = 'CACHE:ONE-SYS-MENU' @tornado.gen.coroutine def GetById(m_id): data = yield db.Execute('default', 'select * from mg_menus where id= %s', (m_id, )) return data @tornado.gen.coroutine def GetcpcList(): list_data = yield DB.FindAll('delete_flag = 0') return list_data @tornado.gen.coroutine def GetAll(): list_data = caching.get(CAHCE_KEY)
import tornado.web from tornzen.database import DbAccessor from tornzen import http, logger, utils, caching import hashlib _dbMenuAccess = DbAccessor('default', ('menu-access')) _dbMenu = DbAccessor('default', ('menus')) _dbEmployeeRole = DbAccessor('default', ('user-role')) _DB_Privilege = DbAccessor('default', ('dc-privilege')) _DB_SeControl = DbAccessor('default', ('dc-secontrol')) _CAHCE_KEY_MENUS = 'CACHE:ONE-SYS-PRIVILEGE-MENU' _CAHCE_KEY_PRIVI = 'CACHE:ONE-SYS-PRIVILEGE-ITEM' @tornado.gen.coroutine def GetAllMenus(): list_data = caching.get(_CAHCE_KEY_MENUS) if not list_data: list_data = yield _dbMenu.FindAll() caching.set(_CAHCE_KEY_MENUS, list_data, 10) return list_data @tornado.gen.coroutine def DeleteRoleAccess(role_id): ret = yield _dbMenuAccess.DeleteBy('role_id = ' + str(role_id)) return ret