Example #1
0
        public string ConsoLogin(string code, string account, string password, string loginIp)
        {
            if (string.IsNullOrEmpty(code))
            {
                throw new CustomException(400, "请输入商户号!");
            }
            if (string.IsNullOrEmpty(account))
            {
                throw new CustomException(400, "请输入登录帐号!");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new CustomException(400, "请输入密码");
            }
            AuthService auth   = new AuthService(this.businessmanRepository);
            var         result = auth.Login(new LoginParames()
            {
                Code = code.Trim(), Password = password, Account = account.Trim(), LoginIP = loginIp, BusinessmanType = 1
            },
                                            identity =>
            {
                MessagePushManager.Send(code, account, Common.Enums.EnumPushCommands.RepeatLogin, c_NeedSignOut);
                //退出
                Exit(identity);
            });

            BehaviorStatService.SaveLoginBehaviorStat(result.Token, EnumBehaviorOperate.LoginCount);
            return(result.Token);
        }
Example #2
0
        public string Login(string code, string account, string password)
        {
            if (string.IsNullOrEmpty(code))
            {
                throw new CustomException(400, "请输入商户号!");
            }
            if (string.IsNullOrEmpty(account))
            {
                throw new CustomException(400, "请输入登录帐号!");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new CustomException(400, "请输入密码");
            }
            RemoteEndpointMessageProperty endpoint = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            AuthService auth   = new AuthService(this.businessmanRepository);
            var         result = auth.Login(new LoginParames()
            {
                Code = code.Trim(), Password = password, Account = account.Trim(), LoginIP = endpoint.Address
            },
                                            identity =>
            {
                MessagePushManager.Send(code, account, Common.Enums.EnumPushCommands.RepeatLogin, c_NeedSignOut);
                //退出
                Exit(identity);
            });

            BehaviorStatService.SaveLoginBehaviorStat(result.Token, EnumBehaviorOperate.LoginCount);
            return(result.Token);
        }