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, + }; + } + ///// ///// 绑定卡 添加卡 /////