Beispiel #1
0
        //发送消息
        public static bool succNotice(domain.Bill bill)
        {
            string     posData    = bill.ToString();
            HttpResult httpResult = postData(Constants.serverUrl + "/payIntf/terminal/receiveNoticeMsg", posData);
            string     jsonStr    = subResultHtml(httpResult.Html);

            Console.WriteLine(jsonStr);
            ServiceDataResult result = JSON.parse <ServiceDataResult>(jsonStr);

            if (result.code == "0")
            {
                BusWebFormE.log("发送消息成功: " + JSON.stringify(bill));
                //更新最后一条流水号
                BusWebFormE.serial = result.data;
                return(true);
            }
            else
            {
                lastError = result.msg;
                return(false);
            }

            //测试
            //Console.WriteLine("发送消息成功: " + JSON.stringify(bill));
            //BusWebFormE.serial = bill.Serial;
            //return true;
        }
Beispiel #2
0
        /**
         * 解析数据节点
         * */
        private void getNodeInfo(HtmlAgilityPack.HtmlNode node)
        {
            int index = 0;
            //时间节点
            var timeNode    = node.ChildNodes[index++];
            var timeContent = timeNode.InnerText;
            var timeStr     = timeContent.Substring(timeContent.IndexOf("201"));
            //log("时间:" + timeStr);
            //流水号节点
            var serialNode = node.ChildNodes[index++];
            var outContent = serialNode.OuterHtml;
            //坑爹玩意 有的流水号不是32位
            string result = outContent.Substring(outContent.IndexOf("title") + 7, 32);

            result = System.Text.RegularExpressions.Regex.Replace(result, @"[^0-9]+", "");
            var serialStr = result;
            //log("流水号:" + serialStr);
            //商户订单号节点
            var orderNode    = node.ChildNodes[index++];
            var orderContent = orderNode.OuterHtml;
            var orderStr     = "--";

            if (!orderNode.InnerText.Equals("--"))
            {
                orderStr = orderContent.Substring(orderContent.IndexOf("title") + 7, 23);
            }
            //log("商户订单号:" + orderStr);

            //对方信息节点
            var customerInfoNode = node.ChildNodes[index++];
            var customerInfoStr  = customerInfoNode.InnerText;
            //log("对方信息:" + customerInfoStr);
            //账务类型节点
            var typeNode = node.ChildNodes[index++];
            var typeStr  = typeNode.InnerText;
            //log("账务类型:" + typeStr);
            //收支金额节点
            var amountNode = node.ChildNodes[index++];
            var amountStr  = amountNode.InnerText;
            //log("收支金额:" + amountStr);
            //账户余额节点
            var balanceNode = node.ChildNodes[index++];
            var balanceStr  = balanceNode.InnerText;

            //log("账户余额:" + balanceStr);
            //操作节点

            domain.Bill bill = new domain.Bill()
            {
                Time              = timeStr,
                Serial            = serialStr,
                Order             = orderStr,
                CustomerInfo      = customerInfoStr,
                Type              = typeStr,
                AmountNode        = amountStr,
                BalanceNode       = balanceStr,
                CollectionAccount = collectionAccount
            };
            billDatas.Add(bill);
            var rs = JSON.stringify(bill);
            //log("......................" + rs);
        }