diff --git a/New_College.Api/Controllers/Front/WeixinPayController.cs b/New_College.Api/Controllers/Front/WeixinPayController.cs index 5a256f0..c84b56c 100644 --- a/New_College.Api/Controllers/Front/WeixinPayController.cs +++ b/New_College.Api/Controllers/Front/WeixinPayController.cs @@ -10,11 +10,13 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using New_College.Common; +using New_College.Common.Helper; using New_College.IRepository; using New_College.IServices; using New_College.Model; using New_College.Model.Models; using New_College.Model.ViewModels; +using Newtonsoft.Json; namespace New_College.Api.Controllers.Front { @@ -52,12 +54,13 @@ namespace New_College.Api.Controllers.Front var resp = new WeixinPayResult(); try { + DingHookHelper.DingTalkHookMessage("UnifiedOrder=>发起支付", JsonConvert.SerializeObject(query)); Random rd = new Random(); //HttpContext.GetClientUserIp(); //外部商户订单号 var payNum = DateTime.Now.ToString("yyyyMMddHHmmss") + rd.Next(0, 1000).ToString().PadLeft(3, '0'); var data = new WxPayData(); - data.SetValue("body", "壹志愿好帮手VIP购买"); + data.SetValue("body", "六纬志愿VIP购买"); data.SetValue("out_trade_no", payNum); data.SetValue("detail", "志愿好帮手VIP卡购买"); data.SetValue("total_fee", Convert.ToInt32(query.total_fee * 100)); @@ -66,9 +69,9 @@ namespace New_College.Api.Controllers.Front data.SetValue("notify_url", WeixinConfig.NotifyUrl); //data.SetValue("goods_tag", "test"); data.SetValue("trade_type", "JSAPI"); - data.SetValue("openid", query.Phone); + data.SetValue("openid", query.OpenId); //可以将用户Id和订单Id同时封装在attach中 - data.SetValue("attach", string.Format("{0}|{1}", query.Phone, payNum)); + data.SetValue("attach", string.Format("{0}|{1}", query.OpenId, payNum)); WxPayData result = UnifiedOrder(data); if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "") { @@ -98,7 +101,7 @@ namespace New_College.Api.Controllers.Front resp.timeStamp = timeStamp; //NLogHelper.WriteInfo("Signurl" + Newtonsoft.Json.JsonConvert.SerializeObject(resp), DevAuthorNameEnum.Michael, false); // WebHookHelper.WebHookmarkdownSend("Signurl" + Newtonsoft.Json.JsonConvert.SerializeObject(resp)); - var customer = await v_CustomerInfoRepository.Query(x => x.OpenId == query.Phone && x.IsDelete == false); + var customer = await v_CustomerInfoRepository.Query(x => x.OpenId == query.OpenId && x.IsDelete == false); if (customer.Count <= 0) return new WeixinPayResult() { err_code_des = "用户出现错误" }; //添加一张卡 @@ -116,16 +119,18 @@ namespace New_College.Api.Controllers.Front Day = cardtype.Day, EndTime = DateTime.Now.AddDays(cardtype.Day) }); + string OrderNo = OrderGenerateHelper.GenerateOrderNo("ZY"); var baseResult = await v_OrderInfoRepository.Add(new V_OrderInfo { out_trade_no = payNum, - // PayType = 2, + PayType = 0, CardTypeId = query.CardTypeId, - // Status = 1, + OrderId = OrderNo, + Status = EnumOrderType.payment, CustomerId = customer.FirstOrDefault().Id, Price = query.total_fee, PayPrice = query.total_fee, - Name = "壹志愿好帮手VIP购买", + Name = "六纬志愿VIP购买", CardNo = code, CardId = addcard }); @@ -152,10 +157,11 @@ namespace New_College.Api.Controllers.Front /// /// [HttpPost] + [AllowAnonymous] public async Task PayNotify() { logger.LogInformation("开始回调PayNotify"); - + DingHookHelper.DingTalkHookMessage("开始回调PayNotify", "开始回调PayNotify"); WxPayData res = new WxPayData(); //接收从微信后台POST过来的数据 @@ -163,6 +169,7 @@ namespace New_College.Api.Controllers.Front WxPayData data = new WxPayData(); using (var reader = new StreamReader(Request.Body)) { + var builder = reader.ReadToEnd(); //WebHookHelper.WebHookmarkdownSend(builder.ToString()); try @@ -172,7 +179,7 @@ namespace New_College.Api.Controllers.Front catch (Exception ex) { //若签名错误,则立即返回结果给微信支付后台 - + DingHookHelper.DingTalkHookMessage("回调PayNotify", ex.Message); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", ex.Message); // NLogHelper.WriteError("Sign check error : " + res.ToXml(), DevAuthorNameEnum.Michael, false); @@ -185,6 +192,7 @@ namespace New_College.Api.Controllers.Front //检查支付结果中transaction_id是否存在 if (!data.IsSet("transaction_id")) { + DingHookHelper.DingTalkHookMessage("回调PayNotify", "支付结果中微信订单号不存在"); //若transaction_id不存在,则立即返回结果给微信支付后台 res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "支付结果中微信订单号不存在"); @@ -193,12 +201,14 @@ namespace New_College.Api.Controllers.Front } // 执行订单状态操作 string out_trade_no = data.GetValue("out_trade_no").ToString(); - logger.LogInformation("开始回调PayNotify"+ out_trade_no); + logger.LogInformation("开始回调PayNotify" + out_trade_no); + DingHookHelper.DingTalkHookMessage("回调PayNotify", "开始回调PayNotify" + out_trade_no); var info = await v_OrderInfoRepository.Query(x => x.out_trade_no == out_trade_no); if (info.Count <= 0) { res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "在自有平台未找到该订单号"); + DingHookHelper.DingTalkHookMessage("回调PayNotify", "在自有平台未找到该订单号" + out_trade_no); //WebHookHelper.WebHookmarkdownSend("支付结果中微信订单号不存在"); return Content(res.ToXml(), "text/xml"); } @@ -207,6 +217,7 @@ namespace New_College.Api.Controllers.Front var rep = await v_OrderInfoRepository.Update(oneinfo); if (rep) { + DingHookHelper.DingTalkHookMessage("支付回调成功", oneinfo.out_trade_no + ":修改为VIP"); //修改用户信息 修改为VIp var customerinfo = await v_CustomerInfoRepository.QueryById(oneinfo.CustomerId); customerinfo.IsVIP = true; @@ -220,10 +231,11 @@ namespace New_College.Api.Controllers.Front { // string attach = data.GetValue("attach").ToString(); // WebHookHelper.WebHookmarkdownSend(attach); + DingHookHelper.DingTalkHookMessage("回调PayNotify", "在自有平台未找到该订单号" + out_trade_no); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "在自有平台未找到该订单号"); } - + return Content(res.ToXml(), "text/xml"); } diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index 0add842..6afac3c 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -505,6 +505,21 @@ 分类等级 + + + 标签代表人物 + + + + + 人物昵称 + + + + + 人物头像 + + 省id diff --git a/New_College.Api/Startup.cs b/New_College.Api/Startup.cs index fadae71..df47a35 100644 --- a/New_College.Api/Startup.cs +++ b/New_College.Api/Startup.cs @@ -215,7 +215,7 @@ namespace New_College }); // 生成种子数据 - // app.UseSeedDataMildd(myContext, Env.WebRootPath); + // app.UseSeedDataMildd(myContext, Env.WebRootPath); // 开启QuartzNetJob调度服务 app.UseQuartzJobMildd(tasksQzServices, schedulerCenter); //服务注册 diff --git a/New_College.Api/appsettings.json b/New_College.Api/appsettings.json index cb58023..2263d80 100644 --- a/New_College.Api/appsettings.json +++ b/New_College.Api/appsettings.json @@ -7,7 +7,7 @@ //MCHKey "KEY": "brapuk6fon0wachiMlth2t3lb4a0h7ji", //NotifyUrl - "NotifyUrl": "http://*:8082/api/WeixinPay/PayNotify" + "NotifyUrl": "https://zytb.ycymedu.com/api/front/WeixinPay/PayNotify" }, "Logging": { "IncludeScopes": false, diff --git a/New_College.Common/Helper/DingHookHelper.cs b/New_College.Common/Helper/DingHookHelper.cs new file mode 100644 index 0000000..9b6b382 --- /dev/null +++ b/New_College.Common/Helper/DingHookHelper.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Common +{ + public class DingHookHelper + { + /// + /// 钉钉消息推送 + /// + /// + /// + /// + public static void DingTalkHookMessage(string controllername, string message) + { + string title = "weipay"; + DingtalkChatbotSdk.DingDingClient.SendMessageAsync("https://oapi.dingtalk.com/robot/send?access_token=879f3d3511b90d2e13080f0f729d9c65c3e6737de76c6074da3b98f8e432cef0", string.Format("title:{0};message:{1}", title, message)); + + } + } +} diff --git a/New_College.Common/New_College.Common.csproj b/New_College.Common/New_College.Common.csproj index 11f3140..eee5eca 100644 --- a/New_College.Common/New_College.Common.csproj +++ b/New_College.Common/New_College.Common.csproj @@ -11,6 +11,7 @@ + diff --git a/New_College.IServices/ID_TagMapPersonServices.cs b/New_College.IServices/ID_TagMapPersonServices.cs new file mode 100644 index 0000000..fa4c711 --- /dev/null +++ b/New_College.IServices/ID_TagMapPersonServices.cs @@ -0,0 +1,12 @@ +using New_College.IServices.BASE; +using New_College.Model.Models; + +namespace New_College.IServices +{ + /// + /// ID_TagMapPersonServices + /// + public interface ID_TagMapPersonServices :IBaseServices + { + } +} \ No newline at end of file diff --git a/New_College.Model/Models/D_TagMapPerson.cs b/New_College.Model/Models/D_TagMapPerson.cs new file mode 100644 index 0000000..e36c6b7 --- /dev/null +++ b/New_College.Model/Models/D_TagMapPerson.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Model.Models +{ + + /// + /// 标签代表人物 + /// + public class D_TagMapPerson:EntityModel + { + public string Tag { get; set; } + + /// + /// 人物昵称 + /// + public string NickName { get; set; } + + public string Description { get; set; } + + /// + /// 人物头像 + /// + public string AvatarUrl { get; set; } + + } +} diff --git a/New_College.Model/ViewModels/Query/AliPayQuery.cs b/New_College.Model/ViewModels/Query/AliPayQuery.cs index 6fb03a8..7c3b28e 100644 --- a/New_College.Model/ViewModels/Query/AliPayQuery.cs +++ b/New_College.Model/ViewModels/Query/AliPayQuery.cs @@ -11,7 +11,7 @@ namespace New_College.Model.ViewModels { public string OutTradeNo { get; set; } = ""; - public string Body { get; set; } = "壹志愿VIP"; + public string Body { get; set; } = "六纬志愿VIP"; public decimal TotalAmount { get; set; } = 0; diff --git a/New_College.Model/ViewModels/Query/UniOrderQuery.cs b/New_College.Model/ViewModels/Query/UniOrderQuery.cs index bc00175..195e356 100644 --- a/New_College.Model/ViewModels/Query/UniOrderQuery.cs +++ b/New_College.Model/ViewModels/Query/UniOrderQuery.cs @@ -10,6 +10,6 @@ namespace New_College.Model.ViewModels public decimal total_fee { get; set; } - public string Phone { get; set; } + public string OpenId { get; set; } } } diff --git a/New_College.Model/ViewModels/Query/WeChatPayQuery.cs b/New_College.Model/ViewModels/Query/WeChatPayQuery.cs index 7747ed8..231b6c3 100644 --- a/New_College.Model/ViewModels/Query/WeChatPayQuery.cs +++ b/New_College.Model/ViewModels/Query/WeChatPayQuery.cs @@ -63,7 +63,7 @@ namespace New_College.Model.ViewModels /// /// 项目编号 /// - public string Body { get; set; } = "壹志愿VIP"; + public string Body { get; set; } = "六纬志愿VIP"; } diff --git a/New_College.Repository/BASE/D_TagMapPersonRepository.cs b/New_College.Repository/BASE/D_TagMapPersonRepository.cs new file mode 100644 index 0000000..9caa986 --- /dev/null +++ b/New_College.Repository/BASE/D_TagMapPersonRepository.cs @@ -0,0 +1,17 @@ +using New_College.IRepository; +using New_College.IRepository.UnitOfWork; +using New_College.Model.Models; +using New_College.Repository.Base; + +namespace New_College.Repository +{ + /// + /// D_TagMapPersonRepository + /// + public class D_TagMapPersonRepository : BaseRepository, ID_TagMapPersonRepository + { + public D_TagMapPersonRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + } +} \ No newline at end of file diff --git a/New_College.Repository/BASE/ID_TagMapPersonRepository.cs b/New_College.Repository/BASE/ID_TagMapPersonRepository.cs new file mode 100644 index 0000000..af026c8 --- /dev/null +++ b/New_College.Repository/BASE/ID_TagMapPersonRepository.cs @@ -0,0 +1,12 @@ +using New_College.IRepository.Base; +using New_College.Model.Models; + +namespace New_College.IRepository +{ + /// + /// ID_TagMapPersonRepository + /// + public interface ID_TagMapPersonRepository : IBaseRepository + { + } +} \ No newline at end of file diff --git a/New_College.Services/D_TagMapPersonServices.cs b/New_College.Services/D_TagMapPersonServices.cs new file mode 100644 index 0000000..8452a3f --- /dev/null +++ b/New_College.Services/D_TagMapPersonServices.cs @@ -0,0 +1,18 @@ + +using New_College.IServices; +using New_College.Model.Models; +using New_College.Services.BASE; +using New_College.IRepository.Base; + +namespace New_College.Services +{ + public class D_TagMapPersonServices : BaseServices, ID_TagMapPersonServices + { + private readonly IBaseRepository _dal; + public D_TagMapPersonServices(IBaseRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + } + } +} \ No newline at end of file diff --git a/New_College.Services/Test_QuestionInfoServices.cs b/New_College.Services/Test_QuestionInfoServices.cs index 09220c6..e5c96eb 100644 --- a/New_College.Services/Test_QuestionInfoServices.cs +++ b/New_College.Services/Test_QuestionInfoServices.cs @@ -35,35 +35,38 @@ namespace New_College.Services if (info == null) return new List() { }; List list = new List() { }; - if (query.CategoryId == 20) - { - List subject = new List() { "物理", "化学", "生物", "政治", "历史", "地理" }; - int sort = 1; - foreach (var x in subject) - { - foreach (var item in info) - { - list.Add(new appQuestionResult() - { - Id = item.Id, - IsAddScore = item.IsAddScore, - QuestionSort = sort++,// item.OrderSort, - QuestionTag = x, - QuestionTitle = "对于" + x + "," + item.QuestionTitle, - QuestionType = item.QuestionType, - QuestionTypeId = item.QuestionTypeId - }); - } - } - return list; - } + //if (query.CategoryId == 20) + //{ + // List subject = new List() { "物理", "化学", "生物", "政治", "历史", "地理" }; + // int sort = 1; + // foreach (var x in subject) + // { + // foreach (var item in info) + // { + // list.Add(new appQuestionResult() + // { + // Id = item.Id, + // IsAddScore = item.IsAddScore, + // QuestionSort = sort++,// item.OrderSort, + // QuestionTag = x, + // QuestionTitle = "对于" + x + "," + item.QuestionTitle, + // QuestionType = item.QuestionType, + // QuestionTypeId = item.QuestionTypeId + // }); + // } + // } + // return list; + //} + + int k = 0; foreach (var item in info) { + k++; list.Add(new appQuestionResult() { Id = item.Id, IsAddScore = item.IsAddScore, - QuestionSort = item.OrderSort, + QuestionSort = k, QuestionTag = item.QuestionTag, QuestionTitle = item.QuestionTitle, QuestionType = item.QuestionType, diff --git a/New_College.Services/V_OrderInfoServices.cs b/New_College.Services/V_OrderInfoServices.cs index 2bec14c..920ce57 100644 --- a/New_College.Services/V_OrderInfoServices.cs +++ b/New_College.Services/V_OrderInfoServices.cs @@ -288,7 +288,7 @@ namespace New_College.Services viewModel.SpBillCreateIp = PayInfoQuery.CreateIp; viewModel.OutTradeNo = out_trade_no; viewModel.TotalFee = Convert.ToInt32(query.Money*100); - viewModel.Body = "壹志愿VIP"; + viewModel.Body = "六纬志愿VIP"; viewModel.TradeType = "MWEB"; var response = await WeChatPay.GetMwebUrl(_client, _optionsAccessor, viewModel); @@ -306,7 +306,7 @@ namespace New_College.Services CustomerId = query.CustomerId, Price = query.Money, PayPrice = query.Money, - Name = "壹志愿好帮手VIP开通", + Name = "六纬志愿VIP开通", CardNo = "0", CardId = 0 }); @@ -592,8 +592,8 @@ namespace New_College.Services //或者失败 var model = new AlipayTradeWapPayModel { - Body = "壹志愿VIP", - Subject = "壹志愿VIP", + Body = "六纬志愿VIP", + Subject = "六纬志愿VIP", TotalAmount = query.Money.ToString(), OutTradeNo = out_trade_no, ProductCode = "QUICK_WAP_WAY", @@ -620,7 +620,7 @@ namespace New_College.Services CustomerId = query.CustomerId, Price = query.Money, PayPrice = query.Money, - Name = "壹志愿好帮手VIP开通", + Name = "六纬志愿VIP开通", CardNo = "0", CardId = 0 }); diff --git a/New_College.Services/V_VipCardInfoServices.cs b/New_College.Services/V_VipCardInfoServices.cs index 72c5467..d53cbfd 100644 --- a/New_College.Services/V_VipCardInfoServices.cs +++ b/New_College.Services/V_VipCardInfoServices.cs @@ -62,7 +62,7 @@ namespace New_College.Services CustomerId = query.CustomerId, Price = cardinfo.Money, PayPrice = cardinfo.Money, - Name = "壹志愿好帮手VIP绑定", + Name = "六纬志愿VIP绑定", CardNo = query.CardCode, CardId = cardinfo.Id });