16 changed files with 242 additions and 20 deletions
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,20 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.1</TargetFramework> |
|||
<RootNamespace /> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Sms" Version="$(VoloAbpPackageVersion)" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Sms; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Activities.Sms; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpElsaModule), |
|||
typeof(AbpSmsModule))] |
|||
public class AbpElsaActivitiesSmsModule : AbpModule |
|||
{ |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
using Elsa; |
|||
using Elsa.ActivityResults; |
|||
using Elsa.Attributes; |
|||
using Elsa.Design; |
|||
using Elsa.Expressions; |
|||
using Elsa.Services; |
|||
using Elsa.Services.Models; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Sms; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Activities.Sms; |
|||
|
|||
[Action( |
|||
Category = "Sms", |
|||
Description = "Send an sms message.", |
|||
Outcomes = new[] { OutcomeNames.Done })] |
|||
public class SendSms : Activity |
|||
{ |
|||
private readonly ISmsSender _smsSender; |
|||
|
|||
public SendSms( |
|||
ISmsSender smsSender) |
|||
{ |
|||
_smsSender = smsSender; |
|||
} |
|||
|
|||
[ActivityInput( |
|||
Hint = "The recipients phoneNumber list.", |
|||
UIHint = ActivityInputUIHints.MultiText, |
|||
DefaultSyntax = SyntaxNames.Json, |
|||
SupportedSyntaxes = new[] { SyntaxNames.Json, SyntaxNames.JavaScript })] |
|||
public ICollection<string> To { get; set; } = new List<string>(); |
|||
|
|||
[ActivityInput(Hint = "The message content.")] |
|||
public string Message { get; set; } |
|||
|
|||
[ActivityInput( |
|||
Hint = "Attachment property that are sent with the message.", |
|||
UIHint = ActivityInputUIHints.MultiLine, DefaultSyntax = SyntaxNames.Json, |
|||
SupportedSyntaxes = new[] { SyntaxNames.Json, SyntaxNames.JavaScript, SyntaxNames.Liquid }, |
|||
Category = PropertyCategories.Advanced |
|||
)] |
|||
public Dictionary<string, string> Properties { get; set; } = new(); |
|||
|
|||
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context) |
|||
{ |
|||
var smsMessage = new SmsMessage(To.JoinAsString(";"), Message); |
|||
foreach (var prop in Properties) |
|||
{ |
|||
smsMessage.Properties.TryAdd(prop.Key, prop.Value); |
|||
} |
|||
|
|||
await _smsSender.SendAsync(smsMessage); |
|||
|
|||
return Done(); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using Elsa.Attributes; |
|||
using Elsa.Options; |
|||
using Elsa.Services.Startup; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Activities.Sms; |
|||
|
|||
[Feature("Sms")] |
|||
public class Startup : StartupBase |
|||
{ |
|||
public override void ConfigureElsa(ElsaOptionsBuilder elsa, IConfiguration configuration) |
|||
{ |
|||
elsa.AddSmsActivities(); |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Elsa.Options; |
|||
using LINGYUN.Abp.Elsa.Activities.Sms; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection; |
|||
|
|||
public static class SmsServiceCollectionExtensions |
|||
{ |
|||
public static ElsaOptionsBuilder AddSmsActivities(this ElsaOptionsBuilder options) |
|||
{ |
|||
options |
|||
.AddActivity<SendSms>(); |
|||
|
|||
return options; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue