public void BetRadarStart() { CacheTool.MatchAdd(MatchId); DataSave.UpdateMatchReplayStatus(MatchId, 6); DataSave.UpdateMatcScore(MatchId, "0:0"); //DataSave.DeleteAndBackupOdds(MatchId); DataSave.UpdateOddsStatus(MatchId, 4); if (Scout.Length > 0) { Log.Info($"賽事編號:{MatchId} 開始傳送走地資料"); PushScoutToMq(0); } else { Log.Info($"賽事編號:{MatchId} 沒有走地資料"); } if (Odds.Length > 0) { Log.Info($"賽事編號:{MatchId} 開始傳送賠率資料"); PushOddstToSportServer(0); } else { Log.Info($"賽事編號:{MatchId} 沒有賠率資料"); } }
private void PushProcess(int oIndex, int sIndex) { try { if (oIndex + 1 > Odds.Length) { Log.Info($"賽事編號:{MatchId} 第{sIndex + 1}次走地資料送完"); Log.Info($"賽事編號:{MatchId},第{oIndex + 1}次賠率資料送完"); DataSave.SwitchOddsActive(MatchId); //賠率送完即結算 DataSave.DoSettle(MatchId, 1); //全場 DataSave.DoSettle(MatchId, 2); //半場 CacheTool.MatchRemove(MatchId); return; } if (sIndex == 0 || oIndex == modIndex || (oIndex - modIndex) % avgIndex == 0) { PushScoutToMq(sIndex); } PushOddstToSportServer(oIndex); } catch (Exception ex) { Log.Info($"賽事編號:{MatchId},第{oIndex + 1}次oIndex失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}"); } }
protected override void Start() { base.Start(); galleryMap = new Dictionary <string, int>(); string iGameLevel = CacheTool.Get("iGameLevel"); for (int i = 0; i < btnGalleryLevel.GetLength(0); ++i) { if (i < int.Parse(iGameLevel)) { btnGalleryLevel[i].GetComponent <Image>().sprite = gallerySpriteCfg[i].unlockedSprite; btnGalleryLevel[i].GetComponent <Button>().enabled = true; btnGalleryLevel[i].GetComponent <Button>().onClick.AddListener(delegate() { OnClickGalleryBtn(); }); galleryMap.Add(btnGalleryLevel[i].name, i); } else { btnGalleryLevel[i].GetComponent <Image>().sprite = gallerySpriteCfg[i].lockedSprite; btnGalleryLevel[i].GetComponent <Button>().enabled = false; } } btnCloseMaximumSpritePanel.onClick.AddListener(OnClickCloseMaximumSpritePanel); }
/// <summary> /// Riskman /// </summary> public void RiskmanStart() { CacheTool.MatchAdd(MatchId); DataSave.UpdateMatchReplayStatus(MatchId, 6); DataSave.UpdateMatcScore(MatchId, "0:0"); DataSave.DeleteAndBackupOdds(MatchId); //DataSave.UpdateOddsStatus(MatchId, 4); if (Scout.Length > 0) { Log.Info($"賽事編號:{MatchId} 開始傳送走地資料"); PushScoutToMq(0); } else { Log.Info($"賽事編號:{MatchId} 沒有走地資料"); } if (RiskOddsDataList.Count > 0) { Log.Info($"賽事編號:{MatchId} 開始傳送賠率資料"); PushOddsToRiskMan(0); } else { Log.Info($"賽事編號:{MatchId} 沒有賠率資料"); } }
private void PushProcessByScout(int ssIndex, int ooIndex) { try { if (ssIndex + 1 > Scout.Length) { Log.Info($"賽事編號:{MatchId} 第{ssIndex + 1}次走地資料送完"); Log.Info($"賽事編號:{MatchId},第{ooIndex + 1}次賠率資料送完"); //賠率送完即結算 DataSave.DoSettle(MatchId, 1); //全場 DataSave.DoSettle(MatchId, 2); //半場 CacheTool.MatchRemove(MatchId); return; } if (ooIndex == 0 || ssIndex == modIndex || (ssIndex - modIndex) % avgIndex == 0) { PushOddsToRiskMan(ooIndex); } PushScoutToMq(ssIndex); } catch (Exception ex) { Log.Info($"賽事編號:{MatchId},第{ssIndex + 1}次ssIndex失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}"); } }
public void RiskmanStart() { CacheTool.MatchAdd(MatchId); DataSave.UpdateMatchReplayStatus(MatchId, 6); DataSave.UpdateMatcScore(MatchId, "0:0"); DataSave.DeleteAndBackupOdds(MatchId); Log.Info($"賽事編號:{MatchId} 開始傳送走地資料"); Log.Info($"賽事編號:{MatchId} 開始傳送賠率資料"); if (flag == 1) { for (int i = 0, j = 0; i <= RiskOddsDataList.Count; i++) { PushProcessByOdds(i, j); if (j == 0 || i == modIndex || (i - modIndex) % avgIndex == 0) { j = j + 1; } Thread.Sleep(avgTimeForOdds); } } else { for (int i = 0, j = 0; i <= Scout.Length; i++) { PushProcessByScout(i, j); if (j == 0 || i == modIndex || (i - modIndex) % avgIndex == 0) { j = j + 1; } Thread.Sleep(avgTimeForOdds); } } }
public ActionResult CustomRun(int customTime, string matchIdList) { ResponesJson jsonResp = new ResponesJson(); try { var matches = InitMatchList(); //指定賽事資料 string[] matchArray = matchIdList.Split(','); List <long> checklist = new List <long>(); foreach (var id in matchArray) { checklist.Add(long.Parse(id)); } //checklist.Add(13854605); //checklist.Add(13649001); List <long> mlist = new List <long>(); foreach (var matchid in checklist) { if (matches.Contains(matchid)) { mlist.Add(matchid); } } if (mlist.Count == 0) { Log.Info($"無賽事走地與賠率資料"); jsonResp.Success = false; jsonResp.ResultData = "無賽事走地與賠率資料"; return(Content(JsonConvert.SerializeObject(jsonResp))); } Nami.Delay(1).Seconds().Do(() => { foreach (var matchid in mlist) { if (!CacheTool.ThreadExist(matchid) && CacheTool.MatchList.Count < 5) { Log.Info($"即將重播 {matchid} 場的賽事走地與賠率資料"); new MatchV1(matchid, customTime).BetRadarStart(); } } }); jsonResp.Success = true; jsonResp.ResultData = RefreshList(); } catch (Exception ex) { jsonResp.ResultData = ex.Message; jsonResp.Success = false; } return(Content(JsonConvert.SerializeObject(jsonResp))); }
public static IEnumerator HttpPost(string url, WWWForm postData) { Debug.Log("enter HttpPost"); var request = UnityWebRequest.Post(url, postData); yield return(request.SendWebRequest()); if (request.isHttpError || request.isNetworkError) { Debug.Log(request.error); } else { ResponseData responseData = JsonUtility.FromJson <ResponseData>(request.downloadHandler.text); Debug.Log(request.downloadHandler.text); switch (responseData.iMessageID) { case (int)Message.MSG_ID.MSG_ID_LOGIN: Message.User user = new Message.User(); Debug.Log(responseData.data); user = JsonUtility.FromJson <Message.User>(responseData.data); CacheTool.Set("uid", user.uid); CacheTool.Set("iGameLevel", user.iGameLevel.ToString()); Debug.Log("now insert userinfo, uid:" + user.uid + "iGameLevel:" + user.iGameLevel); EventComponent.PostEvent(EVENTTYPE.Login, EVENTID.LoginSuccess); break; default: break; } } }
protected override void Start() { base.Start(); buttonMap = new Dictionary <string, int>(); string iGameLevel = CacheTool.Get("iGameLevel"); Debug.Log(iGameLevel); for (int i = 0; i < btnPlayLevel.GetLength(0); ++i) { if (i <= int.Parse(iGameLevel)) { btnPlayLevel[i].GetComponent <Image>().sprite = levelConfig[i].unlockedSprite; btnPlayLevel[i].GetComponent <Button>().enabled = true; btnPlayLevel[i].GetComponent <Button>().onClick.AddListener(delegate() { OnClickPlayLevel(); }); buttonMap.Add(btnPlayLevel[i].name, i); } else { btnPlayLevel[i].GetComponent <Image>().sprite = levelConfig[i].lockedSprite; btnPlayLevel[i].GetComponent <Button>().enabled = false; } } }
public ThreadWork(JobParam jParam) { if (CacheTool.MatchList.Count <= 5) { Log.Info($"即將重播 {jParam.MatchID} 場的賽事走地與賠率資料"); new Match(jParam.MatchID, jParam.Time).BetRadarStart(); CacheTool.MatchAdd(jParam.MatchID); } }
public static void SetBaseConfig(BaseConfig_DT model, int DT_id = 0) { CacheTool.Permanent("BaseConfig_DT" + DT_id, model); //if (Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang")) //{ // model.Plugin_gongyingshang = true; // CacheTool.Permanent("BaseConfig", model); //} }
/// <summary> /// 设置主站点 /// </summary> public static void SetMainSite() { Lebi_Site model = B_Lebi_Site.GetModel("1=1 order by Sort desc"); if (model == null) { model = new Lebi_Site(); } CacheTool.Permanent("MainSite", model); }
/// <summary> /// 当前授权 /// </summary> /// <returns></returns> public static List <UserService> GetLicense() { string cacheKey = "CurrentLicense"; List <UserService> models = CacheTool.Get(cacheKey) as List <UserService>; if (models == null) { SetLicense(); return(GetLicense()); } return(models); }
/// <summary> /// 语言标签缓存 /// </summary> /// <returns></returns> public static List <Lebi_Language_Tag> GetLanguageTag() { string cacheKey = "LanguageTag"; List <Lebi_Language_Tag> models = CacheTool.Get(cacheKey) as List <Lebi_Language_Tag>; if (models == null) { SetLanguageTag(); return(GetLanguageTag()); } return(models); }
public static Lebi_Site GetMainSite() { string cacheKey = "MainSite"; Lebi_Site model = CacheTool.Get(cacheKey) as Lebi_Site; if (model == null) { SetMainSite(); return(GetMainSite()); } return(model); }
/// <summary> /// 当前所有活动缓存 /// </summary> /// <returns></returns> public static List <Lebi_Promotion_Type> GetCurrentPromotionType() { string cacheKey = "CurrentPromotion"; List <Lebi_Promotion_Type> models = CacheTool.Get(cacheKey) as List <Lebi_Promotion_Type>; if (models == null) { SetCurrentPromotionType(); return(GetCurrentPromotionType()); } return(models); }
/// <summary> /// 页面设置缓存 /// </summary> /// <returns></returns> public static List <Lebi_Theme_Page> GetThemePage() { string cacheKey = "ThemePage"; List <Lebi_Theme_Page> models = CacheTool.Get(cacheKey) as List <Lebi_Theme_Page>; if (models == null) { SetThemePage(); return(GetThemePage()); } return(models); }
private void PushOddstToSportServer(int index) { try { if (index + 1 > Odds.Length) { Log.Info($"賽事編號:{MatchId},第{index + 1}次賠率資料送完"); DataSave.SwitchOddsActive(MatchId); CacheTool.MatchRemove(MatchId); return; } Odds[index].Status = 1; var ot = new OperationRequest { OperationCode = (int)OperationCode.MainService, ActionCode = (int)MainServiceActionCode.BroadcastOdds, Parameters = new Dictionary <byte, object> { { 1, Odds[index] } } }; var lodData = JsonConvert.SerializeObject(Odds[index]); Log.Info($"賽事編號:{MatchId},第{index + 1}次發送賠率資料:{lodData}"); var pevMsgNr = (index == 0) ? 0 : Odds[index - 1].MsgNr; if (Odds[index].MsgNr > pevMsgNr || pevMsgNr == 0) { DataSave.SwitchOddsActive(Odds[index].MatchId, /*Odds[index].OddsId,*/ Odds[index].MsgNr); DataSave.UpdateMatchCurrentPeriodStart(Odds[index].MatchId); } int timer = 0; if (index <= Odds.Length - 1) { timer = avgTimeForOdds; } else { timer = modTimeForOdds; } Nami.Delay(timer).Do(() => { PushOddstToSportServer(index + 1); }); } catch (Exception ex) { var lodData = JsonConvert.SerializeObject(Odds[index]); Log.Info($"賽事編號:{MatchId},第{index + 1}次失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}"); } }
public static string GetDomainStatus() { //return Shop.LebiAPI.Service.Instanse.CheckDomain(); string cacheKey = "DomainStatus"; string model = CacheTool.Get(cacheKey) as string; if (model == null) { //SetDomainStatus(); //return GetDomainStatus(); return("1"); } return(model); }
/// <summary> /// 基本设置信息 /// </summary> /// <returns></returns> public static BaseConfig GetBaseConfig() { string cacheKey = "BaseConfig"; BaseConfig model = CacheTool.Get(cacheKey) as BaseConfig; if (model == null) { B_BaseConfig bmodel = new B_BaseConfig(); model = bmodel.LoadConfig(); model.IsMutiSite = false; SetBaseConfig(model); } return(model); }
/// <summary> /// 商品分类缓存 /// </summary> /// <returns></returns> public static List <Lebi_Pro_Type> GetProductType() { //List<Lebi_Pro_Type> models = B_Lebi_Pro_Type.GetList("", "Sort desc"); //return models; string cacheKey = "ProductType"; List <Lebi_Pro_Type> models = CacheTool.Get(cacheKey) as List <Lebi_Pro_Type>; if (models == null) { SetProductType(); return(GetProductType()); } return(models); }
public static BaseConfig_DT GetBaseConfig_DT(int DT_id) { string cacheKey = "BaseConfig_DT" + DT_id; BaseConfig_DT model = CacheTool.Get(cacheKey) as BaseConfig_DT; if (model == null) { B_BaseConfig_DT bmodel = new B_BaseConfig_DT(); model = bmodel.LoadConfig(DT_id); model.IsMutiSite = false; SetBaseConfig(model, DT_id); } return(model); }
public static BaseConfig_Supplier GetBaseConfig_Supplier(int Supplier_id) { string cacheKey = "BaseConfig" + Supplier_id; BaseConfig_Supplier model = CacheTool.Get(cacheKey) as BaseConfig_Supplier; if (model == null) { B_BaseConfig_Supplier bmodel = new B_BaseConfig_Supplier(); model = bmodel.LoadConfig(Supplier_id); model.IsMutiSite = false; SetBaseConfig(model, Supplier_id); } return(model); }
public void BetRadarStart() { CacheTool.MatchAdd(MatchId); DataSave.UpdateMatchReplayStatus(MatchId, 6); DataSave.UpdateMatcScore(MatchId, "0:0"); DataSave.UpdateOddsStatus(MatchId, 4); Log.Info($"賽事編號:{MatchId} 開始傳送走地資料"); Log.Info($"賽事編號:{MatchId} 開始傳送賠率資料"); int j = 0; for (int i = 0; i <= Odds.Length; i++) { PushProcess(i, j); if (j == 0 || i == modIndex || (i - modIndex) % avgIndex == 0) { j = j + 1; } Thread.Sleep(avgTimeForOdds); } }
private void PushOddsToRiskMan(int index) { try { if (index + 1 > RiskOddsDataList.Count) { Log.Info($"賽事編號:{MatchId},第{index + 1}次賠率資料送完"); //賠率送完即結算 DataSave.DoSettle(MatchId, 1); //全場 DataSave.DoSettle(MatchId, 2); //半場 //DataSave.SwitchOddsActive(MatchId); CacheTool.MatchRemove(MatchId); return; } var message = $"賽事編號:{MatchId},第{index + 1}次賠率資料傳送"; SendRisk.DoOddsBatch(message, JsonConvert.SerializeObject(RiskOddsDataList[index])); Log.Info(message + $", Data => {JsonConvert.SerializeObject(RiskOddsDataList[index])}"); int timer = 0; if (index <= RiskOddsDataList.Count - 1) { timer = avgTimeForOddsRisk; } else { timer = modTimeForOddsRisk; } Nami.Delay(timer).Do(() => { PushOddsToRiskMan(index + 1); }); } catch (Exception ex) { var lodData = JsonConvert.SerializeObject(Odds[index]); Log.Info($"賽事編號:{MatchId},第{index + 1}次失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}"); } }
public ActionResult RadomRun(int randomTime, int randomCnt) { ResponesJson jsonResp = new ResponesJson(); try { List <long> mlist = new List <long>(); var matches = InitMatchList(); Random rand = new Random(Guid.NewGuid().GetHashCode()); List <int> listLinq = new List <int>(Enumerable.Range(0, matches.Count() - 1)); listLinq = listLinq.OrderBy(num => rand.Next()).ToList <int>(); for (int i = 0; i < randomCnt; i++) { mlist.Add(matches[listLinq[i]]); } Nami.Delay(1).Seconds().Do(() => { foreach (var matchid in mlist) { if (!CacheTool.ThreadExist(matchid) && CacheTool.MatchList.Count < 5) { Log.Info($"即將重播 {matchid} 場的賽事走地與賠率資料"); new Match(matchid, randomTime).BetRadarStart(); } } }); jsonResp.Success = true; jsonResp.ResultData = RefreshList(); } catch (Exception ex) { jsonResp.ResultData = ex.Message; jsonResp.Success = false; } return(Content(JsonConvert.SerializeObject(jsonResp))); }
private void PushOddsToIntegration(int index) { try { if (index + 1 > OddsDt.Rows.Count) { Log.Info($"賽事編號:{MatchId},第{index + 1}次賠率資料送完"); CacheTool.MatchRemove(MatchId); return; } var lodData = OddsDt.Rows[index]["JsonData"].ToString(); ToMq("odds", "odds.replaylive", EntityTool.Serialize(lodData)); Log.Info($"賽事編號:{MatchId},第{index + 1}次發送賠率資料:{lodData}"); int timer = 0; if (index <= Odds.Length - 1) { timer = avgTimeForOdds; } else { timer = modTimeForOdds; } Nami.Delay(timer).Do(() => { PushOddstToSportServer(index + 1); }); } catch (Exception ex) { var lodData = JsonConvert.SerializeObject(Odds[index]); Log.Info($"賽事編號:{MatchId},第{index + 1}次失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}"); } }
/// <summary> /// 设置域名状态 /// 1正常0禁用 /// </summary> public static void SetDomainStatus() { CacheTool.Permanent("DomainStatus", Shop.LebiAPI.Service.Instanse.CheckDomain()); }
public static void SetLicense(List <UserService> models) { CacheTool.Permanent("CurrentLicense", models); }
/// <summary> /// 设置当前所有活动缓存 /// </summary> public static void SetCurrentPromotionType() { List <Lebi_Promotion_Type> models = B_Lebi_Promotion_Type.GetList("Type_id_PromotionStatus=241", ""); CacheTool.Permanent("CurrentPromotion", models); }