You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using POSV.HttpApi;
|
|
|
|
|
using POSV.Utils;
|
|
|
|
|
|
|
|
|
|
namespace POSV.Proxy.Base
|
|
|
|
|
{
|
|
|
|
|
public class ProxyBase
|
|
|
|
|
{
|
|
|
|
|
public ProxyBase()
|
|
|
|
|
{
|
|
|
|
|
LOGGET = NLog.LogManager.GetLogger(GetType().FullName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected static NLog.Logger LOGGET = null;
|
|
|
|
|
|
|
|
|
|
protected string PaserErrors(string response)
|
|
|
|
|
{
|
|
|
|
|
string result = string.Empty;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
LOGGET.Error(response);
|
|
|
|
|
|
|
|
|
|
Dictionary<string, string> _errorDesc = new Dictionary<string, string>();
|
|
|
|
|
Errors mainError = JsonUtils.Deserialize<Errors>(response);
|
|
|
|
|
if (_errorDesc.ContainsKey(mainError.Code))
|
|
|
|
|
{
|
|
|
|
|
result = _errorDesc[mainError.Code];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = mainError.Message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SubErrors> subError = mainError.SubErrors;
|
|
|
|
|
if (subError != null && subError.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
SubErrors error = subError[0];
|
|
|
|
|
if (_errorDesc.ContainsKey(error.Code))
|
|
|
|
|
{
|
|
|
|
|
result = _errorDesc[error.Code];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = error.Message;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LOGGET.Error(ex, "非法的错误信息格式");
|
|
|
|
|
|
|
|
|
|
// result = _errorDesc["9999"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|