public async Task <Order> CreateCourseOrder(Course course) { // 创建订单 var order = new Order { OrderCode = GetOrderMaxCode(OrderSourceType.Course, PayTypeEnum.Alipay), ProductCode = course.CourseCode, ProductId = null, ProductIndate = course.ValidDays, ProductCreateProjectCount = 0, ProductName = course.Title, Price = course.Price, Status = OrderStatusEnum.WaitForPayment, Discounts = 0m, ActualPayment = course.Price, UserId = AbpSession.UserId, UserName = AbpSession.GetUserName(), OrderSourceType = OrderSourceType.Course, CourseId = course.Id }; order = await CreateOrder(order); return(order); }
/// <summary> /// 创建产品框架订单 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <Order> CreateProductOrder(PurchasePayInput input) { var product = await _entityManager.GetProductByCode(input.ProductCode); // 生成ordercode var tradeno = _orderManager.GetOrderMaxCode(input.OrderSourceType, PayTypeEnum.Alipay); // 创建订单 var order = new Order { OrderCode = tradeno, ProductCode = product.Code, ProductId = product.Id, ProductIndate = product.Indate, ProductCreateProjectCount = product.CreateProjectCount, ProductName = product.Name, Price = product.Price, Status = OrderStatusEnum.WaitForPayment, Discounts = 0m, ActualPayment = product.Price, UserId = AbpSession.UserId, UserName = AbpSession.GetUserName(), OrderSourceType = input.OrderSourceType, CourseId = null }; order = await _orderManager.CreateOrder(order); return(order); }
public async Task <GetCurrentLoginInformationsOutput> GetCurrentLoginInformations() { var output = new GetCurrentLoginInformationsOutput { Application = new ApplicationInfoDto { Version = AppVersionHelper.Version, ReleaseDate = AppVersionHelper.ReleaseDate, Features = new Dictionary <string, bool> { { "SignalR", SignalRFeature.IsAvailable }, { "SignalR.AspNetCore", SignalRFeature.IsAspNetCore }, { AbpSession.GetUserName(), true }, { AbpSession.GerUserEmail(), true } } } }; if (AbpSession.TenantId.HasValue) { output.Tenant = ObjectMapper.Map <TenantLoginInfoDto>(await GetCurrentTenantAsync()); } if (AbpSession.UserId.HasValue) { output.User = ObjectMapper.Map <UserLoginInfoDto>(await GetCurrentUserAsync()); } return(output); }
/// <summary> /// 通过腾讯课程的order订单编码激活52abp的课程 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task SyncTencentOrderToL52ABPCourseOrder(EntityDto <long> input) { var tencentInfo = await _entityRepository.GetAll().FirstOrDefaultAsync(a => a.OrderNumber == input.Id); if (tencentInfo != null) { if (tencentInfo.TradingStatus == "支付成功") { await _entityManager.SyncTencentOrderToL52ABPCourseOrder(tencentInfo); } } else { throw new UserFriendlyException($"您好,{AbpSession.GetUserName()},订单号:{input.Id}我们从系统中查询不到,请重试。"); } }
public async Task SyncTencentOrderToL52ABPCourseOrder(TencentOrderInfo tencentOrderInfo) { var orderNumber = tencentOrderInfo.OrderNumber.ToString(); var entity = await _orderRepository.FirstOrDefaultAsync(a => a.OrderCode == orderNumber); if (entity != null) { throw new UserFriendlyException("此订单编码已经被使用,如有疑问请联系管理员!"); } var order = new Order { ActualPayment = 0, OrderCode = tencentOrderInfo.OrderNumber.ToString(), ProductName = "【同步】" + tencentOrderInfo.CourseTitle, ProductCode = "030015602643300001", Price = 0, Discounts = 0 }; order.ActualPayment = 0; order.Status = OrderStatusEnum.ChangeHands; order.ProductCreateProjectCount = 0; order.UserId = AbpSession.UserId; order.UserName = AbpSession.GetUserName(); order.CourseId = 1; order.OrderSourceType = OrderSourceType.Course; try { await _orderRepository.InsertAsync(order); tencentOrderInfo.IsQqGroupChecked = true; tencentOrderInfo.Is52AbpChecked = true; await _tencentOrderInfoRepository.UpdateAsync(tencentOrderInfo); } catch (Exception e) { Console.WriteLine(e); throw; } }
protected override void OnAuthentication(AuthenticationContext filterContext) { ViewBag.UserName = AbpSession.GetUserName(); base.OnAuthentication(filterContext); }