From ecb063a114adccf1e21bc9ec5d0fd533e78d92b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Tue, 23 Apr 2024 11:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Front/CustomerController.cs | 46 ++++++++++++++++--- New_College.Model/Models/QuestionNaire.cs | 29 ++++++++++++ .../ViewModels/UserSettingBaseRequest.cs | 19 ++++++++ .../BASE/IQuestionNaireRepository.cs | 14 ++++++ .../BASE/QuestionNaireRepository.cs | 19 ++++++++ 5 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 New_College.Model/Models/QuestionNaire.cs create mode 100644 New_College.Repository/BASE/IQuestionNaireRepository.cs create mode 100644 New_College.Repository/BASE/QuestionNaireRepository.cs diff --git a/New_College.Api/Controllers/Front/CustomerController.cs b/New_College.Api/Controllers/Front/CustomerController.cs index 1795ab2..a616f2e 100644 --- a/New_College.Api/Controllers/Front/CustomerController.cs +++ b/New_College.Api/Controllers/Front/CustomerController.cs @@ -15,6 +15,7 @@ using New_College.Model; using New_College.Model.Models; using New_College.Model.Request; using New_College.Model.ViewModels; +using New_College.Repository; namespace New_College.Api.Controllers.Front { @@ -27,12 +28,14 @@ namespace New_College.Api.Controllers.Front private readonly ID_UserSettingBaseServices _userSetting; private readonly ICasdoorUserServices _casdoorUserServices; private readonly ID_FansDistributionServices _fansDistributionServices; - public CustomerController(IV_CustomerInfoServices IV_CustomerInfoServices, ID_UserSettingBaseServices userSetting, ICasdoorUserServices casdoorUserServices, ID_FansDistributionServices fansDistributionServices) + private readonly IQuestionNaireRepository _naireRepository; + public CustomerController(IV_CustomerInfoServices IV_CustomerInfoServices, ID_UserSettingBaseServices userSetting, ICasdoorUserServices casdoorUserServices, ID_FansDistributionServices fansDistributionServices, IQuestionNaireRepository questionNaireRepository) { _services = IV_CustomerInfoServices; _userSetting = userSetting; _casdoorUserServices = casdoorUserServices; _fansDistributionServices = fansDistributionServices; + _naireRepository = questionNaireRepository; } @@ -105,11 +108,12 @@ namespace New_College.Api.Controllers.Front } else { - await _services.Add(new V_CustomerInfo() { - - + await _services.Add(new V_CustomerInfo() + { + + + - }); } } @@ -282,7 +286,7 @@ namespace New_College.Api.Controllers.Front var count = (await _fansDistributionServices.Query(e => e.SaleId == saleId)).Count();//判断邀请人数是否满足三个人 if (count >= 3) { - + await _services.UpdateIsVip(saleId); } return true; @@ -498,5 +502,35 @@ namespace New_College.Api.Controllers.Front { return await _services.GetCustomerInfoById(query); } + + + + + /// + /// 问卷保存 + /// + /// + /// + [HttpPost] + public async Task> QuestionNaireSave([FromBody] QuestionNaireDto dto) + { + var count = await _naireRepository.Add(new QuestionNaire() + { + Id = dto.id, + CreateTime = DateTime.Now, + infoList = dto.infoList, + IsDelete = false, + ModifyTime = DateTime.Now, + OrderSort = 0 + }); + return new MessageModel() + { + response = count > 0, + success = true, + msg = "", + status = 200 + }; + } + } } diff --git a/New_College.Model/Models/QuestionNaire.cs b/New_College.Model/Models/QuestionNaire.cs new file mode 100644 index 0000000..cb9a8ad --- /dev/null +++ b/New_College.Model/Models/QuestionNaire.cs @@ -0,0 +1,29 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Model.Models +{ + + /// + /// + /// + public class QuestionNaire : EntityModel + { + + /// + /// + /// + [SugarColumn(IsNullable = false, IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 学校名称 + /// + [SugarColumn(Length = int.MaxValue)] + public string infoList { get; set; } + } +} diff --git a/New_College.Model/ViewModels/UserSettingBaseRequest.cs b/New_College.Model/ViewModels/UserSettingBaseRequest.cs index c468f55..bed9f95 100644 --- a/New_College.Model/ViewModels/UserSettingBaseRequest.cs +++ b/New_College.Model/ViewModels/UserSettingBaseRequest.cs @@ -22,6 +22,25 @@ namespace New_College.Model.ViewModels } + + /// + /// + /// + public class QuestionNaireDto + { + + /// + /// + /// + public int id { get; set; } + + /// + /// + /// + public string infoList { get; set; } + + } + public class UserBaseSettingDto { public int CustomerId { get; set; } diff --git a/New_College.Repository/BASE/IQuestionNaireRepository.cs b/New_College.Repository/BASE/IQuestionNaireRepository.cs new file mode 100644 index 0000000..f39cf3f --- /dev/null +++ b/New_College.Repository/BASE/IQuestionNaireRepository.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 IQuestionNaireRepository : IBaseRepository + { + } +} diff --git a/New_College.Repository/BASE/QuestionNaireRepository.cs b/New_College.Repository/BASE/QuestionNaireRepository.cs new file mode 100644 index 0000000..a1ca814 --- /dev/null +++ b/New_College.Repository/BASE/QuestionNaireRepository.cs @@ -0,0 +1,19 @@ +using New_College.IRepository; +using New_College.IRepository.UnitOfWork; +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 QuestionNaireRepository : BaseRepository, IQuestionNaireRepository + { + public QuestionNaireRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + } +}