Service implement api or sdk of 3rd party.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
filesite 99bfd6b213 readme update 4 days ago
conf aliyun sms send done 1 year ago
test add api for aliyun sms send detail query 5 days ago
.gitignore aliyun sms test done 1 year ago
LICENSE Initial commit 1 year ago
README.md readme update 4 days ago
aliyunSmsClient.js add api for aliyun sms send detail query 5 days ago
common.js add loki service 11 months ago
package.json aliyun sms send done 1 year ago
router_aliyun.js add api for aliyun sms send detail query 5 days ago
router_loki.js add token check 11 months ago
server.js add loki service 11 months ago

README.md

service-3rd

Service implement api or sdk of 3rd party.

实现第三方平台接口的公用服务,通过API调用。

使用方法

  1. 安装依赖的库
npm install
  1. 启动web服务
npm start

访问:http://localhost:8081 验证接口服务已开启

已对接功能

  • 阿里云的短信发送接口
  • 阿里云的短信发送详情查询接口

接口参数签名方法

将所有参数按字母排序之后转换成JSON字符串(注意需保持斜杠/和unicode字符串不转义),最后再拼接上token计算MD5值。

示例如下:

var token = 'hello world';        //config.js里配置的密钥
var params = {                    //参数示例
    "b": 2,
    "a": 1,
    "t": 234343
};

var sortObj = function(obj) {     //参数排序方法
    return Object.keys(obj).sort().reduce(function(result, key) {
        result[key] = obj[key];
        return result;
    }, {});
};

//1. 排序参数
var sortedParams = sortObj(params);
//2. 计算MD5值
var sign = md5( JSON.stringify(sortedParams) + token );

二次开发步骤

  1. 修改aliyunSmsClient.js增加其它功能
  2. 修改router_aliyun.js增加web接口
  3. 修改test/aliyun.test.js增加接口测试代码,进入test/目录,执行测试脚本:node aliyun.test.js

类库和api测试通过,即可发布上线。