齐越消息中心
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.5 KiB

using BBWYB.Server.Business;
using Microsoft.Extensions.Configuration;
using QYMessageCenter.Common.Http;
using QYMessageCenter.Common.Log;
using QYMessageCenter.Common.Models;
using QYMessageCenter.Model.DTO;
using System.Configuration;
using System.Threading.Channels;
using Yitter.IdGenerator;
namespace QYMessageCenter.Business
{
public class MessageBusiness : BaseBusiness, IDenpendency
{
private readonly string Key = "BC-652c4236c6ba4083b026e8cfa2e199b1";
public MessageBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, RestApiService restApiService) : base(fsql, nLogManager, idGenerator, restApiService)
{
}
/// <summary>
/// 发送消息
/// </summary>
/// <param name="request"></param>
public void Send(SendMessageRequest request)
{
#region 调用goeasy
var goeasy_httpResult = restApiService.SendRequest("https://rest-hz.goeasy.io/", "v2/pubsub/publish", new
{
appkey = Key,
channel = request.Channel,
content = request.Content
}, null, HttpMethod.Post);
if (goeasy_httpResult.StatusCode != System.Net.HttpStatusCode.OK)
throw new BusinessException($"消息发送失败 httpcode {goeasy_httpResult.StatusCode} conent {goeasy_httpResult.Content}");
#endregion
#region 保存入库
#endregion
}
}
}