Commit e1d8ca03 authored by 席世权's avatar 席世权

推送添加环境参数

parent f9087de0
......@@ -54,7 +54,8 @@ namespace PushApi.Act.BLL
task.Push_AndLink = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.PushAndLink, task.Push_AndLink), data);
task.Push_WebLink = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.PushWebLink, task.Push_WebLink), data);
task.Push_WechatLink = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.PushWechatLink, task.Push_WechatLink), data);
task.EnvType = valModel.EnvType;
if (taskBll.ConfirmSend(task, data))
{
result.DetailedMessage = "发送成功";
......
......@@ -69,5 +69,9 @@ namespace PushApi.Act.Models.Send
/// 推送数据包
/// </summary>
public Dictionary<string, string> DicValue { get; set; }
/// <summary>
/// 环境类型1-生产,2-测试
/// </summary>
public int? EnvType { get; set; } = 1;
}
}
......@@ -455,7 +455,7 @@ namespace PushInfo.Core.BLL
AppPushConfig appCfgModel = JsonUtil.ConvertToObject<AppPushConfig>(appCfg.Config_Info);
if (!string.IsNullOrEmpty(Data.clientID) && !string.IsNullOrEmpty(Data.clientType))
{
result = Send_PushJg(appCfgModel, Data.clientID, Data.clientType, mapProPush.Push_Title, mapProPush.Push_Body, mapProPush.Push_AndLink, mapProPush.Push_IosLink);
result = Send_PushJg(appCfgModel, Data.clientID, Data.clientType, mapProPush);
}
else
{
......@@ -523,11 +523,15 @@ namespace PushInfo.Core.BLL
/// <param name="andActionLink"></param>
/// <param name="iosActionLink"></param>
/// <returns></returns>
public APIResult<string> Send_PushJg(AppPushConfig appCfgModel, string clientId, string clientType, string pushTitle, string pushBody, string andActionLink, string iosActionLink)
public APIResult<string> Send_PushJg(AppPushConfig appCfgModel, string clientId, string clientType, Map_Project_Push mapProPush)
{
var message = new JiguangPushMessage(appCfgModel.AppKey, appCfgModel.MasterSecret);
string pushTitle = mapProPush.Push_Title;
string pushBody = mapProPush.Push_Body;
string andActionLink = mapProPush.Push_AndLink;
string iosActionLink = mapProPush.Push_IosLink;
Dictionary<string, object> extras = new Dictionary<string, object>();
if (clientType.ToLower() == "ios")
if (clientType.ToLower() == "ios" || clientType=="2")
{
if (!string.IsNullOrEmpty(iosActionLink))
{
......@@ -549,6 +553,8 @@ namespace PushInfo.Core.BLL
bool isProd = false;
if (System.Configuration.ConfigurationManager.AppSettings["IsProd"] == "1")
isProd = true;
if(mapProPush.EnvType==2)
isProd = false;
return message.SendPush(new Jiguang.JPush.Model.Audience { RegistrationId = new List<string> { clientId } },
pushTitle, pushBody, intent,
extras, isProd);
......@@ -580,12 +586,12 @@ namespace PushInfo.Core.BLL
{
try
{
//ConfirmSendTask(mapProPush, data);
if (mapProPush.Push_Style.IndexOf(((int)PushStyle.APP).ToString()) > -1)
MqNameTwo = MqName;
else if (mapProPush.Push_Style.IndexOf(((int)PushStyle.极光App).ToString()) > -1)
MqNameTwo = MqNameUrora;
ActiveMQHelper.CreateMQProducer(MqNameTwo, MQMode.Queue, new DataCenterMessage { ObjectID = "", MsgData = mapProPush.ToJson(), MsgSecondData = data.ToJson() }, sendDate);
ConfirmSendTask(mapProPush, data);
//if (mapProPush.Push_Style.IndexOf(((int)PushStyle.APP).ToString()) > -1)
// MqNameTwo = MqName;
//else if (mapProPush.Push_Style.IndexOf(((int)PushStyle.极光App).ToString()) > -1)
// MqNameTwo = MqNameUrora;
//ActiveMQHelper.CreateMQProducer(MqNameTwo, MQMode.Queue, new DataCenterMessage { ObjectID = "", MsgData = mapProPush.ToJson(), MsgSecondData = data.ToJson() }, sendDate);
}
catch (Exception e)
{
......
......@@ -156,7 +156,9 @@ namespace PushInfo.Core.Models.Tables
/// </summary>
[IgnoreColumn]
public Dictionary<string, string> valMap { get; set; }
/// <summary>
/// 环境类型
/// </summary>
public int? EnvType { get; set; }
}
}
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