【统一应用软件】),且只有验证码,若你不在乎,那么可以继续学习。个人使用,只需要上传身份证变更为个人开发者即可使用,暂未发现需要域名备案等要求。其次测试模板每天仅10个手机号100条短信,主邮箱次手机号绑定的网站推荐,建议还是认证一下准备工作
分为几个步骤,电脑看右侧目录树,手机点左上角看目录树
注册及实名
注册登录到DCloud开发者中心(用户信息):https://dev.dcloud.net.cn/pages/user/info
登录后进行实名认证操作
![图片[1]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504181757556-fd65828d94a63c110f648556f5e872e7.png)
等待认证通过
![图片[2]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504181542872-image.png)
创建服务空间及其它
登录到unicloud:https://unicloud.dcloud.net.cn/
创建新的服务空间
![图片[3]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504181846328-dc894b66e9935ccaba5bdee53b3467ee.png)
平台提供了3个选项,其中两个有免费服务,阿里巴巴老慈善家了,固定NPC,记得每个月免费续费一次(会有通知提醒,每到期前15天内可续费),如果你的量大的话,直接付费搞年付就好了
![图片[4]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504182233441-6b337d9c3b25ad2770546ba899faf842.png)
购买后,会处于初始化过程,需要等待10分钟创建好环境
![图片[5]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504182612378-26052ac5e95ef8920498184e487fb638.png)
这等待时间,咱们也别耽误,可以给账号添加一个警告通知
![图片[6]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504182540543-4780ccfbbb121cc37fb31c3c3c1f12a8.png)
以这样的方式添加新邮箱(不是,这都偷懒)
![图片[7]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504182838817-2031dbf5401ad2a9a64f97bb98fd8099.png)
进入短信页面,同意一些条款,让其初始化,记得顺手充值2块,用来测试
![图片[8]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504183901355-image.png)
部署云函数
安装HBuilder X编辑器,下载地址:https://www.dcloud.io/hbuilderx.html
![图片[9]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504183211656-7a445bd45855536a78f629b32f28edbd.png)
登录之前注册的账号,都会吧
![图片[10]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504183410398-f90614b9995928616945fcffe51bd23d.png)
创建项目,由于官方不再为新用户提供API服务,只能通过创建uniapp项目,为其添加SDK,用来创建自己的API
![图片[11]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504184004489-d54f6e8c9076027c89359e1dd8a7fb65.png)
看图操作,新建一个uni-app项目
![图片[12]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504184625316-3f71aaf66b12bf73ea0a6b5c5e56f6ac.png)
将本地项目关联服务空间
![图片[13]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504184721894-1b97690d59ead615b67864428ffbaa0f.png)
勾选创建的服务空间并关联
![图片[14]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504184800573-5a59f78e35fa05614992300ae0a3cc10.png)
为项目新建云函数
![图片[15]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504184849879-9579dc290851a18f1916e4c6ef54be22.png)
在公共模板中选择短信SDK,看图操作,注意记住云函数名称,这是云函数在项目中的文件夹名
![图片[16]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504184923617-01b12f1087f849a9a3b768aea795d755.png)
这是成功的样子,会跳转到index.js
![图片[17]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504185007877-c6cae225baf98062ffc8bac690cf6a2a.png)
前往manifest.json文件,复制APPID
![图片[18]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504185208772-image.png)
将下面的云函数后端填入,并修改APPID,保存
![图片[19]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504185538321-bf0a38f0778595f287cc86e516fa7498.png)
右键云函数文件夹,上传部署
![图片[20]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504185658357-51d3d553e66a725f4feff9ddee9403f4.png)
控制台提示完成
![图片[21]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504185915639-9d8c09557c0df57866663a810e10b764.png)
回到开发者后台,进入空间详情
![图片[22]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504185942716-d540e2fee19c3e4eeaf495a44f135bb9.png)
函数列表这里,点域名绑定,刷新一下默认域名,记得复制
![图片[23]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504190200555-1b24459c0271548a402eeb8861214652.png)
编辑云函数设置
![图片[24]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504190037672-6d8635184b80241eb7188626939ec1c9.png)
调整函数运行内存,开源节流
![图片[25]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504190111348-e395dabdc129af503b46e7558c063af9.png)
往下滑,找到云函数URL化,设置路径为:/send_sms或是其它,你自己定义
![图片[26]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504190420790-6333b814105a116eb3eecec61339e93a.png)
这时,你获得了短信服务API接口
![图片[27]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504190548199-f0cf0102d9abfe2e57760feb6bb33818.png)
API文档
接口名称:sendSms
接口描述:用于发送短信通知,支持群发和单发功能
请求URL:无需提供,通过云函数调用
请求方式:POST
请求参数:
template_id(必填):模板ID
phone(必填):手机号,支持单个手机号或手机号数组
data:短信模板中的变量数据
batch:是否为群发,值为true表示群发
响应参数:
code:返回状态码,1表示成功,-1表示失败
msg:返回信息
data:返回数据,包括发送成功的数量
短信签名及模板(无则跳过)
签名需要上传各种资料,营业执照,法人证件,电话
![图片[28]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504190726272-53d7f72e6a44db1314261788a237b8b0.png)
申请模板,这个需要给运营商审核的,等待时间比较久,图中为告诉你模板id在哪里,若无,则可以使用默认测试模板
![图片[29]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504191355761-image.png)
子比主题接入该API示例代码[已开源]
需要上传补丁文件,上传以下文件到根目录,解压即可
2.每次更新主题,到会导致配置丢失,务必收藏内容,如链接
当前仅适用于子比主题8.5,若需通知,请在本文评论,方便获取更新通知
1.目录文件:/wp-content/themes/zibll/inc/class/sms-class.php
![图片[30]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20251006201848448-image.png)
腾讯sdk下填入
// 引入unismsSDK文件
require_once __DIR__ . '/unisms_send.php';
![图片[31]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20251006202021592-image.png)
is_phonenumber函数下填入
//引入unisms短信类
use UnismsSMSTrait;
2.目录文件:/wp-content/themes/zibll/inc/options/admin-options.php
![图片[32]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20251006202407872-image.png)
看图删除原来的array配置,就在限制国内手机号配置array上方填入
// 引用外部文件内容并插入
include_once trailingslashit(get_template_directory()) . 'inc/options/sms_sdk.php',
![图片[33]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20251006202659766-image.png)
短信发送测试配置array上方填入
// 引用外部文件内容并插入
include_once trailingslashit(get_template_directory()) . 'inc/options/sms_unisms_option.php',
打开子比主题短信设置页面,填入API,填入模板ID(测试模板id为:uni_sms_test),并切换短信服务为uni短信即可
![图片[34]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504192213957-image.png)
测试接口发信
![图片[35]-自建部署DCloud(unisms)短信API及接入子比主题(实惠且个人可用)-王先生笔记](https://wxsnote.cn/wp-content/uploads/2025/05/20250504193149679-b612dfedb63b3c3cbb1e890b5b1a21e0.jpg)
2026-01-12 21:34:47,某些文章具有时效性,若有错误或已失效,请在下方留言或加入QQ群:
399019539 联系群主反馈。注意一些链接无法访问可能是你网络的原因,如Github,并非资源地址失效。
登录后可快速点此处反馈,点击登录













请登录后查看评论内容