1. 创建店铺

创建店铺

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

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

字段名 字段位置 字段类型 字段说明 举例 必选
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 店铺类型 这个值必须存在在shoptypes表里 必选
brief body string 店铺的简介 64个字符以内,必须是英文或者数字 必选

BrowserSDK调用代码

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

    api_name = "创建店铺";
    got_shop_id = "";
    await dua.login({
        by  :   "tel",
        ustr:   '+86-15810419011',
        pwd :   'a906449d5769fa7361d7ecc6aa3f6d28',
        shop:   "XdUaXduA",
        role:   "none"
    })

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

}

test_addshop();

1.1. 成功的返回

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

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

1.2. 失败的返回

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

results matching ""

    No results matching ""