public bool SpreadVip(int pzoneID, int proleID, int czoneID, int croleID) { //推广员 KFSpreadData pData = GetSpreadData(pzoneID, proleID); if (pData == null) { return(false); } pData.UpdateLogtime(); //推广员 lock (pData) { bool result = SpreadPersistence.Instance.DBSpreadIsVip(pzoneID, proleID, czoneID, croleID); if (result) { pData.CountVip += 1; if (pData.ServerID > 0) { NotifySpreadData(pData); } return(true); } } return(false); }
public bool SpreadVip(int pzoneID, int proleID, int czoneID, int croleID) { KFSpreadData pData = this.GetSpreadData(pzoneID, proleID); bool result2; if (pData == null) { result2 = false; } else { pData.UpdateLogtime(); lock (pData) { bool result = SpreadPersistence.Instance.DBSpreadIsVip(pzoneID, proleID, czoneID, croleID); if (result) { pData.CountVip++; if (pData.ServerID > 0) { this.NotifySpreadData(pData); } return(true); } } result2 = false; } return(result2); }
public int TelCodeVerify(int serverID, int czoneID, int croleID, int telCode) { if (!IsAgent(serverID)) { return((int)ESpreadState.EServer); } KFSpreadKey ckey = KFSpreadKey.Get(czoneID, croleID); KFSpreadVerifyData verifyData = null; if (!_spreadVerifyDataDic.TryGetValue(ckey, out verifyData)) { return((int)ESpreadState.EVerifyNo); } //推广员 KFSpreadData pData = GetSpreadData(verifyData.PZoneID, verifyData.PRoleID); if (pData == null) { return((int)ESpreadState.EVerifyCodeWrong); } pData.UpdateLogtime(); if (verifyData.TelCode != telCode) { return((int)ESpreadState.ETelCodeWrong); } if (DateTime.Now.AddSeconds(-TEL_CODE_OUT_TIME) > verifyData.TelTime) { return((int)ESpreadState.ETelCodeOutTime); } //验证成功加数据库 bool result = SpreadPersistence.Instance.DBSpreadRoleAdd( verifyData.PZoneID, verifyData.PRoleID, verifyData.CUserID, verifyData.CZoneID, verifyData.CRoleID, verifyData.Tel, verifyData.IsVip, verifyData.IsLevel); if (!result) { return((int)ESpreadState.Fail); } //推广员 lock (pData) { pData.CountLevel += verifyData.IsLevel; pData.CountVip += verifyData.IsVip; pData.CountRole += 1; if (pData.ServerID > 0) { NotifySpreadData(pData); } } _spreadVerifyDataDic.TryRemove(ckey, out verifyData); return((int)ESpreadState.Success); }
public int TelCodeVerify(int serverID, int czoneID, int croleID, int telCode) { int result; if (!this.IsAgent(serverID)) { result = -5; } else { KFSpreadKey ckey = KFSpreadKey.Get(czoneID, croleID); KFSpreadVerifyData verifyData = null; if (!this._spreadVerifyDataDic.TryGetValue(ckey, out verifyData)) { result = -10; } else { KFSpreadData pData = this.GetSpreadData(verifyData.PZoneID, verifyData.PRoleID); if (pData == null) { result = -14; } else { pData.UpdateLogtime(); if (verifyData.TelCode != telCode) { result = -34; } else if (TimeUtil.NowDateTime().AddSeconds(-90.0) > verifyData.TelTime) { result = -35; } else if (!SpreadPersistence.Instance.DBSpreadRoleAdd(verifyData.PZoneID, verifyData.PRoleID, verifyData.CUserID, verifyData.CZoneID, verifyData.CRoleID, verifyData.Tel, verifyData.IsVip, verifyData.IsLevel)) { result = -1; } else { lock (pData) { pData.CountLevel += verifyData.IsLevel; pData.CountVip += verifyData.IsVip; pData.CountRole++; if (pData.ServerID > 0) { this.NotifySpreadData(pData); } } this._spreadVerifyDataDic.TryRemove(ckey, out verifyData); result = 1; } } } } return(result); }