public override void OnExit(SkillBlackBoard blackBoard) { CLog.Log("TestSkillAction:[OnExit]"); }
private void OnStartBattle(object args) { CLog.Log("开始战斗"); }
protected override void OnEnter(SkillBlackBoard blackBoard) { m_nTimes = skillData.times; CLog.Log("TestSkillAction:[OnEnter]"); }
private void OnCallback(bool succ, NetChannelType channel) { CLog.Log("返回连接服务器结果:" + succ); }
static void itemRun(RunningItem item) { string myguid = AutoRunMgrStatus.CurrentGuid; int sleepTime = 10; if (item.Target.Timers != null && item.Target.Timers.Length > 0) { //如果是定点执行,可以让Thread.Sleep睡眠长一点 sleepTime = 60000; } else { sleepTime = Math.Min(60000, item.Target.Interval / 2); } try { //如果AutoRunMgrStatus.CurrentGuid != myguid,表示新的进程启动了,这里该退出了 while (AutoRunMgrStatus.Status == MgrStatus.Running && AutoRunMgrStatus.CurrentGuid == myguid) { try { bool toRun = false; if (item.Target.Timers != null && item.Target.Timers.Length > 0) { //每天特定时间执行 foreach (double hour in item.Target.Timers) { int h = (int)hour; //过滤出哪个小时 int m = (int)((hour % 1) * 100); //过滤出分钟 //转换成当天的执行时间点 DateTime time = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd " + h + ":" + m + ":00")); if (DateTime.Now >= time && item.LastInvokeTime.GetValueOrDefault() < time) { //log一下,记录哪个自动运行类运行了 using (CLog log = new CLog(item.Target + " 运行 ")) { } toRun = true; break; } } } else { //间隔多少豪秒执行一次 var milliseconds = int.MaxValue; if (item.LastInvokeTime != null) { milliseconds = (int)(DateTime.Now - item.LastInvokeTime.Value).TotalMilliseconds; } if (milliseconds >= item.Target.Interval) { toRun = true; } else { //例如,如果6000执行一次,现在已经过了5000毫秒了,那么再sleep(1000)就可以了 milliseconds = item.Target.Interval - milliseconds; if (milliseconds > 0 && milliseconds < sleepTime) { Thread.Sleep((int)milliseconds); continue; } } } if (toRun) { item.LastInvokeTime = DateTime.Now; item.Target.Run(); } } #if NET46 catch (ThreadAbortException) { //线程被终止,应该是进程被关闭了 return; } #endif catch (Exception ex) { using (CLog log = new CLog(item.Target + " error ")) { log.Log(ex.ToString()); } } Thread.Sleep(sleepTime); } } catch { } }
private void handleNotify() { using (CLog log = new CLog("alipay handleNotify ")) { log.Log(Request.Form.ToJson()); SortedDictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { string out_trade_no = Request.Form["out_trade_no"]; var config = new Config(PayFactory.GetInterfaceXmlConfig(PayInterfaceType.AlipayWebPay, out_trade_no)); Com.Alipay.Notify aliNotify = new Com.Alipay.Notify(config); bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); log.Log("verifyResult:{0}", verifyResult); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //商户订单号 //支付宝交易号 string trade_no = Request.Form["trade_no"]; //交易状态 string trade_status = Request.Form["trade_status"]; log.Log(Request.Form["trade_status"]); PayFactory.OnLog(out_trade_no, Request.Form.ToJson()); if (Request.Form["trade_status"] == "TRADE_FINISHED") { //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的 //如果有做过处理,不执行商户的业务程序 //注意: //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知 } else if (Request.Form["trade_status"] == "TRADE_SUCCESS") { //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的 //如果有做过处理,不执行商户的业务程序 //注意: //付款完成后,支付宝系统发送该交易状态通知 log.Log("OnPaySuccessed"); PayFactory.OnPaySuccessed(out_trade_no, Request.Form.ToJson()); } else { } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— Response.Write("success"); //请不要修改或删除 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { log.Log("fail"); Response.Write("fail"); } } else { log.Log("无通知参数"); Response.Write("无通知参数"); } } }
private void OnCallback(object netObj) { var data = netObj as Proto.Msg_Test_Data; CLog.Log("recv:" + data.msg); }
/// <summary> /// log /// </summary> /// <param name="format"></param> /// <param name="ps"></param> /// <returns></returns> public static Node Log(string format, params object[] ps) { return(DoSucc(() => { CLog.Log(format, ps); return Status.Succ; })); }
private void handleReturn() { using (CLog log = new CLog("alipay handleReturn ")) { log.Log(Request.QueryString.ToString()); SortedDictionary <string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { //Com.Alipay.Notify aliNotify = new Com.Alipay.Notify(); //bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); bool verifyResult = true; if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; string myStatus = ""; log.Log("trade_status:{0}", Request.QueryString["trade_status"]); if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS") { //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 PayFactory.OnPaySuccessed(out_trade_no, Request.Form.ToJson()); myStatus = "SUCCESS"; } else { myStatus = HttpUtility.UrlEncode(Request.QueryString["trade_status"]); } string returnUrl = ReturnUrlConfigs[out_trade_no]; if (returnUrl.IsNullOrEmpty() == false) { log.Log("returnUrl:{0}", returnUrl); if (returnUrl.Contains("?") == false) { returnUrl += "?"; } else { returnUrl += "&"; } returnUrl += "status=" + myStatus + "&tradeID=" + HttpUtility.UrlEncode(out_trade_no) + "&interface=" + this.GetType().Name; //移除跳转地址,防止堆积过多 ReturnUrlConfigs.Remove(out_trade_no); Response.Write("<script>location.href=\"" + returnUrl + "\"</script>"); } } } } }
public TaskStatus Handle(IHttpProxy httpHandler) { try { var xml = httpHandler.ReadRequestBody(); using (CLog log = new CLog("WeiXinNotify Notify", false)) { log.Log("xml:{0}", xml); XDocument xmldoc = XDocument.Parse(xml); SortedDictionary <string, string> xmlDict = new SortedDictionary <string, string>(); var nodes = xmldoc.Root.Elements(); foreach (var element in nodes) { if (element.Name.LocalName != "sign") { xmlDict[element.Name.LocalName] = element.Value; } } var return_code = xmlDict["return_code"]; var result_code = xmlDict["result_code"]; var out_trade_no = xmlDict["out_trade_no"]; PayFactory.OnLog(out_trade_no, LogEventType.ReceiveNotify, xml); var config = new Config(PayFactory.GetInterfaceXmlConfig(PayInterfaceType.WeiXinScanQRCode, out_trade_no)); log.Log("签名校验"); var sign = xmldoc.Root.XPathSelectElement("sign").Value; var computeSign = Helper.GetMd5Hash(xmlDict, config.Key); if (sign != computeSign) { log.Log("正确签名:{0}", computeSign); log.Log("签名校验不通过"); throw new Exception("签名校验不通过"); } if (result_code == "SUCCESS" && return_code == "SUCCESS") { log.Log("excute OnPaySuccessed"); PayFactory.OnPaySuccessed(out_trade_no, null, null, xml); WxPayData data = new WxPayData(); data.SetValue("return_code", "SUCCESS"); data.SetValue("return_msg", "OK"); data.SetValue("appid", config.AppID); data.SetValue("mch_id", config.MchID); data.SetValue("result_code", "SUCCESS"); data.SetValue("err_code_des", "OK"); data.SetValue("sign", data.MakeSign(config)); var writebackXml = data.ToXml(); log.Log("write to weixin:{0}", writebackXml); httpHandler.ResponseWrite(writebackXml); } } } catch (Exception ex) { using (CLog log = new CLog("WeiXin Notify error ")) { log.Log(ex.ToString()); WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", ex.Message); var writebackXml = res.ToXml(); log.Log("write to weixin:{0}", writebackXml); httpHandler.ResponseWrite(writebackXml); } } return(TaskStatus.Completed); }
public override void OnExit() { base.OnExit(); CLog.Log("LoadingView[OnExit]"); }
public override void OnEnter(ViewParam openParam) { base.OnEnter(openParam); CLog.Log("LoadingView[OnEnter]"); }
internal override async Task Initialize() { //await new WaitForEndOfFrame(); CLog.Log("初始化FsmManager完成"); return; }
public static void Debug(string msg) { CLog.Log(msg); }