예제 #1
0
 public void WriteCoupleData(CoupleArenaCoupleDataK coupleData)
 {
     if (coupleData != null)
     {
         try
         {
             string sql = string.Format("INSERT INTO t_couple_arena_group(`couple_id`,`man_rid`,`man_zoneid`,`wife_rid`,`wife_zoneid`,`total_pk_times`,`total_win_times`,`liansheng`,`jifen`,`duanwei_type`,`duanwei_level`,`rank`,`is_divorced`,`man_data1`,`wife_data1`)  VALUES({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},@man_data1,@wife_data1)  ON DUPLICATE KEY UPDATE `total_pk_times`={5},`total_win_times`={6},`liansheng`={7},`jifen`={8},`duanwei_type`={9},`duanwei_level`={10},`rank`={11},`is_divorced`={12},`man_data1`=@man_data1,`wife_data1`=@wife_data1;", new object[]
             {
                 coupleData.Db_CoupleId,
                 coupleData.ManRoleId,
                 coupleData.ManZoneId,
                 coupleData.WifeRoleId,
                 coupleData.WifeZoneId,
                 coupleData.TotalFightTimes,
                 coupleData.WinFightTimes,
                 coupleData.LianShengTimes,
                 coupleData.JiFen,
                 coupleData.DuanWeiType,
                 coupleData.DuanWeiLevel,
                 coupleData.Rank,
                 coupleData.IsDivorced
             });
             DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
             {
                 new Tuple <string, byte[]>("man_data1", coupleData.ManSelectorData),
                 new Tuple <string, byte[]>("wife_data1", coupleData.WifeSelectorData)
             });
         }
         catch (Exception ex)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("FlushRandList2Db failed, couple_id={0},man={1},wife={2}", coupleData.Db_CoupleId, coupleData.ManRoleId, coupleData.WifeRoleId), ex, true);
         }
     }
 }
예제 #2
0
 public void SaveBHMatchRolesData(int type, int rid, string rname, int zoneid, int bhid, byte[] roledata)
 {
     if (null != roledata)
     {
         string sql = string.Format("INSERT INTO t_banghui_match_roles(`type`, rid, rname, zoneid, bhid, data1) VALUES({0},{1},'{2}',{3},{4}, @content) ON DUPLICATE KEY UPDATE rname='{2}', bhid={4}, data1=@content;", new object[]
         {
             type,
             rid,
             rname,
             zoneid,
             bhid
         });
         DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
         {
             new Tuple <string, byte[]>("content", roledata)
         });
     }
     else
     {
         string sql = string.Format("INSERT INTO t_banghui_match_roles(`type`, rid, rname, zoneid, bhid) VALUES({0},{1},'{2}',{3},{4}) ON DUPLICATE KEY UPDATE rname='{2}', bhid={4};", new object[]
         {
             type,
             rid,
             rname,
             zoneid,
             bhid
         });
         this.AddDelayWriteSql(sql);
     }
 }
예제 #3
0
        public bool WriteCoupleData(int week, CoupleWishCoupleDataK coupleData)
        {
            bool result;

            try
            {
                string sql = string.Format("INSERT INTO t_couple_wish_group(`couple_id`,`man_rid`,`man_zoneid`,`man_rname`,`wife_rid`,`wife_zoneid`,`wife_rname`,`be_wish_num`,`rank`,`week`,`man_selector`,`wife_selector`)  VALUES({0},{1},{2},'{3}',{4},{5},'{6}',{7},{8},{9},@man_selector,@wife_selector)  ON DUPLICATE KEY UPDATE `man_rname`='{3}',`wife_rname`='{6}',`be_wish_num`={7},`rank`={8},`man_selector`=@man_selector,`wife_selector`=@wife_selector;", new object[]
                {
                    coupleData.DbCoupleId,
                    coupleData.Man.RoleId,
                    coupleData.Man.ZoneId,
                    coupleData.Man.RoleName,
                    coupleData.Wife.RoleId,
                    coupleData.Wife.ZoneId,
                    coupleData.Wife.RoleName,
                    coupleData.BeWishedNum,
                    coupleData.Rank,
                    week
                });
                DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
                {
                    new Tuple <string, byte[]>("man_selector", coupleData.ManSelector),
                    new Tuple <string, byte[]>("wife_selector", coupleData.WifeSelector)
                });
                result = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("CoupleWish FlushRandList2Db failed, couple_id={0},man={1},wife={2}", coupleData.DbCoupleId, coupleData.Man.RoleId, coupleData.Wife.RoleId), ex, true);
                result = false;
            }
            return(result);
        }
예제 #4
0
        public bool WriteStatueData(CoupleWishSyncStatueData statue)
        {
            bool result;

            try
            {
                string sql = string.Format("INSERT INTO t_couple_wish_statue(`couple_id`,`man_rid`,`man_zoneid`,`man_rname`,`wife_rid`,`wife_zoneid`,`wife_rname`,`admire_cnt`,`is_divorced`,`week`,`yanhui_join_num`,`man_statue`,`wife_statue`)  VALUES({0},{1},{2},'{3}',{4},{5},'{6}',{7},{8},{9},{10},@man_statue,@wife_statue)  ON DUPLICATE KEY UPDATE `admire_cnt`={7},`is_divorced`={8},`yanhui_join_num`={10},`man_statue`=@man_statue,`wife_statue`=@wife_statue;", new object[]
                {
                    statue.DbCoupleId,
                    statue.Man.RoleId,
                    statue.Man.ZoneId,
                    statue.Man.RoleName,
                    statue.Wife.RoleId,
                    statue.Wife.ZoneId,
                    statue.Wife.RoleName,
                    statue.BeAdmireCount,
                    statue.IsDivorced,
                    statue.Week,
                    statue.YanHuiJoinNum
                });
                DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
                {
                    new Tuple <string, byte[]>("man_statue", statue.ManRoleDataEx),
                    new Tuple <string, byte[]>("wife_statue", statue.WifeRoleDataEx)
                });
                result = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("CoupleWish WriteStatueData failed, couple_id={0},man={1},wife={2}", statue.DbCoupleId, statue.Man.RoleId, statue.Wife.RoleId), ex, true);
                result = false;
            }
            return(result);
        }
예제 #5
0
 public int SetLingZhu(int roleId, int lingDiType, int junTuanId, string junTuanName, int zhiWu, byte[] roledata)
 {
     try
     {
         int        oldRid = 0;
         LingDiData data   = new LingDiData();
         lock (this.Mutex)
         {
             if (this.LingDiDataList.Count < 2 || this.LingDiDataList[0] == null || null == this.LingDiDataList[1])
             {
                 return(0);
             }
             oldRid = this.LingDiDataList[lingDiType].RoleId;
             this.LingDiDataList[lingDiType].RoleId    = roleId;
             this.LingDiDataList[lingDiType].OpenCount = 0;
             this.LingDiDataList[lingDiType].BeginTime = DateTime.MaxValue;
             this.LingDiDataList[lingDiType].EndTime   = DateTime.MinValue;
             foreach (LingDiShouWei item in this.LingDiDataList[lingDiType].ShouWeiList)
             {
                 item.State         = 0;
                 item.FreeBuShuTime = DateTime.MinValue;
             }
             this.LingDiDataList[lingDiType].JunTuanId   = junTuanId;
             this.LingDiDataList[lingDiType].RoleData    = roledata;
             this.LingDiDataList[lingDiType].JunTuanName = junTuanName;
             data = this.LingDiDataList[lingDiType];
         }
         string optTime = TimeUtil.NowDateTime().ToString();
         string sql     = string.Format("update t_lingditequan set lingzhu=0,opttime='{2}' where rid={0} and lingditype={1};", oldRid, lingDiType, optTime);
         sql += string.Format("replace into t_lingditequan(rid,lingditype,juntuanid,juntuanname,lingzhu,roledata,opttime) values ({0},{1},{2},'{3}',{4},@roledata,'{5}');", new object[]
         {
             roleId,
             lingDiType,
             junTuanId,
             junTuanName,
             zhiWu,
             optTime
         });
         int ret = DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
         {
             new Tuple <string, byte[]>("roledata", roledata)
         });
         if (ret > 0)
         {
             ClientAgentManager.Instance().BroadCastAsyncEvent(GameTypes.JunTuan, new AsyncDataItem(KuaFuEventTypes.SyncLingDiData, new object[]
             {
                 data
             }), 0);
             return(1);
         }
         return(ret);
     }
     catch
     {
     }
     return(0);
 }
예제 #6
0
        public void UpdateRebornRoleData4Selector(KFRebornRoleData roleData)
        {
            string sql = string.Format("UPDATE t_reborn_roles SET data1=@content WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);

            DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
            {
                new Tuple <string, byte[]>("content", roleData.RoleData4Selector)
            });
        }
예제 #7
0
 public KuaFuWorldRoleData InsertKuaFuWorldRoleData(KuaFuWorldRoleData data, int tempRoleID)
 {
     try
     {
         object[] ptidAndRid;
         int      result = DbHelperMySQL.GetSingleValues(string.Format("SELECT ptid,rid FROM `t_pt_roles` where temprid={0}", data.LocalRoleID), out ptidAndRid);
         bool     flag;
         if (result >= 0)
         {
             flag = !ptidAndRid.All((object x) => x != null);
         }
         else
         {
             flag = true;
         }
         if (!flag)
         {
             if (!(data.PTID.ToString() != ptidAndRid[0].ToString()))
             {
                 return(this.QueryKuaFuWorldRoleData(data.LocalRoleID, data.PTID));
             }
             data.TempRoleID = tempRoleID;
         }
         else
         {
             data.TempRoleID = data.LocalRoleID;
         }
         List <Tuple <string, byte[]> > imgList = new List <Tuple <string, byte[]> >();
         imgList.Add(new Tuple <string, byte[]>("content", data.RoleData));
         string strSql = string.Format("insert into `t_pt_roles`(ptid,rid,temprid,userid,zoneid,channel,roledata) values('{0}','{1}','{2}','{3}','{4}','{5}',@content)", new object[]
         {
             data.PTID,
             data.LocalRoleID,
             data.TempRoleID,
             data.UserID,
             data.ZoneID,
             data.Channel
         });
         result = DbHelperMySQL.ExecuteSqlInsertImg(strSql, imgList);
         if (result >= 0)
         {
             return(data);
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
     }
     return(null);
 }
예제 #8
0
 /// <summary>
 /// 添加圣域城主历史记录数据
 /// </summary>
 /// <param name="CityOwnerData"></param>
 public void InsertCityOwnerHistory(LangHunLingYuKingHist CityOwnerData)
 {
     try
     {
         string sql = string.Format("INSERT INTO t_lhly_hist(role_id, admire_count, time, data) VALUES({0}, {1}, '{2}', @content)",
                                    CityOwnerData.rid, CityOwnerData.AdmireCount, CityOwnerData.CompleteTime.ToString());
         List <Tuple <string, byte[]> > imgList = new List <Tuple <string, byte[]> >();
         imgList.Add(new Tuple <string, byte[]>("content", CityOwnerData.CityOwnerRoleData));
         DbHelperMySQL.ExecuteSqlInsertImg(sql, imgList);
     }
     catch (System.Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
     }
 }
예제 #9
0
        public int WriteKuaFuWorldRoleData(KuaFuWorldRoleData data)
        {
            int result = -15;

            try
            {
                string strSql = string.Format("update `t_pt_roles` set roledata=@content where ptid={0} and rid={1}", data.PTID, data.PTID);
                result = DbHelperMySQL.ExecuteSqlInsertImg(strSql, new List <Tuple <string, byte[]> >
                {
                    new Tuple <string, byte[]>("content", data.RoleData)
                });
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            return(result);
        }
예제 #10
0
        public bool DBRankDataUpdate(KFRankData data)
        {
            string sql = string.Format("REPLACE INTO t_rank(rankType,rank,zoneID,roleID,roleName,grade,rankTime,serverID,rankData) \r\n                                        VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',@roleData)", new object[]
            {
                data.RankType,
                data.Rank,
                data.ZoneID,
                data.RoleID,
                data.RoleName,
                data.Grade,
                data.RankTime,
                data.ServerID
            });

            DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
            {
                new Tuple <string, byte[]>("roleData", data.RoleData)
            });
            return(true);
        }
예제 #11
0
 public void WriteRoleInfoDataToDb(TianTiRoleInfoData data)
 {
     //写数据库
     try
     {
         List <Tuple <string, byte[]> > imgList = new List <Tuple <string, byte[]> >();
         imgList.Add(new Tuple <string, byte[]>("content", data.TianTiPaiHangRoleData));
         imgList.Add(new Tuple <string, byte[]>("mirror", data.PlayerJingJiMirrorData));
         //IConvertible
         DbHelperMySQL.ExecuteSqlInsertImg(string.Format("INSERT INTO t_tianti_roles(rid,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,rname,data1,data2) " +
                                                         "VALUES({0},{1},{2},{3},{4},{5},'{6}',@content,@mirror) " +
                                                         "ON DUPLICATE KEY UPDATE `zoneid`={1},`duanweiid`={2},`duanweijifen`={3},`duanweirank`={4},`zhanli`={5},`rname`='{6}',`data1`=@content,`data2`=@mirror;",
                                                         data.RoleId, data.ZoneId, data.DuanWeiId, data.DuanWeiJiFen, data.DuanWeiRank, data.ZhanLi, data.RoleName),
                                           imgList);
     }
     catch (System.Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
     }
 }
예제 #12
0
        public void DelayWriteDataProc()
        {
            List <Tuple <string, List <Tuple <string, byte[]> >, Action <object, int> > > list = null;

            lock (this.Mutex)
            {
                if (this.DelayWriteSqlQueue.Count == 0)
                {
                    return;
                }
                list = this.DelayWriteSqlQueue.ToList <Tuple <string, List <Tuple <string, byte[]> >, Action <object, int> > >();
                this.DelayWriteSqlQueue.Clear();
            }
            foreach (Tuple <string, List <Tuple <string, byte[]> >, Action <object, int> > sql in list)
            {
                try
                {
                    LogManager.WriteLog(LogTypes.SQL, sql.Item1, null, true);
                    int ret;
                    if (null == sql.Item2)
                    {
                        ret = DbHelperMySQL.ExecuteSql(sql.Item1);
                    }
                    else
                    {
                        ret = DbHelperMySQL.ExecuteSqlInsertImg(sql.Item1, sql.Item2);
                    }
                    if (sql.Item3 != null)
                    {
                        sql.Item3(sql, ret);
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteException(string.Format("sql: {0}\r\n{1}", sql, ex.ToString()));
                }
            }
        }
        private bool BuildZhengBaRank(int nowMonth, List <ZhanDuiZhengBaZhanDuiData> rankList)
        {
            bool bMonthFirst = false;

            try
            {
                foreach (ZhanDuiZhengBaZhanDuiData roleData in rankList)
                {
                    string repSql = string.Format("REPLACE INTO t_zhandui_zhengba(`month`,zhanduiid,zoneid,zhanduiname,duanweiid,duanweijifen,duanweirank,zhanli,`grade`,`group`,state,data1,data2) VALUES({0},{1},{2},'{3}',{4},{5},{6},{7},{8},{9},{10},@content,null)", new object[]
                    {
                        nowMonth,
                        roleData.ZhanDuiID,
                        roleData.ZoneId,
                        roleData.ZhanDuiName,
                        roleData.DuanWeiId,
                        0,
                        roleData.DuanWeiRank,
                        roleData.ZhanLi,
                        64,
                        roleData.Group,
                        0
                    });
                    DbHelperMySQL.ExecuteSqlInsertImg(repSql, new List <Tuple <string, byte[]> >
                    {
                        new Tuple <string, byte[]>("content", DataHelper2.ObjectToBytes <List <RoleOccuNameZhanLi> >(roleData.MemberList))
                    });
                }
                DbHelperMySQL.ExecuteSql(string.Format("REPLACE INTO t_async(`id`,`value`) VALUES({0},{1});", 13, nowMonth));
                bMonthFirst = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            return(bMonthFirst);
        }
예제 #14
0
        /// <summary>
        /// 检测生成众生争霸排行榜
        /// </summary>
        /// <param name="now"></param>
        private bool CheckBuildZhengBaRank(int selectRoleIfNewCreate, int nowMonth)
        {
            bool bMonthFirst = false;

            try
            {
                DbHelperMySQL.ExecuteSql(
                    string.Format("INSERT IGNORE INTO t_async(`id`,`value`) VALUES({0},{1});",
                                  AsyncTypes.ZhengBaCurrMonth, ZhengBaConsts.DefaultAsyncMonth)
                    );

                // 防止人为的重新reload月排行榜导致众神争霸战斗信息丢失

                /* 这里有一些细节要注意:
                 * 1:每月1号凌晨3点更新月排行榜,然后触发更新争霸角色
                 * 2: 服务器启动的时候,尝试生成争霸角色
                 * 3:要防止当月的争霸角色重复生成
                 * 4:必须保证天梯排行角色已经生成,才能生成争霸角色 -->例如,1号凌晨两点启动,必须保证等到3点的时候,天梯月排行榜生成之后,能够生成本月的争霸角色
                 */
                int    oldMonth           = (int)DbHelperMySQL.GetSingle("select value from t_async where id = " + AsyncTypes.ZhengBaCurrMonth);
                object ageObj_tiantiMonth = DbHelperMySQL.GetSingle("select value from t_async where id = " + AsyncTypes.TianTiPaiHangModifyOffsetDay);
                if (oldMonth != nowMonth &&
                    ageObj_tiantiMonth != null &&
                    ZhengBaUtils.MakeMonth(DataHelper2.GetRealDate((int)ageObj_tiantiMonth)) == nowMonth)
                {
                    string strSql = string.Format("SELECT rid,rname,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,data1,data2 FROM t_tianti_month_paihang ORDER BY duanweirank ASC LIMIT {0};", selectRoleIfNewCreate);
                    var    sdr    = DbHelperMySQL.ExecuteReader(strSql);
                    while (sdr != null && sdr.Read())
                    {
                        ZhengBaRoleInfoData roleData = new ZhengBaRoleInfoData();
                        roleData.RoleId       = (int)Convert.ToInt32(sdr["rid"]);
                        roleData.ZoneId       = (int)Convert.ToInt32(sdr["zoneid"]);
                        roleData.DuanWeiId    = (int)Convert.ToInt32(sdr["duanweiid"]);
                        roleData.DuanWeiJiFen = (int)Convert.ToInt32(sdr["duanweijifen"]);
                        roleData.DuanWeiRank  = (int)Convert.ToInt32(sdr["duanweirank"]);
                        roleData.ZhanLi       = (int)Convert.ToInt32(sdr["zhanli"]);
                        roleData.RoleName     = sdr["rname"].ToString();
                        if (!sdr.IsDBNull(sdr.GetOrdinal("data1")))
                        {
                            roleData.TianTiPaiHangRoleData = (byte[])(sdr["data1"]);
                        }
                        if (!sdr.IsDBNull(sdr.GetOrdinal("data2")))
                        {
                            roleData.PlayerJingJiMirrorData = (byte[])(sdr["data2"]);
                        }
                        if (string.IsNullOrEmpty(roleData.RoleName) && roleData.TianTiPaiHangRoleData != null)
                        {
                            var onlyName = DataHelper2.BytesToObject <TianTiPaiHangRoleData_OnlyName>(
                                roleData.TianTiPaiHangRoleData, 0, roleData.TianTiPaiHangRoleData.Length);
                            if (onlyName != null)
                            {
                                roleData.RoleName = onlyName.RoleName;
                            }
                        }

                        string repSql = string.Format(
                            "REPLACE INTO t_zhengba_roles(`month`,rid,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,`grade`,`group`,state,rname,data1,data2) "
                            + "VALUES({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},'{10}',@content,@mirror)",
                            nowMonth, roleData.RoleId, roleData.ZoneId, roleData.DuanWeiId,
                            roleData.DuanWeiJiFen, roleData.DuanWeiRank, roleData.ZhanLi,
                            (int)EZhengBaGrade.Grade100, (int)ZhengBaConsts.NoneGroup, (int)EZhengBaState.None, roleData.RoleName);

                        DbHelperMySQL.ExecuteSqlInsertImg(repSql,
                                                          new List <Tuple <string, byte[]> > {
                            new Tuple <string, byte[]>("content", roleData.TianTiPaiHangRoleData),
                            new Tuple <string, byte[]>("mirror", roleData.PlayerJingJiMirrorData)
                        });
                    }
                    if (sdr != null)
                    {
                        sdr.Close();
                    }

                    DbHelperMySQL.ExecuteSql(
                        string.Format("REPLACE INTO t_async(`id`,`value`) VALUES({0},{1});",
                                      AsyncTypes.ZhengBaCurrMonth, nowMonth)
                        );

                    bMonthFirst = true;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(bMonthFirst);
        }
예제 #15
0
        private bool CheckBuildZhengBaRank(int selectRoleIfNewCreate, int nowMonth)
        {
            bool bMonthFirst = false;

            try
            {
                DbHelperMySQL.ExecuteSql(string.Format("INSERT IGNORE INTO t_async(`id`,`value`) VALUES({0},{1});", 30, 201111));
                int    oldMonth           = (int)DbHelperMySQL.GetSingle("select value from t_async where id = " + 30);
                object ageObj_tiantiMonth = DbHelperMySQL.GetSingle("select value from t_async where id = " + 4);
                if (oldMonth != nowMonth && ageObj_tiantiMonth != null && ZhengBaUtils.MakeMonth(DataHelper2.GetRealDate((int)ageObj_tiantiMonth)) == nowMonth)
                {
                    string          strSql = string.Format("SELECT rid,rname,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,data1,data2 FROM t_tianti_month_paihang ORDER BY duanweirank ASC LIMIT {0};", selectRoleIfNewCreate);
                    MySqlDataReader sdr    = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        ZhengBaRoleInfoData roleData = new ZhengBaRoleInfoData();
                        roleData.RoleId       = Convert.ToInt32(sdr["rid"]);
                        roleData.ZoneId       = Convert.ToInt32(sdr["zoneid"]);
                        roleData.DuanWeiId    = Convert.ToInt32(sdr["duanweiid"]);
                        roleData.DuanWeiJiFen = Convert.ToInt32(sdr["duanweijifen"]);
                        roleData.DuanWeiRank  = Convert.ToInt32(sdr["duanweirank"]);
                        roleData.ZhanLi       = Convert.ToInt32(sdr["zhanli"]);
                        roleData.RoleName     = sdr["rname"].ToString();
                        if (!sdr.IsDBNull(sdr.GetOrdinal("data1")))
                        {
                            roleData.TianTiPaiHangRoleData = (byte[])sdr["data1"];
                        }
                        if (!sdr.IsDBNull(sdr.GetOrdinal("data2")))
                        {
                            roleData.PlayerJingJiMirrorData = (byte[])sdr["data2"];
                        }
                        if (string.IsNullOrEmpty(roleData.RoleName) && roleData.TianTiPaiHangRoleData != null)
                        {
                            TianTiPaiHangRoleData_OnlyName onlyName = DataHelper2.BytesToObject <TianTiPaiHangRoleData_OnlyName>(roleData.TianTiPaiHangRoleData, 0, roleData.TianTiPaiHangRoleData.Length);
                            if (onlyName != null)
                            {
                                roleData.RoleName = onlyName.RoleName;
                            }
                        }
                        string repSql = string.Format("REPLACE INTO t_zhengba_roles(`month`,rid,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,`grade`,`group`,state,rname,data1,data2) VALUES({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},'{10}',@content,@mirror)", new object[]
                        {
                            nowMonth,
                            roleData.RoleId,
                            roleData.ZoneId,
                            roleData.DuanWeiId,
                            roleData.DuanWeiJiFen,
                            roleData.DuanWeiRank,
                            roleData.ZhanLi,
                            100,
                            0,
                            0,
                            roleData.RoleName
                        });
                        DbHelperMySQL.ExecuteSqlInsertImg(repSql, new List <Tuple <string, byte[]> >
                        {
                            new Tuple <string, byte[]>("content", roleData.TianTiPaiHangRoleData),
                            new Tuple <string, byte[]>("mirror", roleData.PlayerJingJiMirrorData)
                        });
                    }
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                    DbHelperMySQL.ExecuteSql(string.Format("REPLACE INTO t_async(`id`,`value`) VALUES({0},{1});", 30, nowMonth));
                    bMonthFirst = true;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            return(bMonthFirst);
        }
예제 #16
0
 public void SaveCompRoleData(KFCompRoleData roleData, bool chgJX = false, bool chgJXL = false, bool chgJiFen = false, bool chgMine = false)
 {
     if (null != roleData.RoleData4Selector)
     {
         string sql = string.Format("INSERT INTO t_comp_roles(rid, `type`, rname, zoneid, junxian, junxian_last, type_last, battlejifen, type_battle, minejifen, type_mine, data1) VALUES({0},{1},'{2}',{3},{4},{5},{6},{7},{8},{9},{10},@content) ON DUPLICATE KEY UPDATE `type`={1}, rname='{2}', junxian={4}, junxian_last={5}, type_last={6}, battlejifen={7}, type_battle={8}, minejifen={9}, type_mine={10}, data1=@content;", new object[]
         {
             roleData.RoleID,
             roleData.CompType,
             roleData.RoleName,
             roleData.ZoneID,
             roleData.JunXian,
             roleData.JunXianLast,
             roleData.CompTypeLast,
             roleData.BattleJiFen,
             roleData.CompTypeBattle,
             roleData.MineJiFen,
             roleData.CompTypeMine
         });
         DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
         {
             new Tuple <string, byte[]>("content", roleData.RoleData4Selector)
         });
     }
     else
     {
         string sql = string.Format("INSERT INTO t_comp_roles(rid, `type`, rname, zoneid, junxian, junxian_last, type_last, battlejifen, type_battle, minejifen, type_mine) VALUES({0},{1},'{2}',{3},{4},{5},{6},{7},{8},{9},{10}) ON DUPLICATE KEY UPDATE `type`={1}, rname='{2}', junxian={4}, junxian_last={5}, type_last={6}, battlejifen={7}, type_battle={8}, minejifen={9}, type_mine={10};", new object[]
         {
             roleData.RoleID,
             roleData.CompType,
             roleData.RoleName,
             roleData.ZoneID,
             roleData.JunXian,
             roleData.JunXianLast,
             roleData.CompTypeLast,
             roleData.BattleJiFen,
             roleData.CompTypeBattle,
             roleData.MineJiFen,
             roleData.CompTypeMine
         });
         this.AddDelayWriteSql(sql);
     }
     if (null != roleData.RoleData4Selector)
     {
         if (chgJX)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_jx=NOW() WHERE rid={0};", roleData.RoleID);
             this.ExecuteSqlNoQuery(sql);
         }
         if (chgJXL)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_jxl=ranktm_jx WHERE rid={0};", roleData.RoleID);
             this.ExecuteSqlNoQuery(sql);
         }
         if (chgJiFen)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_bjf=NOW() WHERE rid={0};", roleData.RoleID);
             this.ExecuteSqlNoQuery(sql);
         }
         if (chgMine)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_mjf=NOW() WHERE rid={0};", roleData.RoleID);
             this.ExecuteSqlNoQuery(sql);
         }
     }
     else
     {
         if (chgJX)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_jx=NOW() WHERE rid={0};", roleData.RoleID);
             this.AddDelayWriteSql(sql);
         }
         if (chgJXL)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_jxl=ranktm_jx WHERE rid={0};", roleData.RoleID);
             this.AddDelayWriteSql(sql);
         }
         if (chgJiFen)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_bjf=NOW() WHERE rid={0};", roleData.RoleID);
             this.AddDelayWriteSql(sql);
         }
         if (chgMine)
         {
             string sql = string.Format("UPDATE t_comp_roles SET ranktm_mjf=NOW() WHERE rid={0};", roleData.RoleID);
             this.AddDelayWriteSql(sql);
         }
     }
 }