[TOC=2,3]
* * * * *
* * * * *
* * * * *
## 1. 獲取該套產品詳細信息
+++
get:/store/product/product_details
*int:product_id#該套產品的id值【PS: product_id=1】
<<<
success
返回示例:
{
status: 200,
product: {
sid: "001",
product_type_name: "FOHEART-C1",
add_time: "2014-12-01 00:00:00",
sale_time: "2016-11-01 00:00:00",
status: 0,
devices_type: {
1: {
type_name: "節點",
count: 5
},
2: {
type_name: "插排",
count: 1
},
3: {
type_name: "路由器",
count: 1
}
}
},
product_detail: {
1: [
{
type_name: "節點",
id: 1,
p_id: 1,
t_id: 1,
sn: "111111",
add_time: "2016-12-01 00:00:00",
sale_time: "2016-12-01 00:00:00",
status: 0,
model_number: "MC1508"
},
{
type_name: "節點",
id: 11,
p_id: 1,
t_id: 1,
sn: "111113",
add_time: "2016-12-01 00:00:00",
sale_time: "2016-12-01 00:00:00",
status: 0,
model_number: "MC1508"
},
{
type_name: "節點",
id: 13,
p_id: 1,
t_id: 1,
sn: "111115",
add_time: "2016-12-01 00:00:00",
sale_time: "2016-12-01 00:00:00",
status: 0,
model_number: "MC1508"
},
{
type_name: "節點",
id: 10,
p_id: 1,
t_id: 1,
sn: "111112",
add_time: "2016-12-01 00:00:00",
sale_time: "2016-12-01 00:00:00",
status: 0,
model_number: "MC1508"
},
{
type_name: "節點",
id: 12,
p_id: 1,
t_id: 1,
sn: "111114",
add_time: "2016-12-01 00:00:00",
sale_time: "2016-12-01 00:00:00",
status: 0,
model_number: "MC1508"
}
],
2: [
{
type_name: "插排",
id: 2,
p_id: 1,
t_id: 2,
sn: "222222",
add_time: "2016-12-01 00:00:00",
sale_time: "2016-12-01 00:00:00",
status: 0,
model_number: "MC1508"
}
],
3: [
{
type_name: "路由器",
id: 3,
p_id: 1,
t_id: 3,
sn: "333333",
add_time: "2016-12-01 00:00:00",
sale_time: "2016-12-01 00:00:00",
status: 0,
model_number: "MC1508"
}
]
}
}
<<<
error
返回示例:
{
status: 400,
message: "沒有該產品詳細信息!"
}
+++
* * * * *
* * * * *
* * * * *
## 2. 產品管理中的 新增產品信息
+++
post:/store/product/add_product
*int:sid#該套產品的id值【PS: sid=0001】
*int:p_tid#該套產品的類型id值
datetime:sale_time#需要更新設備的出售時間【PS:sale_time=2016-12-01 00:00:00】
int:status=默認值#可以為以下值:-1(有問題)/0(在庫)/1(出售)
<<<
success
返回示例:
{
status: 200,
id:1,
message: "新增成功!"
}
<<<
error
返回示例:
{
status: 400,
message: "新增失敗!"
}
+++
* * * * *
* * * * *
* * * * *
## 3. 產品管理中的 更新產品信息
+++
post:/store/product/edit_product
*int:id#該套產品的id值【PS: id=0001】
int:sid#該套產品的序列號(編號)值【PS: sid=0001】
int:status=默認值#可以為以下值:-1(有問題)/0(在庫)/1(出售)
<<<
success
返回示例:
{
status: 200,
message: "修改成功!"
}
<<<
error
返回示例:
{
status: 400,
message: "修改失敗!"
}
+++
* * * * *
* * * * *
* * * * *
## 4. 產品管理中的 新增設備【手動輸入】
+++
post:/store/product/add_devices
*int:p_id#新增設備所屬產品的id
*int:t_id#新增設備所屬類型的id
*int:p_tid#新增設備所屬產品類型的id
*string:sn#需要新增設備的S/N碼
datetime:sale_time#需要更新設備的出售時間【PS:sale_time=2016-12-01 00:00:00】
int:status=默認值#可以為以下值:-1(有問題)/0(在庫)/1(出售)
<<<
success
返回示例:
{
status: 200,
message: "新增成功!"
"devices":
{
"type_name":"節點",
"model_number":"MC1508",
"id":242,
"sn":"1403003e",
"t_id":1,
"p_id":1,
"p_tid":1,
"add_time":"2016-12-10 17:31:21",
"sale_time":"0000-00-00 00:00:00",
"status":0
}
}
<<<
error1
返回示例:
{
status: 400,
message: "產品id必須"【PS:p_id無值】
}
<<<
error2
返回示例:
{
status: 400,
message: "設備類型必須"【PS:t_id無值】
}
<<<
error3
返回示例:
{
status: 400,
message: "產品類型必須"【PS:p_tid無值】
}
<<<
error4
返回示例:
{
status: 400,
message: "該S/N碼已經存在"【PS:該S/N碼已經存在】
}
<<<
error5
返回示例:
{
status: 400,
message: "新增失敗!"【PS:該設備沒有新增成功】
}
+++
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
## 5. 產品管理中的 新增設備【自動輸入】
+++
post:/store/product/add_device
*int:p_id#新增設備所屬產品的id
*int:t_id#新增設備所屬類型的id
*int:p_tid#新增設備所屬產品類型的id
*string:num#需要新增設備的數量
<<<
success
返回示例:
{
"status":200,
"message":"新增2個設備成功!",
"devices":[
{
"type_name":"節點",
"model_number":"MC1508",
"id":242,
"sn":"1403003e",
"t_id":1,
"p_id":1,
"p_tid":1,
"add_time":"2016-12-10 17:31:21",
"sale_time":"0000-00-00 00:00:00",
"status":0
},
{
"type_name":"節點",
"model_number":"MC1508",
"id":239,
"sn":"1403003d",
"t_id":1,
"p_id":1,
"p_tid":1,
"add_time":"2016-12-10 17:31:21",
"sale_time":null,
"status":0
}
]
}
返回事例:
devices:新增成功的設備信息
<<<
error1
返回示例:
{
status: 400,
message: "產品id必須"【PS:p_id無值】
}
<<<
error2
返回示例:
{
status: 400,
message: "設備類型必須"【PS:t_id無值】
}
<<<
error3
返回示例:
{
status: 400,
message: "產品類型必須"【PS:p_tid無值】
}
<<<
error4
返回示例:
{
status: 400,
message: "數量必須輸入!"【PS:num無值】
}
<<<
error5
返回示例:
{
status: 400,
message: "該類型下設備數量只有2個,請先添加設備!"【PS:num值超出】
}
<<<
error6
返回示例:
{
status: 400,
message: "新增2個設備成功;1個設備失敗!"【PS:新增設備失敗】
}
+++
* * * * *
* * * * *
* * * * *
## 6. 產品管理中的 更新設備
+++
post:/store/product/edit_devices
*int:id#需要更新設備的id值【PS: id=1】
string:sn#需要更新設備的S/N碼
datetime:sale_time#需要更新設備的出售時間【PS:sale_time=2016-12-01 00:00:00】
int:status=默認值#可以為以下值:-1(有問題)/0(在庫)/1(出售)
<<<
success
返回示例:
{
status: 200,
message: "修改成功!"
}
<<<
error1
返回示例:
{
status: 400,
message: "該S/N碼已經存在"【PS:該S/N碼已經存在】
}
<<<
error2
返回示例:
{
status: 400,
message: "修改失敗!"【PS:該設備沒有或者S/N碼沒有改變】
}
+++