public ApiResult <string> CheckMobileValidateCode(CheckMobileValidateCodeReqs reqs) { if (!this.TryValidateModel(reqs)) { return(Anonymous.NewApiResult(ApiStatus.Fail, string.Empty, this.ModelErrorMessage)); } try { var handler = this.commandBus.Send(new DestroyMobileCodeCommand(NewId.GenerateGuid()) { Mobile = reqs.Mobile, UsageType = reqs.UsageType, VCode = reqs.VCode, }); if (handler == null) { return(Anonymous.NewApiResult(ApiStatus.Fail, string.Empty, "验证失败")); } if (handler.Status != CommandHandlerStatus.Success) { return(Anonymous.NewApiResult(ApiStatus.Error, string.Empty, this.HandlerMerssage(handler))); } return(Anonymous.NewApiResult(ApiStatus.Success, string.Empty)); } catch (Exception ex) { this.loggerBuilder.Build(typeof(VCodeController)).Error("check email code error", ex); return(Anonymous.NewApiResult(ApiStatus.Error, string.Empty, ex.GetMessage())); } }
public ApiResult <string> CreateMobileValidateCode(CreateMobileValidateCodeReqs reqs) { if (!this.TryValidateModel(reqs)) { return(Anonymous.NewApiResult(ApiStatus.Fail, string.Empty, this.ModelErrorMessage)); } var max = this.mobileCodeQuery.Max(reqs.Mobile.AsLong()); if (max != null && max.UsageStatus == UsageStatus.未使用 && max.ExpireTime > DateTime.Now) { return(Anonymous.NewApiResult(ApiStatus.Success, string.Empty)); } try { var handler = this.commandBus.Send(new CreateMobileCodeCommand(NewId.GenerateGuid()) { Mobile = reqs.Mobile, UsageType = reqs.UsageType <= 0 ? UsageType.登录 : reqs.UsageType, ClientIP = reqs.ClientIP, Length = reqs.Length, Platform = reqs.Platform, }); if (handler == null) { return(Anonymous.NewApiResult(ApiStatus.Fail, string.Empty, "获取失败")); } if (handler.Status != CommandHandlerStatus.Success) { return(Anonymous.NewApiResult(ApiStatus.Error, string.Empty, this.HandlerMerssage(handler))); } return(Anonymous.NewApiResult(ApiStatus.Success, string.Empty)); } catch (Exception ex) { this.loggerBuilder.Build(typeof(VCodeController)).Error("get email code error", ex); return(Anonymous.NewApiResult(ApiStatus.Error, string.Empty, ex.GetMessage())); } }
/// <summary> /// /// </summary> /// <param name="user"></param> public virtual Task <Token> SignIn(HttpContext context, long user) { var cryptToke = NewId.GenerateString(NewId.StringLength.L24); var userToken = NewId.GenerateGuid().ToString().Replace("-", ""); var accessToken = string.Concat(cryptToke, "|", userToken).To3DES("56dc54a07f3d15a400000155"); var token = new Token() { CryptToken = cryptToke, UserToken = userToken, AccessToken = accessToken }; var oldtoken = this.singleCounter.GetValue(user); if (oldtoken.IsNotNullOrEmpty()) { this.concurrentCounter.RemoveValue(oldtoken); } this.concurrentCounter.SetValue(token.UserToken, user, TimeSpan.FromDays(7)); this.singleCounter.SetValue(user, token.UserToken); return(Task.FromResult(token)); }
/// <summary> /// 将当前激发的消息压入队列中,开始进行按模板的步骤进行工作流,并返回当前模板组织的节点信息 /// </summary> /// <param name="commandType">命令类型,长度不能超过20个字符</param> /// <param name="userSign">用户标识,长度不能超过80个字符</param> /// <param name="templateName"></param> /// <param name="message"></param> /// <returns></returns> public TaskschedNode Push <TWorkStepMessage>(string templateName, string userSign, string commandType, TWorkStepMessage message) where TWorkStepMessage : IWorkStepMessage { var template = this.templateRepository.Get(this.workflowengine.JsonSerializer, templateName); if (template == null) { throw new TemplateNotFoundException("没有找到该{0}模板内容", new[] { templateName }); } if (commandType.IsNullOrWhiteSpace()) { throw new WorkFlowKeyTooLongException("commandType is null"); } if (commandType.Length > 20) { throw new WorkFlowKeyTooLongException("commandType长度超过了20个字符"); } if (userSign.IsNotNullOrEmpty() && userSign.Length > 80) { throw new WorkFlowKeyTooLongException("userSign长度超过了80个字符"); } var task = new TaskschedNode() { TaskId = NewId.GenerateGuid(), ProcessPercent = 0m, StartTime = DateTime.Now.AddSeconds(10), NextStep = 1, Status = TaskschedStatus.Working, UserSign = userSign, UserSignState = this.GetASCII(userSign), CommandType = commandType, StepCount = template.StepCount - 2, }; task.PushMessage = this.SerializeObject(task, message); var nodes = new List <ExecutingNode>(task.StepCount - 2); foreach (var step in template.Steps) { if (step.Order == 0) { continue; } if (step.Order == template.StepCount - 1) { continue; } var node = new ExecutingNode() { TaskId = task.TaskId, StepCount = task.StepCount - 2, RowId = NewId.GenerateGuid(), OrderNo = step.Order, StepType = step.ToStepType(), StepCoordinationMode = step.Mode, StartTime = DateTime.Now, FailTimes = 0, ExecutingMessage = string.Empty, ResultMessage = string.Empty, }; nodes.Add(node); } this.excutingRepository.Save(task, nodes.ToArray()); return(task); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultApiRouteProvider"/> class. /// </summary> /// <param name="A10ContentMatch">The a10 content match.</param> protected DefaultApiRouteProvider(Func <string, bool> A10ContentMatch) { this.A10ContentMatch = A10ContentMatch ?? ((x) => x != null && x.IndexOf("work") > 0); this.Group = NewId.GenerateGuid().ToString(); }
/// <summary> /// 创建一个干净的命令 /// </summary> /// <returns></returns> public static GuidAggregateCommand New() { return(new GuidAggregateCommand(NewId.GenerateGuid())); }