Community Server专题八:MemberRole之Membership深入篇

本文详细探讨了ASP.NET Membership的工作原理,重点分析了SqlMembershipProvider类的实现细节,包括MembershipUser类的功能、创建用户的过程及数据库交互机制。
专题八的上篇大致讨论了MemberRole中的Membership实现,对于运用Membership进行web开发足够,但是对于想更深入了解Membership实现机理的朋友那是远远不够的,这个专题我们更深入一下了解Membership。
其实MemberRole是一个非常好的资源包,借住Reflector这个优秀的工具,你可以对其进行代码分析。它无论是在组建的构架、代码的设计、数据库表的建立、存储过程的使用等都是非常优秀的,你是程序员也好构架师也罢,其中可以学习的真的很多很多,我在整个分析的过程中也深深受益。
由于MemberRole中的Membership只实现了对SQL Server的操Provider类,即SqlMembershipProvider类。因此我们从SqlMembershipProvider开始分析。Provider模型在上篇已经做过介绍,SqlMembershipProvider类继承了MembershipProvider,并实现其所有的抽象方法。在分析之前先看两个类:MembershipUser与MembershipUserCollection。
MembershipUser,先看看代码:(代码中省略的具体实现,只有方法与属性名称)
Membership创建的User,该类中有这个User的一些基本状态,如该User的UserName、Email等,还有一些方法,如ChangePassword()、ResetPassword()等(如果你是初学者,还在为建立一个对象需要什么属性,包含什么方法发愁,那这就是你应该好好学的,这也是OOP最基本的要求)。
public class MembershipUser
{
      
// Methods
      protected MembershipUser();
      
public MembershipUser(MembershipProvider provider, string name, object providerUserKey, string email, string passwordQuestion, string comment, bool isApproved, bool isLockedOut, DateTime creationDate, DateTime lastLoginDate, DateTime lastActivityDate, DateTime lastPasswordChangedDate, DateTime lastLockoutDate);
      
public virtual bool ChangePassword(string oldPassword, string newPassword);
      
public virtual bool ChangePasswordQuestionAndAnswer(string password, string newPasswordQuestion, string newPasswordAnswer);
      
public virtual string GetPassword();
      
public virtual string GetPassword(string passwordAnswer);
      
public virtual string ResetPassword();
      
public virtual string ResetPassword(string passwordAnswer);
      
public override string ToString();
      
public virtual bool UnlockUser();
      
internal virtual void Update();
      
private void UpdateSelf();
      
// Properties
      public virtual string Comment getset; }
      
public virtual DateTime CreationDate get; }
      
public virtual string Email getset; }
      
public virtual bool IsApproved getset; }
      
public virtual bool IsLockedOut get; }
      
public bool IsOnline get; }
      
public virtual DateTime LastActivityDate getset; }
      
public virtual DateTime LastLockoutDate get; }
      
public virtual DateTime LastLoginDate getset; }
      
public virtual DateTime LastPasswordChangedDate get; }
      
public virtual string PasswordQuestion get; }
      
public virtual MembershipProvider Provider get; }
      
public virtual object ProviderUserKey get; }
      
public virtual string UserName get; }
      
// Fields
      private string _Comment;
      
private DateTime _CreationDate;
      
private string _Email;
      
private bool _IsApproved;
      
private bool _IsLockedOut;
      
private DateTime _LastActivityDate;
      
private DateTime _LastLockoutDate;
      
private DateTime _LastLoginDate;
      
private DateTime _LastPasswordChangedDate;
      
private string _PasswordQuestion;
      
private MembershipProvider _Provider;
      
private object _ProviderUserKey;
      
private string _UserName;
}

这是一个实体类,表示一个由
MembershipUserCollection,这是一个MembershipUser类的容器,用来存放MembershipUser列表,记得上次广州.net俱乐部聚会时,我的演讲中有朋友在提出CS是否使用自定义类来存储用户列表,其实在这里可以看到CS中使用的就是自定义的类而不是DataSet(我想在asp.net 2.0正式发布后这也不会改变),这样做主要是因为考虑到性能与灵活性。
好了,回到SqlMembershipProvider类上来,我们具体分析一个有代表性质的方法:
MembershipUser对象,如果建立失败MembershipUser对象为null(其实我早期做过一些项目的时候喜欢在建立对象成功后返回一个ID)。可以看到在这个方法中有很多的if语句,它们是为了检验数据是否合法,这是必须的吗?其实不是,但对于构建一个强壮的底层代码这是必须的,不然一点点的错误都有可能导致系统的瘫痪。其实做项目与做开发有的时候不太一样,企业的有些项目开发很多时候只要能实现功能就可以了,而且开发过程也集中在一些现有的代码或者组建的基础上,个人的错误不会影响全局的运行,PM也不做过多要求。但如果是做产品,这个情况可能会有所改变,很多时候要求很严格,至少我是这样。在做完对输入参数的验证后,CreateUser建立与数据库的连接,这里是调用SqlConnectionHelper类下的GetConnection方法进行的,为了照顾初学者阅读,我这里这一下为什么需要把对数据库连接与操作写在SqlConnectionHelper类下,而不是直接采用SqlConnection提供的方法,其实这是一个设计模式的问题,Membership的实现需要很多的方法与数据库进行交换数据库,如果每次方法都调用一次SqlConnection的方法建立数据库连接,一来会造成大量的代码冗余,而且一旦数据库连接语句一旦改变,你就要去修改很多个方法,如果你把这个过程都包装在一个类下面,连接数据库就有统一的入口,一来容易维护,二来不会有太多的代码冗余,再者如果需要查找错误也非常容易。这里Membership采用的是存储过程,我们可以看到使用的是dbo.aspnet_Membership_CreateUser存储过程,好了,打开你的数据库,找到这个存储过程:
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)

{

      
string text3;

      MembershipUser user1;

      
if (!SecUtility.ValidateParameter(ref password, truetruefalse0x80))

      
{

            status 
= MembershipCreateStatus.InvalidPassword;

            
return null;

      }


      
string text1 = base.GenerateSalt();

      
string text2 = base.EncodePassword(password, (intthis._PasswordFormat, text1);

      
if (text2.Length > 0x80)

      
{

            status 
= MembershipCreateStatus.InvalidPassword;

            
return null;

      }


      
if (passwordAnswer != null)

      
{

            passwordAnswer 
= passwordAnswer.Trim();

      }


      
if ((passwordAnswer != null&& (passwordAnswer.Length > 0))

      
{

            
if (passwordAnswer.Length > 0x80)

            
{

                  status 
= MembershipCreateStatus.InvalidAnswer;

                  
return null;

            }


            text3 
= base.EncodePassword(passwordAnswer.ToLower(CultureInfo.InvariantCulture), (intthis._PasswordFormat, text1);

      }


      
else

      
{

            text3 
= passwordAnswer;

      }


      
if (!SecUtility.ValidateParameter(ref text3, this.RequiresQuestionAndAnswer, this.RequiresQuestionAndAnswer, false0x80))

      
{

            status 
= MembershipCreateStatus.InvalidAnswer;

            
return null;

      }


      
if (!SecUtility.ValidateParameter(ref username, truetruetrue0x100))

      
{

            status 
= MembershipCreateStatus.InvalidUserName;

            
return null;

      }


      
if (!SecUtility.ValidateParameter(ref email, this.RequiresUniqueEmail, this.RequiresUniqueEmail, false0x100))

      
{

            status 
= MembershipCreateStatus.InvalidEmail;

            
return null;

      }


      
if (!SecUtility.ValidateParameter(ref passwordQuestion, this.RequiresQuestionAndAnswer, this.RequiresQuestionAndAnswer, false0x100))

      
{

            status 
= MembershipCreateStatus.InvalidQuestion;

            
return null;

      }


      
if ((providerUserKey != null&& !(providerUserKey is Guid))

      
{

            status 
= MembershipCreateStatus.InvalidProviderUserKey;

            
return null;

      }


      
if (password.Length < this.MinRequiredPasswordLength)

      
{

            status 
= MembershipCreateStatus.InvalidPassword;

            
return null;

      }


      
int num1 = 0;

      
for (int num2 = 0; num2 < password.Length; num2++)

      
{

            
if (!char.IsLetterOrDigit(password, num2))

            
{

                  num1
++;

            }


      }


      
if (num1 < this.MinRequiredNonAlphanumericCharacters)

      
{

            status 
= MembershipCreateStatus.InvalidPassword;

            
return null;

      }


      
if ((this.PasswordStrengthRegularExpression.Length > 0&& !Regex.IsMatch(password, this.PasswordStrengthRegularExpression))

      
{

            status 
= MembershipCreateStatus.InvalidPassword;

            
return null;

      }


      ValidatePasswordEventArgs args1 
= new ValidatePasswordEventArgs(username, password, true);

      
this.OnValidatingPassword(args1);

      
if (args1.Cancel)

      
{

            status 
= MembershipCreateStatus.InvalidPassword;

            
return null;

      }


      
try

      
{

            SqlConnectionHolder holder1 
= null;

            
try

            
{

                  holder1 
= SqlConnectionHelper.GetConnection(this._sqlConnectionString, true);

                  
this.CheckSchemaVersion(holder1.Connection);

                  SqlCommand command1 
= new SqlCommand("dbo.aspnet_Membership_CreateUser", holder1.Connection);

                  command1.CommandTimeout 
= this.CommandTimeout;

                  command1.CommandType 
= CommandType.StoredProcedure;

                  command1.Parameters.Add(
this.CreateInputParam("@ApplicationName", SqlDbType.NVarChar, this.ApplicationName));

                  command1.Parameters.Add(
this.CreateInputParam("@UserName", SqlDbType.NVarChar, username));

                  command1.Parameters.Add(
this.CreateInputParam("@Password", SqlDbType.NVarChar, text2));

                  command1.Parameters.Add(
this.CreateInputParam("@PasswordSalt", SqlDbType.NVarChar, text1));

                  command1.Parameters.Add(
this.CreateInputParam("@Email", SqlDbType.NVarChar, email));

                  command1.Parameters.Add(
this.CreateInputParam("@PasswordQuestion", SqlDbType.NVarChar, passwordQuestion));

                  command1.Parameters.Add(
this.CreateInputParam("@PasswordAnswer", SqlDbType.NVarChar, text3));

                  command1.Parameters.Add(
this.CreateInputParam("@IsApproved", SqlDbType.Bit, isApproved));

                  command1.Parameters.Add(
this.CreateInputParam("@UniqueEmail", SqlDbType.Int, this.RequiresUniqueEmail ? 1 : 0));

                  command1.Parameters.Add(
this.CreateInputParam("@PasswordFormat", SqlDbType.Int, (intthis.PasswordFormat));

                  command1.Parameters.Add(
this.GetTimeZoneAdjustmentParam());

                  SqlParameter parameter1 
= this.CreateInputParam("@UserId", SqlDbType.UniqueIdentifier, providerUserKey);

                  parameter1.Direction 
= ParameterDirection.InputOutput;

                  command1.Parameters.Add(parameter1);

                  parameter1 
= new SqlParameter("@ReturnValue", SqlDbType.Int);

                  parameter1.Direction 
= ParameterDirection.ReturnValue;

                  command1.Parameters.Add(parameter1);

                  
object obj1 = command1.ExecuteScalar();

                  DateTime time1 
= this.RoundToSeconds(DateTime.Now);

                  
if ((obj1 != null&& (obj1 is DateTime))

                  
{

                        time1 
= (DateTime) obj1;

                  }


                  
int num3 = (parameter1.Value != null? ((int) parameter1.Value) : -1;

                  
if ((num3 < 0|| (num3 > 11))

                  
{

                        num3 
= 11;

                  }


                  status 
= (MembershipCreateStatus) num3;

                  
if (num3 != 0)

                  
{

                        
return null;

                  }


                  providerUserKey 
= new Guid(command1.Parameters["@UserId"].Value.ToString());

                  
return new MembershipUser(this, username, providerUserKey, email, passwordQuestion, null, isApproved, false, time1, time1, time1, time1, new DateTime(0x6da11));

            }


            
finally

            
{

                  
if (holder1 != null)

                  
{

                        holder1.Close();

                        holder1 
= null;

                  }


            }


      }


      
catch

      
{

            
throw;

      }


      
return user1;

}


该方法实现建立一个用户的过程,建立后返回一个被建立的
EXEC dbo.aspnet_Applications_CreateApplication,调用aspnet_Applications_CreateApplication存储过程,建立一个名字为@ApplicationName 的Application,如果该Application不存在的话.并且返回该Application的ID,这里的ApplicationName在web.config membership节点中设置过,即:dev。如果执行以上过程有错误,通过SQL的GOTO语句跳至Cleanup部分,执行ROLLBACK TRANSACTION,回滚这次操作。如果没有错误存储过程就接着向下执行,EXEC dbo.aspnet_GetUtcDate @TimeZoneAdjustment, @CreateDate OUTPUT,这是获得当前Utc时间。再下来就判断aspnet_Users表中用户的UserId是否在数据库中有该UserId(UserId是一个Guid),如果没有就在表aspnet_Users中建立。这时在进行一次失分发生错误的判断,执行的方法与前一次一样。再下来判断aspnet_Membership表中是否有该UserId存在,如果没有就根据@UniqueEmail参数判断是否允许Email在数据库中重复。最后才是把User的信息插入aspnet_Membership表,再下来还有一些对错误的处理...
够长的,不过没有关系,分几个部分看,首先是定义一些要发挥得参数,然后初始化,接着
其实这个存储过程并不复杂,但是非常繁琐的,也可以看出设计者对数据库检验的严格性的要求非常高。有了对存储过程一定的了解后,我们接下来那些传递的参数也就明白有何用处了,最后关闭数据库的连接,把返回的这些参数通过实例化一个MembershipUser类传递过去,然后返回这个实例化的MembershipUser,这样该方法就完成了一次操作。
最后我们看看数据库,Membership直接关联的有3个表
表很简单,关系也很明了,我就不多说了,总要给我留点时间吧,也给你自己留一些分析的空间,我要是全都说完了那你做什么?呵呵。
    如果你了解CS系统,你肯定会提出这样一个疑问:用户信息不只表Membership中这一点呀,保存用户个性化设置的如选用什么语言、什么皮肤等等信息的数据都在哪里?期待吧,那是后面的Profile专题需要叙述的问题。
 
 

Trackback: http://tb.blog.youkuaiyun.com/TrackBack.aspx?PostId=1538982

 
# CRM项目控制器接口报告 ## 目录结构说明 本报告按照以下三个路径对控制器进行分类: 1. **/Controllers** - 主控制器目录(MVC控制器) 2. **/Areas/API/Controllers** - API控制器目录(Web API控制器) --- # 第一部分:/Controllers 目录下的控制器 ## 1. HomeController **路径**: `/Controllers/HomeController.cs` **命名空间**: `BEMS.Web.Controllers` **基类**: `Controller` ### 接口列表 #### 1. Login (GET) - **路径**: `/Home/Login` - **HTTP方法**: GET - **描述**: 显示登录页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 2. LoginBlank (GET) - **路径**: `/Home/LoginBlank` - **HTTP方法**: GET - **描述**: 显示空白登录页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 3. SSOLogin (GET) - **路径**: `/Home/SSOLogin` - **HTTP方法**: GET - **描述**: SSO登录重定向 - **入参**: 无 - **返回值**: `RedirectResult` #### 4. Login (POST) - **路径**: `/Home/Login` - **HTTP方法**: POST - **描述**: 处理用户登录 - **入参**: `LoginViewModel` ```csharp public class LoginViewModel { [Required] [Display(Name = "登录名")] public string LoginName { get; set; } [Required] [Display(Name = "密码")] public string Password { get; set; } } ``` - **返回值**: `ActionResult` (View或Redirect) #### 5. LoginBlank (POST) - **路径**: `/Home/LoginBlank` - **HTTP方法**: POST - **描述**: 处理空白登录页面登录 - **入参**: `LoginViewModel` (同上) - **返回值**: `ActionResult` (View或Redirect) #### 6. LogOut (POST) - **路径**: `/Home/LogOut` - **HTTP方法**: POST - **描述**: 退出登录 - **入参**: 无 - **返回值**: `ActionResult` (Redirect) --- ## 2. UserController **路径**: `/Controllers/Authorization/UserController.cs` **命名空间**: `BEMS.Web.Controllers.Authorization` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/User/Index` - **HTTP方法**: GET/POST - **描述**: 用户列表查询 - **入参**: `UserListViewModel` ```csharp public class UserListViewModel { public PageInfo PageInfo { get; set; } public IEnumerable<UserViewModel> UserViewModels { get; set; } public UserSearchParams SearchParams { get; set; } } public class UserSearchParams { public string Name { get; set; } } ``` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/User/Create` - **HTTP方法**: GET - **描述**: 显示创建用户页面 - **入参**: 无 - **返回值**: `ActionResult` (PartialView) #### 3. Create (POST) - **路径**: `/User/Create` - **HTTP方法**: POST - **描述**: 创建新用户 - **入参**: `UserViewModel` ```csharp public class UserViewModel : ViewModelBase { [Required] [StringLength(50)] [Display(Name = "登录帐号")] public string UserName { get; set; } [StringLength(30, MinimumLength = 6)] [Display(Name = "登录密码")] public string Password { get; set; } [StringLength(20)] [Display(Name = "电话号码")] public string PhoneNo { get; set; } [Required] [Display(Name = "角色")] public List<string> RoleIds { get; set; } [Required] [Display(Name = "用户姓名")] public string TrueName { get; set; } public bool IsSystem { get; set; } public bool FromLoginCenter { get; set; } [Display(Name = "管理大区")] public List<string> Regions { get; set; } } ``` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/User/Remove` - **HTTP方法**: GET - **描述**: 删除用户 - **入参**: `string id` (用户ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/User/Edit` - **HTTP方法**: GET - **描述**: 显示编辑用户页面 - **入参**: `string id` (用户ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/User/Edit` - **HTTP方法**: POST - **描述**: 更新用户信息 - **入参**: `UserViewModel` (同上) - **返回值**: `ActionResult` (Redirect) #### 7. ChangePassword (GET) - **路径**: `/User/ChangePassword` - **HTTP方法**: GET - **描述**: 显示修改密码页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 8. ChangePassword (POST) - **路径**: `/User/ChangePassword` - **HTTP方法**: POST - **描述**: 修改密码 - **入参**: `ChangePasswordViewModel` ```csharp public class ChangePasswordViewModel { [Required] [StringLength(30, MinimumLength = 6)] [Display(Name = "旧密码")] public string OldPassword { get; set; } [Required] [StringLength(30, MinimumLength = 6)] [Display(Name = "新的密码")] public string NewPassword { get; set; } [Required] [Compare("NewPassword")] [StringLength(30, MinimumLength = 6)] [Display(Name = "确认新密码")] public string ConfirmPassword { get; set; } } ``` - **返回值**: `JsonResult<JsonBase<String>>` #### 9. Welcome (GET) - **路径**: `/User/Welcome` - **HTTP方法**: GET - **描述**: 欢迎页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 10. LogOut (GET) - **路径**: `/User/LogOut` - **HTTP方法**: GET - **描述**: 退出登录 - **入参**: 无 - **返回值**: `ActionResult` (Redirect) --- ## 3. RoleController **路径**: `/Controllers/Authorization/RoleController.cs` **命名空间**: `BEMS.Web.Controllers.Authorization` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/Role/Index` - **HTTP方法**: GET/POST - **描述**: 角色列表查询 - **入参**: `RoleListViewModel` ```csharp public class RoleListViewModel { public PageInfo PageInfo { get; set; } public IEnumerable<RoleViewModel> RoleViewModels { get; set; } public RoleSearchParams SearchParams { get; set; } } public class RoleSearchParams { public string Name { get; set; } } ``` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/Role/Create` - **HTTP方法**: GET - **描述**: 显示创建角色页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 3. Create (POST) - **路径**: `/Role/Create` - **HTTP方法**: POST - **描述**: 创建新角色 - **入参**: `RoleViewModel` ```csharp public class RoleViewModel : ViewModelBase { [Required] [StringLength(50)] [Display(Name = "角色名称")] public string RoleName { get; set; } [StringLength(500)] [Display(Name = "备注")] public string Comments { get; set; } [Display(Name = "角色类型")] public int RoleType { get; set; } public bool IsSystem { get; set; } } ``` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/Role/Remove` - **HTTP方法**: GET - **描述**: 删除角色 - **入参**: `string id` (角色ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/Role/Edit` - **HTTP方法**: GET - **描述**: 显示编辑角色页面 - **入参**: `string id` (角色ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/Role/Edit` - **HTTP方法**: POST - **描述**: 更新角色信息 - **入参**: `RoleViewModel` (同上) - **返回值**: `JsonResult<JsonBase<String>>` #### 7. Authority (GET) - **路径**: `/Role/Authority` - **HTTP方法**: GET - **描述**: 角色授权页面 - **入参**: `string roleId` (角色ID) - **返回值**: `ActionResult` (View) #### 8. Update (POST) - **路径**: `/Role/Update` - **HTTP方法**: POST - **描述**: 更新角色权限 - **入参**: `AuthorityEntityModel` ```csharp public class AuthorityEntityModel { public string Actions { get; set; } public string SiteMaps { get; set; } public string Category { set; get; } public string TargetId { set; get; } } ``` - **返回值**: `ActionResult` (Redirect) --- ## 4. APPDataController **路径**: `/Controllers/Base/APPDataController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/APPData/Index` - **HTTP方法**: GET/POST - **描述**: APP数据列表查询 - **入参**: `APPDataListViewModel` ```csharp public class APPDataListViewModel { public PageInfo PageInfo { get; set; } public IEnumerable<APPDataViewModel> ViewModels { get; set; } public APPDataSearchParams SearchParams { get; set; } } public class APPDataSearchParams { public string Name { get; set; } } ``` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/APPData/Create` - **HTTP方法**: GET - **描述**: 显示创建APP数据页面 - **入参**: 无 - **返回值**: `ActionResult` (PartialView) #### 3. Create (POST) - **路径**: `/APPData/Create` - **HTTP方法**: POST - **描述**: 创建APP数据 - **入参**: `APPDataViewModel` ```csharp public class APPDataViewModel : ViewModelBase { [Required] [StringLength(100)] [Display(Name = "模块名称")] public string APP_Name { get; set; } [Required] [StringLength(50)] [Display(Name = "模块代码")] public string APP_Code { get; set; } [StringLength(300)] [Display(Name = "模块描述")] public string APP_Desc { get; set; } } ``` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/APPData/Remove` - **HTTP方法**: GET - **描述**: 删除APP数据 - **入参**: `string id` (APP数据ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/APPData/Edit` - **HTTP方法**: GET - **描述**: 显示编辑APP数据页面 - **入参**: `string id` (APP数据ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/APPData/Edit` - **HTTP方法**: POST - **描述**: 更新APP数据 - **入参**: `APPDataViewModel` (同上) - **返回值**: `JsonResult<JsonBase<String>>` --- ## 5. MemberRoleController **路径**: `/Controllers/Base/MemberRoleController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/MemberRole/Index` - **HTTP方法**: GET/POST - **描述**: 会员角色列表查询 - **入参**: `MemberRoleListViewModel` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/MemberRole/Create` - **HTTP方法**: GET - **描述**: 显示创建会员角色页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 3. Create (POST) - **路径**: `/MemberRole/Create` - **HTTP方法**: POST - **描述**: 创建会员角色 - **入参**: `MemberRoleViewModel` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/MemberRole/Remove` - **HTTP方法**: GET - **描述**: 删除会员角色 - **入参**: `string id` (角色ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/MemberRole/Edit` - **HTTP方法**: GET - **描述**: 显示编辑会员角色页面 - **入参**: `string id` (角色ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/MemberRole/Edit` - **HTTP方法**: POST - **描述**: 更新会员角色 - **入参**: `MemberRoleViewModel` - **返回值**: `JsonResult<JsonBase<String>>` #### 7. MemberRoleAuthority (GET) - **路径**: `/MemberRole/MemberRoleAuthority` - **HTTP方法**: GET - **描述**: 会员角色授权页面 - **入参**: `string memberRoleId` (会员角色ID) - **返回值**: `ActionResult` (View) #### 8. UpdateMemberRoleAuthority (POST) - **路径**: `/MemberRole/UpdateMemberRoleAuthority` - **HTTP方法**: POST - **描述**: 更新会员角色权限 - **入参**: `MemberAppAuthorityUpdateEntityModel` - **返回值**: `ActionResult` (Redirect) --- ## 6. MemberUserController **路径**: `/Controllers/Base/MemberUserController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/MemberUser/Index` - **HTTP方法**: GET/POST - **描述**: 会员用户列表查询 - **入参**: `MemberUserListViewModel` ```csharp public class MemberUserListViewModel { public PageInfo PageInfo { get; set; } public IEnumerable<MemberUserViewModel> ViewModels { get; set; } public MemberUserSearchParams SearchParams { get; set; } } public class MemberUserSearchParams { public string Name { get; set; } } ``` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/MemberUser/Create` - **HTTP方法**: GET - **描述**: 显示创建会员用户页面 - **入参**: 无 - **返回值**: `ActionResult` (PartialView) #### 3. Create (POST) - **路径**: `/MemberUser/Create` - **HTTP方法**: POST - **描述**: 创建会员用户 - **入参**: `MemberUserViewModel` ```csharp public class MemberUserViewModel : ViewModelBase { [Required] [StringLength(50)] [Display(Name = "用户名")] public string UserName { get; set; } [Required] [StringLength(50)] [Display(Name = "姓名")] public string TrueName { get; set; } [Required] [StringLength(50, MinimumLength = 6)] [Display(Name = "密码")] public string Password { get; set; } [StringLength(20)] [Display(Name = "电话号码")] public string PhoneNo { get; set; } [StringLength(200)] [Display(Name = "Email")] public string Email { get; set; } [StringLength(40)] [Display(Name = "域账号")] public string SSOAccount { get; set; } [StringLength(200)] [Display(Name = "微信Id")] public string WXOpenId { get; set; } [StringLength(200)] [Display(Name = "微信Id")] public string WXUnionId { get; set; } [Display(Name = "UUID")] public string UUID { get; set; } [Display(Name = "角色")] public List<string> RoleIds { get; set; } public bool IsSSOAutoCreate { get; set; } [Display(Name = "国家地区")] public List<string> CompanyCodeList { get; set; } public string CompanyCodeListDesc { get; set; } } ``` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/MemberUser/Remove` - **HTTP方法**: GET - **描述**: 删除会员用户 - **入参**: `string id` (用户ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/MemberUser/Edit` - **HTTP方法**: GET - **描述**: 显示编辑会员用户页面 - **入参**: `string id` (用户ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/MemberUser/Edit` - **HTTP方法**: POST - **描述**: 更新会员用户信息 - **入参**: `MemberUserViewModel` (同上) - **返回值**: `ActionResult` (Redirect) --- ## 7. MemberUserLoginLogController **路径**: `/Controllers/Base/MemberUserLoginLogController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/MemberUserLoginLog/Index` - **HTTP方法**: GET/POST - **描述**: 会员用户登录日志列表查询 - **入参**: `MemberUserLoginLogListViewModel` - **返回值**: `ActionResult` (PartialView) --- ## 8. PersonController **路径**: `/Controllers/Demo/PersonController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/Person/Index` - **HTTP方法**: GET/POST - **描述**: 人员列表查询 - **入参**: `PersonListViewModel` ```csharp public class PersonListViewModel { public PageInfo PageInfo { get; set; } public IEnumerable<PersonViewModel> ViewModels { get; set; } public PersonSearchParams SearchParams { get; set; } } public class PersonSearchParams { public string Name { get; set; } } ``` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/Person/Create` - **HTTP方法**: GET - **描述**: 显示创建人员页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 3. Create (POST) - **路径**: `/Person/Create` - **HTTP方法**: POST - **描述**: 创建人员 - **入参**: `PersonViewModel` ```csharp public class PersonViewModel : ViewModelBase { [Required] [StringLength(50)] [Display(Name = "姓名")] public string UserName { get; set; } [Required] [Display(Name = "性别")] public int Sex { get; set; } [Required] [Display(Name = "身高")] public int Height { get; set; } [Required] [Display(Name = "体重")] public decimal Weight { get; set; } } ``` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/Person/Remove` - **HTTP方法**: GET - **描述**: 删除人员 - **入参**: `string id` (人员ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/Person/Edit` - **HTTP方法**: GET - **描述**: 显示编辑人员页面 - **入参**: `string id` (人员ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/Person/Edit` - **HTTP方法**: POST - **描述**: 更新人员信息 - **入参**: `PersonViewModel` (同上) - **返回值**: `ActionResult` (Redirect) --- ## 9. ImplantMainInfoController **路径**: `/Controllers/Implant/ImplantMainInfoController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/ImplantMainInfo/Index` - **HTTP方法**: GET/POST - **描述**: 植入主信息列表查询 - **入参**: `ImplantMainInfoListViewModel` - **返回值**: `ActionResult` (PartialView) #### 2. Remove (GET) - **路径**: `/ImplantMainInfo/Remove` - **HTTP方法**: GET - **描述**: 删除植入主信息 - **入参**: `string id` (主信息ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 3. SetPrintStatus (GET) - **路径**: `/ImplantMainInfo/SetPrintStatus` - **HTTP方法**: GET - **描述**: 设置打印状态 - **入参**: - `string id` (主信息ID) - `string status` (状态) - `string from` (来源,默认"Index") - **返回值**: `JsonResult<JsonBase<String>>` #### 4. SetPrintStatus2 (GET) - **路径**: `/ImplantMainInfo/SetPrintStatus2` - **HTTP方法**: GET - **描述**: 批量设置打印状态 - **入参**: - `string ids` (主信息ID列表,逗号分隔) - `string status` (状态) - `string from` (来源,默认"Index") - **返回值**: `JsonResult<JsonBase<String>>` #### 5. DoCheck (POST) - **路径**: `/ImplantMainInfo/DoCheck` - **HTTP方法**: POST - **描述**: 审核植入信息 - **入参**: `DoCheckModel` ```csharp public class DoCheckModel { public string id { get; set; } public string status { get; set; } public string from { get; set; } public string adminRemarks { get; set; } } ``` - **返回值**: `JsonResult<JsonBase<String>>` #### 6. ViewDetails (GET) - **路径**: `/ImplantMainInfo/ViewDetails` - **HTTP方法**: GET - **描述**: 查看植入详情 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 7. Edit (GET) - **路径**: `/ImplantMainInfo/Edit` - **HTTP方法**: GET - **描述**: 显示编辑植入信息页面 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 8. PrintWarrentyCard (GET) - **路径**: `/ImplantMainInfo/PrintWarrentyCard` - **HTTP方法**: GET - **描述**: 打印保修卡 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 9. PrintWarrentyCard2 (GET) - **路径**: `/ImplantMainInfo/PrintWarrentyCard2` - **HTTP方法**: GET - **描述**: 批量打印保修卡 - **入参**: `string ids` (主信息ID列表) - **返回值**: `ActionResult` (PartialView) #### 10. PrintWarrentyCardQRCode (GET) - **路径**: `/ImplantMainInfo/PrintWarrentyCardQRCode` - **HTTP方法**: GET - **描述**: 打印带二维码的保修卡 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 11. PrintWarrentyCard2QRCode (GET) - **路径**: `/ImplantMainInfo/PrintWarrentyCard2QRCode` - **HTTP方法**: GET - **描述**: 批量打印带二维码的保修卡 - **入参**: `string ids` (主信息ID列表) - **返回值**: `ActionResult` (PartialView) #### 12. UpdateCardInfo (POST) - **路径**: `/ImplantMainInfo/UpdateCardInfo` - **HTTP方法**: POST - **描述**: 更新卡片信息 - **入参**: `ImplantMainInfoViewModel` - **返回值**: `JsonResult<JsonBase<String>>` #### 13. DeleteAttachment (GET) - **路径**: `/ImplantMainInfo/DeleteAttachment` - **HTTP方法**: GET - **描述**: 删除附件 - **入参**: - `string mainInfoId` (主信息ID) - `string attachmentId` (附件ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 14. DelPacemakersDetails (GET) - **路径**: `/ImplantMainInfo/DelPacemakersDetails` - **HTTP方法**: GET - **描述**: 删除起搏器详情 - **入参**: - `string id` (详情ID) - `string mainInfoId` (主信息ID) - **返回值**: `JsonResult<JsonBase<string>>` #### 15. UploadAttachment (POST) - **路径**: `/ImplantMainInfo/UploadAttachment` - **HTTP方法**: POST - **描述**: 上传附件 - **入参**: 文件上传 (FormData) - **返回值**: `JsonResult<JsonBase<String>>` #### 16. Export (GET) - **路径**: `/ImplantMainInfo/Export` - **HTTP方法**: GET - **描述**: 导出数据 - **入参**: - `string RecordStatus` - `string WarrantyCardStatus` - `string CreatedTimeSpan` - `string ImplantDateTimeSpan` - `string Name` - `string PrintStatus` - `string Province` - `string Type` - `string RegistrationStatus` - `string SubModel` - `string SubSerial` - `string FollowUp` - **返回值**: `FileResult` (Excel文件) #### 17. GetModelInfo (GET) - **路径**: `/ImplantMainInfo/GetModelInfo` - **HTTP方法**: GET - **描述**: 获取型号信息 - **入参**: `string modelNo` (型号编号) - **返回值**: `JsonResult` (包含SelectMode和WarrantyYear) #### 18. SavePacemakersDetails (GET) - **路径**: `/ImplantMainInfo/SavePacemakersDetails` - **HTTP方法**: GET - **描述**: 保存起搏器详情 - **入参**: `PacemakersDetailsViewModel` - **返回值**: `JsonResult` #### 19. CheckMainSerialNumber (GET) - **路径**: `/ImplantMainInfo/CheckMainSerialNumber` - **HTTP方法**: GET - **描述**: 检查主序列号 - **入参**: - `string mainInfoId` (主信息ID) - `string modelNo` (型号) - `string serialNumber` (序列号) - **返回值**: `JsonResult` #### 20. AdminSave (GET) - **路径**: `/ImplantMainInfo/AdminSave` - **HTTP方法**: GET - **描述**: 管理员保存数据 - **入参**: `ImplantMainInfoViewModel` - **返回值**: `JsonResult` --- ## 10. ModelInfoController **路径**: `/Controllers/Implant/ModelInfoController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/ModelInfo/Index` - **HTTP方法**: GET/POST - **描述**: 型号信息列表查询 - **入参**: `ModelInfoListViewModel` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/ModelInfo/Create` - **HTTP方法**: GET - **描述**: 显示创建型号信息页面 - **入参**: 无 - **返回值**: `ActionResult` (PartialView) #### 3. Create (POST) - **路径**: `/ModelInfo/Create` - **HTTP方法**: POST - **描述**: 创建型号信息 - **入参**: `ModelInfoViewModel` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/ModelInfo/Remove` - **HTTP方法**: GET - **描述**: 删除型号信息 - **入参**: `string id` (型号信息ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/ModelInfo/Edit` - **HTTP方法**: GET - **描述**: 显示编辑型号信息页面 - **入参**: `string id` (型号信息ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/ModelInfo/Edit` - **HTTP方法**: POST - **描述**: 更新型号信息 - **入参**: `ModelInfoViewModel` - **返回值**: `JsonResult<JsonBase<String>>` #### 7. MaterialList (GET) - **路径**: `/ModelInfo/MaterialList` - **HTTP方法**: GET - **描述**: 获取物料列表 - **入参**: `string KeyWord` (关键词) - **返回值**: `JsonResult` (物料列表) --- ## 11. PowerController **路径**: `/Controllers/Implant/PowerController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/Power/Index` - **HTTP方法**: GET/POST - **描述**: 电源主信息列表查询 - **入参**: `PowerMainListViewModel` - **返回值**: `ActionResult` (PartialView) #### 2. ViewDetail (GET) - **路径**: `/Power/ViewDetail` - **HTTP方法**: GET - **描述**: 查看电源详情 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 3. Remove (GET) - **路径**: `/Power/Remove` - **HTTP方法**: GET - **描述**: 删除电源信息 - **入参**: `string id` (主信息ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 4. Export (GET) - **路径**: `/Power/Export` - **HTTP方法**: GET - **描述**: 导出电源数据 - **入参**: `PowerMainSearchParams` - **返回值**: `FileResult` (Excel文件) --- ## 12. SICDImplantController **路径**: `/Controllers/Implant/SICDImplantController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/SICDImplant/Index` - **HTTP方法**: GET/POST - **描述**: SICD植入信息列表查询 - **入参**: `SICDImplantMainInfoListViewModel` - **返回值**: `ActionResult` (PartialView) #### 2. ViewDetail (GET) - **路径**: `/SICDImplant/ViewDetail` - **HTTP方法**: GET - **描述**: 查看SICD植入详情 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 3. Remove (GET) - **路径**: `/SICDImplant/Remove` - **HTTP方法**: GET - **描述**: 删除SICD植入信息 - **入参**: `string id` (主信息ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 4. SetPrintStatus (GET) - **路径**: `/SICDImplant/SetPrintStatus` - **HTTP方法**: GET - **描述**: 设置打印状态 - **入参**: - `string id` (主信息ID) - `string status` (状态) - `string from` (来源,默认"Index") - **返回值**: `JsonResult<JsonBase<String>>` #### 5. SetPrintStatus2 (GET) - **路径**: `/SICDImplant/SetPrintStatus2` - **HTTP方法**: GET - **描述**: 批量设置打印状态 - **入参**: - `string ids` (主信息ID列表) - `string status` (状态) - `string from` (来源,默认"Index") - **返回值**: `JsonResult<JsonBase<String>>` #### 6. DoCheck (POST) - **路径**: `/SICDImplant/DoCheck` - **HTTP方法**: POST - **描述**: 审核SICD植入信息 - **入参**: `DoCheckModel` (同上) - **返回值**: `JsonResult<JsonBase<String>>` #### 7. PrintWarrentyCard (GET) - **路径**: `/SICDImplant/PrintWarrentyCard` - **HTTP方法**: GET - **描述**: 打印保修卡 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 8. PrintWarrentyCard2 (GET) - **路径**: `/SICDImplant/PrintWarrentyCard2` - **HTTP方法**: GET - **描述**: 批量打印保修卡 - **入参**: `string ids` (主信息ID列表) - **返回值**: `ActionResult` (PartialView) #### 9. PrintWarrentyCardQRCode (GET) - **路径**: `/SICDImplant/PrintWarrentyCardQRCode` - **HTTP方法**: GET - **描述**: 打印带二维码的保修卡 - **入参**: `string id` (主信息ID) - **返回值**: `ActionResult` (PartialView) #### 10. PrintWarrentyCard2QRCode (GET) - **路径**: `/SICDImplant/PrintWarrentyCard2QRCode` - **HTTP方法**: GET - **描述**: 批量打印带二维码的保修卡 - **入参**: `string ids` (主信息ID列表) - **返回值**: `ActionResult` (PartialView) #### 11. Export (GET) - **路径**: `/SICDImplant/Export` - **HTTP方法**: GET - **描述**: 导出SICD数据 - **入参**: - `string RecordStatus` - `string WarrantyCardStatus` - `string CreatedTimeSpan` - `string ImplantDateTimeSpan` - `string Name` - `string PrintStatus` - `string Provincec` - `string Province` - `string RegistrationStatus` - `string SubModel` - `string SubSerial` - `string FollowUp` - **返回值**: `FileResult` (Excel文件) --- ## 13. SiteMapController **路径**: `/Controllers/Sys/SiteMapController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/SiteMap/Index` - **HTTP方法**: GET/POST - **描述**: 站点地图列表查询 - **入参**: `SiteMapListViewModel` - **返回值**: `ActionResult` (PartialView) #### 2. Create (GET) - **路径**: `/SiteMap/Create` - **HTTP方法**: GET - **描述**: 显示创建站点地图页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 3. Create (POST) - **路径**: `/SiteMap/Create` - **HTTP方法**: POST - **描述**: 创建站点地图 - **入参**: `SiteMapViewModel` - **返回值**: `ActionResult` (Redirect) #### 4. Remove (GET) - **路径**: `/SiteMap/Remove` - **HTTP方法**: GET - **描述**: 删除站点地图 - **入参**: `string id` (站点地图ID) - **返回值**: `JsonResult<JsonBase<String>>` #### 5. Edit (GET) - **路径**: `/SiteMap/Edit` - **HTTP方法**: GET - **描述**: 显示编辑站点地图页面 - **入参**: `string id` (站点地图ID) - **返回值**: `ActionResult` (PartialView) #### 6. Edit (POST) - **路径**: `/SiteMap/Edit` - **HTTP方法**: POST - **描述**: 更新站点地图 - **入参**: `SiteMapViewModel` - **返回值**: `JsonResult<JsonBase<String>>` --- ## 14. UserLoginLogController **路径**: `/Controllers/Sys/UserLoginLogController.cs` **命名空间**: `BEMS.Controllers` **基类**: `BaseController` ### 接口列表 #### 1. Index (GET/POST) - **路径**: `/UserLoginLog/Index` - **HTTP方法**: GET/POST - **描述**: 用户登录日志列表查询 - **入参**: `UserLoginLogListViewModel` - **返回值**: `ActionResult` (PartialView) --- ## 15. LoginController **路径**: `/Controllers/WebApp/LoginController.cs` **命名空间**: `BEMS.Web.Controllers.WebApp` **基类**: `WebAppController` ### 接口列表 #### 1. Index (GET) - **路径**: `/Login/Index` - **HTTP方法**: GET - **描述**: 显示登录页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 2. ChangeLan (POST) - **路径**: `/Login/ChangeLan` - **HTTP方法**: POST - **描述**: 更改语言 - **入参**: `string lan` (语言代码) - **返回值**: `JsonResult` --- ## 16. BEUserLoginController **路径**: `/Controllers/WebApp/BEUserLoginController.cs` **命名空间**: `BEMS.Web.Controllers.WebApp` **基类**: `WebAppController` ### 接口列表 #### 1. Login (GET) - **路径**: `/BEUserLogin/Login` - **HTTP方法**: GET - **描述**: 显示BE用户登录页面 - **入参**: 无 - **返回值**: `ActionResult` (View) #### 2. Login (POST) - **路径**: `/BEUserLogin/Login` - **HTTP方法**: POST - **描述**: 处理BE用户登录 - **入参**: `MemberLoginViewModel` ```csharp public class MemberLoginViewModel { [Required] [Display(Name = "登录名")] public string LoginName { get; set; } [Required] [Display(Name = "密码")] public string Password { get; set; } } ``` - **返回值**: `ActionResult` (View或Redirect) #### 3. LogOut (GET) - **路径**: `/BEUserLogin/LogOut` - **HTTP方法**: GET - **描述**: BE用户退出登录 - **入参**: 无 - **返回值**: `ActionResult` (Redirect) --- ## 17. ErrorController **路径**: `/Controllers/ErrorController.cs` **命名空间**: `BEMS.Web.Controllers` **基类**: `Controller` ### 接口列表 #### 1. Error_500 (GET) - **路径**: `/Error/Error_500` - **HTTP方法**: GET - **描述**: 显示500错误页面 - **入参**: 无 - **返回值**: `ActionResult` (PartialView) --- ## 18. WebAppController **路径**: `/Controllers/WebAppController.cs` **命名空间**: `BEMS.Web.Controllers` **基类**: `Controller` ### 接口列表 #### 1. SetLanguage (GET) - **路径**: `/WebApp/SetLanguage` - **HTTP方法**: GET - **描述**: 设置语言 - **入参**: `string language` (语言代码) - **返回值**: `ActionResult` (Redirect) --- # 第二部分:/Areas/API/Controllers 目录下的控制器 ## 1. PatientController **路径**: `/Areas/API/Controllers/PatientController.cs` **命名空间**: `BEMS.Web.Areas.API.Controllers` **基类**: `ApiController` **路由前缀**: `api/Patient` ### 接口列表 #### 1. ParamVerification (POST) - **路径**: `/api/Patient/ParamVerification` - **HTTP方法**: POST - **描述**: 参数验证 - **入参**: `Object bodyParam` (加密的JSON字符串) - **返回值**: `ResModel` ```csharp public class ResModel { public int code { get; set; } public string message { get; set; } public object data { get; set; } } ``` #### 2. ImplantInfo (POST) - **路径**: `/api/Patient/ImplantInfo` - **HTTP方法**: POST - **描述**: 获取患者植入信息 - **入参**: `string bodyParam` (加密的JSON字符串,包含patientName) - **返回值**: `ResModel` (包含患者植入信息列表) ```csharp public class PatientImplantInfo { public string PatientName { get; set; } public string PatientSex { get; set; } public string ModelNo { get; set; } public string SerialNumber { get; set; } public string SelectMode { get; set; } public DateTime? ImplantDate { get; set; } public string WarrantyYear { get; set; } public string HospitalName { get; set; } public string HospitalAddress { get; set; } public string DoctorName { get; set; } public string HospitalTel { get; set; } public string Type { get; set; } public string RecordStatus { get; set; } public List<PacemakersDetail> PacemakersDetail { get; set; } } ``` #### 3. SyncRegistrationInfo (POST) - **路径**: `/api/Patient/SyncRegistrationInfo` - **HTTP方法**: POST - **描述**: 同步注册信息(患者手机号和身份证号) - **入参**: `string bodyParam` (加密的JSON字符串,包含modelNo, serialNumber, patientPhone, patientIdCard) - **返回值**: `ResModel` --- ## 2. ImplantInfoController **路径**: `/Areas/API/Controllers/WebApp/ImplantInfoController.cs` **命名空间**: `BEMS.Web.Areas.API.Controllers` **基类**: `MemberApiController` **路由前缀**: `api/ImplantInfo` ### 接口列表 #### 1. GetHospitalList (GET) - **路径**: `/api/ImplantInfo/HospitalList` - **HTTP方法**: GET - **描述**: 获取医院列表 - **入参**: `string KeyWord` (关键词,可选) - **返回值**: `ResModel` (包含医院列表) ```csharp // 返回数据格式 { code: 200, message: "", data: [ { Text: "医院名称", Value: "医院代码", Tel: "" } ] } ``` #### 2. GetDoctorsList (GET) - **路径**: `/api/ImplantInfo/DoctorsList` - **HTTP方法**: GET - **描述**: 获取医生列表 - **入参**: - `string HospitalCode` (医院代码) - `string KeyWord` (关键词,可选) - **返回值**: `ResModel` (包含医生列表) #### 3. SetDoctorInfo (POST) - **路径**: `/api/ImplantInfo/Doctor` - **HTTP方法**: POST - **描述**: 设置医生信息 - **入参**: `dynamic data` ```csharp { HospitalCode: string, HospitalName: string, HCPName: string, HCPTel: string } ``` - **返回值**: `ResModel` #### 4. GetFollowUpUserList (GET) - **路径**: `/api/ImplantInfo/FollowUpUserList` - **HTTP方法**: GET - **描述**: 获取跟台人列表 - **入参**: `string KeyWord` (关键词,可选) - **返回值**: `ResModel` (包含跟台人列表) #### 5. GetSubBUList (GET) - **路径**: `/api/ImplantInfo/SubBUList` - **HTTP方法**: GET - **描述**: 获取类别列表(SubBU) - **入参**: 无 - **返回值**: `ResModel` (包含类别列表) #### 6. MaterialList (GET) - **路径**: `/api/ImplantInfo/MaterialList` - **HTTP方法**: GET - **描述**: 获取型号列表 - **入参**: - `string KeyWord` (关键词) - `string productLine` (产品线,默认"CRM") - **返回值**: `ResModel` (包含型号列表) #### 7. GetProviderList (GET) - **路径**: `/api/ImplantInfo/ProviderList` - **HTTP方法**: GET - **描述**: 获取制造商列表(植入电极导管信息) - **入参**: 无 - **返回值**: `ResModel` (包含制造商列表) #### 8. GetImplantPositionList (GET) - **路径**: `/api/ImplantInfo/ImplantPositionList` - **HTTP方法**: GET - **描述**: 获取植入位置列表 - **入参**: 无 - **返回值**: `ResModel` (包含植入位置列表) #### 9. GetMyImplantsList (GET) - **路径**: `/api/ImplantInfo/MyImplantsList` - **HTTP方法**: GET - **描述**: 我的植入单列表 - **入参**: - `string keyWords` (关键词) - `string recordStatus` (记录状态) - `string printStatus` (打印状态) - `string registrationStatus` (注册状态) - `int pageIndex` (页码,默认1) - `int pageSize` (每页大小,默认10) - **返回值**: `ResModel` (包含植入单列表和总数) #### 10. GetImplantsById (GET) - **路径**: `/api/ImplantInfo/ImplantsById` - **HTTP方法**: GET - **描述**: 获取植入单详情 - **入参**: `string Id` (植入单ID) - **返回值**: `ResModel` (包含植入单详情) #### 11. DeleteImplantsById (GET) - **路径**: `/api/ImplantInfo/DeleteMyImplant` - **HTTP方法**: GET - **描述**: 删除植入单 - **入参**: `string Id` (植入单ID) - **返回值**: `ResModel` #### 12. CancelImplantsById (GET) - **路径**: `/api/ImplantInfo/CancelMyImplant` - **HTTP方法**: GET - **描述**: 撤销植入单 - **入参**: - `string Id` (植入单ID) - `int VersionNumber` (版本号) - **返回值**: `ResModel` #### 13. SaveDraft (POST) - **路径**: `/api/ImplantInfo/SaveDraft` - **HTTP方法**: POST - **描述**: 保存草稿 - **入参**: `ImplantMainInfoModel` ```csharp public class ImplantMainInfoModel { public string Id { get; set; } public DateTime? ImplantDate { get; set; } public string HospitalCode { get; set; } public string HospitalName { get; set; } public string HospitalTel { get; set; } public string DoctorCode { get; set; } public string DoctorName { get; set; } public string DoctorTel { get; set; } public string FollowUpByEID { get; set; } public string FollowUpByName { get; set; } public string PatientNameCN { get; set; } public string PatientNameEN { get; set; } public string PatientPhoneNotCrypto { get; set; } public string PatientIdCardNotCrypto { get; set; } public string PatientSex { get; set; } public string ModelNo { get; set; } public string SerialNumber { get; set; } public string RecordStatus { get; set; } public List<PacemakersDetailsModel> PacemakersDetailsList { get; set; } public List<ScreenShotsModel> Attachments { get; set; } // ... 更多字段 } ``` - **返回值**: `ResModel` #### 14. Submit (POST) - **路径**: `/api/ImplantInfo/Submit` - **HTTP方法**: POST - **描述**: 提交植入单 - **入参**: `ImplantMainInfoModel` (同上) - **返回值**: `ResModel` #### 15. UploadAttachment (POST) - **路径**: `/api/ImplantInfo/UploadAttachment` - **HTTP方法**: POST - **描述**: 上传附件 - **入参**: 文件上传 (FormData) - **返回值**: `ResModel` (包含文件信息) ```csharp { FileId: string, PreSignedUrl: string, ThumbUrl: string, OriginalUrl: string, FileName: string, OriginFileName: string } ``` #### 16. UsualnessHospitalList (GET) - **路径**: `/api/ImplantInfo/UsualnessHospitalList` - **HTTP方法**: GET - **描述**: 获取常用医院列表 - **入参**: 无 - **返回值**: `ResModel` (包含常用医院列表,最多10条) --- ## 3. MemberUserController **路径**: `/Areas/API/Controllers/WebApp/MemberUserController.cs` **命名空间**: `BEMS.Web.Areas.API.Controllers` **基类**: `MemberApiController` ### 接口列表 #### 1. Login (GET) - **路径**: `/api/MemberUser/Login` - **HTTP方法**: GET - **描述**: 用户登录 - **入参**: - `string username` (用户名) - `string password` (密码,MD5加密) - `string sign` (签名) - `int tspan` (时间戳) - **返回值**: `ResModel` (包含用户信息和Token) ```csharp { Id: string, UserName: string, TrueName: string, Token: string, PhoneNo: string, Email: string, IsEmailBind: bool, SSOAccount: string, MFlowToken: string, AuthorizedAppModule: List<string> } ``` #### 2. BindingEmailPassword (POST) - **路径**: `/api/MemberUser/BindingEmailPassword` - **HTTP方法**: POST - **描述**: 绑定邮箱密码 - **入参**: `BindingEmailPasswordReq` ```csharp public class BindingEmailPasswordReq { public string pwdhash { get; set; } } ``` - **返回值**: `ResModel` #### 3. CheckEmailPwd (POST) - **路径**: `/api/MemberUser/CheckEmailPwd` - **HTTP方法**: POST - **描述**: 检查邮箱密码 - **入参**: `string hash` (密码哈希) - **返回值**: `ResModel` --- ## 4. PowerController **路径**: `/Areas/API/Controllers/WebApp/PowerController.cs` **命名空间**: `BEMS.Web.Areas.API.Controllers` **基类**: `MemberApiController` **路由前缀**: `api/Power` ### 接口列表 #### 1. SearchImplant (GET) - **路径**: `/api/Power/SearchImplant` - **HTTP方法**: GET - **描述**: 搜索植入单 - **入参**: - `string keyWords` (关键词,可选) - `int pageIndex` (页码,默认1) - `int pageSize` (每页大小,默认10) - **返回值**: `ResModel` (包含植入单列表和总数) #### 2. PacemakersDetails (GET) - **路径**: `/api/Power/PacemakersDetails` - **HTTP方法**: GET - **描述**: 获取起搏器详情(最多3条) - **入参**: `string id` (植入单ID) - **返回值**: `ResModel` (包含起搏器详情列表) #### 3. GetList (GET) - **路径**: `/api/Power/GetList` - **HTTP方法**: GET - **描述**: 获取设备电池列表 - **入参**: - `string keyword` (关键词,可选) - `int pageIndex` (页码,默认1) - `int pageSize` (每页大小,默认10) - **返回值**: `ResModel` (包含设备电池列表和总数) #### 4. GetDetail (GET) - **路径**: `/api/Power/GetDetail` - **HTTP方法**: GET - **描述**: 获取设备电池详情 - **入参**: `string id` (设备电池ID) - **返回值**: `ResModel` (包含主信息、详情和附件) #### 5. Submit (POST) - **路径**: `/api/Power/Submit` - **HTTP方法**: POST - **描述**: 提交设备电池信息 - **入参**: `SubmitModel` - **返回值**: `ResModel` #### 6. UploadAttachment (POST) - **路径**: `/api/Power/UploadAttachment` - **HTTP方法**: POST - **描述**: 上传附件 - **入参**: 文件上传 (FormData) - **返回值**: `ResModel` (包含文件信息) --- ## 5. SICDImplantInfoController **路径**: `/Areas/API/Controllers/WebApp/SICDImplantInfoController.cs` **命名空间**: `BEMS.Web.Areas.API.Controllers` **基类**: `MemberApiController` **路由前缀**: `api/SICDImplant` ### 接口列表 #### 1. GetMyImplantsList (GET) - **路径**: `/api/SICDImplant/MyImplantsSCID` - **HTTP方法**: GET - **描述**: 我的S-ICD植入单列表 - **入参**: - `string ipttype` (植入类型) - `string recordStatus` (记录状态) - `string registrationStatus` (注册状态) - `string subModel` (子型号) - `string subSerial` (子序列号) - `string keyWords` (关键词) - `int pageIndex` (页码,默认1) - `int pageSize` (每页大小,默认10) - **返回值**: `ResModel` (包含植入单列表和总数) #### 2. GetImplantsById (GET) - **路径**: `/api/SICDImplant/ImplantsById` - **HTTP方法**: GET - **描述**: 获取S-ICD植入单详情 - **入参**: `string Id` (植入单ID) - **返回值**: `ResModel` (包含植入单详情) #### 3. DeleteImplantsById (GET) - **路径**: `/api/SICDImplant/DeleteMyImplant` - **HTTP方法**: GET - **描述**: 删除S-ICD植入单 - **入参**: `string Id` (植入单ID) - **返回值**: `ResModel` #### 4. CancelImplantsById (GET) - **路径**: `/api/SICDImplant/CancelMyImplant` - **HTTP方法**: GET - **描述**: 撤销S-ICD植入单 - **入参**: - `string Id` (植入单ID) - `int VersionNumber` (版本号) - **返回值**: `ResModel` #### 5. SaveDraft (POST) - **路径**: `/api/SICDImplant/SaveDraft` - **HTTP方法**: POST - **描述**: 保存筛选单草稿 - **入参**: `SICDImplantMainInfoModel` ```csharp public class SICDImplantMainInfoModel { public string Id { get; set; } public string PatientName { get; set; } public string PatientEnName { get; set; } public string PatientPhoneNotCrypto { get; set; } public string PatientIdCardNotCrypto { get; set; } public string PatientGender { get; set; } public int? PatientHeight { get; set; } public int? PatientWeight { get; set; } public decimal? BMI { get; set; } public string NYHA { get; set; } public string Indication { get; set; } public string Prd_Model { get; set; } public string Prd_SN { get; set; } public DateTime? ImplantDate { get; set; } public string HospitalCode { get; set; } public string HospitalName { get; set; } public string DoctorCode { get; set; } public string DoctorName { get; set; } public string RecordStatus { get; set; } public List<SICDImplant_Detail_ModelSub> ModelList { get; set; } public List<SICDImplant_Attachment_ModelSub> Attachments { get; set; } // ... 更多字段 } ``` - **返回值**: `ResModel` #### 6. Submit (POST) - **路径**: `/api/SICDImplant/Submit` - **HTTP方法**: POST - **描述**: 提交筛选单 - **入参**: `SICDImplantMainInfoModel` (同上) - **返回值**: `ResModel` #### 7. SaveImplateDraft (POST) - **路径**: `/api/SICDImplant/ImplateDraft` - **HTTP方法**: POST - **描述**: 保存植入单草稿 - **入参**: `SICDImplantMainInfoModel` (同上) - **返回值**: `ResModel` #### 8. SaveImplateSubmit (POST) - **路径**: `/api/SICDImplant/ImplateSubmit` - **HTTP方法**: POST - **描述**: 提交植入单 - **入参**: `SICDImplantMainInfoModel` (同上) - **返回值**: `ResModel` #### 9. AdminSubmit (POST) - **路径**: `/api/SICDImplant/AdminSubmit` - **HTTP方法**: POST - **描述**: 管理员修改筛选单 - **入参**: `SICDImplantMainInfoModel` (同上) - **返回值**: `ResModel` #### 10. SaveAdminImplateSubmit (POST) - **路径**: `/api/SICDImplant/AdminImplateSubmit` - **HTTP方法**: POST - **描述**: 管理员修改植入单 - **入参**: `SICDImplantMainInfoModel` (同上) - **返回值**: `ResModel` --- ## 6. WxCommonController **路径**: `/Areas/API/Controllers/WebApp/WxCommonController.cs` **命名空间**: `BEMS.Web.Areas.API.Controllers` **基类**: `ApiController` **路由前缀**: `api/WxCommon` ### 接口列表 #### 1. GetWXAuthorizationToken (GET) - **路径**: `/api/WxCommon/WXAuthorizationToken` - **HTTP方法**: GET - **描述**: 获取微信授权Token - **入参**: - `string code` (微信授权码) - `string account` (账号,可选,用于模拟登录) - **返回值**: `ResModel` (包含Token和用户信息) ```csharp { Token: string, Avatar: string, TrueName: string } ``` #### 2. GetWXConfig (GET) - **路径**: `/api/WxCommon/WXConfig` - **HTTP方法**: GET - **描述**: 获取微信配置信息 - **入参**: `string shareurl` (分享URL) - **返回值**: `ResModel` (包含微信JS-SDK配置信息) -
12-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值