Exemple #1
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()
Exemple #2
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()
Exemple #3
0
 def __get_vip_table(self, file_name):
     vip_dict = collections.OrderedDict()  # {vip:money} # use min money
     file_table = ReadTable.ReadTable(file_name).read_table_file_coupled()
     for vip in file_table.keys():
         value = int(file_table[vip]['money'])
         vip_dict[vip] = value
     return vip_dict
Exemple #4
0
 def __load_item(self):
     file_name = ConfParameters.ConfParameters(
     ).conf_path + 'WorldMatch.txt'
     self.item_dict = ReadTable.ReadTable(file_name).read_table_file()
Exemple #5
0
def __read_table(table_file_name):
    file_path = ConfParameters.ConfParameters().conf_path + table_file_name
    return ReadTable.ReadTable(file_path).read_table_file_coupled()
Exemple #6
0
def shop_exchange(input_dict, *flag):
    Y_list = []
    Y_trans = dict()
    data_dict = dict()

    head_name = "商店" + str(flag[0])

    easy_mysql = EasyMysql.EasyMysql()
    is_legal_input(input_dict)
    date_list = [max(input_dict['date_list'])]
    date_list = sorted(date_list)
    if len(date_list) == 0:
        msg = 'Not date selected, len(date_list)' + str(len(date_list))
        raise RuntimeError(msg)
    zoneid_list = input_dict['zone_list']
    channel_list = input_dict['channel_list']
    cursor = input_dict['cursor']
    sql_where = ' where date <=' + easy_mysql.sql_value_str(date_list)
    if len(zoneid_list) > 0:
        sql_where = sql_where + ' and zoneid in (' + easy_mysql.sql_value_str(
            zoneid_list) + ') '
    if len(channel_list) > 0:
        sql_where = sql_where + ' and channel in (' + easy_mysql.sql_value_str(
            channel_list) + ') '

    if len(flag) > 0:
        sqlstr = 'select mvip,itemid,sum(times) from(select uid,max(viplevel) as mvip from shopexchange' + sql_where + ' and shopid=' + str(
            flag[0]
        ) + ' group by uid) as a left join (select uid,itemid,sum(times) as times from shopexchange' + sql_where + ' and shopid=' + str(
            flag[0]
        ) + ' group by uid,itemid) as b on a.uid=b.uid group by mvip,itemid;'
        # print(sqlstr)
        cursor.execute(sqlstr)
        alldata = cursor.fetchall()
        if alldata:
            for rec in alldata:
                Y_list.append(str(rec[1]))
        Y_list = sorted(list(set(Y_list)))
        for y in Y_list:
            data_dict[y] = dict()
        if alldata:
            for rec in alldata:
                data_dict[str(rec[1])][int(rec[0])] = rec[2]

        Y_trans_origin = ReadTable.ReadTable(
            "./conf/item.txt").read_table_file_coupled([1, 1])
        for i in Y_list:
            Y_trans[i] = Y_trans_origin.setdefault(i, dict()).setdefault(
                "游戏内名称", "-")

    for key in data_dict.keys():
        data_dict[key]['trans'] = Y_trans[key]
    res_dict = {
        'data_dict': data_dict,
        'X_list': X_list,
        'Y_list': Y_list,
        'head_name': head_name,
        'X_trans': X_trans,
        'default_value': default_value
    }
    # print(res_dict)
    res_dict['note'] = "开始-终止日的" + str(flag[0]) + "商城购买次数"
    return res_dict
Exemple #7
0
 def read_table(self):
     file_name = self.conf_path + 'ship_exclusive.txt'
     self.ship_table = ReadTable.ReadTable(file_name).read_table_file()