1. 创建订单

创建订单

POST:http://api.xdua.com/order

只有户群主root才有权利创建order.

字段名 字段位置 字段类型 字段说明 举例 必选
apiv head string API版本,默认是1.0.0 1.0.0 可选
Authorization head string 客户端保存的鉴权token Authorization字符串 必选
code body string 订单的代号 16个字符以内,小写字母,数字和字母,不能有特殊符号,一旦创建,不可修改 必选
name body string 订单的名字 16个字符以内 必选
avatar body string 订单图标 必须 必选
god_id body string 管理员id 必须 必选
ugrp_id body string 户群id 必须 必选
type body string 订单类型 这个值必须存在在ordertypes表里 必选
brief body string 订单的简介 64个字符以内,必须是英文或者数字 必选

BrowserSDK调用代码

const lovearth = require('../lib')
async function test_addorder() {
    //--------------------------------------------------
    const dua = await lovearth({
        APP_KEY: "您的appkey",
        APP_SECRET: "您的appsecret",
    })

    api_name = "创建订单";
    got_order_id = "";
    await dua.login({
        by  :   "tel",
        ustr:   '+86-15810419011',
        pwd :   'a906449d5769fa7361d7ecc6aa3f6d28',
        order:   "XdUaXduA",
        role:   "none"
    })

    const res = await dua.addorder({
        name:"测试订单",
        brief:"这是一个测试用的订单", 
        avatar:"",
        pid:"户群的id",
        god_id:"管理员的id"
    })
    console.log(res);
    if(res.error == 0){
        got_order_id = res.result.id;
        console.log(api_name+"成功 "+got_order_id);
    }else{
        got_order_id = res.result.id;
        console.log(api_name+"失败 "+res.reason);
    }

}

test_addorder();

1.1. 成功的返回

返回的id便是新创建的order的id.

{
    "error": 0,
    "reason": "Success",
    "result": ["id"=>"3bc8d2bf"]
}

1.2. 失败的返回

{
    "error": 1,
    "reason": "失败原因",
    "result": {"失败返回的参考数据"}
}

results matching ""

    No results matching ""