From 99901ec2a00fa28726efc6732fe7053e3d5e09db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Fri, 1 Mar 2024 10:22:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E7=B2=89=E4=B8=9D?= =?UTF-8?q?=E8=A3=82=E5=8F=98Id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Front/CustomerController.cs | 40 ++++++++++++++++++- New_College.Api/New_College.Model.xml | 15 +++++++ .../ID_FansDistributionServices.cs | 18 +++++++++ .../Models/D_FansDistribution.cs | 27 +++++++++++++ .../Request/DecryptUserInfoRequest.cs | 4 +- .../BASE/D_FansDistributionRepository.cs | 21 ++++++++++ .../BASE/ID_FansDistributionRepository.cs | 14 +++++++ .../D_FansDistributionServices.cs | 27 +++++++++++++ 8 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 New_College.IServices/ID_FansDistributionServices.cs create mode 100644 New_College.Model/Models/D_FansDistribution.cs create mode 100644 New_College.Repository/BASE/D_FansDistributionRepository.cs create mode 100644 New_College.Repository/BASE/ID_FansDistributionRepository.cs create mode 100644 New_College.Services/D_FansDistributionServices.cs diff --git a/New_College.Api/Controllers/Front/CustomerController.cs b/New_College.Api/Controllers/Front/CustomerController.cs index 2e0713b..24b9b36 100644 --- a/New_College.Api/Controllers/Front/CustomerController.cs +++ b/New_College.Api/Controllers/Front/CustomerController.cs @@ -26,11 +26,13 @@ namespace New_College.Api.Controllers.Front private readonly IV_CustomerInfoServices _services; private readonly ID_UserSettingBaseServices _userSetting; private readonly ICasdoorUserServices _casdoorUserServices; - public CustomerController(IV_CustomerInfoServices IV_CustomerInfoServices, ID_UserSettingBaseServices userSetting, ICasdoorUserServices casdoorUserServices) + private readonly ID_FansDistributionServices _fansDistributionServices; + public CustomerController(IV_CustomerInfoServices IV_CustomerInfoServices, ID_UserSettingBaseServices userSetting, ICasdoorUserServices casdoorUserServices, ID_FansDistributionServices fansDistributionServices) { _services = IV_CustomerInfoServices; _userSetting = userSetting; _casdoorUserServices = casdoorUserServices; + _fansDistributionServices = fansDistributionServices; } @@ -198,8 +200,12 @@ namespace New_College.Api.Controllers.Front { try { + + await DistrFanc(request.SaleId, customerinfo.Id); newId = await updatesync(customerinfo.Phone); - }catch (Exception ex) { + } + catch (Exception ex) + { } } return new MessageModel() @@ -210,6 +216,36 @@ namespace New_College.Api.Controllers.Front }; } + + + /// + /// 增加粉丝 + /// + /// + /// + /// + private async Task DistrFanc(int saleId, int fancId) + { + if (saleId > 0) + { + var exist = await _fansDistributionServices.Query(q => q.FansId == fancId); + if (!exist.Any()) + { + await _fansDistributionServices.Add(new D_FansDistribution() + { + CreateTime = DateTime.Now, + IsDelete = false, + OrderSort = 0, + ModifyTime = DateTime.Now, + FansId = fancId, + SaleId = saleId, + }); + return true; + } + } + return false; + } + /// /// 同步合并数据 /// diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index e46d488..416c761 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -210,6 +210,21 @@ + + + 销售分销表 + + + + + 客户Id + + + + + 销售id + + 标签 diff --git a/New_College.IServices/ID_FansDistributionServices.cs b/New_College.IServices/ID_FansDistributionServices.cs new file mode 100644 index 0000000..895e781 --- /dev/null +++ b/New_College.IServices/ID_FansDistributionServices.cs @@ -0,0 +1,18 @@ +using New_College.IServices.BASE; +using New_College.Model.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.IServices +{ + + public interface ID_FansDistributionServices : IBaseServices + { + + + } + +} diff --git a/New_College.Model/Models/D_FansDistribution.cs b/New_College.Model/Models/D_FansDistribution.cs new file mode 100644 index 0000000..3bafcf7 --- /dev/null +++ b/New_College.Model/Models/D_FansDistribution.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Model.Models +{ + + /// + /// 销售分销表 + /// + public class D_FansDistribution : EntityModel + { + + /// + /// 客户Id + /// + public int FansId { get; set; } + + /// + /// 销售id + /// + public int SaleId { get; set; } + + } +} diff --git a/New_College.Model/Request/DecryptUserInfoRequest.cs b/New_College.Model/Request/DecryptUserInfoRequest.cs index dd4f246..55b7e16 100644 --- a/New_College.Model/Request/DecryptUserInfoRequest.cs +++ b/New_College.Model/Request/DecryptUserInfoRequest.cs @@ -26,8 +26,10 @@ namespace New_College.Model.Request public class DecryptUserPhoneRequest { - public string openId { get; set; } + public string openId { get; set; } public string code { get; set; } + public int SaleId { get; set; } + } } diff --git a/New_College.Repository/BASE/D_FansDistributionRepository.cs b/New_College.Repository/BASE/D_FansDistributionRepository.cs new file mode 100644 index 0000000..a1c4c17 --- /dev/null +++ b/New_College.Repository/BASE/D_FansDistributionRepository.cs @@ -0,0 +1,21 @@ +using New_College.IRepository.UnitOfWork; +using New_College.IRepository; +using New_College.Model.Models; +using New_College.Repository.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Repository +{ + + public class D_FansDistributionRepository : BaseRepository, ID_FansDistributionRepository + { + public D_FansDistributionRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + } + +} diff --git a/New_College.Repository/BASE/ID_FansDistributionRepository.cs b/New_College.Repository/BASE/ID_FansDistributionRepository.cs new file mode 100644 index 0000000..70757a6 --- /dev/null +++ b/New_College.Repository/BASE/ID_FansDistributionRepository.cs @@ -0,0 +1,14 @@ +using New_College.IRepository.Base; +using New_College.Model.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Repository +{ + public interface ID_FansDistributionRepository : IBaseRepository + { + } +} diff --git a/New_College.Services/D_FansDistributionServices.cs b/New_College.Services/D_FansDistributionServices.cs new file mode 100644 index 0000000..3b4a1eb --- /dev/null +++ b/New_College.Services/D_FansDistributionServices.cs @@ -0,0 +1,27 @@ +using New_College.IRepository.Base; +using New_College.IServices; +using New_College.Model.Models; +using New_College.Services.BASE; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Services +{ + + /// + /// 销售粉丝统计 + /// + public class D_FansDistributionServices : BaseServices, ID_FansDistributionServices + { + private readonly IBaseRepository _dal; + public D_FansDistributionServices(IBaseRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + } + } + +}