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

新增阿里云短信推送

parent e1d8ca03
...@@ -47,6 +47,7 @@ namespace PushApi.Act.BLL ...@@ -47,6 +47,7 @@ namespace PushApi.Act.BLL
data.mobile = valModel.Mobile; data.mobile = valModel.Mobile;
data.openId = valModel.OpenId; data.openId = valModel.OpenId;
data.dicValue = valModel.DicValue; data.dicValue = valModel.DicValue;
data.TemplateParam = valModel.TemplateParam;
task.Push_Title = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.PushTitle, task.Push_Title), data); task.Push_Title = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.PushTitle, task.Push_Title), data);
task.Push_Body = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.PushBody, task.Push_Body), data); task.Push_Body = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.PushBody, task.Push_Body), data);
task.Wx_MsmTemp = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.WxMsmTemp, task.Wx_MsmTemp), data); task.Wx_MsmTemp = PushValueHelp.TransfOfDataModel(StringUtil.ExtractNotEmtry(valModel.WxMsmTemp, task.Wx_MsmTemp), data);
......
...@@ -73,5 +73,9 @@ namespace PushApi.Act.Models.Send ...@@ -73,5 +73,9 @@ namespace PushApi.Act.Models.Send
/// 环境类型1-生产,2-测试 /// 环境类型1-生产,2-测试
/// </summary> /// </summary>
public int? EnvType { get; set; } = 1; public int? EnvType { get; set; } = 1;
/// <summary>
/// 阿里云短信专用参数
/// </summary>
public string TemplateParam { get; set; }
} }
} }
...@@ -16,6 +16,7 @@ using System.Data; ...@@ -16,6 +16,7 @@ using System.Data;
using PushInfo.Core.Common; using PushInfo.Core.Common;
using PushPlatform.Common.Model; using PushPlatform.Common.Model;
using PushPlatform.Common.Mq; using PushPlatform.Common.Mq;
using PushInfo.Core.Models.Param;
namespace PushInfo.Core.BLL namespace PushInfo.Core.BLL
{ {
...@@ -363,7 +364,16 @@ namespace PushInfo.Core.BLL ...@@ -363,7 +364,16 @@ namespace PushInfo.Core.BLL
{ {
SmsConfig smsCfgModel = JsonUtil.ConvertToObject<SmsConfig>(smsCfg.Config_Info); SmsConfig smsCfgModel = JsonUtil.ConvertToObject<SmsConfig>(smsCfg.Config_Info);
if (!string.IsNullOrEmpty(Data.mobile)) if (!string.IsNullOrEmpty(Data.mobile))
result = Send_Message(smsCfgModel.InfoPformProId, Data.mobile, mapProPush.Push_Body, smsCfgModel.SmsSign, smsCfgModel.SmsType); result = Send_Message(new SendShortMessageParam()
{
ProjectId = smsCfgModel.InfoPformProId,
Mobile = Data.mobile,
PushBody = mapProPush.Push_Body,
SmsMessageSigna = smsCfgModel.SmsSign,
SmsType = smsCfgModel.SmsType,
TemplateCode = mapProPush.TemplateCode,
TemplateParam = Data.TemplateParam
});
else else
{ {
result.Result = 0; result.Result = 0;
...@@ -568,10 +578,10 @@ namespace PushInfo.Core.BLL ...@@ -568,10 +578,10 @@ namespace PushInfo.Core.BLL
/// <param name="mobile">手机号</param> /// <param name="mobile">手机号</param>
/// <param name="pushBody">短信内容</param> /// <param name="pushBody">短信内容</param>
/// <returns></returns> /// <returns></returns>
public APIResult<string> Send_Message(string projectId, string mobile, string pushBody, string smsMessageSigna, int smsType) public APIResult<string> Send_Message(SendShortMessageParam param)
{ {
SmsBLL bllSms = new SmsBLL(); SmsBLL bllSms = new SmsBLL();
return bllSms.PushMessage(projectId, mobile, pushBody, smsMessageSigna, smsType); return bllSms.PushMessage(param);
} }
#endregion #endregion
......
...@@ -13,6 +13,7 @@ using WebSocketSharp; ...@@ -13,6 +13,7 @@ using WebSocketSharp;
using System.Net.Mail; using System.Net.Mail;
using PushPlatform.Common.Model; using PushPlatform.Common.Model;
using System.Net; using System.Net;
using PushInfo.Core.Models.Param;
namespace PushInfo.Core.BLL namespace PushInfo.Core.BLL
{ {
...@@ -58,18 +59,18 @@ namespace PushInfo.Core.BLL ...@@ -58,18 +59,18 @@ namespace PushInfo.Core.BLL
#endregion #endregion
#region 推送短信 #region 推送短信
public APIResult<string> PushMessage(string smsProjectId,string mobile, string body,string smsMessageSigna, int smsType) public APIResult<string> PushMessage(SendShortMessageParam param)
{ {
APIResult<string> result = new APIResult<string>(); APIResult<string> result = new APIResult<string>();
result.Result = 1; result.Result = 1;
try try
{ {
var smsresult = ""; var smsresult = "";
if(smsType == (int)SmsType.博士通) //607新版短信 if(param.SmsType == (int)SmsType.博士通) //607新版短信
{ {
using (PushPlatform.Common.NewSmsService.SmsServiceClient sms = new PushPlatform.Common.NewSmsService.SmsServiceClient()) using (PushPlatform.Common.NewSmsService.SmsServiceClient sms = new PushPlatform.Common.NewSmsService.SmsServiceClient())
{ {
var r = sms.SendMsg(smsProjectId, mobile, string.Format(smsMessageSigna, body)); var r = sms.SendMsg(smsProjectId, param.Mobile, string.Format(param.SmsMessageSigna, param.PushBody));
smsresult = r; smsresult = r;
if (r.Substring(0, 1) == "0") if (r.Substring(0, 1) == "0")
{ {
...@@ -77,11 +78,11 @@ namespace PushInfo.Core.BLL ...@@ -77,11 +78,11 @@ namespace PushInfo.Core.BLL
} }
} }
} }
else if(smsType == (int)SmsType.阿里云) else if(param.SmsType == (int)SmsType.阿里云)
{ {
using (PushPlatform.Common.NewSmsService.SmsServiceClient sms = new PushPlatform.Common.NewSmsService.SmsServiceClient()) using (PushPlatform.Common.NewSmsService.SmsServiceClient sms = new PushPlatform.Common.NewSmsService.SmsServiceClient())
{ {
var r = sms.AliSendCode(smsProjectId, smsMessageSigna, "SMS_213772733", mobile, ""); var r = sms.AliSendCode(smsProjectId, param.SmsMessageSigna, param.TemplateCode, param.Mobile, (param.TemplateParam??""));
smsresult = r; smsresult = r;
if (r=="OK") if (r=="OK")
{ {
...@@ -93,7 +94,7 @@ namespace PushInfo.Core.BLL ...@@ -93,7 +94,7 @@ namespace PushInfo.Core.BLL
{ {
using (SMSServiceClient sms = new SMSServiceClient()) using (SMSServiceClient sms = new SMSServiceClient())
{ {
smsresult = sms.SendMessage(Guid.Parse(smsProjectId), mobile, string.Format(smsMessageSigna, body), null).ToString(); smsresult = sms.SendMessage(Guid.Parse(smsProjectId), param.Mobile, string.Format(param.SmsMessageSigna, param.PushBody), null).ToString();
} }
} }
......
...@@ -21,7 +21,7 @@ namespace PushInfo.Core.DAL.MySql ...@@ -21,7 +21,7 @@ namespace PushInfo.Core.DAL.MySql
t1.Exec_Time,t1.Exec_Status,t1.Push_Target,t1.Push_Style,t1.Push_TagId,t1.Push_Title,case when t1.Push_Body is null then t2.Push_Body else t1.Push_Body end as Push_Body, t1.Exec_Time,t1.Exec_Status,t1.Push_Target,t1.Push_Style,t1.Push_TagId,t1.Push_Title,case when t1.Push_Body is null then t2.Push_Body else t1.Push_Body end as Push_Body,
t1.Push_Type,t1.Push_Cycle,t1.Push_Month,t1.Push_Which,t2.Push_Action,t2.Push_ActionType, t1.Push_Type,t1.Push_Cycle,t1.Push_Month,t1.Push_Which,t2.Push_Action,t2.Push_ActionType,
t2.Push_IosLink,t2.Push_AndLink,t2.Push_WebLink,t2.Push_WechatLink,t2.Db_ConnectId, t2.Push_IosLink,t2.Push_AndLink,t2.Push_WebLink,t2.Push_WechatLink,t2.Db_ConnectId,
t1.Wx_MsmodelId,t1.Is_Deleted,t1.Trigger_Key,t2.Push_User_Action,t2.Push_User_ActionType,t2.Db_User_ConnectId t1.Wx_MsmodelId,t1.Is_Deleted,t1.Trigger_Key,t2.Push_User_Action,t2.Push_User_ActionType,t2.Db_User_ConnectId,t1.TemplateCode
from map_project_push t1 join sys_push t2 on t1.Push_Id = t2.Id and t1.ID = @Id and t1.Is_Deleted = 0 and t2.Is_Deleted = 0 "; from map_project_push t1 join sys_push t2 on t1.Push_Id = t2.Id and t1.ID = @Id and t1.Is_Deleted = 0 and t2.Is_Deleted = 0 ";
Dictionary<string, object> param = new Dictionary<string, object>(); Dictionary<string, object> param = new Dictionary<string, object>();
param.Add("@Id", Id); param.Add("@Id", Id);
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PushInfo.Core.Models.Param
{
/// <summary>
/// 发送短信数据对象
/// </summary>
public class SendShortMessageParam
{
/// <summary>
/// 项目Id
/// </summary>
public string ProjectId { get; set; }
/// <summary>
/// 手机号
/// </summary>
public string Mobile { get; set; }
/// <summary>
/// 推送消息体
/// </summary>
public string PushBody { get; set; }
/// <summary>
/// 签名
/// </summary>
public string SmsMessageSigna { get; set; }
/// <summary>
/// 短信供应商对应SmsType枚举
/// </summary>
public int SmsType { get; set; }
/// <summary>
/// 阿里云短信专用模板编号
/// </summary>
public string TemplateCode { get; set; }
/// <summary>
/// 阿里云短信专用参数
/// </summary>
public string TemplateParam { get; set; }
}
}
...@@ -49,6 +49,10 @@ namespace PushInfo.Core.Models.QueryResults ...@@ -49,6 +49,10 @@ namespace PushInfo.Core.Models.QueryResults
/// 用户邮箱 /// 用户邮箱
/// </summary> /// </summary>
public string Email { get; set; } public string Email { get; set; }
/// <summary>
/// 阿里云短信专用参数
/// </summary>
public string TemplateParam { get; set; }
} }
} }
...@@ -160,5 +160,9 @@ namespace PushInfo.Core.Models.Tables ...@@ -160,5 +160,9 @@ namespace PushInfo.Core.Models.Tables
/// 环境类型 /// 环境类型
/// </summary> /// </summary>
public int? EnvType { get; set; } public int? EnvType { get; set; }
/// <summary>
/// 阿里云模板编号
/// </summary>
public string TemplateCode { get; set; }
} }
} }
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
<Compile Include="IDAL\ISysPushDAL.cs" /> <Compile Include="IDAL\ISysPushDAL.cs" />
<Compile Include="IDAL\ITableInfoDAL.cs" /> <Compile Include="IDAL\ITableInfoDAL.cs" />
<Compile Include="IDAL\IWechatMsgmodelDAL.cs" /> <Compile Include="IDAL\IWechatMsgmodelDAL.cs" />
<Compile Include="Models\Param\SendShortMessageParam.cs" />
<Compile Include="Models\QueryResults\DataMessage.cs" /> <Compile Include="Models\QueryResults\DataMessage.cs" />
<Compile Include="Models\QueryResults\ResultHelper.cs" /> <Compile Include="Models\QueryResults\ResultHelper.cs" />
<Compile Include="Models\Tables\Mappush_User_Role.cs" /> <Compile Include="Models\Tables\Mappush_User_Role.cs" />
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
--> -->
<configuration> <configuration>
<connectionStrings> <connectionStrings>
<add name="WriteConnStr" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/> <!--<add name="WriteConnStr" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/>
<add name="ReadConnStr" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/> <add name="ReadConnStr" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/>
<add name="PushPlatformContext" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/> <add name="PushPlatformContext" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/>-->
<add name="WriteConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/>
<add name="ReadConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/>
<add name="PushPlatformContext" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/>
<add name="mongo_edc_log" connectionString="mongodb://iis_Trialdem:WezpeW1ajDvBGnz@101.132.228.78:3717/ASHermed_91Trialdem_Logs?slaveOk=true" /> <add name="mongo_edc_log" connectionString="mongodb://iis_Trialdem:WezpeW1ajDvBGnz@101.132.228.78:3717/ASHermed_91Trialdem_Logs?slaveOk=true" />
<!--<add name="WriteConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/>
<add name="ReadConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/>-->
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<add key="DB" value="MySql" /> <add key="DB" value="MySql" />
...@@ -91,4 +93,24 @@ ...@@ -91,4 +93,24 @@
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers> </compilers>
</system.codedom> </system.codedom>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="WeChatServiceSoap" />
<binding name="BasicHttpBinding_ISMSService" />
<binding name="BasicHttpBinding_ISmsService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://tools.ashermed.com/WeChatPlatForm/WeChatService.asmx"
binding="basicHttpBinding" bindingConfiguration="WeChatServiceSoap"
contract="WeChatService.WeChatServiceSoap" name="WeChatServiceSoap" />
<endpoint address="http://localhost:4316/SMSService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISMSService"
contract="SmsService.ISMSService" name="BasicHttpBinding_ISMSService" />
<endpoint address="http://channel.ashermed.com/SmsService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISmsService"
contract="NewSmsService.ISmsService" name="BasicHttpBinding_ISmsService" />
</client>
</system.serviceModel>
</configuration> </configuration>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<label for="c5d73547-4abb-435b-92a0-155447440591" class="poradio">互亿</label> <label for="c5d73547-4abb-435b-92a0-155447440591" class="poradio">互亿</label>
</div> </div>
<div class="radio radio-custom radio-inline phmod1"> <div class="radio radio-custom radio-inline phmod1">
<input type="radio" id="c5d73547-4abb-435b-92a0-155447440591" name="SmsType" @(smsModel.SmsType == (int)SmsType.阿里云 ? "checked" : "") value="4" onclick="inputctr.cgsel(this)"> <input type="radio" id="7090920a-a413-4d65-9359-6206b6db5b64" name="SmsType" @(smsModel.SmsType == (int)SmsType.阿里云 ? "checked" : "") value="4" onclick="inputctr.cgsel(this)">
<label for="c5d73547-4abb-435b-92a0-155447440591" class="poradio">阿里云</label> <label for="c5d73547-4abb-435b-92a0-155447440591" class="poradio">阿里云</label>
</div> </div>
</div> </div>
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
--> -->
<configuration> <configuration>
<connectionStrings> <connectionStrings>
<add name="WriteConnStr" connectionString="Server=192.168.0.62;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/> <add name="WriteConnStr" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/>
<add name="ReadConnStr" connectionString="Server=192.168.0.62;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/> <add name="ReadConnStr" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/>
<add name="PushPlatformContext" connectionString="Server=192.168.0.62;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/> <add name="PushPlatformContext" connectionString="Server=192.168.0.49;Database=db_ashermed_push;Uid=user;Pwd=Asher1234;"/>
<!--<add name="WriteConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/> <!--<add name="WriteConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/>
<add name="ReadConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/> <add name="ReadConnStr" connectionString="Server=101.132.234.102;Database=db_ashermed_push;Uid=iis;Pwd=iis;"/>
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
......
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