一:导入Excel数据
[ Area ( "Pumch" ) ]
public class UserController : BaseController
{
protected IUserService m_UserService= IocProxyFactory. GetService < IUserService > ( ) ;
public JsonResult Import ( )
{
var jObject = ParseRawData ( ) . GetAwaiter ( ) . GetResult ( ) ;
var commandName = jObject[ "Command" ] . ToString ( ) ;
var path = Convert. ToString ( jObject[ "Data" ] [ "SitePath" ] ) ;
if ( string . IsNullOrEmpty ( path) )
{
throw new ArgumentException ( "请上传Excel路径SitePath" ) ;
}
return Json ( Exec ( "User" , jObject) ) ;
}
IDictionary< string , IDictionary< string , AuthMethod> > m_MethodDic = null ;
protected override AuthMethod GetMethod ( string actionName, string commandName)
{
if ( m_MethodDic == null )
{
m_MethodDic = new Dictionary < string , IDictionary< string , AuthMethod> > ( )
{
{
"User" , new Dictionary < string , AuthMethod > ( ) {
{
"Import" , new AuthMethod ( ) {
Method= m_UserService. Import} }
} }
} ;
}
m_MethodCommandDic = m_MethodDic;
return base . GetMethod ( actionName, commandName) ;
}
}
public Result Import ( JObject jObject)
{
var path = AppDomain. CurrentDomain. BaseDirectory + "wwwroot" + Convert. ToStrin