Ejemplo n.º 1
0
        public HttpResponseMessage ordercallback()
        {
            var callback      = OnReadPostData();
            var xe            = XElement.Parse(callback);
            var cash_feev     = xe.Element("cash_fee");
            var out_trade_nov = xe.Element("out_trade_no");
            var total_feev    = xe.Element("total_fee");
            var trade_typev   = xe.Element("trade_type");
            var signv         = xe.Element("sign");

            if (cash_feev != null && out_trade_nov != null && total_feev != null && trade_typev != null && signv != null)
            {
                var out_trade_no = out_trade_nov.Value;
                var cash_fee     = cash_feev.Value;
                var total_fee    = total_feev.Value;
                var trade_type   = trade_typev.Value;
                if (cash_fee == total_fee)
                {
                    //var res = DoOrderPayed(out_trade_no, typeParser.intParse(cash_fee), trade_type, callback);

                    {
                        AOutput.LogError("order " + out_trade_no + " update failed\r\n" + callback);
                    }
                }
                else
                {
                    AOutput.LogError("order " + out_trade_no + " fee not equal!\r\n" + callback);
                }
            }
            var res = (@"<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg><sign><![CDATA[" + signv.Value + "]]></sign></xml>");

            return(ResultToJson.ToNormalResponse(res));
        }
Ejemplo n.º 2
0
        private HttpResponseMessage Handle(string postString)
        {
            var xmldoc = new XmlDocument();

            xmldoc.LoadXml(postString);
            XmlNode ToUserName   = xmldoc.SelectSingleNode("/xml/ToUserName");
            XmlNode FromUserName = xmldoc.SelectSingleNode("/xml/FromUserName");
            XmlNode MsgType      = xmldoc.SelectSingleNode("/xml/MsgType");

            var tousername = ToUserName.InnerText;
            var fromOpenID = FromUserName.InnerText;

            if (MsgType.InnerText == "event")
            {
                XmlNode Event  = xmldoc.SelectSingleNode("/xml/Event");
                var     sEvent = Event.InnerText;
                if (sEvent.Equals("subscribe"))
                {
                    return(ResultToJson.ToNormalResponse(FormatResult(fromOpenID, tousername, "欢迎光临,您是来捐款的吗?可以现金,可以刷卡,可以小额贷款,接受器官捐献。")));
                }
                return(ResultToJson.ToNormalResponse($"未处理的事件类型:{sEvent}"));
            }

            XmlNode Content = xmldoc.SelectSingleNode("/xml/Content");
            var     req     = Content.InnerText;
            var     result  = req.ToLower().Trim();

            switch (result)
            {
            case "cfkj":
            case "乘法口诀":
                return(ResultToJson.ToNormalResponse(FormatResult(fromOpenID, tousername, $"{ApiRandom.Instance.Next(1, 10)}×{ApiRandom.Instance.Next(1, 10)}=")));

            default:
                return(ResultToJson.ToNormalResponse(FormatResult(fromOpenID, tousername, result)));
            }
        }
Ejemplo n.º 3
0
        public HttpResponseMessage Pay(string orderid)
        {
            var res = APIWechatPay.Pay(1, orderid, "desc", "127.0.0.1", "APP");

            return(ResultToJson.ToNormalResponse(res));
        }
Ejemplo n.º 4
0
 public HttpResponseMessage Count()
 {
     return(ResultToJson.ToNormalResponse(ARoomManager.Instance.Count.ToString()));
 }