商品管理服务

更新时间:2018-04-27 19:45:42

创建商品

定义描述

path 版本 描述 是否需要cloudToken
/cloud/linkbusiness/commodity/create 1.0.0 创建商品

请求参数

参数 类型 必填 描述
name String 商品名称
description String 商品描述
imgUrl String 商品图片url
basePrice Long 商品价格(单位:分)
chargeType String 商品交易类型(先付款:PRE_PAYMENT,后付款:POST_PAYMENT)
userName String 登录用户名
projectId String 项目id

返回参数

参数 类型 描述
Long 商品id

示例

请求示例

{
    "id": "1509086454180",
    "version": "1.0",
    "request": {
        "apiVer": "1.0.0",
        "iotToken": "token"
    },
    "params": {
        "name":"农夫山泉",
        "description":"农夫山泉有点甜",
        "imgUrl":"http://www.xxx.com",
        "basePrice":300,
        "chargeType":"PRE_PAYMENT",
        "userName":"xiaoming",
        "projectId":"a124h24UUIbe3C1o"
    }
}

返回示例

{
  "code": 200,
  "data": "1018031002075601",
  "localizedMsg": null,
  "message": "success"
}

更新商品

定义描述

path 版本 描述 是否需要cloudToken
/cloud/linkbusiness/commodity/update 1.0.0 更新商品

请求参数

参数 类型 必填 描述
commodityId Long 商品id
name String 商品名称
description String 商品描述
imgUrl String 商品图片url
basePrice Long 商品价格(单位:分)
userName String 登录用户名
projectId String 项目id

返回参数

参数 类型 描述
Boolean true:更新成功,false:更新失败

示例

请求示例

{
    "commodityId": "1509086454180",
    "version": "1.0",
    "request": {
        "apiVer": "1.0.0",
        "iotToken": "token"
    },
    "params": {
        "commodityId":1018031002075601,
        "name":"农夫山泉",        
        "description":"农夫山泉有点甜",
        "basePrice":250,
        "imgUrl":"http://www.xxx.com",
        "userName":"xiaoming",
        "projectId":"a124h24UUIbe3C1o"
    }
}

返回示例

{
  "code": 200,
  "data": true,
  "localizedMsg": null,
  "message": "success"
}

删除商品

定义描述

path 版本 描述 是否需要cloudToken
/cloud/linkbusiness/commodity/delete 1.0.0 删除商品

请求参数

参数 类型 必填 描述
commodityId Long 商品id
userName String 登录用户名
projectId String 项目id

返回参数

参数 类型 描述
Boolean true:删除成功,false:删除失败

示例

请求示例

{
    "id": "1509086454180",
    "version": "1.0",
    "request": {
        "apiVer": "1.0.0",
        "iotToken": "token"
    },
    "params": {
        "commodityId":1018031002075601,
        "userName":"xiaoming",
        "projectId":"a124h24UUIbe3C1o"
    }
}

返回示例

{
  "code": 200,
  "data": true,
  "localizedMsg": null,
  "message": "success"
}

根据条件查询项目下的所有商品

定义描述

path 版本 描述 是否需要cloudToken
/cloud/linkbusiness/commodity/query 1.0.0 查询商品列表

请求参数

参数 类型 必填 描述
pageNo Integer 页号,默认从1开始
pageSize Integer 每页的记录大小,默认是20
isByPage Boolean 是否分页,默认是分页
name String 商品名称,用于模糊查询
channelIds JSON 填默认值[200]
nameEqual String 商品名称,完全匹配查询

返回参数

参数​ 类型​ 描述​
JSON 商品信息列表

示例

请求示例

{
    "id": "1509086454180",
    "version": "1.0",
    "request": {
        "apiVer": "1.0.0",
        "iotToken": "token"
    },
    "params": {
        "isByPage":true,
        "pageNo":1,
        "pageSize":2,
        "name":"可乐"
    }
}

返回示例

{
  "code": 200,
  "data": "{
    "total": 2,
    "bean" : {
      {
       "chargeType":"PRE_PAYMENT",
       "description":"xxxx",    
       "gmtCreate":1522295028000,
       "gmtModified":1522295028000,
       "imgUrl":"http://www.xxx.com",
       "name":"可口可乐",
       "id":1018031002089421,
       "basePrice":300
      },
 ​     {
       "chargeType":"PRE_PAYMENT",
       "description":"xxxx",    
       "gmtCreate":1522295028000,
       "gmtModified":1522295028000,
       "imgUrl":"http://www.xxx.com",
       "name":"百事可乐",
       "id":1018031002089422,
       "basePrice":300
      },
   }",
  "localizedMsg": null,
  "message": "success"
}

查询项目下所有上架售卖的商品

定义描述

path 版本 描述 是否需要cloudToken
/cloud/linkbusiness/commodity/querySale 1.0.0 查询项目下上架售卖的商品

请求参数

返回参数

参数​ 类型​ 描述
JSON 商品信息列表

示例

请求示例

{
    "id": "1509086454180",
    "version": "1.0",
    "request": {
        "apiVer": "1.0.0",
        "iotToken": "token"
    },
}

返回示例

{
  "code": 200,
  "data": "{
    "total": 2,
    "bean" : {
      {
       "chargeType":"PRE_PAYMENT",
       "description":"xxxx",    
       "gmtCreate":1522295028000,
       "gmtModified":1522295028000,
       "imgUrl":"http://www.xxx.com",
       "name":"农夫山泉",
       "id":1018031002089421,
       "basePrice":300,
       "coordinateRow":1,
       "coordinateColumn":1,
       "relationId":1
      },
      {
       "chargeType":"PRE_PAYMENT",
       "description":"xxxx",    
       "gmtCreate":1522295028000,
       "gmtModified":1522295028000,
       "imgUrl":"http://www.xxx.com",
       "name":"农夫山泉",
       "id":1018031002089422,
       "basePrice":300,
       "coordinateRow":1,
       "coordinateColumn":2,
       "relationId":2
      }
   }",
  "localizedMsg": null,
  "message": "success"
}

保存设备格子和商品的关系

定义描述

path 版本 描述 是否需要cloudToken
/cloud/linkbusiness/commodityAndGridRelation/save 1.0.0 设置设备格子和商品的关系

请求参数(JSON数组)

参数
类型
必填
描述
commodityId
Long
商品id
备注:
添加商品和修改商品:需要传商品id。
删除商品:
当移除某个位置上的商品时,该字段传被移除的商品id。
identityId
String
登录用户的id
coordinateRow
Integer
商品位置所在的行
coordinateColumn
Integer
商品位置所在的列
id​
Long​
是​
商品​与格子关系id
备注:​
新增​商品时,传0
更新和删除时,填原有的关系id。

返回参数

参数 类型 描述
Boolean true:保存成功,false:保存失败

示例

请求示例

{
    "id": "1509086454180",
    "version": "1.0",
    "request": {
        "apiVer": "1.0.0",
        "iotToken": "token"
    },
    "params": [
        {
        "identityId":"1112233422",
        "commodityId":1018031002075601,
        "coordinateRow":1,
        "coordinateColumn":1,
        "id":1
        },
        {
        "identityId":"1112233422",
        "commodityId":1018031002075602,
        "coordinateRow":1,
        "coordinateColumn":2,
        "id":2
        },
        {
        "identityId":"1112233422",
        "commodityId":1018031002075601,
        "coordinateRow":1,
        "coordinateColumn":3,
        "id":3
        }
    ]
}

返回示例

{
  "code": 200,
  "data": true,
  "localizedMsg": null,
  "message": "success"
}

results matching ""

    No results matching ""