def _output_HARD_STAGE_CHALLENGE(): global stage_result_dict result = [] for _stage_id, values in stage_result_dict.items(): cur_date = values['cur_date'] _stage_id = values['stage_id'] challenge_count = values['challenge_count'] challenge_win_count = values['challenge_win_count'] mop_count = values['mop_count'] win_rate = values['win_rate'] result.append([cur_date, _stage_id, challenge_count, challenge_win_count, mop_count, win_rate]) #排序 result.sort(lambda x, y: cmp(x[1], y[1])) #副本名称 for each_lst in result: # 副本信息 stage_config = game_config.get_stages_config(int(each_lst[1])) # 副本名称 stage_name = stage_config['stageInfo']+"_"+str(stage_config['id']) each_lst[1] = stage_name out_put_file = open(FILE_NAME, 'w') print(FILE_NAME) cPickle.dump(result, out_put_file) out_put_file.close()
def _output_NORMAL_STAGE_CHALLENGE(): global stage_result_dict result = [] for _stage_id, values in stage_result_dict.items(): cur_date = values['cur_date'] _stage_id = values['stage_id'] challenge_count = values['challenge_count'] challenge_win_count = values['challenge_win_count'] mop_count = values['mop_count'] win_rate = values['win_rate'] result.append([cur_date, _stage_id, challenge_count, challenge_win_count, mop_count, win_rate]) #排序 result.sort(lambda x, y: cmp(x[1], y[1])) #副本名称 for each_lst in result: # 副本信息 stage_config = game_config.get_stages_config(int(each_lst[1])) # 副本名称 stage_name = stage_config['stageInfo']+"_"+str(stage_config['id']) each_lst[1] = stage_name out_put_file = open(FILE_NAME, 'w') print(FILE_NAME) cPickle.dump(result, out_put_file) out_put_file.close()
def _output_HARD_STAGE_CHALLENGE(): global stage_result_dict result = [] for _stage_id, values in stage_result_dict.items(): cur_date = values["cur_date"] _stage_id = values["stage_id"] challenge_count = values["challenge_count"] challenge_win_count = values["challenge_win_count"] mop_count = values["mop_count"] win_rate = values["win_rate"] result.append([cur_date, _stage_id, challenge_count, challenge_win_count, mop_count, win_rate]) # 排序 result.sort(lambda x, y: cmp(x[1], y[1])) # 副本名称 for each_lst in result: # 副本信息 stage_config = game_config.get_stages_config(int(each_lst[1])) # 副本名称 stage_name = stage_config["stageInfo"] + "_" + str(stage_config["id"]) each_lst[1] = stage_name out_put_file = open(FILE_NAME, "w") print (FILE_NAME) cPickle.dump(result, out_put_file) out_put_file.close()
def _output_GOLD_STAGE_CHALLENGE(split_date,out_put_file_path): """ 经验关卡挑战数据 # 参与人数 参与次数 完成人数 总完成次数 到达要求人数 参与率 成功率 """ print("GOLD_STAGE_CHALLENGE") normal_stage_logs = [] action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_STAGE_GOLD_WIN, 'Err') normal_stage_logs.extend(cur_action_log_dict.get(action_str, [])) action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_STAGE_GOLD_FAIL, 'Err') normal_stage_logs.extend(cur_action_log_dict.get(action_str, [])) # 胜利失败关卡日志字典 stage_id_logs_dict = dict() for _log in normal_stage_logs: _stage_id = _log['stage_index'] _dat_lst = stage_id_logs_dict.get(_stage_id, []) _dat_lst.append(_log) stage_id_logs_dict[_stage_id] = _dat_lst open_level = game_config.get_game_config_val_int("OpenLevelStageGold") can_join_user_num = len(set([_uid for _uid, _lv in cur_user_level_dict.items() if _lv >= open_level])) result = [] for _stage_id, logs in stage_id_logs_dict.items(): cur_date = split_date.strftime('%m/%d/%Y') # 参与人数 challenge_user_count = len(set([l['uid'] for l in logs])) # 参与次数 challenge_count = len(logs) # 总完成次数 challenge_win_count = len([l for l in logs if l['action'] == game_define.EVENT_ACTION_STAGE_GOLD_WIN]) # 完成人数 challenge_win_user_count = len(set([l['uid'] for l in logs if l['action'] == game_define.EVENT_ACTION_STAGE_GOLD_WIN])) #胜率 win_rate = str(round(float(challenge_win_count)/float(challenge_count), 2)*100)+'%' # 参与率 join_rate = str(round(float(challenge_user_count)/float(can_join_user_num), 2)*100)+'%' result.append([cur_date,_stage_id, challenge_user_count, challenge_count, challenge_win_user_count, challenge_win_count, can_join_user_num, join_rate, win_rate]) #排序 result.sort(lambda x,y:cmp(x[1],y[1])) #副本名称 for each_lst in result: # 副本信息 stage_config = game_config.get_stages_config(int(each_lst[1])) # 副本名称 stage_name = stage_config['stageInfo']+"_"+str(stage_config['id']) each_lst[1] = stage_name out_put_file = open(out_put_file_path + 'GOLD_STAGE_CHALLENGE', 'w') pickle.dump(result, out_put_file) out_put_file.close() # if __name__ == "__main__": # start(sys.argv) # start(['2015-06-05', '2015-06-05'])