Commit 38ebfa64 authored by 吴春's avatar 吴春

提交代码

parent 806f4877
......@@ -104,7 +104,7 @@ namespace Mall.Model.Entity.Point
/// <summary>
/// 版本来源 0默认商城 1教育
/// 版本来源 0默认商城 1教育,2-相亲
/// </summary>
public int? VersionSource { get; set; }
......
......@@ -251,13 +251,22 @@ namespace Mall.Module.Education
UserId = model.UserId,
Type = Common.Enum.MarketingCenter.RecordTypeEnum.Income,
PonitNum = model.PonitNum + model.GivePoint,
Description = "在线购买" + model.PonitNum + "点" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint+"点") : ""),
// Description = "在线购买" + model.PonitNum + "点" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint+"点") : ""),
CreateDate = newModel.PaymentTime,
TenantId = model.TenantId,
MallBaseId = model.MallBaseId,
Remarks = "订单号:" + model.OrderNo + "在线购买支付" + model.Income + "元" + model.PonitNum + "点" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint + "点") : ""),
// Remarks = "订单号:" + model.OrderNo + "在线购买支付" + model.Income + "元" + model.PonitNum + "点" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint + "点") : ""),
PlatformType = model.OrderSource
};
if (model.VersionSource == 2)
{
memberBalanceModel.Description = "在线购买" + model.PonitNum + "星" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint + "星") : "");
memberBalanceModel.Remarks = "订单号:" + model.OrderNo + "在线购买支付" + model.Income + "元" + model.PonitNum + "星" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint + "星") : "");
}
else {
memberBalanceModel.Description = "在线购买" + model.PonitNum + "点" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint + "点") : "");
memberBalanceModel.Remarks = "订单号:" + model.OrderNo + "在线购买支付" + model.Income + "元" + model.PonitNum + "点" + (model.GivePoint > 0 ? ("赠送" + model.GivePoint + "点") : "");
}
memberPointBalanceRepository.Insert(memberBalanceModel, trans);
flag = pointOrderRepository.Update(fileds, auditrecordWhereHelpers, trans);
......
......@@ -202,7 +202,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
#region 点数充值
#region 点数充值(教育线上约课)
/// <summary>
/// 微信支付
/// </summary>
......@@ -589,5 +589,96 @@ namespace Mall.WebApi.Controllers.AppletWeChat
return ApiResult.Success("");
}
#endregion
#region 星星充值(相亲)
/// <summary>
/// 微信支付
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetStarsPayInfo()
{
var request = RequestParm;
var userInfo = AppletUserInfo;
if (userInfo == null)
{
return ApiResult.Failed("请登录");
}
RB_Point_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Point_Order_Extend>(request.msg.ToString());
string sPayInfo = string.Empty;
if (!demodel.PayWay.HasValue)
{
return ApiResult.Failed("请选择支付方式");
}
//查询充值信息
if (!demodel.Income.HasValue)
{
return ApiResult.Failed("请传入星星购买金额");
}
//查询用户的openId
var userModel = userModule.GetMemberUserEntityModule(new RB_Member_User_Extend { MallBaseId = userInfo.MallBaseId, TenantId = userInfo.TenantId, Id = userInfo.UserId });
if (userModel == null)
{
return ApiResult.Failed("用户不存在");
}
string payGoodsName = "购买星星";
var rechargeRulesModel = pointModule.GetPointGoodsList(new Model.Extend.Point.RB_Point_Goods_Extend { MallBaseId = userInfo.MallBaseId, TenantId = userInfo.TenantId, ID = demodel.PointGoodsId }).FirstOrDefault();
if (rechargeRulesModel == null)
{
return ApiResult.Failed("选择的星星产品不存在");
}
if (demodel.PointGoodsId > 0)
{
if (demodel.Income.Value != Convert.ToDecimal(rechargeRulesModel.SellingPrice.Value))
{
return ApiResult.Failed("购买星星金额与设定的金额不符");
}
demodel.PonitNum = rechargeRulesModel.PonitNum;
demodel.OldPonitNum = userModel.PointNum;
demodel.GivePoint = rechargeRulesModel.GivePoint;
}
else
{
return ApiResult.Failed("星星产品不存在");
}
Random R = new Random();
int Rstr = R.Next(111, 999);
demodel.OrderNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + Rstr;
demodel.State = 0;
demodel.CreateDate = System.DateTime.Now;
demodel.PaymentWay = Common.Enum.Goods.OrderPaymentTypeEnum.OnlinePayment;
demodel.OrderStatus = 1;
demodel.VersionSource = 2;
demodel.UserId = userInfo.UserId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.TenantId = userInfo.TenantId;
demodel.OrderSource = userModel.Source;
//新增充值记录
int rechargeId = pointModule.SetPointOrder(demodel);
if (rechargeId == 0)
{
return ApiResult.Failed("购买星星失败");
}
string sOrderNo = (DateTime.Now.ToString("yyyyMMddHHmmssfff")) + rechargeId;
//根据订单号获取微信支付配置信息
RB_MiniProgram_Extend miniProgram = new RB_MiniProgram_Extend(); //2020年5月26号新增
miniProgram = programModule.GetMiniProgramModule(new RB_MiniProgram_Extend { MallBaseId = userInfo.MallBaseId, TenantId = userInfo.TenantId });
App_Code.PayUtil payUtil = new App_Code.PayUtil();
switch ((int)demodel.PayWay)
{
case 1://微信支付
sPayInfo = App_Code.PayUtil.GetMinUnifiedOrder(sOrderNo, payGoodsName, Convert.ToDecimal(demodel.Income), userInfo.UserId.ToString(), userModel.OpenId, (Config.sTenpayPointNotify + "/" + demodel.MallBaseId + "/" + demodel.TenantId), miniProgram, _accessor, System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList.FirstOrDefault(address => address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)?.ToString());
break;
default:
break;
}
return ApiResult.Success("", sPayInfo);
}
#endregion
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment