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.
145 lines
4.6 KiB
C#
145 lines
4.6 KiB
C#
using DSWeb.Areas.CommMng.DAL;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using HcUtility.Comm;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.Entity.Core.Metadata.Edm;
|
|
using System.Diagnostics.Contracts;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
namespace DSWeb.Areas.CommMng.Controllers
|
|
{
|
|
public class PublicInterfaceController
|
|
{
|
|
|
|
|
|
[HttpPost]
|
|
public InterfaceResult PostInterface(InterfaceParam param) {
|
|
try {
|
|
Assembly assembly = Assembly.Load("DSWeb.Areas.CommMng.Controllers");
|
|
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
var _param = new object[]{ param};
|
|
InterfaceResult result = (InterfaceResult)doset.Invoke(obj,BindingFlags.Instance|BindingFlags.NonPublic,null, _param, null);
|
|
return result;
|
|
} catch (Exception e) {
|
|
var _r = new InterfaceResult();
|
|
_r.errCode = "1";
|
|
|
|
var msg = e.Message;
|
|
if (e.InnerException != null && e.InnerException.Message != null) {
|
|
msg += "//InnerException.Message:" + e.InnerException.Message;
|
|
}
|
|
var _rs= BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
|
|
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
|
|
return _r;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 诺诺开票回调 未完成
|
|
/// </summary>
|
|
/// <param name="param"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public InterfaceResult NNCallBack(InterfaceParam param)
|
|
{
|
|
try
|
|
{
|
|
Assembly assembly = Assembly.Load("DSWeb.Areas.Account.Controllers");
|
|
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
var _param = new object[] { param };
|
|
InterfaceResult result = (InterfaceResult)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null);
|
|
return result;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
var _r = new InterfaceResult();
|
|
_r.errCode = "1";
|
|
|
|
var msg = e.Message;
|
|
if (e.InnerException != null && e.InnerException.Message != null)
|
|
{
|
|
msg += "//InnerException.Message:" + e.InnerException.Message;
|
|
}
|
|
var _rs = BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
|
|
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
|
|
return _r;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class InterfaceResult {
|
|
public string errCode { get; set; }
|
|
public string errMsg { get; set; }
|
|
|
|
public InterfaceResult() { }
|
|
|
|
public InterfaceResult(DBResult dbresult) {
|
|
if (dbresult.Success)
|
|
{
|
|
errCode = "0";
|
|
}
|
|
else
|
|
{
|
|
errCode = "1";
|
|
}
|
|
|
|
errMsg = dbresult.Message + ";Data:" + JsonConvert.Serialize(dbresult.Data);
|
|
}
|
|
}
|
|
|
|
public class InterfaceParam {
|
|
public string PORTNAME { get; set; }
|
|
public string GID { get; set; }
|
|
|
|
public string Param { get; set; }
|
|
}
|
|
|
|
public class InterfaceBase
|
|
{
|
|
public InterfaceBase() { }
|
|
|
|
public InterfaceResult DoSet(InterfaceParam param) {
|
|
return new InterfaceResult();
|
|
}
|
|
|
|
public class csCust: InterfaceBase
|
|
{
|
|
public InterfaceResult DoSet(InterfaceParam param)
|
|
{
|
|
return new InterfaceResult();
|
|
}
|
|
}
|
|
}
|
|
|
|
public class NNCallBackInfo {
|
|
public string operater { get; set; }
|
|
public string billNo { get; set; }
|
|
public NNContent content { get; set; }
|
|
}
|
|
|
|
public class NNContent {
|
|
|
|
|
|
List<NNDetail> details { get; set; }
|
|
}
|
|
|
|
public class NNDetail
|
|
{
|
|
|
|
}
|
|
} |