{"id":20348698,"url":"https://github.com/jevonsflash/sms","last_synced_at":"2026-03-03T08:13:13.857Z","repository":{"id":144172984,"uuid":"556669349","full_name":"jevonsflash/Sms","owner":"jevonsflash","description":"适用于AbpBoilerplate的短信服务(Short Message Service，SMS)模块，通过简单配置即可使用，仅更改一处代码即可切换短信服务提供商","archived":false,"fork":false,"pushed_at":"2023-04-13T03:22:41.000Z","size":25,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-02-15T05:59:13.261Z","etag":null,"topics":["aliyun","sms","tencent-cloud"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jevonsflash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-24T09:33:19.000Z","updated_at":"2023-06-06T08:13:14.000Z","dependencies_parsed_at":"2023-07-08T03:18:03.414Z","dependency_job_id":null,"html_url":"https://github.com/jevonsflash/Sms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jevonsflash/Sms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FSms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FSms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FSms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FSms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jevonsflash","download_url":"https://codeload.github.com/jevonsflash/Sms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FSms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30036999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T06:58:30.252Z","status":"ssl_error","status_checked_at":"2026-03-03T06:58:15.329Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun","sms","tencent-cloud"],"created_at":"2024-11-14T22:21:45.771Z","updated_at":"2026-03-03T08:13:13.797Z","avatar_url":"https://github.com/jevonsflash.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sms\n\n适用于AbpBoilerplate的短信服务(Short Message Service，SMS)模块，通过简单配置即可使用，仅更改一处代码即可切换短信服务提供商。\n\n\nAliyun.Sms由阿里云Sms提供服务(https://www.aliyun.com/product/sms)\n\nTencentCloud.Sms由腾讯云Sms提供服务(https://cloud.tencent.com/product/sms)\n\n\n\n\n## 快速开始\n\n### 使用阿里云Sms服务提供商\n在项目中引用[AbpBoilerplate.Aliyun.Sms]( https://www.nuget.org/packages/AbpBoilerplate.Aliyun.Sms)\n\n\n```\ndotnet add package AbpBoilerplate.Aliyun.Sms\n```\n\n添加AliyunSmsModule模块依赖\n```\n[DependsOn(typeof(AliyunSmsModule))]\npublic class CoreModule : AbpModule\n\n```\n\nappsettings.json配置文件中，添加服务相关配置\n```\n\"AliyunSms\": {\n    \"RegionId\": \"cn-hangzhou\",\n    \"AccessKey\": \"\",\n    \"AccessKeySecret\": \"\"\n}\n...\n```\n### 使用腾讯云Sms服务提供商\n在项目中引用[AbpBoilerplate.TencentCloud.Sms]( https://www.nuget.org/packages/AbpBoilerplate.TencentCloud.Sms)\n\n\n```\ndotnet add package AbpBoilerplate.TencentCloud.Sms\n```\n\n添加TencentCloudSmsModule模块依赖\n```\n[DependsOn(typeof(TencentCloudSmsModule))]\npublic class CoreModule : AbpModule\n\n```\n\nappsettings.json配置文件中，添加服务相关配置\n```\n\"TencentCloudSms\": {\n    \"SmsSdkAppId\": \"\",\n    \"SecretId\": \"\",\n    \"SecretKey\": \"\"\n}\n...\n```\n\n\n\n## 使用帮助\n\n在Service层中注入ISmsService服务即可\n\n发送短信示例\n```\npublic class CaptchaManager : DomainService\n{\n    private readonly ISmsService smsService;\n\n    public CaptchaManager(ISmsService smsService)\n    {\n        this.smsService=smsService;\n    }\n\n    public async Task SendCaptchaAsync(string phoneNumber)\n    {\n\n        var captcha = CommonHelper.GetRandomCaptchaNumber();\n        var model = new SendSmsRequest();\n        model.PhoneNumbers= new string[] { phoneNumber };\n        model.SignName=\"MatoApp\";   //阿里云或腾讯云后台签名管理中设置应用名称\n        model.TemplateCode=\"SMS_255330989\";  //阿里云或腾讯云后台模板管理中设置模板\n        model.TemplateParam=\"{'code':'\"+captcha+\"'}\";\n        await smsService.SendSmsAsync(model);\n    }\n}\n```\n\n\u003cb\u003e注意！不同服务商所传参数有可能不同，如腾讯的短信模板参数为字符串数组，而阿里云为键值对\u003c/b\u003e\n```\n//for aliyun\nmodel.TemplateParam= JsonConvert.SerializeObject(new { code = captcha });\n\n//for tencent-cloud\nmodel.TemplateParam= JsonConvert.SerializeObject(new string[] {captcha});\n```\n\n\n## 作者信息\n\n作者：林小\n\n邮箱：jevonsflash@qq.com\n\n\n\n## License\n\nThe MIT License (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjevonsflash%2Fsms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjevonsflash%2Fsms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjevonsflash%2Fsms/lists"}