Commit a5cc0efc authored by liudong1993's avatar liudong1993

1

parent 1634afe0
......@@ -14,6 +14,11 @@ namespace Edu.Common.Enum.WeChat
/// 公众订阅号
/// </summary>
[EnumField("公众订阅号")]
Subscription = 1
Subscription = 1,
/// <summary>
/// 其他
/// </summary>
[EnumField("其他")]
Other = 2
}
}
......@@ -1310,18 +1310,22 @@ namespace Edu.Module.QYWeChat
PublishLogId = pmodel.Id;
}
}
else if (model.Type == ContributeInfoTypeEnum.Image) {
else if (model.Type == ContributeInfoTypeEnum.Image)
{
//图片 自己写推送方法 盛派不支持多图片
var mediumList = contribute_MediumRepository.GetList(new RB_Contribute_Medium_ViewModel() { Group_Id = userInfo.Group_Id, MediumIds = model.ImageMediumIds });
List<int> midsList = JsonHelper.DeserializeObject<List<int>>("[" + model.ImageMediumIds + "]");
List<string> wxMediaId = new List<string>();
foreach (var item in midsList) {
foreach (var item in midsList)
{
string mediaId = mediumList.Where(x => x.Id == item).FirstOrDefault()?.Media_Id ?? "";
if (!string.IsNullOrEmpty(mediaId)) {
if (!string.IsNullOrEmpty(mediaId))
{
wxMediaId.Add(mediaId);
}
}
if (wxMediaId.Any()) {
if (wxMediaId.Any())
{
var pmodel = contribute_PublishLogRepository.GetList(new RB_Contribute_PublishLog_ViewModel() { Group_Id = userInfo.Group_Id, ContributeId = contributeId, PlatfromId = (ContributeConfigTypeEnum)platformId }).FirstOrDefault();
if (pmodel == null)
{
......@@ -1360,7 +1364,8 @@ namespace Edu.Module.QYWeChat
return "推送失败,请联系管理员";
}
}
else if (IsPreview == 2) {//群发
else if (IsPreview == 2)
{//群发
var Rmsg = GZHWeChatHelper.SendImageMessageByTagId(token, tagId, wxMediaId, model.Description, string.IsNullOrEmpty(tagId) ? true : false);
if (Rmsg != null && Rmsg.errcode == Senparc.Weixin.ReturnCode.请求成功)
{
......@@ -1391,7 +1396,8 @@ namespace Edu.Module.QYWeChat
}
}
if (!string.IsNullOrEmpty(Media_Id)) {
if (!string.IsNullOrEmpty(Media_Id))
{
//开始群发推送
try
{
......@@ -1411,13 +1417,15 @@ namespace Edu.Module.QYWeChat
return "推送失败,请联系管理员";
}
}
else if (IsPreview == 2) {
else if (IsPreview == 2)
{
//群发
var Rmsg = GZHWeChatHelper.SendGroupMessageByTagId(token, tagId, Media_Id, PType, string.IsNullOrEmpty(tagId) ? true : false);
if (Rmsg.errcode == Senparc.Weixin.ReturnCode.请求成功)
{
//推送OK 需要记录推送的 Msg_Id 以后用作查询使用
if (PublishLogId > 0) {
if (PublishLogId > 0)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Contribute_PublishLog_ViewModel.Msg_Id), Rmsg.msg_id},
{ nameof(RB_Contribute_PublishLog_ViewModel.Msg_Data_Id), Rmsg.msg_data_id},
......@@ -1447,7 +1455,29 @@ namespace Edu.Module.QYWeChat
}
}
}
else {
else if (configModel.Type == ContributeConfigTypeEnum.Other) {
//查询该平台是否已发布过
var pmodel = contribute_PublishLogRepository.GetList(new RB_Contribute_PublishLog_ViewModel() { Group_Id = userInfo.Group_Id, ContributeId = contributeId, PlatfromId = (ContributeConfigTypeEnum)platformId }).FirstOrDefault();
if (pmodel == null)
{
contribute_PublishLogRepository.Insert(new Model.Entity.WeChat.RB_Contribute_PublishLog()
{
Id = 0,
Content = "发布其他平台",
ContributeId = contributeId,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id,
Media_Id = "",
PlatfromId = configModel.Type,
Status = 0,
UpdateBy = userInfo.Id,
UpdateTime = DateTime.Now
});
}
}
else
{
return "该平台未开通";
}
return "";
......
......@@ -30,6 +30,10 @@ namespace Edu.Repository.WeChat
{
where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.CreateBy > 0)
{
where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
if (demodel.MediaState > 0)
{
where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.MediaState)} ={demodel.MediaState}";
......
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