diff --git a/api_v1/Appointment.Api/Appointment.Api/Appointment.Api.csproj b/api_v1/Appointment.Api/Appointment.Api/Appointment.Api.csproj
index 908d29c..8617825 100644
--- a/api_v1/Appointment.Api/Appointment.Api/Appointment.Api.csproj
+++ b/api_v1/Appointment.Api/Appointment.Api/Appointment.Api.csproj
@@ -31,7 +31,7 @@
- Always
+ Never
diff --git a/api_v1/Appointment.Entity/Appointment.Entity.csproj b/api_v1/Appointment.Entity/Appointment.Entity.csproj
index e32549a..c04a1e5 100644
--- a/api_v1/Appointment.Entity/Appointment.Entity.csproj
+++ b/api_v1/Appointment.Entity/Appointment.Entity.csproj
@@ -32,7 +32,7 @@
- Always
+ Never
diff --git a/api_v1/Appointment.Entity/Utility/AizhuhotelHelper.cs b/api_v1/Appointment.Entity/Utility/AizhuhotelHelper.cs
index 5bf5d15..0752396 100644
--- a/api_v1/Appointment.Entity/Utility/AizhuhotelHelper.cs
+++ b/api_v1/Appointment.Entity/Utility/AizhuhotelHelper.cs
@@ -1,4 +1,5 @@
-using Newtonsoft.Json;
+using Google.Protobuf.WellKnownTypes;
+using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
@@ -6,6 +7,7 @@ using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
+using System.Xml.Linq;
namespace Appointment.Entity
{
@@ -441,7 +443,7 @@ namespace Appointment.Entity
}
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
string retString = reader.ReadToEnd();
- _logger.Info("-->" + itemMsg);
+ _logger.Info("-->" + itemMsg + " response-->" + retString);
if (!string.IsNullOrWhiteSpace(retString))
{
@@ -464,5 +466,76 @@ namespace Appointment.Entity
if (msg.Length > 0) _logger.Error(msg.ToString());
}
+
+ public static ApiResult SendTempMsg(string msg)
+ {
+ try
+ {
+ string accessTokenMode = BaseConfig.App(new string[] { "AccessTokenMode" });
+ if (string.IsNullOrWhiteSpace(accessTokenMode))
+ {
+ _logger.Error("配置文件中未获取有效的AccessTokenMode");
+ return ApiResult.Failed("配置文件中未获取有效的AccessTokenMode");
+ }
+
+ // 获取 AccessToken
+ string access_token = string.Empty;
+ for (int i = 0; i < 3; i++)
+ {
+ ApiResult tokenResult = null;
+ if (i == 0)
+ {
+ tokenResult = accessTokenMode == "1" ? AizhuhotelGetAccesstoken() : GetAccessToken();
+ }
+ else
+ {
+ tokenResult = accessTokenMode == "1" ? AizhuhotelGetAccesstoken() : GetAccessToken(true);
+ }
+ if (tokenResult.IsSuccess && !string.IsNullOrEmpty(tokenResult.Info))
+ {
+ access_token = tokenResult.Info;
+ break;
+ }
+ Thread.Sleep(500);
+ }
+ if (string.IsNullOrWhiteSpace(access_token)) return ApiResult.Failed("未获取有效的AccessToken");
+
+ // 推送消息
+ var postUrl = $"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={access_token}";
+ HttpWebRequest request = (HttpWebRequest)WebRequest.Create(postUrl);
+ request.Proxy = null;
+ request.Method = "POST";
+ request.ContentType = "application/json";
+ using (StreamWriter dataStream = new StreamWriter(request.GetRequestStream()))
+ {
+ dataStream.Write(msg);
+ dataStream.Close();
+ }
+ HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+ string encoding = response.ContentEncoding;
+ if (encoding == null || encoding.Length < 1)
+ {
+ encoding = "UTF-8"; //默认编码
+ }
+ StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
+ string retString = reader.ReadToEnd();
+ _logger.Info("-->" + msg + " response-->" + retString);
+ if (!string.IsNullOrWhiteSpace(retString))
+ {
+ var sendTemplateMsgRes = JsonConvert.DeserializeObject(retString);
+ if (sendTemplateMsgRes.Errmsg.ToLower() == "ok")
+ {
+ return ApiResult.Success(string.Empty);
+ }
+ }
+ return ApiResult.Failed(msg: "", info: retString);
+
+ }
+ catch (Exception ex)
+ {
+ _logger.Debug(ex.ToString());
+ return ApiResult.Failed(msg: "", info: ex.Message);
+ }
+ }
}
}
diff --git a/api_v1/Appointment.Entity/Utility/WechatHelper.cs b/api_v1/Appointment.Entity/Utility/WechatHelper.cs
index ac07ea1..654d4b4 100644
--- a/api_v1/Appointment.Entity/Utility/WechatHelper.cs
+++ b/api_v1/Appointment.Entity/Utility/WechatHelper.cs
@@ -1,4 +1,5 @@
-using System;
+using Google.Protobuf.WellKnownTypes;
+using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
@@ -9,6 +10,7 @@ namespace Appointment.Entity
public class WechatHelper
{
private static HttpClient _HttpClient = null;
+ static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(WechatHelper));
static WechatHelper()
{
@@ -25,7 +27,7 @@ namespace Appointment.Entity
public ApiResult Code2Session(string code)
{
string appId = BaseConfig.App(new string[] { "WeChat", "AppId" });
- if(string.IsNullOrWhiteSpace(appId)) ApiResult.Failed("缺少配置参数 [AppId]!");
+ if (string.IsNullOrWhiteSpace(appId)) ApiResult.Failed("缺少配置参数 [AppId]!");
string appSecret = BaseConfig.App(new string[] { "WeChat", "AppSecret" });
if (string.IsNullOrWhiteSpace(appSecret)) ApiResult.Failed("缺少配置参数 [AppSecret]!");
@@ -40,6 +42,7 @@ namespace Appointment.Entity
if (res.StatusCode == HttpStatusCode.OK)
{
var result = Encoding.Default.GetString(res.Content.ReadAsByteArrayAsync().Result);
+ log.Info($"jscode2session:{result}");
if (string.IsNullOrWhiteSpace(result) || result.IndexOf("session_key") == -1)
{
return ApiResult.Failed("调用微信接口失败,可能code已失效");
@@ -58,7 +61,7 @@ namespace Appointment.Entity
//
public class LoveInnGetAccessTokenReq
- {
+ {
public string AppId { get; set; }
public string AppName { get; set; }
diff --git a/api_v1/Appointment.IRepository/Appointment.IRepository.csproj b/api_v1/Appointment.IRepository/Appointment.IRepository.csproj
index 5343cfd..35271c3 100644
--- a/api_v1/Appointment.IRepository/Appointment.IRepository.csproj
+++ b/api_v1/Appointment.IRepository/Appointment.IRepository.csproj
@@ -15,7 +15,7 @@
- Always
+ Never
diff --git a/api_v1/Appointment.Repository/Appointment.Repository.csproj b/api_v1/Appointment.Repository/Appointment.Repository.csproj
index b507ecc..9f1207b 100644
--- a/api_v1/Appointment.Repository/Appointment.Repository.csproj
+++ b/api_v1/Appointment.Repository/Appointment.Repository.csproj
@@ -25,7 +25,7 @@
- Always
+ Never
diff --git a/api_v1/Appointment.Repository/ApptRepoJNC.cs b/api_v1/Appointment.Repository/ApptRepoJNC.cs
index 371f054..0fcc64b 100644
--- a/api_v1/Appointment.Repository/ApptRepoJNC.cs
+++ b/api_v1/Appointment.Repository/ApptRepoJNC.cs
@@ -1,6 +1,7 @@
using Appointment.Entity;
using Appointment.Entity.Utility;
using Appointment.IRepository;
+using Google.Protobuf.WellKnownTypes;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlSugar;
@@ -1347,21 +1348,38 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- // v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY
-
- // 审核提醒
- //===========================
- // 资料已提交,请尽快审核 {{first.DATA}}
- // 审核内容:XX资料 审核内容:{{keyword1.DATA}}
- // 时间:2015-06-22 时间:{{keyword2.DATA}}
- // 请尽快审核 {{remark.DATA}}
- //-----------------------------
- // 详情
- //===========================
- string first = $"预定部 {loginUserRes.Info.UserName}取消了您的订单";
- var keyword = new[] { $"{summaryM.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
- string remark = "请注意查看";
- AizhuhotelHelper.SendTemplateMsg(userWxServiceId, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=5", first, remark, keyword);
+ //---------------
+ // {{first.DATA}}
+ // 订单编号:{{OrderSn.DATA}}
+ // 订单状态:{{OrderStatus.DATA}}
+ // {{remark.DATA}}
+ //-----------
+ // 详情 >
+ //---------------
+ // 2024-09-12
+ string appId = BaseConfig.App(new string[] { "WeChat", "AppId" });
+ if (string.IsNullOrWhiteSpace(appId)) ApiResult.Failed("缺少配置参数 [AppId]!");
+ var first = $"预定部 {loginUserRes.Info.UserName}取消了您的订单";
+ var json = new
+ {
+ touser = userWxServiceId,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=5" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summaryM.No },
+ keyword2 = new { value = first },
+ remark = new { value = "请注意查看" }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
}
else
{
@@ -3529,6 +3547,7 @@ namespace Appointment.Repository
DateTime now = DateTime.Now;
string AppId = BaseConfig.App(new string[] { "WeChatService", "AppId" });
string Hotelid = BaseConfig.App(new string[] { "Hotelid" });
+ string appId = BaseConfig.App(new string[] { "WeChat", "AppId" });// 小程序的appid
var userAll = Db.Queryable().ToList().Replace();
var userCreate = userAll.Where(t => t.OpId == summary.UserId).FirstOrDefault();
if (userCreate == null) return;
@@ -3567,9 +3586,37 @@ namespace Appointment.Repository
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
string first = $"{userCreate.OpName}提交了新的预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
string remark = "请尽快审核";
- AizhuhotelHelper.SendTemplateMsg(usersPost.Select(t => t.WxServiceId).ToList(), "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=2", first, remark, keyword);
+ var tousers = usersPost.Select(t => t.WxServiceId).ToList();
+
+ if (tousers != null && tousers.Count > 0)
+ {
+ if (string.IsNullOrWhiteSpace(appId)) ApiResult.Failed("缺少配置参数 [AppId]!");
+
+ foreach (var touser in tousers)
+ {
+ var json = new
+ {
+ touser = touser,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=2" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = $"{summary.BuyerTitle}" },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3596,16 +3643,41 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
- string first = $"预定部{audoter}审核通过了您的预定申请";
+ if (createUserOpenid != null && createUserOpenid.Count > 0)
+ {
+ if (string.IsNullOrWhiteSpace(appId)) ApiResult.Failed("缺少配置参数 [AppId]!");
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
+ string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
+ string first = $"预定部{audoter}审核通过了您的预定申请";
- string remark = "";
- if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
- remark += "后续流程:请等待销售经理审核";
+ string remark = "";
+ if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
+ remark += "后续流程:请等待销售经理审核";
- AizhuhotelHelper.SendTemplateMsg(createUserOpenid, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=7", first, remark, keyword);
+ foreach (var createUserOpenidItem in createUserOpenid)
+ {
+ var json = new
+ {
+ touser = createUserOpenidItem,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=7" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = $"{summary.BuyerTitle}" },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3630,9 +3702,36 @@ namespace Appointment.Repository
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
string first = $"{userCreate.OpName}提交了预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
string remark = "请尽快审核";
- AizhuhotelHelper.SendTemplateMsg(usersPost.Select(t => t.WxServiceId).ToList(), "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=2", first, remark, keyword);
+
+ var tousers = usersPost.Select(t => t.WxServiceId).ToList();
+ if (tousers != null && tousers.Count > 0)
+ {
+ if (string.IsNullOrWhiteSpace(appId)) ApiResult.Failed("缺少配置参数 [AppId]!");
+ foreach (var touser in tousers)
+ {
+ var json = new
+ {
+ touser = touser,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=2" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3659,16 +3758,38 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
- string first = $"销售经理{audoter}审核通过了您的预订申请";
+ if (createUserOpenid != null && createUserOpenid.Count > 0)
+ {
+ string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
+ string first = $"销售经理{audoter}审核通过了您的预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
-
- string remark = "";
- if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
- remark += "后续流程:请等待财务经理审核";
-
- AizhuhotelHelper.SendTemplateMsg(createUserOpenid, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=7", first, remark, keyword);
+ string remark = "";
+ if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
+ remark += "后续流程:请等待财务经理审核";
+ foreach (var item in createUserOpenid)
+ {
+ var json = new
+ {
+ touser = item,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=7" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3692,10 +3813,36 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string first = $"{userCreate.OpName}提交了预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
- string remark = "请尽快审核";
- AizhuhotelHelper.SendTemplateMsg(usersPost.Select(t => t.WxServiceId).ToList(), "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=2", first, remark, keyword);
+ var tousers = usersPost.Select(t => t.WxServiceId).ToList();
+ if (tousers != null && tousers.Count > 0)
+ {
+ string first = $"{userCreate.OpName}提交了预订申请";
+ var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
+ string remark = "请尽快审核";
+ foreach (var touser in tousers)
+ {
+ var json = new
+ {
+ touser = touser,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=2" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3722,16 +3869,40 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
- string first = $"财务经理{audoter}审核通过了您的预订申请";
+ if (createUserOpenid != null && createUserOpenid.Count > 0)
+ {
+ string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
+ string first = $"财务经理{audoter}审核通过了您的预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
+ string remark = "";
+ if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
+ remark += "后续流程:请等待财务总监审核";
+ foreach (var item in createUserOpenid)
+ {
+ var json = new
+ {
+ touser = item,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=7" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
- string remark = "";
- if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
- remark += "后续流程:请等待财务总监审核";
- AizhuhotelHelper.SendTemplateMsg(createUserOpenid, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=7", first, remark, keyword);
}
else
{
@@ -3755,10 +3926,36 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string first = $"{userCreate.OpName}提交了预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
- string remark = "请尽快审核";
- AizhuhotelHelper.SendTemplateMsg(usersPost.Select(t => t.WxServiceId).ToList(), "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=2", first, remark, keyword);
+
+ var tousers = usersPost.Select(t => t.WxServiceId).ToList();
+ if (tousers != null && tousers.Count > 0)
+ {
+ string first = $"{userCreate.OpName}提交了预订申请";
+ string remark = "请尽快审核";
+ foreach (var touser in tousers)
+ {
+ var json = new
+ {
+ touser = touser,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=2" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3785,16 +3982,39 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
- string first = $"财务总监{audoter}审核通过了您的预订申请";
+ if (createUserOpenid != null && createUserOpenid.Count > 0)
+ {
+ string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
+ string first = $"财务总监{audoter}审核通过了您的预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
+ string remark = "";
+ if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
+ remark += "后续流程:请等待总经理审核";
- string remark = "";
- if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
- remark += "后续流程:请等待总经理审核";
-
- AizhuhotelHelper.SendTemplateMsg(createUserOpenid, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=7", first, remark, keyword);
+ foreach (var item in createUserOpenid)
+ {
+ var json = new
+ {
+ touser = item,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=7" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3818,10 +4038,37 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string first = $"{userCreate.OpName}提交了预订申请";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
- string remark = "请尽快审核";
- AizhuhotelHelper.SendTemplateMsg(usersPost.Select(t => t.WxServiceId).ToList(), "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=2", first, remark, keyword);
+ var tousers = usersPost.Select(t => t.WxServiceId).ToList();
+ if (tousers != null && tousers.Count > 0)
+ {
+ string first = $"{userCreate.OpName}提交了预订申请";
+ var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
+ string remark = "请尽快审核";
+
+ foreach (var touser in tousers)
+ {
+ var json = new
+ {
+ touser = touser,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=2" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
}
else
{
@@ -3848,16 +4095,39 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
- string first = $"总经理{audoter}审核通过了您的预订申请";
+ if (createUserOpenid != null && createUserOpenid.Count > 0)
+ {
+ string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
+ string first = $"总经理{audoter}审核通过了您的预订申请";
+ string remark = "";
+ if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
+ remark += "后续流程:请团队来临前生成完成单,以便触发消息推送给相关人员";
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
+ foreach (var item in createUserOpenid)
+ {
+ var json = new
+ {
+ touser = item,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=8" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
+ }
- string remark = "";
- if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"审核评语[{audimM.Remark}],";
- remark += "后续流程:请团队来临前生成完成单,以便触发消息推送给相关人员";
-
- AizhuhotelHelper.SendTemplateMsg(createUserOpenid, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=8", first, remark, keyword);
}
else
{
@@ -3909,43 +4179,64 @@ namespace Appointment.Repository
}
else if (AppId == "wx2b6e92e9e0c6025f") // 香堤湾
{
- // 获取驳回前最后一条审核记录以推理驳回人的角色
- // 因为驳回即发送信息,不做严谨判断了
- var _audimM = Db.Queryable().Where(t => t.ApptId == summary.Id && t.Type == 1 && t.Id != audimM.Id).OrderBy(t => t.Id, OrderByType.Desc).First();
- string zw = "";
-
- switch ((EnumAuditorJncStatus)_audimM.AuditorStatus)
+ if (createUserOpenid != null && createUserOpenid.Count > 0)
{
- case EnumAuditorJncStatus.审核单申请:
- zw = "预定部";
- break;
- case EnumAuditorJncStatus.审核单预定部:
- zw = "销售经理";
- break;
- case EnumAuditorJncStatus.审核单销售经理:
- zw = "财务经理";
- break;
- case EnumAuditorJncStatus.审核单财务经理:
- zw = "财务总监";
- break;
- case EnumAuditorJncStatus.审核单财务总监:
- zw = "总经理";
- break;
- default:
- break;
+ // 获取驳回前最后一条审核记录以推理驳回人的角色
+ // 因为驳回即发送信息,不做严谨判断了
+ var _audimM = Db.Queryable().Where(t => t.ApptId == summary.Id && t.Type == 1 && t.Id != audimM.Id).OrderBy(t => t.Id, OrderByType.Desc).First();
+ string zw = "";
+
+ switch ((EnumAuditorJncStatus)_audimM.AuditorStatus)
+ {
+ case EnumAuditorJncStatus.审核单申请:
+ zw = "预定部";
+ break;
+ case EnumAuditorJncStatus.审核单预定部:
+ zw = "销售经理";
+ break;
+ case EnumAuditorJncStatus.审核单销售经理:
+ zw = "财务经理";
+ break;
+ case EnumAuditorJncStatus.审核单财务经理:
+ zw = "财务总监";
+ break;
+ case EnumAuditorJncStatus.审核单财务总监:
+ zw = "总经理";
+ break;
+ default:
+ break;
+ }
+
+ string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
+ var first = $"{zw}{audoter}驳回了您的预订申请";
+ string remark = "";
+ if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"驳回评语[{audimM.Remark}],";
+ remark += "后续流程:请核对信息进行修改后重新提交";
+
+ foreach (var item in createUserOpenid)
+ {
+ var json = new
+ {
+ touser = item,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=4" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = summary.BuyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = remark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
+ }
}
-
- string audoter = userAll.Where(t => t.OpId == audimM.UserId).FirstOrDefault()?.OpName;
- var first = $"{zw}{audoter}驳回了您的预订申请";
-
-
- var keyword = new[] { $"{summary.BuyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
-
- string remark = "";
- if (!string.IsNullOrEmpty(audimM.Remark)) remark += $"驳回评语[{audimM.Remark}],";
- remark += "后续流程:请核对信息进行修改后重新提交";
-
- AizhuhotelHelper.SendTemplateMsg(createUserOpenid, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=4", first, remark, keyword);
}
else
{
@@ -3975,6 +4266,8 @@ namespace Appointment.Repository
DateTime now = DateTime.Now;
string AppId = BaseConfig.App(new string[] { "WeChatService", "AppId" });
string Hotelid = BaseConfig.App(new string[] { "Hotelid" });
+ string appId = BaseConfig.App(new string[] { "WeChat", "AppId" });
+ if (string.IsNullOrWhiteSpace(appId)) ApiResult.Failed("缺少配置参数 [AppId]!");
if (AppId == "wx3f193488e04b2ed8")
{
string first = "";
@@ -4023,11 +4316,26 @@ namespace Appointment.Repository
}
}
msgremark += "请关注订单信息";
-
- var keyword = new[] { $"{buyerTitle}", now.ToString("yyyy-MM-dd HH:mm") };
-
-
- AizhuhotelHelper.SendTemplateMsg(wxSericeOpenId, "v_IPzOm9JwAFfJdQLWy11eoHZ9CkOb4PaHbOqosGQcY", $"pages/index/index?hotelid={Hotelid}&status=6", first, msgremark, keyword);
+ var json = new
+ {
+ touser = wxSericeOpenId,
+ template_id = "21Qr9bf5k3UlxD3K6EBKjEnxrz8Djiw6TIu6yExMGLg",
+ miniprogram = new
+ {
+ appid = appId, // 小程序appId
+ pagepath = $"pages/index/index?hotelid={Hotelid}&status=6" // 跳转到小程序中的地址
+ },
+ topcolor = "#FF0000",
+ data = new
+ {
+ first = new { value = first },
+ keyword1 = new { value = buyerTitle },
+ keyword2 = new { value = first },
+ remark = new { value = msgremark }
+ }
+ };
+ var msg = JsonConvert.SerializeObject(json);
+ AizhuhotelHelper.SendTempMsg(msg);
}
else
{