Commit 98511c35 authored by 黄奎's avatar 黄奎

推送修改

parent 0f1aa015
...@@ -32,9 +32,11 @@ namespace Mall.Common.Plugin ...@@ -32,9 +32,11 @@ namespace Mall.Common.Plugin
return flag; return flag;
} }
string content = string.Format("您有{0}个新订单未支付,请点击链接地址进行支付! ", pushUrlList.Count); string content = string.Format("您有{0}个新订单未支付,请点击链接地址进行支付! ", pushUrlList.Count);
int index = 1;
foreach (var item in pushUrlList) foreach (var item in pushUrlList)
{ {
content += item + " \r\n"; content += string.Format("订单{0}:" + item + " \n", index);
index++;
} }
//请求路径 //请求路径
string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}", access_token); string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}", access_token);
......
...@@ -91,19 +91,24 @@ namespace Mall.WebApi.Controllers.Adapay ...@@ -91,19 +91,24 @@ namespace Mall.WebApi.Controllers.Adapay
Request.Body.Position = 0; Request.Body.Position = 0;
} }
#endregion #endregion
Common.Plugin.LogHelper.Write("请求参数:: responseData" + responseData);
if (!string.IsNullOrEmpty(responseData)) if (!string.IsNullOrEmpty(responseData))
{ {
JObject jobj = JObject.Parse(responseData); JObject jobj = JObject.Parse(responseData);
string openId = jobj.GetStringValue("FromUserName"); string openId = jobj.GetStringValue("FromUserName");
string MsgType = jobj.GetStringValue("MsgType"); string MsgType = jobj.GetStringValue("MsgType");
string Conten = jobj.GetStringValue("Content"); string Content = jobj.GetStringValue("Content");
if (MsgType == "text" && string.IsNullOrEmpty(openId) && !string.IsNullOrEmpty("支付")) Common.Plugin.LogHelper.Write($"请求参数:: openId:{openId} MsgType:{MsgType} Content:{Content}" );
if (MsgType == "text" && !string.IsNullOrEmpty(openId) && !string.IsNullOrEmpty(Content) && Content.Contains("支付"))
{ {
Task.Run(() => Task.Run(() =>
{ {
Common.Plugin.LogHelper.WriteInfo($"消息_推送客服消息:{openId}");
string payInfoKey = CacheManager.DataStatistic.DataConstant.DATA_AliPay_Order + openId; string payInfoKey = CacheManager.DataStatistic.DataConstant.DATA_AliPay_Order + openId;
Common.Plugin.LogHelper.WriteInfo($"消息_推送客服消息:获取缓存");
var zfbPayList = UserReidsCache.GetOrderPay(payInfoKey); var zfbPayList = UserReidsCache.GetOrderPay(payInfoKey);
if (zfbPayList != null && zfbPayList.Count > 0)
{
Common.Plugin.LogHelper.WriteInfo($"消息_推送客服缓存:{JsonHelper.Serialize(zfbPayList)}");
List<string> pushUrlList = new List<string>(); List<string> pushUrlList = new List<string>();
foreach (var item in zfbPayList) foreach (var item in zfbPayList)
{ {
...@@ -112,10 +117,13 @@ namespace Mall.WebApi.Controllers.Adapay ...@@ -112,10 +117,13 @@ namespace Mall.WebApi.Controllers.Adapay
pushUrlList.Add(item.PayInfo); pushUrlList.Add(item.PayInfo);
} }
} }
Common.Plugin.LogHelper.WriteInfo($"消息_删除缓存");
//删除缓存 //删除缓存
UserReidsCache.DeleteMiniAppUsetOpenId(payInfoKey); UserReidsCache.DeleteMiniAppUsetOpenId(payInfoKey);
SendMessage(openId, pushUrlList); SendMessage(openId, pushUrlList);
Common.Plugin.LogHelper.WriteInfo($"消息_推送客服消息:{openId} ,地址:{JsonHelper.Serialize(pushUrlList)}"); Common.Plugin.LogHelper.WriteInfo($"消息_推送客服消息:{openId} ,地址:{JsonHelper.Serialize(pushUrlList)}");
}
}); });
} }
} }
...@@ -153,7 +161,7 @@ namespace Mall.WebApi.Controllers.Adapay ...@@ -153,7 +161,7 @@ namespace Mall.WebApi.Controllers.Adapay
System.Threading.Tasks.Task.Run(() => WeiXinReidsCache.Set(miniProgram.MiniAppId, token)); System.Threading.Tasks.Task.Run(() => WeiXinReidsCache.Set(miniProgram.MiniAppId, token));
} }
Common.Plugin.LogHelper.WriteInfo($"SendMessage:{token}"); Common.Plugin.LogHelper.WriteInfo($"SendMessage:{token}");
bool flag = Common.Plugin.WeChatMessageHelper.SendCustomerMessage(token, toUser, targerList, out string message); bool flag = Common.Plugin.WeChatMessageHelper.SendCustomerMessage(token, toUser, pushList, out string message);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment