321
This commit is contained in:
parent
bf7c67daa9
commit
b53ae616ff
|
|
@ -95,5 +95,9 @@ namespace CoreCms.Net.IServices
|
|||
Expression<Func<SQReservationParticipants, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
#endregion
|
||||
|
||||
#region 用户支付鸽子费
|
||||
Task Pay(string paymentId);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,5 +113,7 @@ namespace CoreCms.Net.IServices
|
|||
/// <param name="participants">需通知的参与人集合</param>
|
||||
Task NotifyReservationSuccessAsync(SQReservations reservation, IEnumerable<SQReservationParticipants> participants);
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,9 +128,9 @@ namespace CoreCms.Net.Model.Entities
|
|||
public System.String important_data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否需要退款。0 无需退款,未交押金,1 交押金,待退款,2,交押金,退款中,3 退款成功,9退款失败
|
||||
/// 是否需要退款。0 无需退款,未交押金,1 待支付 ,2 已支付 ,9退款失败
|
||||
/// </summary>
|
||||
[Display(Name = "是否需要退款。0 无需退款,未交押金,1 交押金,待退款,2,交押金,退款中,3 退款成功,9退款失败")]
|
||||
[Display(Name = "是否需要退款。0 无需退款,未交押金,1 待支付 ,2 已支付 ,9退款失败")]
|
||||
public System.Int32 is_refund { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -145,5 +145,11 @@ namespace CoreCms.Net.Model.Entities
|
|||
/// </summary>
|
||||
[Display(Name = "是否评论过")]
|
||||
public System.Int32 is_evaluation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单id
|
||||
/// </summary>
|
||||
[Display(Name = "订单id")]
|
||||
public string paymentId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace CoreCms.Net.Services
|
|||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
|
||||
private readonly ISQReservationParticipantsServices _sqReservationParticipantsServices;
|
||||
private readonly ICoreCmsSettingServices _settingServices;
|
||||
private readonly ICoreCmsUserBalanceServices _userBalanceServices;
|
||||
private readonly ICoreCmsFormSubmitServices _formSubmitServices;
|
||||
|
|
@ -81,6 +81,7 @@ namespace CoreCms.Net.Services
|
|||
, ICoreCmsUserServicesOrderServices userServicesOrderServices
|
||||
, ICoreCmsUserWeChatInfoServices userWeChatInfoServices
|
||||
, IOptions<WeChatOptions> weChatOptions
|
||||
, ISQReservationParticipantsServices sqReservationParticipantsServices
|
||||
)
|
||||
{
|
||||
this._dal = dal;
|
||||
|
|
@ -100,6 +101,7 @@ namespace CoreCms.Net.Services
|
|||
_userServicesOrderServices = userServicesOrderServices;
|
||||
_userWeChatInfoServices = userWeChatInfoServices;
|
||||
_weChatOptions = weChatOptions.Value;
|
||||
_sqReservationParticipantsServices = sqReservationParticipantsServices;
|
||||
}
|
||||
|
||||
#region 生成支付单的时候,格式化支付单明细
|
||||
|
|
@ -699,6 +701,11 @@ namespace CoreCms.Net.Services
|
|||
var id = billPaymentInfo.sourceId.ObjectToInt(0);
|
||||
await _formSubmitServices.Pay(id);
|
||||
}
|
||||
else if (billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.GeZiFei)
|
||||
{
|
||||
//form表单支付
|
||||
await _sqReservationParticipantsServices.Pay(paymentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//::todo 其他业务逻辑
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ namespace CoreCms.Net.Services
|
|||
SpBillCreateIp = entity.ip,
|
||||
NotifyUrl = weChatPayUrl,
|
||||
TradeType = tradeType,
|
||||
OpenId = openId
|
||||
OpenId = openId,
|
||||
TimeExpire= DateTime.Now.AddMinutes(5).ToString("yyyyMMddHHmmss")
|
||||
};
|
||||
|
||||
var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
|
|
@ -19,6 +20,7 @@ using CoreCms.Net.IServices;
|
|||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
|
|
@ -131,7 +133,30 @@ namespace CoreCms.Net.Services
|
|||
{
|
||||
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
||||
}
|
||||
|
||||
public async Task Pay(string paymentId)
|
||||
{
|
||||
var model = await _dal.QueryByClauseAsync(it => it.paymentId == paymentId);
|
||||
if (model == null)
|
||||
{
|
||||
throw new Exception("未找到订单记录");
|
||||
}
|
||||
if (model.status == 1)
|
||||
{
|
||||
model.is_refund = 2;
|
||||
await _dal.UpdateAsync(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
//订单出错
|
||||
throw new Exception("订单状态异常");
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,10 @@ namespace CoreCms.Net.Services
|
|||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.SendWxTemplateMessage, JsonConvert.SerializeObject(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ using ToolGood.Words.internals;
|
|||
using NPOI.SS.Formula.PTG;
|
||||
using NPOI.OpenXmlFormats.Dml;
|
||||
using Humanizer;
|
||||
using Newtonsoft.Json;
|
||||
namespace CoreCms.Net.Web.WebApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -534,7 +535,31 @@ public class SQController : ControllerBase
|
|||
Msg = "该时间段房间已被预约"
|
||||
};
|
||||
}
|
||||
|
||||
string paymentId = "";
|
||||
if (dto.deposit_fee > 0)
|
||||
{
|
||||
var imdata = JsonConvert.DeserializeObject<Dictionary<string, object>>(dto.important_data);
|
||||
if (imdata == null || !imdata.ContainsKey("paymentId") || string.IsNullOrEmpty(imdata["paymentId"].ToString()))
|
||||
{
|
||||
return new WebApiDto()
|
||||
{
|
||||
Code = 500,
|
||||
Data = null,
|
||||
Msg = "押金支付信息错误!"
|
||||
};
|
||||
}
|
||||
//订单编号
|
||||
paymentId = imdata["paymentId"].ToString();
|
||||
}
|
||||
if (string.IsNullOrEmpty(paymentId))
|
||||
{
|
||||
return new WebApiDto()
|
||||
{
|
||||
Code = 500,
|
||||
Data = null,
|
||||
Msg = "生成订单失败!"
|
||||
};
|
||||
}
|
||||
// 5. 创建预约记录
|
||||
var reservation = new SQReservations
|
||||
{
|
||||
|
|
@ -581,7 +606,8 @@ public class SQController : ControllerBase
|
|||
role = 1,
|
||||
status = 0,
|
||||
is_refund = dto.deposit_fee > 0 ? 1 : 0,
|
||||
important_data = dto.important_data
|
||||
important_data = dto.important_data,
|
||||
paymentId = paymentId
|
||||
};
|
||||
await _SQReservationParticipantsServices.InsertAsync(participant);
|
||||
|
||||
|
|
|
|||
|
|
@ -844,6 +844,13 @@
|
|||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.CanCreateSQReservation(CoreCms.Net.Model.ViewModels.SQ.SQReservationsAddDto)">
|
||||
<summary>
|
||||
用户是否可以创建预约(仅校验,不创建)
|
||||
</summary>
|
||||
<param name="dto">创建预约所需参数</param>
|
||||
<returns>返回可否创建及原因</returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.JoinReservation(CoreCms.Net.Model.ViewModels.SQ.SQReservationParticipantsAddDto)">
|
||||
<summary>
|
||||
用户加入预约接口
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user