Commit 9502602c authored by 黄奎's avatar 黄奎

1111

parent 30c19983
...@@ -2,39 +2,54 @@ ...@@ -2,39 +2,54 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace Edu.Common.Message namespace Edu.Common.Message
{ {
/// <summary> /// <summary>
/// 消息发送 /// 消息队列帮助类
/// </summary> /// </summary>
public class MessageHelper public class MessageHelper : IDisposable
{ {
private readonly ConnectionFactory _factory;
private IConnection _connection;
private IModel _channel;
/// <summary> /// <summary>
/// 获取连接 /// 构造函数
/// </summary> /// </summary>
/// <param name="rabbitConfig">连接配置实体</param> public MessageHelper()
/// <returns></returns> {
private static ConnectionFactory GetConnectionFactory(RabbitConfig rabbitConfig) Int32.TryParse(Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "Port"), out int Port);
RabbitConfig rabbitConfig = new RabbitConfig()
{ {
ConnectionFactory factory = new ConnectionFactory HostName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "HostName"),
Password = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "Password"),
Port = Port,
UserName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "UserName"),
QueenName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "QueenName"),
};
// 设置连接参数
_factory = new ConnectionFactory()
{ {
HostName = rabbitConfig.HostName, HostName = rabbitConfig.HostName,
//默认端口 //默认端口
Port = rabbitConfig.Port, Port = Port,
UserName = rabbitConfig.UserName, UserName = rabbitConfig.UserName,
Password = rabbitConfig.Password, Password = rabbitConfig.Password,
}; };
return factory;
} }
/// <summary> /// <summary>
/// 发送 /// 发送
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
public static void SendMessage(PushMessageModel message) /// <param name="PushAppId"></param>
private void SendMessage(PushMessageModel message)
{ {
try
{
InitConnection();
Int32.TryParse(Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "Port"), out int Port); Int32.TryParse(Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "Port"), out int Port);
RabbitConfig rabbitConfig = new RabbitConfig() RabbitConfig rabbitConfig = new RabbitConfig()
{ {
...@@ -44,6 +59,7 @@ namespace Edu.Common.Message ...@@ -44,6 +59,7 @@ namespace Edu.Common.Message
UserName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "UserName"), UserName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "UserName"),
QueenName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "QueenName"), QueenName = Common.Config.ReadConfigKey("RabbitMqConfig", subKey: "QueenName"),
}; };
string queenName = rabbitConfig.QueenName;
var obj = new var obj = new
{ {
Id = 0,// 主键 Id = 0,// 主键
...@@ -63,43 +79,68 @@ namespace Edu.Common.Message ...@@ -63,43 +79,68 @@ namespace Edu.Common.Message
Status = 0, Status = 0,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
AppId = Common.Config.PushAppId, AppId = Common.Config.PushAppId,
IsRead=0, IsRead = 0,
}; };
Task.Run(() => var body = Encoding.UTF8.GetBytes(Common.Plugin.JsonHelper.Serialize(obj));
{ // 声明队列
try _channel.QueueDeclare(queue: queenName,
durable: true,// 设置为true表示队列是持久化的
exclusive: false,
autoDelete: false,
arguments: null);
IBasicProperties properties = _channel.CreateBasicProperties();
properties.DeliveryMode = 2;
_channel.BasicPublish(exchange: "", routingKey: queenName, basicProperties: properties, body: body);
Common.Plugin.LogHelper.WriteInfo("发送企微消息:" + Common.Plugin.JsonHelper.Serialize(obj));
}
catch (Exception ex)
{ {
using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection()) Common.Plugin.LogHelper.Write(ex, "SendMessage");
}
}
/// <summary>
/// 发送消息
/// </summary>
/// <param name="list"></param>
/// <param name="PushAppId"></param>
public void SendMessage(List<PushMessageModel> list)
{ {
using (IModel channel = conn.CreateModel()) foreach (var item in list)
{ {
//在MQ上定义一个持久化队列,如果名称相同不会重复创建 SendMessage(item);
channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
byte[] buffer = Encoding.UTF8.GetBytes(Common.Plugin.JsonHelper.Serialize(obj));
IBasicProperties properties = channel.CreateBasicProperties();
properties.DeliveryMode = 2;
channel.BasicPublish("", rabbitConfig.QueenName, properties, buffer);
} }
} }
/// <summary>
/// 初始化链接
/// </summary>
private void InitConnection()
{
try
{
if (_connection == null || !_connection.IsOpen)
{
_connection = _factory.CreateConnection();
_channel = _connection.CreateModel();
}
} }
catch (Exception ex) catch (Exception ex)
{ {
Common.Plugin.LogHelper.Write(ex, "RabbitMq_SendMessage"); Common.Plugin.LogHelper.Write(ex, "InitConnection");
} }
});
} }
/// <summary> /// <summary>
/// 批量推送 /// 释放资源
/// </summary> /// </summary>
/// <param name="msgList"></param> public void Dispose()
public static void SendMessage(List<PushMessageModel> msgList)
{ {
foreach (var item in msgList) _channel?.Close();
{ _channel?.Dispose();
SendMessage(item); _connection?.Close();
} _connection?.Dispose();
} }
} }
} }
...@@ -36,7 +36,8 @@ namespace Edu.Common.Plugin ...@@ -36,7 +36,8 @@ namespace Edu.Common.Plugin
Platform = 5, Platform = 5,
ReceiveId = receiveid ReceiveId = receiveid
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> list = new List<Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(list);
} }
} }
} }
...@@ -2184,8 +2184,8 @@ namespace Edu.Module.Course ...@@ -2184,8 +2184,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -2213,7 +2213,8 @@ namespace Edu.Module.Course ...@@ -2213,7 +2213,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -2246,8 +2247,8 @@ namespace Edu.Module.Course ...@@ -2246,8 +2247,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
#region 即将欠费提醒(管理者) #region 即将欠费提醒(管理者)
...@@ -2274,7 +2275,8 @@ namespace Edu.Module.Course ...@@ -2274,7 +2275,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -2307,8 +2309,8 @@ namespace Edu.Module.Course ...@@ -2307,8 +2309,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -2337,7 +2339,8 @@ namespace Edu.Module.Course ...@@ -2337,7 +2339,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -2370,8 +2373,8 @@ namespace Edu.Module.Course ...@@ -2370,8 +2373,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -2400,7 +2403,8 @@ namespace Edu.Module.Course ...@@ -2400,7 +2403,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -2438,7 +2442,8 @@ namespace Edu.Module.Course ...@@ -2438,7 +2442,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
...@@ -2663,8 +2668,8 @@ namespace Edu.Module.Course ...@@ -2663,8 +2668,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -2692,7 +2697,8 @@ namespace Edu.Module.Course ...@@ -2692,7 +2697,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
......
...@@ -1728,7 +1728,8 @@ namespace Edu.Module.Course ...@@ -1728,7 +1728,8 @@ namespace Edu.Module.Course
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
......
...@@ -324,7 +324,8 @@ namespace Edu.Module.Customer ...@@ -324,7 +324,8 @@ namespace Edu.Module.Customer
if (!string.IsNullOrEmpty(queryTargetWorkId)) if (!string.IsNullOrEmpty(queryTargetWorkId))
{ {
modelWork.ReceiveId = queryTargetWorkId; modelWork.ReceiveId = queryTargetWorkId;
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
if (assistList != null && assistList.Count > 0) if (assistList != null && assistList.Count > 0)
...@@ -335,7 +336,8 @@ namespace Edu.Module.Customer ...@@ -335,7 +336,8 @@ namespace Edu.Module.Customer
if (!string.IsNullOrEmpty(queryTargetWorkId)) if (!string.IsNullOrEmpty(queryTargetWorkId))
{ {
modelWork.ReceiveId = queryTargetWorkId; modelWork.ReceiveId = queryTargetWorkId;
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
} }
...@@ -767,7 +769,8 @@ namespace Edu.Module.Customer ...@@ -767,7 +769,8 @@ namespace Edu.Module.Customer
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
} }
......
This diff is collapsed.
...@@ -104,7 +104,7 @@ namespace Edu.Module.Duty ...@@ -104,7 +104,7 @@ namespace Edu.Module.Duty
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
[TransactionCallHandler] [TransactionCallHandler]
public virtual bool SetVisitorReserveModule(RB_Visitor_Reserve_Extend model,out string message) public virtual bool SetVisitorReserveModule(RB_Visitor_Reserve_Extend model, out string message)
{ {
message = ""; message = "";
bool flag; bool flag;
...@@ -138,7 +138,8 @@ namespace Edu.Module.Duty ...@@ -138,7 +138,8 @@ namespace Edu.Module.Duty
{ {
model.ReserveClassId = remodel.ReserveClassId; model.ReserveClassId = remodel.ReserveClassId;
} }
else { else
{
var newFlag = SetReserveClassModule(reserveClass, out string newMsg); var newFlag = SetReserveClassModule(reserveClass, out string newMsg);
if (!newFlag) if (!newFlag)
{ {
...@@ -215,7 +216,7 @@ namespace Edu.Module.Duty ...@@ -215,7 +216,7 @@ namespace Edu.Module.Duty
/// </summary> /// </summary>
/// <param name="Id"></param> /// <param name="Id"></param>
/// <returns></returns> /// <returns></returns>
public bool UpdateVisitorReserveStatusModule(int Id,int ReserveStatus,string Remark) public bool UpdateVisitorReserveStatusModule(int Id, int ReserveStatus, string Remark)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
...@@ -254,7 +255,7 @@ namespace Edu.Module.Duty ...@@ -254,7 +255,7 @@ namespace Edu.Module.Duty
string visitorIds = string.Join(",", visitorList.Select(qitem => qitem.Visitor_Id)); string visitorIds = string.Join(",", visitorList.Select(qitem => qitem.Visitor_Id));
if (!string.IsNullOrEmpty(visitorIds)) if (!string.IsNullOrEmpty(visitorIds))
{ {
stuOrderList= student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel() stuOrderList = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel()
{ {
QStudentIds = visitorIds QStudentIds = visitorIds
}); });
...@@ -264,7 +265,7 @@ namespace Edu.Module.Duty ...@@ -264,7 +265,7 @@ namespace Edu.Module.Duty
foreach (var item in list) foreach (var item in list)
{ {
var tempList = visitorList?.Where(qitem => qitem.ReserveClassId == item.ReserveClassId); var tempList = visitorList?.Where(qitem => qitem.ReserveClassId == item.ReserveClassId);
item.JoinNum = tempList?.Count()??0; item.JoinNum = tempList?.Count() ?? 0;
item.VisitorList = tempList?.ToList() ?? new List<RB_Visitor_Reserve_Extend>(); item.VisitorList = tempList?.ToList() ?? new List<RB_Visitor_Reserve_Extend>();
int OrderCount = 0; int OrderCount = 0;
int failCount = 0; int failCount = 0;
...@@ -310,7 +311,7 @@ namespace Edu.Module.Duty ...@@ -310,7 +311,7 @@ namespace Edu.Module.Duty
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
public bool SetReserveClassModule(RB_Reserve_Class_Extend model,out string message) public bool SetReserveClassModule(RB_Reserve_Class_Extend model, out string message)
{ {
bool flag; bool flag;
message = ""; message = "";
...@@ -368,8 +369,8 @@ namespace Edu.Module.Duty ...@@ -368,8 +369,8 @@ namespace Edu.Module.Duty
var teacherList = accountRepository.GetAccountListRepository(new Model.ViewModel.User.RB_Account_ViewModel() var teacherList = accountRepository.GetAccountListRepository(new Model.ViewModel.User.RB_Account_ViewModel()
{ {
Group_Id = model.Group_Id, Group_Id = model.Group_Id,
QAccountIds = (model?.TeacherId??0) +","+(oldModel?.TeacherId??0), QAccountIds = (model?.TeacherId ?? 0) + "," + (oldModel?.TeacherId ?? 0),
AccountType= Common.Enum.User.AccountTypeEnum.Teacher AccountType = Common.Enum.User.AccountTypeEnum.Teacher
}); });
Common.Message.PushMessageModel pushModel = new Common.Message.PushMessageModel() Common.Message.PushMessageModel pushModel = new Common.Message.PushMessageModel()
{ {
...@@ -382,7 +383,7 @@ namespace Edu.Module.Duty ...@@ -382,7 +383,7 @@ namespace Edu.Module.Duty
SendType = 0, SendType = 0,
Title = "试听课", Title = "试听课",
Platform = 2, Platform = 2,
ReceiveId = (teacherList.Where(qitem=>qitem.AccountId==model.TeacherId)?.FirstOrDefault()?.Id??0).ToString(), ReceiveId = (teacherList.Where(qitem => qitem.AccountId == model.TeacherId)?.FirstOrDefault()?.Id ?? 0).ToString(),
}; };
Common.Message.PushMessageModel pushModel2 = new Common.Message.PushMessageModel() Common.Message.PushMessageModel pushModel2 = new Common.Message.PushMessageModel()
{ {
...@@ -402,7 +403,7 @@ namespace Edu.Module.Duty ...@@ -402,7 +403,7 @@ namespace Edu.Module.Duty
pushModel, pushModel,
pushModel2 pushModel2
}; };
Common.Message.MessageHelper.SendMessage(messageList); new Common.Message.MessageHelper().SendMessage(messageList);
} }
} }
else else
...@@ -431,7 +432,8 @@ namespace Edu.Module.Duty ...@@ -431,7 +432,8 @@ namespace Edu.Module.Duty
}; };
if (flag) if (flag)
{ {
Common.Message.MessageHelper.SendMessage(pushModel); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { pushModel };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
return flag; return flag;
...@@ -492,12 +494,12 @@ namespace Edu.Module.Duty ...@@ -492,12 +494,12 @@ namespace Edu.Module.Duty
/// <param name="model"></param> /// <param name="model"></param>
/// <param name="RoomMessage"></param> /// <param name="RoomMessage"></param>
/// <returns></returns> /// <returns></returns>
public bool CheckClassRoomModule(DateTime chooseDateTime, DateTime chooseEndTime, RB_Reserve_Class_Extend model,out string RoomMessage) public bool CheckClassRoomModule(DateTime chooseDateTime, DateTime chooseEndTime, RB_Reserve_Class_Extend model, out string RoomMessage)
{ {
RoomMessage = ""; RoomMessage = "";
var planList = class_PlanRepository.GetClassPlanListExtRepository(new RB_Class_Plan_ViewModel() var planList = class_PlanRepository.GetClassPlanListExtRepository(new RB_Class_Plan_ViewModel()
{ {
ClassRoomId=model.ClassRoomId, ClassRoomId = model.ClassRoomId,
QClassDateStr = Common.ConvertHelper.FormatDate(model.ClassDate), QClassDateStr = Common.ConvertHelper.FormatDate(model.ClassDate),
Group_Id = model.Group_Id Group_Id = model.Group_Id
}); });
...@@ -633,7 +635,8 @@ namespace Edu.Module.Duty ...@@ -633,7 +635,8 @@ namespace Edu.Module.Duty
}; };
if (flag) if (flag)
{ {
Common.Message.MessageHelper.SendMessage(pushModel); List<Common.Message.PushMessageModel> pushList = new List<PushMessageModel>() { pushModel };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
return flag; return flag;
......
...@@ -455,7 +455,8 @@ namespace Edu.Module.User ...@@ -455,7 +455,8 @@ namespace Edu.Module.User
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
...@@ -767,7 +768,8 @@ namespace Edu.Module.User ...@@ -767,7 +768,8 @@ namespace Edu.Module.User
{ {
var queryTargetWorkId = accountModule.GetWorkUserIdModule(customerModel.CreateBy); var queryTargetWorkId = accountModule.GetWorkUserIdModule(customerModel.CreateBy);
modelWork.ReceiveId = queryTargetWorkId; modelWork.ReceiveId = queryTargetWorkId;
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
//if (assistList != null && assistList.Count > 0) //if (assistList != null && assistList.Count > 0)
//{ //{
......
...@@ -143,7 +143,10 @@ namespace Edu.Repository.Course ...@@ -143,7 +143,10 @@ namespace Edu.Repository.Course
}); });
builder = builder.Remove(builder.Length - 1, 1); builder = builder.Remove(builder.Length - 1, 1);
builder.Append("ON DUPLICATE KEY UPDATE CurrentHours=VALUES(CurrentHours);"); builder.Append("ON DUPLICATE KEY UPDATE CurrentHours=VALUES(CurrentHours);");
flag= Execute(builder.ToString()) > 0; flag = Execute(builder.ToString()) > 0;
//builder.Append(@" REPLACE INTO rb_course_chapter (ChapterId, CurrentHours) VALUES(@ChapterId,@CurrentHours)");
//param
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -304,8 +304,8 @@ namespace Edu.Repository.EduTask ...@@ -304,8 +304,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -333,7 +333,8 @@ namespace Edu.Repository.EduTask ...@@ -333,7 +333,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -366,8 +367,8 @@ namespace Edu.Repository.EduTask ...@@ -366,8 +367,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
#region 即将欠费提醒(管理者) #region 即将欠费提醒(管理者)
...@@ -394,7 +395,8 @@ namespace Edu.Repository.EduTask ...@@ -394,7 +395,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -428,7 +430,8 @@ namespace Edu.Repository.EduTask ...@@ -428,7 +430,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -458,7 +461,8 @@ namespace Edu.Repository.EduTask ...@@ -458,7 +461,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -492,8 +496,8 @@ namespace Edu.Repository.EduTask ...@@ -492,8 +496,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -522,7 +526,8 @@ namespace Edu.Repository.EduTask ...@@ -522,7 +526,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
...@@ -560,7 +565,8 @@ namespace Edu.Repository.EduTask ...@@ -560,7 +565,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
...@@ -658,8 +664,8 @@ namespace Edu.Repository.EduTask ...@@ -658,8 +664,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -687,7 +693,8 @@ namespace Edu.Repository.EduTask ...@@ -687,7 +693,8 @@ namespace Edu.Repository.EduTask
Platform = 5, Platform = 5,
ReceiveId = x.WorkUserId ReceiveId = x.WorkUserId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
}); });
} }
#endregion #endregion
......
...@@ -2340,10 +2340,11 @@ namespace Edu.WebApi.Controllers.Course ...@@ -2340,10 +2340,11 @@ namespace Edu.WebApi.Controllers.Course
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
Common.Message.MessageHelper.SendMessage(model); List<Common.Message.PushMessageModel> pushList2 = new List<Common.Message.PushMessageModel>() { model };
new Common.Message.MessageHelper().SendMessage(pushList2);
} }
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
......
...@@ -413,10 +413,10 @@ namespace Edu.WebApi.Controllers.User ...@@ -413,10 +413,10 @@ namespace Edu.WebApi.Controllers.User
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
return ApiResult.Success(); return ApiResult.Success();
} }
else else
...@@ -548,8 +548,8 @@ namespace Edu.WebApi.Controllers.User ...@@ -548,8 +548,8 @@ namespace Edu.WebApi.Controllers.User
Platform = 5, Platform = 5,
ReceiveId = queryTargetWorkId ReceiveId = queryTargetWorkId
}; };
Common.Message.MessageHelper.SendMessage(modelWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
#endregion #endregion
...@@ -578,7 +578,8 @@ namespace Edu.WebApi.Controllers.User ...@@ -578,7 +578,8 @@ namespace Edu.WebApi.Controllers.User
Platform = 5, Platform = 5,
ReceiveId = to ReceiveId = to
}; };
Common.Message.MessageHelper.SendMessage(modelPubWork); List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelPubWork };
new Common.Message.MessageHelper().SendMessage(pushList);
} }
} }
......
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