コード例 #1
0
ファイル: KFCopyTeamManager.cs プロジェクト: chenchungit/ky
        public KFCopyTeamAnalysis BuildAnalysisData()
        {
            KFCopyTeamAnalysis data = new KFCopyTeamAnalysis();

            lock (Mutex)
            {
                foreach (var kvp in CopyTeamDict)
                {
                    long         teamId = kvp.Key;
                    CopyTeamData td     = kvp.Value;

                    KFCopyTeamAnalysis.Item item = null;
                    if (!data.AnalysisDict.TryGetValue(td.FuBenId, out item))
                    {
                        item = new KFCopyTeamAnalysis.Item();
                        data.AnalysisDict[td.FuBenId] = item;
                    }

                    item.TotalCopyCount += 1;
                    item.TotalRoleCount += td.TeamRoles.Count;
                    if (td.StartTime > 0)
                    {
                        item.StartCopyCount += 1;
                        item.StartRoleCount += td.TeamRoles.Count;
                    }
                    else
                    {
                        item.UnStartCopyCount += 1;
                        item.UnStartRoleCount += td.TeamRoles.Count;
                    }
                }
            }

            return(data);
        }
コード例 #2
0
ファイル: KuaFuCopyDbMgr.cs プロジェクト: qiuhoude/mu_server
 public void SaveCopyTeamAnalysisData(KFCopyTeamAnalysis data)
 {
     if (data != null)
     {
         string nowTime = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
         KFCopyTeamAnalysis.Item totalItem = new KFCopyTeamAnalysis.Item();
         foreach (KeyValuePair <int, KFCopyTeamAnalysis.Item> kvp in data.AnalysisDict)
         {
             int copyId = kvp.Key;
             KFCopyTeamAnalysis.Item item = kvp.Value;
             totalItem.TotalCopyCount   += item.TotalCopyCount;
             totalItem.StartCopyCount   += item.StartCopyCount;
             totalItem.UnStartCopyCount += item.UnStartCopyCount;
             totalItem.TotalRoleCount   += item.TotalRoleCount;
             totalItem.StartRoleCount   += item.StartRoleCount;
             totalItem.UnStartRoleCount += item.UnStartRoleCount;
             string sql = string.Format("REPLACE INTO t_kuafu_fuben_game_log(fuben_id,total_fuben_count,start_fuben_count,unstart_fuben_count,total_role_count,start_role_count,unstart_role_count,time)  VALUES({0},{1},{2},{3},{4},{5},{6},'{7}') ", new object[]
             {
                 copyId,
                 item.TotalCopyCount,
                 item.StartCopyCount,
                 item.UnStartCopyCount,
                 item.TotalRoleCount,
                 item.StartRoleCount,
                 item.UnStartRoleCount,
                 nowTime
             });
             this.ExecuteSqlNoQuery(sql);
         }
         string totalSql = string.Format("REPLACE INTO t_kuafu_fuben_game_log(fuben_id,total_fuben_count,start_fuben_count,unstart_fuben_count,total_role_count,start_role_count,unstart_role_count,time)  VALUES({0},{1},{2},{3},{4},{5},{6},'{7}') ", new object[]
         {
             -1,
             totalItem.TotalCopyCount,
             totalItem.StartCopyCount,
             totalItem.UnStartCopyCount,
             totalItem.TotalRoleCount,
             totalItem.StartRoleCount,
             totalItem.UnStartRoleCount,
             nowTime
         });
         this.ExecuteSqlNoQuery(totalSql);
         string deleteSql = string.Format("DELETE FROM t_kuafu_fuben_game_log WHERE time != '{0}'", nowTime);
         this.ExecuteSqlNoQuery(deleteSql);
     }
 }