Example #1
0
 def __init__(self):
     conf = ConfParameters.ConfParameters().log_conf
     self.log_path = conf['game_log_path_current']
     self.world_path = conf['world_log_path']
     self.start_date = '2018-08-17'
     self.end_date = '2018-08-26'
     self.period = '1'
     # data
     # {uid:{world:world,rank:rank,item1:count1,other_attr...}}
     self.top_map = dict()
     self.item_list = [
         '50064', '50023', '50060', '50044', '50045', '50046', '50047',
         '40049', '50030'
     ]
     self.item_dict = dict(
     )  # here keep the maximum item count which users are capable to exchange
     self.__load_item()
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_base'])
     self.stat_pay = mysql_para['stat_pay']
     self.stat_base = mysql_para['stat_base']
     self.user_reg = mysql_para['stat_userreg']
     self.user_active_openid = mysql_para['user_active_openid']
     self.cursor = self.db.cursor()
     # initial xls writer
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     # user info check
     self.user_info = UserInfoCheck.UserInfoCheck(self.cursor)
Example #2
0
 def deviceid_to_devicetype(self, date_str):
     # 863064037545227,HUAWEI_HUAWEI_MLA-AL10,1,0
     # {device_id : {device-type:device-type,web_response:web_response,game_connect:game_connect}}
     result_map = dict()
     today = DateList.DateList().get_today()
     if today == date_str:
         log_path = ConfParameters.ConfParameters(
         ).log_conf['stat_log_path'] + 'event.log'
     else:
         log_path = ConfParameters.ConfParameters(
         ).log_conf['stat_log_path'] + 'event.log.' + date_str
     cmd = 'grep \'context:0_\' ' + log_path + '|grep \'chanel:' + self.channel + '\'|awk -F \',\' \'{OFS=\":\";print $4,$5,$8}\'|awk -F \':\' \'{device[$4]=$6;enter[$4]=1;if($2==\"0_gameConnect_\"){pass[$4]=1};} END {OFS=\",\";for(i in device)print i,device[i],enter[i],pass[i]==\"\"?0:1}\''
     print cmd
     val = os.popen(cmd).readlines()
     for line in val:
         line = line.strip()
         array = line.split(',')
         deviceid = str(array[0])
         device_type = str(array[1])
         entered = int(array[2])
         passed = int(array[3])
         key = deviceid  # _ is not acceptable for there may be '_' in device type
         if key not in result_map.keys():
             result_map[key] = dict()
             result_map[key]['device_type'] = device_type
             result_map[key]['entered'] = entered
             result_map[key]['passed'] = passed
     return result_map
 def __init__(self):
     # initial mysql
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(host=mysql_para['ip'],
                               port=mysql_para['port'],
                               user=mysql_para['users'],
                               passwd=mysql_para['password'],
                               db=mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     self.act_stat_base = mysql_para['stat_base']
     self.reg_stat_base = mysql_para['stat_userreg']
     self.pay_base = mysql_para['stat_pay']
     #initial rate
     self.current_rate = ConfParameters.ConfParameters().current_rate
     # self.levellist = [0, 1000, 2000, 3000, 4000, 5000]
     self.levellist = [
         0, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000,
         250000, 500000, 1000000
     ]
     # initial EasyXls
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.style = xlwt.XFStyle()
     self.style.borders = self.xls_writer.borders
     # local parameter
     self.date_list = list()
     self.channel_list = list()
     self.zone_list = list()
     self.input_dict = dict()
     self.__load_input()
Example #4
0
 def __init__(self):
     # conf path
     self.conf_path = ConfParameters.ConfParameters().conf_path
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     self.stat_pay = mysql_para['stat_pay']
     self.stat_base = mysql_para['stat_base']
     self.user_active_openid = mysql_para['user_active_openid']
     # initial xls writer
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.style = xlwt.XFStyle()
     self.style.borders = self.xls_writer.borders
     # local parameter
     self.compute_date = '2018-09-13'
     self.limit_num = '100'
     self.eighteen_ships = self.__list_to_str([
         1001, 1002, 1003, 2001, 2002, 2003, 2004, 2005, 3001, 4001, 4002,
         4003, 4004, 3004, 4030
     ])
     self.sixteen_ships = self.__list_to_str(
         [1004, 1005, 1006, 1007, 2007, 4005, 4008, 4009, 4013, 3005, 4031])
     self.fifteen_ships = self.__list_to_str([
         1008, 2006, 2008, 2009, 2010, 2011, 3002, 3003, 4006, 4007, 4010,
         4011, 4012, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020,
         5021, 5022, 5025
     ])
     file_name = self.conf_path + 'ship_exclusive.txt'
     self.ship_table = ReadTable.ReadTable(file_name).read_table_file()
Example #5
0
 def __init__(self, compute_date):
     self.compute_date = compute_date
     # conf path
     self.conf_path = ConfParameters.ConfParameters().conf_path
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     # initial xls writer
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.borders = xlwt.Borders()
     self.style = xlwt.XFStyle()
     self.__load_borders()
     self.style.borders = self.borders
     # local parameter
     self.ship_table = dict()
     self.read_table()
     self.ship_table_name = 'user_ship_info'
     self.missile_table_name = 'user_missile_info'
     self.eighteen_ships = [
         1001, 1002, 1003, 2001, 2002, 2003, 2004, 2005, 3001, 4001, 4002,
         4003, 4004, 3004, 4030
     ]
     self.sixteen_ships = [
         1004, 1005, 1006, 1007, 2007, 4005, 4008, 4009, 4013, 3005, 4031
     ]
     self.fifteen_ships = [
         1008, 2006, 2008, 2009, 2010, 2011, 3002, 3003, 4006, 4007, 4010,
         4011, 4012, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020,
         5021, 5022, 5025
     ]
     self.zoneid_list_0512 = [
         10001, 40001, 20001, 40002, 20002, 30001, 20003, 30002, 20004,
         40003, 10002, 20005, 30003, 20006, 20007, 30004, 20008, 20009,
         20010, 30005, 20011, 20012, 20013, 20014, 30006, 40004, 10003,
         20015, 10004, 20016, 20017, 40005, 20018, 10005, 20019, 20020
     ]
     self.zoneid_list_0731 = [
         20021, 30007, 20022, 20023, 20024, 40006, 20025, 20026, 20027,
         10006, 20028, 30008, 20029, 20030, 40007, 20031, 20032, 20033,
         20034
     ]
     self.zoneid_list_0913 = [
         20035, 30009, 40008, 10007, 20036, 20037, 20038, 20039, 20040,
         20041, 50001, 20042, 10008, 20043, 55001, 20044, 20045, 20046,
         30010, 40009, 20047, 55002, 20048, 55003, 55004
     ]
Example #6
0
    def execute(self, uid_list, start_date, end_date, *cycle):
        file_name = ConfParameters.ConfParameters(
        ).save_path + 'Periodic_Vip_' + start_date + '-' + end_date + '.xls'
        if len(cycle) > 0:
            [res_dict_money,
             res_dict_vip] = self.get_periodic_vip(uid_list, start_date,
                                                   end_date, cycle[0])
        else:
            [res_dict_money,
             res_dict_vip] = self.get_periodic_vip(uid_list, start_date,
                                                   end_date)

        msg = '*周期:' + str(str(self.cycle)) + '天'
        new_sheet = self.xls_writer.new_sheet('周期付费计算表-按实际付费金额', self.wbk)
        new_sheet.col(0).width = 256 * 20
        line_num = [0]
        write_standard_form(res_dict_money, new_sheet, line_num, self.style)
        self.xls_writer.insert_xls([msg], new_sheet, line_num)
        new_sheet1 = self.xls_writer.new_sheet('周期付费计算表-按折算VIP', self.wbk)
        new_sheet1.col(0).width = 256 * 20
        line_num1 = [0]
        write_standard_form(res_dict_vip, new_sheet1, line_num1, self.style)
        self.xls_writer.insert_xls([msg], new_sheet1, line_num1)
        self.wbk.save(file_name)
        self.db.close()
Example #7
0
 def get_diamond_detail_info(self, top_list):
     # initial mysql-db big_data_test(this is a special version, only acceptable for modernship cn)
     easy_sql = EasyMysql.EasyMysql()
     mysql_para_bd_test = ConfParameters.ConfParameters().mysql_conf_bd_test
     db_bd_test = MySQLdb.connect(mysql_para_bd_test['ip'],
                                  mysql_para_bd_test['users'],
                                  mysql_para_bd_test['password'],
                                  mysql_para_bd_test['stat_base'])
     cursor_bd_test = db_bd_test.cursor()
     top_str = easy_sql.sql_value_str(top_list)
     sql_str = 'select uid,date,moneytype,sum(cash+diamond) from diamond_pay_users where uid in (' + top_str + ') group by uid,date,moneytype'
     cursor_bd_test.execute(sql_str)
     all_data = cursor_bd_test.fetchall()
     date_list = list()
     money_type_list = list()
     result_dict = dict()
     if all_data:
         for rec in all_data:
             uid = str(rec[0])
             date = str(rec[1])
             if date not in date_list:
                 date_list.append(date)
             money_type = str(rec[2])
             if money_type not in money_type_list:
                 money_type_list.append(money_type)
             if uid not in result_dict.keys():
                 result_dict[uid] = dict()
             if money_type not in result_dict[uid].keys():
                 result_dict[uid][money_type] = dict()
             result_dict[uid][money_type][date] = int(rec[3])
     date_list = sorted(date_list)
     money_type_list = sorted(money_type_list, key=lambda x: int(x))
     db_bd_test.close()
     return [money_type_list, date_list, result_dict]
 def __init__(self, start_date, end_date):
     super(LogUserGuide, self).__init__(start_date, end_date)
     self.key_word = 'MilitaryRankReset'
     # initial mysql-db
     self.mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = None  # such is initiate not in constructor but when actually used to ensure db get closed after connect
     self.cursor = None
Example #9
0
 def __init__(self, start_date, end_date):
     self.conf = ConfParameters.ConfParameters()
     self.log_path = self.conf.log_conf['game_log_path_current']
     self.stat_path = self.conf.log_conf['stat_log_path']
     self.date_list = DateList.DateList().get_date_list(
         start_date, end_date)
     self.date_obj = DateList.DateList()
 def run_without_thread(uid_list):
     cmd_list = SocketBatchedPlayerInfo.get_cmd_list(uid_list)
     easy_sock = EasySocketCmd.EasySocketCmd()
     result_dict = dict()
     sk_conf = ConfParameters.ConfParameters().socket_conf_xf
     ip_port = (sk_conf['ip'], sk_conf['port'])
     sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     sk.connect(ip_port)
     sk.settimeout(2)
     sid = 1
     time_start = time.time()
     # log_factory = EasyLog.EasyLog(self.__class__.__name__, 'socket')
     print('[Original]start at ', time.ctime())
     for cmd in cmd_list:
         cmd_send = cmd + ',' + str(sid) + '\n'
         sid += 1
         try:
             result_dict[cmd_send] = easy_sock.send_cmd_message(
                 cmd_send, sk)
         except Exception:
             print(traceback.format_exc())
     print('[Original]finish at ',
           time.ctime(), ',with len(result_dict.keys()):',
           len(result_dict.keys()), ',time cost:',
           str(time.time() - time_start))
     # time.sleep(5)
     # print(result_dict)
     SocketBatchedPlayerInfo.dissect_result(result_dict)
Example #11
0
 def __init__(self, start_date, end_date):
     super(LogUserGuide, self).__init__(start_date, end_date)
     self.key_word = 'DceGuide'
     guide_table_name = ConfParameters.ConfParameters(
     ).conf_path + 'GuideStep.txt'
     self.guide_table = ReadTable.ReadTable(
         guide_table_name).read_table_file()
Example #12
0
 def __init__(self):
     # conf path
     self.conf_path = ConfParameters.ConfParameters().conf_path
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     # initial xls writer
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.style = xlwt.XFStyle()
     self.style.borders = self.xls_writer.borders
     # local parameter
     self.start_date = '2018-06-01'
     self.end_date = '2018-09-17'
Example #13
0
 def execute(self):
     file_name = ConfParameters.ConfParameters(
     ).save_path + 'Top100_ship_' + self.compute_date + '.xls'
     # self.diamond_xls()
     self.ship_xls(self.eighteen_ships, '18')
     self.ship_xls(self.sixteen_ships, '16')
     self.ship_xls(self.fifteen_ships, '15')
     self.wbk.save(file_name)
     self.db.close()
Example #14
0
 def __init__(self, start_date, end_date, *channel):
     # conf path
     self.conf_path = ConfParameters.ConfParameters().conf_path
     # initial mysql-db
     self.mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.stat_base = self.mysql_para['stat_base']
     self.db = None  # such is initiate not in constructor but when actually used to ensure db get closed after connect
     self.cursor = None
     # initial xls writer
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.style = xlwt.XFStyle()
     self.style.borders = self.xls_writer.borders
     # local parameter
     self.start_date = start_date
     self.end_date = end_date
     self.channel = '-1'
     self.period_limit = '30'
     if len(channel) > 0:
         self.channel = channel[0]
    def __init__(self):

        # initial socket
        self.sk_conf = ConfParameters.ConfParameters().socket_conf_xf
        ip_port = (self.sk_conf['ip'], self.sk_conf['port'])
        # log module
        self.easy_log = EasyLog.EasyLog(self.__class__.__name__, 'socket')
        # local parameter
        self.easy_sock = EasySocketBatch.NetConnection(ip_port[0], ip_port[1])
        # result
        self.result_dict = dict()
Example #16
0
 def __init__(self):
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     # local parameter
     self.date_start = '2018-08-28'
     self.date_end = '2018-09-23'
     self.date_length = 4
     self.channel = ''
Example #17
0
 def __init__(self, start_date, end_date):
     self.start_date = start_date
     self.end_date = end_date
     self.ship_log_key = 'shipInfoTotal'
     self.ship_table_name = 'user_ship_info'
     self.missile_table_name = 'user_missile_info'
     self.missile_log_key = 'missleInfoTotal'
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_base'])
     self.cursor = self.db.cursor()
Example #18
0
 def __init__(self):
     # initial socket
     self.sk_conf = ConfParameters.ConfParameters().socket_conf_xf
     self.sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     ip_port = (self.sk_conf['ip'], self.sk_conf['port'])
     self.sk.settimeout(2)
     self.sk.connect(ip_port)
     # log module
     self.easy_log = EasyLog.EasyLog(self.__class__.__name__, 'socket')
     # local parameter
     self.easy_sock = EasySocketCmd.EasySocketCmd()
     # sid
     self.sid = 1000
Example #19
0
 def execute_total(self, zoneid_list, name):
     file_name = ConfParameters.ConfParameters(
     ).save_path + name + '_ship_total_info_' + self.compute_date + '.xls'
     ship_list = self.fifteen_ships
     sheet_name = '15评级船'
     self.compute_total_sheet(zoneid_list, ship_list, sheet_name)
     ship_list = self.sixteen_ships
     sheet_name = '16评级船'
     self.compute_total_sheet(zoneid_list, ship_list, sheet_name)
     ship_list = self.eighteen_ships
     sheet_name = '18评级船'
     self.compute_total_sheet(zoneid_list, ship_list, sheet_name)
     self.wbk.save(file_name)
Example #20
0
 def __init__(self):
     # environment
     self.conf_path = ConfParameters.ConfParameters().conf_path
     # initialize
     # # mysql
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_pay'])
     self.cursor = self.db.cursor()
     self.easy_mysql = EasyMysql.EasyMysql()
     # # xls
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.style = xlwt.XFStyle()
     self.style.borders = self.xls_writer.borders
     # # others
     self.easy_date = DateList.DateList()
     # local
     self.cycle = 7
     vip_file_name = self.conf_path + 'Vip_Money.txt'
     self.vip_dict = self.__get_vip_table(vip_file_name)
 def execute(self, input_dict):
     self.__set_input(input_dict)
     date_list = self.__get_input()['date_list']
     start_date = date_list[0]
     end_date = date_list[len(date_list) - 1]
     exc_time = int(time.time())
     time_stamp = exc_time - 10000 * (exc_time / 10000)
     file_name = ConfParameters.ConfParameters(
     ).save_path + 'CrossProjectCompare_' + ConfParameters.ConfParameters(
     ).project_name + '_' + start_date + '-' + end_date + '_' + str(
         time_stamp) + '.xls'
     # module list
     module_list = [
         self.__general_report,  # 概览
         self.__user_guidance,  # 新手引导
         self.__event_login,  # 启动加载项
         self.__retenratio,  #留存
         self.__online_time,  #在线时长
         # # self.__life_time, # 生命周期 # this only works when computing from the beginning
         self.__user_return,  # 老用户回归
         self.__pay_motivation  # 付费激励
     ]
     for module in module_list:
         now_time = time.time()
         try:
             msg = 'Try running ' + module.__name__
             print(msg)
             module()
             msg = 'Finish running ' + module.__name__ + ',time cost:' + str(
                 time.time() - now_time)
             print(msg)
         except Exception:
             msg = 'Error in running' + module.__name__ + ',time cost:' + str(
                 time.time() - now_time)
             print(msg)
             print traceback.format_exc()
     self.wbk.save(file_name)
     self.db.close()
Example #22
0
 def __init__(self):
     self.final_step = '1000601'
     self.channel = '1007'
     self.start_date = '2018-08-20'
     self.end_date = '2018-09-03'
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'],
                               mysql_para['password'],
                               mysql_para['stat_userreg'])
     self.cursor = self.db.cursor()
     # initial xls writer
     self.wbk = xlwt.Workbook()
     return
Example #23
0
 def __init__(self):
     # initial socket
     self.sk_conf = ConfParameters.ConfParameters().socket_conf
     self.sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     ip_port = (self.sk_conf['ip'], self.sk_conf['port'])
     self.sk.settimeout(2)
     self.sk.connect(ip_port)
     # local parameter
     self.receive_list = [
         'openid', 'region', 'channel', 'level', 'viplevel', 'logintime',
         'cash', 'recharge', 'max_power', 'name', 'mbname'
     ]
     self.write_list = copy.copy(self.receive_list)
     self.easy_sock = EasySocketCmd.EasySocketCmd()
     self.count = 0
Example #24
0
 def __init__(self):
     # initial mysql
     mysql_para = ConfParameters.ConfParameters().mysql_conf_bd
     self.db = MySQLdb.connect(host=mysql_para['ip'], user=mysql_para['users'],
                               passwd=mysql_para['password'], db=mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     # initial xls
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.style = xlwt.XFStyle()
     self.style.borders = self.xls_writer.borders
     # local
     self.stat_jp = 'zhanguo_jp_stat_base'
     self.stat_tw = 'zhanguo_stat_base'
     self.key_list = ['Login','Logout','InstanceBattle','QuickInstance','CreateBuilding','GetCity','March','FinishBattle']
Example #25
0
 def execute(self):
     # sheet 1 : 兑换数量
     # sheet 1 : 兑换比例
     self.load_data()
     file_name = ConfParameters.ConfParameters(
     ).save_path + 'WorldMatch_' + self.start_date + '_' + self.end_date + '.xls'
     sheet_name = '兑换数量'
     sheet1 = self.xls_writer.new_sheet(sheet_name, self.wbk)
     self.write_xls(sheet1)
     # sheet_name = '兑换比例'
     # sheet2 = self.xls_writer.new_sheet(sheet_name, self.wbk)
     # self.write_xls(sheet2, 1)
     self.db.close()
     self.wbk.save(file_name)
     return
Example #26
0
    def execute(self, zoneid_list, name):
        file_name = ConfParameters.ConfParameters(
        ).save_path + name + '_ship_16_info_' + self.compute_date + '.xls'
        ship_list = self.sixteen_ships
        for ship_id in ship_list:
            self.compute_certain_ship(str(ship_id), zoneid_list)
        self.wbk.save(file_name)

        self.wbk = xlwt.Workbook()
        file_name = ConfParameters.ConfParameters(
        ).save_path + name + '_ship_18_info_' + self.compute_date + '.xls'
        ship_list = self.eighteen_ships
        for ship_id in ship_list:
            self.compute_certain_ship(str(ship_id), zoneid_list)
        self.wbk.save(file_name)

        self.wbk = xlwt.Workbook()
        file_name = ConfParameters.ConfParameters(
        ).save_path + name + '_ship_15_info_' + self.compute_date + '.xls'
        ship_list = self.fifteen_ships
        for ship_id in ship_list:
            self.compute_certain_ship(str(ship_id), zoneid_list)
        self.wbk.save(file_name)
        self.db.close()
Example #27
0
    def __init__(self):
        self.channel=''
        self.start_date = '2018-09-01'
        self.end_date = '2018-09-30'
        self.channel_notin=(1099, 109902, 109903, 1105, 1098, 109802, 1100, 1104, 1101)
        self.month=[]
        self.stayratio=dict()
        self.payratio=dict()
        # initial mysql-db
        mysql_para = ConfParameters.ConfParameters().mysql_conf
        self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'], mysql_para['password'],mysql_para['stat_base'])

        self.cursor = self.db.cursor()
        # initial xls writer
        self.wbk = xlwt.Workbook()
        self.sheet = self.wbk.add_sheet('Sheet1', cell_overwrite_ok=True)
        return
 def run_in_package(uid_list):
     cmd_list = SocketBatchedPlayerInfo.get_cmd_list(uid_list)
     sk_conf = ConfParameters.ConfParameters().socket_conf_xf
     sk_obj = EasySocketBatchSend.EasySocketBatchSend(
         sk_conf['ip'], sk_conf['port'])
     time_start = time.time()
     print('[Threading Batch]start at ', time.ctime())
     result_list = sk_obj.run_cmd_list(cmd_list)
     print('[Threading]finish at ', time.ctime(),
           ',with len(result_dict.keys()):', len(result_list),
           ',time cost:', str(time.time() - time_start))
     result_dict = dict()
     for result in result_list:
         result_dict[result[0]] = result[1]
     sk_obj.quit_receiving()
     # print(result_dict)
     SocketBatchedPlayerInfo.dissect_result(result_dict)
Example #29
0
 def __init__(self):
     # initial mysql-db
     mysql_para = ConfParameters.ConfParameters().mysql_conf
     self.db = MySQLdb.connect(mysql_para['ip'], mysql_para['users'], mysql_para['password'], mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     # initial xls writer
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.borders = xlwt.Borders()
     self.style = xlwt.XFStyle()
     self.__load_borders()
     self.style.borders = self.borders
     # local parameter
     self.key_level = 'level'
     self.key_vip = 'vip_level'
     self.table_name = 'user_reten_lv_vip'
     self.start_date = '2018-03-28'
     self.end_date = '2018-09-22'
Example #30
0
 def __init__(self, start_date, end_date):
     # initial mysql
     mysql_para = ConfParameters.ConfParameters().mysql_conf_bd
     self.db = MySQLdb.connect(host=mysql_para['ip'],
                               user=mysql_para['users'],
                               passwd=mysql_para['password'],
                               db=mysql_para['stat_base'])
     self.cursor = self.db.cursor()
     # initial xls
     self.wbk = xlwt.Workbook()
     self.xls_writer = EasyXls.EasyXls()
     self.style = xlwt.XFStyle()
     self.style.borders = self.xls_writer.borders
     # local
     self.stat_jp = 'zhanguo_jp_stat_base'
     self.stat_tw = 'zhanguo_stat_base'
     self.start_date = start_date
     self.end_date = end_date