Пример #1
0
        public FunctionResult <JobToken> Login(string loginKey, string pwd)
        {
            var r = new FunctionResult <JobToken>();

            pwd = Encryption(pwd);
            LoginInfo data = LoginDal.Login(loginKey, pwd);

            if (data != null)
            {
                var jobToken = new JobToken()
                {
                    JobId  = GetJobId(data.UserId),
                    UserId = data.UserId,
                    Token  = GetToken()
                };
                if (JobTokenDal.Add(jobToken) > 0)
                {
                    r.Data = jobToken;
                    RedisService.Set <JobToken>(DefineTable.CacheName, String.Format(JobAuthorityCacheKey.AuthorityCacheKey, jobToken.Token), jobToken);
                }
                else
                {
                    r.ErrorMsg = "无法获取标识";
                }
            }
            else
            {
                r.ErrorMsg = "无匹配用户登陆信息";
            }
            return(r);
        }
Пример #2
0
        public FunctionResult <JobToken> MobileLogin(string mobile, string code)
        {
            var       r    = new FunctionResult <JobToken>();
            LoginInfo data = LoginDal.MobileLogin(mobile, code);

            if (data != null)
            {
                var jobToken = new JobToken()
                {
                    JobId  = GetJobId(data.UserId),
                    UserId = data.UserId,
                    Token  = GetToken()
                };
                if (JobTokenDal.Add(jobToken) > 0)
                {
                    r.Data = jobToken;
                }
                else
                {
                    r.ErrorMsg = "无法获取标识";
                }
            }
            else
            {
                r.ErrorMsg = "无匹配用户登陆信息";
            }
            return(r);
        }
Пример #3
0
        public FunctionResult <JobToken> Create(JobToken info)
        {
            var r = new FunctionResult <JobToken>(); int id = JobTokenDal.Add(info); if (id > 0)

            {
                r.Data = info; r.Data.JobTokenId = id;
            }

            return(r);
        }