Example #1
0
        public EAlly HUnionDataChange(AllyData unionData)
        {
            EAlly result = EAlly.EFail;

            try
            {
                lock (_Mutex)
                {
                    IAllyService kuaFuService = GetKuaFuService();
                    if (null == kuaFuService)
                    {
                        return(result);
                    }

                    try
                    {
                        result = (EAlly)kuaFuService.UnionDataChange(_ClientInfo.ServerId, unionData);
                        if (result == EAlly.Succ)
                        {
                            int unionID = unionData.UnionID;

                            DateTime oldTime;
                            if (_unionDic.TryGetValue(unionID, out oldTime))
                            {
                                _unionDic[unionID] = DateTime.Now;
                                return(EAlly.Succ);
                            }
                            else
                            {
                                _unionDic.TryAdd(unionID, DateTime.Now);

                                HAllyDataList(unionID, EAllyDataType.Ally);
                                HAllyDataList(unionID, EAllyDataType.Request);
                                HAllyDataList(unionID, EAllyDataType.Accept);
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        ResetKuaFuService();
                    }
                }
            }
            catch (System.Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }

            return(result);
        }
Example #2
0
        public EAlly HUnionDataChange(AllyData unionData)
        {
            EAlly result = EAlly.EFail;

            try
            {
                lock (this._Mutex)
                {
                    IAllyService kuaFuService = this.GetKuaFuService(false);
                    if (null == kuaFuService)
                    {
                        return(result);
                    }
                    try
                    {
                        result = (EAlly)kuaFuService.UnionDataChange(this._ClientInfo.ServerId, unionData);
                        if (result == EAlly.Succ)
                        {
                            int      unionID = unionData.UnionID;
                            DateTime oldTime;
                            if (this._unionDic.TryGetValue(unionID, out oldTime))
                            {
                                this._unionDic[unionID] = TimeUtil.NowDateTime();
                                return(EAlly.Succ);
                            }
                            this._unionDic.TryAdd(unionID, TimeUtil.NowDateTime());
                            this.HAllyDataList(unionID, EAllyDataType.Ally);
                            this.HAllyDataList(unionID, EAllyDataType.Request);
                            this.HAllyDataList(unionID, EAllyDataType.Accept);
                        }
                    }
                    catch (Exception ex)
                    {
                        this.ResetKuaFuService();
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
            }
            return(result);
        }