Ejemplo n.º 1
0
        public UserModule(IUserMapper userMapper, IUserBaseService userBaseService)
        {
            //获取新增用户
            Post["/user/add"] = x =>
            {
                var entity   = this.Bind <UserBase>();
                var isRepeat = userBaseService.GetUserBase(entity.UserName) == null;
                if (!isRepeat)
                {
                    return(Response.AsErrorJson("用户名重复!"));
                }

                var data = userBaseService.AddUserBase(entity);
                return(Response.AsSuccessJson(data));
            };

            //初始化默认用户
            Post["/user/initDefault"] = x =>
            {
                var entity = new UserBase
                {
                    UserName = "******",
                    Password = "******"
                };
                userBaseService.AddUserBase(entity);

                return(Response.AsSuccessJson(entity));
            };
        }
Ejemplo n.º 2
0
 public ChargeController(IChargeService ChargeService, IUserService userService, IUserBaseService userBaseService, IAppLogService appLogService)
 {
     _chargeService   = ChargeService;
     _userService     = userService;
     _userBaseService = userBaseService;
     _currentUserId   = _userService.GetCurrentUserId();
     _appLogService   = appLogService;
 }
 public UserBaseController(IUserRoleService iService, IRoleService rService, IUserDetailService aService, IUserBaseService uService, ICompanyService cService, IDeptService dService)
 {
     userDetailService    = aService;
     userBaseService      = uService;
     companyService       = cService;
     deptService          = dService;
     roleService          = rService;
     userRoleIndexService = iService;
 }
 //////////////////////////////////
 public UserBaseController(IUserBaseService userBaseService, IUserService userService, ISendgridService sendgridService, IErrorLogService errorLogService, IGmailService gmailService, IEmailTemplate emailTemplate)
 {
     _userBaseService = userBaseService;
     _userService     = userService;
     _sendgridService = sendgridService;
     _gmailService    = gmailService;
     _errorLogService = errorLogService;
     _emailTemplate   = emailTemplate;
 }
Ejemplo n.º 5
0
        public UserModule(IUserMapper userMapper, IUserBaseService userBaseService)
        {
            //获取新增用户
            Post["/user/add"] = x =>
            {
                var entity = this.Bind <UserBase>();
                entity.Id         = Guid.NewGuid().ToString();
                entity.CreateTime = DateTime.Now;

                var data = userBaseService.AddUserBase(entity);
                return(Response.AsSuccessJson(data));
            };
        }
        public AuthModule(IUserMapper userMapper, IUserBaseService userBaseService)
        {
            Post["/auth/login"] = x =>
            {
                var userOAuthRequest = this.Bind <UserOAuthRequest>();
                if (userOAuthRequest == null)
                {
                    return(Response.AsErrorJson("非法访问!"));
                }

                //todo 暂不进行dto验证 默认登录成功
                //设置token并返回结果集
                var token             = userMapper.GenerateToken(userOAuthRequest.AccountNumber);
                var userOAuthResponse = new UserOAuthResponse
                {
                    AccessToken   = token,
                    AccountNumber = userOAuthRequest.AccountNumber
                };
                return(Response.AsSuccessJson(userOAuthResponse));
            };
        }
Ejemplo n.º 7
0
 public ChargeService(IEmailMessenger emailMessenger, IEmailTemplateService emailTemplateService, IUserBaseService userBaseService)
 {
     _emailMessenger       = emailMessenger;
     _emailTemplateService = emailTemplateService;
     _userBaseService      = userBaseService;
 }