From 1f2798a5427a56aa1940314c5abb07828e150828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Sat, 11 May 2024 16:39:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=89=E6=96=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=BB=91=E5=AE=9A=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/Query/VipCardQuery.cs | 12 ++++++ New_College.Services/V_VipCardInfoServices.cs | 40 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/New_College.Model/ViewModels/Query/VipCardQuery.cs b/New_College.Model/ViewModels/Query/VipCardQuery.cs index 5548c6c..4996a6b 100644 --- a/New_College.Model/ViewModels/Query/VipCardQuery.cs +++ b/New_College.Model/ViewModels/Query/VipCardQuery.cs @@ -13,6 +13,18 @@ namespace New_College.Model.ViewModels public string CardPwd { get; set; } } + public class OpenVipCardRequest + { + public int CustomerId { get; set; } + + public string CardCode { get; set; } + + public string CardPwd { get; set; } + + public int? TenantId { get; set; } + } + + public class AutoVipInfoQuery { /// diff --git a/New_College.Services/V_VipCardInfoServices.cs b/New_College.Services/V_VipCardInfoServices.cs index 9802868..5b250dd 100644 --- a/New_College.Services/V_VipCardInfoServices.cs +++ b/New_College.Services/V_VipCardInfoServices.cs @@ -88,6 +88,46 @@ namespace New_College.Services } } + + /// + ///三方接口绑定卡 + /// + /// + /// + public async Task> OpemBindCardInfo(OpenVipCardRequest query) + { + + var cardinfo = (await _dal.Query(x => x.IsDelete == false && x.Code == query.CardCode && x.Pwd == query.CardPwd)).FirstOrDefault(); + if (cardinfo == null || cardinfo != null && cardinfo.IsBind == 1) + return new MessageModel() { success = false, msg = "会员卡号有误或已被绑定" }; + cardinfo.IsBind = 1; + cardinfo.ModifyTime = DateTime.Now; + cardinfo.EndTime = DateTime.Now.AddDays(cardinfo.Day); + var result = await _dal.Update(cardinfo); + if (result == false) + return new MessageModel() { success = false, msg = "绑定失败" }; + var baseResult = await v_OrderInfoRepository.Add(new V_OrderInfo + { + out_trade_no = query.CustomerId + query.CardCode, + TenantId = query.TenantId, + // PayType = 2, + CardTypeId = cardinfo.CardTypeId, + Status = EnumOrderType.payoff, + CustomerId = query.CustomerId, + Price = cardinfo.Money, + PayPrice = cardinfo.Money, + Name = "六纬志愿VIP绑定", + CardNo = query.CardCode, + CardId = cardinfo.Id + }); + return new MessageModel() + { + msg = "ok", + response = true, + success = true, + }; + } + ///// ///// 绑定卡 添加卡 /////