コード例 #1
0
        public override string AddPrinter(PrintParameter parameter)
        {
            int           stime    = PrintTools.GetTotalSeconds(DateTime.Now);
            StringBuilder postData = new StringBuilder();

            postData.Append("printerContent=" + parameter.SnList);
            postData.Append("&user="******"&stime=" + stime);
            postData.Append("&sig=" + PrintTools.Sha1(USer, UKey, stime + ""));
            postData.Append("&apiname=" + "Open_printerAddlist");
            string result = PrintRequest.RequestMethod(postData.ToString(), Url, Encoding.UTF8);

            return(result);
        }
コード例 #2
0
        public override string QueryOrderInfoByDate(string SN = "", string Date = "")
        {
            StringBuilder postData = new StringBuilder($"sn={SN}");

            postData.Append($"&date={Date}");
            int itime = PrintTools.GetTotalSeconds(DateTime.Now);//时间戳秒数
            //string stime = itime.ToString();
            string sig = PrintTools.Sha1(USer, UKey, itime + "");

            postData.Append($"&user={USer}");
            postData.Append($"&stime={itime + ""}");
            postData.Append($"&sig={sig}" + sig);
            postData.Append("&apiname=Open_queryOrderInfoByDate");
            string result = PrintRequest.RequestMethod(postData.ToString(), Url, Encoding.UTF8);

            return(result);
        }
コード例 #3
0
        public override string QueryPrinterStatus(string SN = "")
        {
            if (string.IsNullOrEmpty(SN))
            {
                return("参数错误");
            }
            StringBuilder postData = new StringBuilder($"sn={SN}");
            int           itime    = PrintTools.GetTotalSeconds(DateTime.Now);//时间戳秒数
            //string stime = itime.ToString();
            string sig = PrintTools.Sha1(USer, UKey, itime + "");

            postData.Append($"&user={USer}");
            postData.Append($"&stime={itime + ""}");
            postData.Append($"&sig={sig}");
            postData.Append("&apiname=Open_queryPrinterStatus");
            string result = PrintRequest.RequestMethod(postData.ToString(), Url, Encoding.UTF8);

            return(result);
        }
コード例 #4
0
        public override string QureyOrderState(string orderID = "")
        {
            if (string.IsNullOrEmpty(orderID))
            {
                return("参数错误");
            }
            string postData = $"orderid={orderID}";
            int    itime    = PrintTools.GetTotalSeconds(DateTime.Now);//时间戳秒数
            string stime    = itime.ToString();
            string sig      = PrintTools.Sha1(USer, UKey, stime);

            postData += ("&user="******"&stime=" + stime);
            postData += ("&sig=" + sig);
            postData += ("&apiname=" + "Open_queryOrderState");
            string result = PrintRequest.RequestMethod(postData.ToString(), Url, Encoding.UTF8);

            return(result);
        }
コード例 #5
0
        public override string PrinterRequest(PrintParameter parameter, Data.Printer printer)
        {
            string        orderinfo = GetRequsetContent(parameter, printer.PrintWay);
            string        order     = Uri.UnescapeDataString(orderinfo.ToString());
            StringBuilder postData  = new StringBuilder("sn=" + parameter.SN);

            postData.Append($"&content={order}");
            postData.Append($"&times={(string.IsNullOrEmpty(parameter.Times) || !int.TryParse(parameter.Times, out int times) ? 1 + "" : parameter.Times)}");
            // int itime = DateTimeToStamp(System.DateTime.Now);//时间戳秒数
            int    stime = PrintTools.GetTotalSeconds(DateTime.Now);
            string sig   = PrintTools.Sha1(USer, UKey, stime + "");

            postData.Append("&user="******"&stime=" + stime);
            postData.Append("&sig=" + sig);
            postData.Append("&apiname=Open_printMsg");
            string result = PrintRequest.RequestMethod(postData.ToString(), Url, Encoding.UTF8);

            return(result);
        }