1 Star 0 Fork 0

中通技术团队 / zopsdk-node

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

中通开放平台SDK(node.js)

环境

nodejs

使用方式

npm install zopsdk-node
var zop_client = require("zopsdk-node");

// int方法的两个参数companyid和key,都需要注册中通开放平台后到个人中心查看
zop_client.init("kfpttestCode", "kfpttestkey==");
let request = {
    url: "http://58.40.16.125:9001/submitOrderCode",
    data: {
        "data":{
            "content": {
                "branchId": "",
                "buyer": "",
                "collectMoneytype": "CNY",
                "collectSum": "12.00",
                "freight": "10.00",
                "id": "xfs2018031500002222333",
                "orderSum": "0.00",
                "orderType": "1",
                "otherCharges": "0.00",
                "packCharges": "1.00",
                "premium": "0.50",
                "price": "126.50",
                "quantity": "2",
                "receiver": {
                    "address": "育德路XXX号",
                    "area": "501022",
                    "city": "四川省,XXX,XXXX",
                    "company": "XXXX有限公司",
                    "email": "yyj@abc.com",
                    "id": "130520142097",
                    "im": "yangyijia-abc",
                    "mobile": "136*****321",
                    "name": "XXX",
                    "phone": "010-222***89",
                    "zipCode": "610012"
                },
                "remark": "请勿摔货",
                "seller": "",
                "sender": {
                    "address": "华新镇华志路XXX号",
                    "area": "310118",
                    "city": "上海,上海市,青浦区",
                    "company": "XXXXX有限公司",
                    "email": "ll@abc.com",
                    "endTime": 1369033200000,
                    "id": "131*****010",
                    "im": "1924656234",
                    "mobile": "1391***5678",
                    "name": "XXX",
                    "phone": "021-87***321",
                    "startTime": 1369022400000,
                    "zipCode": "610012"
                },
                "size": "12,23,11",
                "tradeId": "2701843",
                "type": "1",
                "typeId": "",
                "weight": "0.753"
            },
            "datetime": "2019-4-03 15:33:00",
            "partner": "test",
            "verify": "ZTO123"
        }
    }
};


// 本模块http请求使用的是node-fetch库,请自行百度
let response = zop_client.execute(request);
response.then(res => res.text())
    .then(body => console.log(body));

其他

  1. 该项目刚创建,功能还很不完善,如有问题请提issue
  2. 由于中通开放平台各个接口返回值格式没有统一,所以未封装返回值,未来可能会做封装

Comments ( 0 )

Sign in for post a comment

About

中通开放平台SDK(node.js) spread retract
Cancel

Releases

No release

Gitee Metrics

Contributors

All

Activities

load more
can not load any more
JavaScript
1
https://git.oschina.net/zto_express/zopsdk-node.git
git@git.oschina.net:zto_express/zopsdk-node.git
zto_express
zopsdk-node
zopsdk-node
master

Search