域名和端口
http://52.24.88.186:8888/
請求格式
對于POST和PUT請求,請求的主體必須是JSON格式,
錯誤返回
正確返回在詳細中,所有出錯返回均為
{
'state':'error',
'error':' error detail'
}
詳細使用
用戶認證
url:
/1.0/auth
methed:
post
-
發送參數
{ type:'', phone_num:'', password:'', }
-
返回
{ state:' ', //ok or error [error]:'',//when error [uid]:,// when ok [token]:'', }
用戶取消認證
本操作將刪除設備令牌token
url:
/v1.0/auth/{{uid}}/{{token}}
methed:
delete
-
返回
{ state:'', //ok or error [error]:'', //error info when error }
獲取用戶信息
url
/v1.0/users/{{uid}}
methed
get
-
返回
{ uid: , sex: , // 0 for female, 1 for male username:'', phone_num:' ', score: , qq:'', school:'', dept:'', sign,' ', enroll_year:'',//入學時間 home_area:' ', home_city:'', home_province:' ', birthday:' ', constellation:' ', hobbies: ' ', image: ' ' }
注冊
url`/v1.0/users
methed
post
-
參數
{ username = '', image ='', sex = 1 or 0, phone_num = ' ', school = ' ', dept = ' ', enroll_year = ' ',入學時間 password = ' '//hash過 }
-
返回
{ uid: , token:'', }
修改用戶信息
url
/v1.0/users
methed :
put
-
參數
{ uid: , token:'', sex: , // 0 for female, 1 for male username:'', phone_num:' ', score: , qq:'', school:'', dept:'', sign,' ', enroll_year:'',//入學時間 home_area:' ', home_city:'', home_province:' ', birthday:' ', constellation:' ', hobbies: ' ', image: ' ' , }
-
返回
{ uid: , token:'', }
獲取用戶權限手機號是否公開,收藏是否公開
url:
/v1.0/users/authority/{{uid}}/{{token}}/
methed:
get
-
返回
{ phone_pub:, coll_pub: }
修改用戶權限手機號是否公開,收藏是否公開
url:
/v1.0/users/authority/{{uid}}/{{token}}
methed:
put
-
參數
{ phone_pub: , coll_pub: }
-
返回
{ state:'' , }
查看簽到信息
url:
/v1.0/sign/{{uid}}/{{token}}
methed:
get
-
返回
{ sign:true or false }
簽到
url:
/v1.0/sign/{{uid}}/{{token}}
methed:
post
-
返回
{ state:'ok' }
搜索用戶
url:
/v1.0/users/search
methed:
post
-
參數
{ 'key_word':'', ['page']: , }
獲取分類商品
url:
/v1.0/goods
methed:
get
-
參數
{ kind:,//表示商品分類 sort_by:'',//排序方式( 'multiple','date','view','price',) [reversed]: true or false ,//如果存在則倒序排序,否則正序 page: ,//每次返回20個,表示第幾個20個 }
-
返回
[ { gid: , name:'', views: , price: , date: '', image:'', }, ... ]
獲取商品詳情
url:
/v1.0/goods/{{gid}}
methed:
get
參數:
none-
返回
{ gid: , name: ' ', price: , image:' ', user_info:{ uid: , username:' ', user_image: ' ', phone_num:' ', qq:' ' } school:' ', old: ' ', date:' ', content: ' ', // 描述 kind:{ kind1_name:'', kind2_name:'', } views: , }
獲取首頁最新商品
url:
/v1.0/new_goods
methed
get
-
參數
{ [page]: ,//一次返回20個商品,默認為 1 , }
-
返回
[ { gid: , name:'', price: , date: '', school: '', image: ' ', }, ... ]
搜索商品
url:
/v1.0/goods/search
methed:
post
-
參數
{ key_word: ' ', [page]: , }
-
返回
{ gid: , name: , price: , image: , views: , date: ' ', }
發布商品
url:
/v1.0/goods
methed:
post
-
參數
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學校校 price: , content:'', //描述 kind: ,//分類信息 old: '' // 新舊程度 }
-
返回
{ state:'', //ok or error }
修改商品信息
url:
/v1.0/goods
methed:
put
-
參數
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學校校 price: , content:'', //描述 kind: ,//分類信息 old: '' // 新舊程度 }
-
返回
{ state:'', //ok or error [error]:'' , //error info when error }
下架貨物
url:
/v1.0/goods/{{uid}}/{{token}}/{{gid}}
methed:
DELETE
- 返回
{ state:'', //ok or error [error]:'' , //error info when error }
重新上架貨物
* url: `/v1.0/goods/{{uid}}/{{token}}/{{gid}}`
* methed: `POST`
* 返回
```
{
state:'', //ok or error
[error]:'' , //error info when error
}
```
獲取分類求購
url:
/v1.0/wants
methed:
get
-
參數
{ kind: , sort_by:'',//'multiple','date','view','price' reversed:' ', {{page}}:' ' }
-
返回
{ wid: , name:'', price: , image: , views: , date: , user_info:{ uid: , username: , image: } }
獲取求購詳情
url:
/v1.0/wants/{{wid}}
methed:
get
- 返回
{ wid: , name:' ', views: , price: , content: ' ', school:' ', user_info:{ uid: , username:' ', image:' ' }, kind_info:{ kind_name:' ' } }
獲取首頁最新求購信息
url:
/v1.0/wants/index
methed:
get
-
參數
{ {{page}} }
-
返回
[ { wid: , name:' ' , price: , views: , data:' ', school:' ', user_info:{ uid: , username: , image: ' ' } }, .... ]
搜索求購
url:
/v1.0/wants/search
methed:
post
-
參數
{ key_word:' ', [page]: }
發布求購信息
url:
/v1.0/wants/{{uid}}/{{token}}
methed:
post
-
參數
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學校校 price: , content:'', //描述 kind: ,//分類信息 old: '' // 新舊程度 }
-
返回
{ state:'', //ok or error }
修改求購信息
url:
/v1.0/wants/{{uid}}/{{token}}
methed:
put
-
參數
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學校校 price: , content:'', //描述 kind: ,//分類信息 old: '' // 新舊程度 }
-
返回
{ state:'', //ok or error }
刪除求購信息
url:
/v1.0/wants/{{uid}}/{{wid}}/{{token}}
methed:
delete
- 返回
{ state:'', //ok or error }
獲取當前用戶收藏商品信息
url:
/v1.0/collections/goods
methed:
POST
-
參數
{ uid:' ', token: ' ', [page]:' ' }
-
返回
{ 'user_info':{ uid:, username: '', image:' ', }, price:' ', state:' ',//狀態 商品出售中或者已經下架 gid: ' ', date: ' ', image:' ', name:' ' }
獲取當前用戶收藏求購信息
* url:`/v1.0/collections/wants`
* methed:`POST`
* 參數
```
{
uid:' ',
token: ' ',
[page]:' '
}
```
* 返回
```
{
'user_info':{
uid:,
username: '',
image:' ',
},
price:' ',
state:' ',//狀態 商品出售中或者已經下架
wid: ' ',
date: ' ',
name:' '
}
```
獲取制定用戶收藏商品信息
* url:`/v1.0/collections/goods/{{uid}}`
* methed:`GET`
* 參數
```
{
[page]:' '
}
```
* 返回
```
{
'user_info':{
uid:,
username: '',
image:' ',
},
price:' ',
state:' ',//狀態 商品出售中或者已經下架
gid: ' ',
date: ' ',
image:' ',
name:' '
}
```
獲取指定用戶收藏求購信息
* url:`/v1.0/collections/wants/{{uid}}`
* methed:`GET`
* 參數
```
{
[page]:' '
}
```
* 返回
```
{
'user_info':{
uid:,
username: '',
image:' ',
},
price:' ',
state:' ',//狀態 商品出售中或者已經下架
wid: ' ',
date: ' ',
name:' '
}
```
新增商品收藏
url :
/v1.0/collections/goods/{{uid}}/{{gid}}/{{token}}
methed: 'post',
-
返回
{ state:' ok', }
新增求購收藏
url :
/v1.0/collections/wants/{{uid}}/{{gid}}/{{token}}
methed: 'post',
-
返回
{ state:' ok', }
刪除商品收藏
url :
/v1.0/collections/goods/{{uid}}/{{gid}}/{{token}}
methed: 'DELETE',
-
返回
{ state:' ok', }
刪除求購收藏
url :
/v1.0/collections/wants/{{uid}}/{{gid}}/{{token}}
methed: 'DELETE',
-
返回
{ state:' ok', }
獲取一級分類分類信息
url
/v1.0/kinds
methed:
get
-
返回
{ kid: , name:' ', image:' ' }
獲取一級分類下所有二級分類信息
url
/v1.0/kinds/{{ l_kid }}
methed:
get
-
返回
{ s_kid: , name:'', image:'', }
獲取商品評論
url:
/v1.0/comments/goods/{{gid}}
methed:
get
參數
{
[page]
}-
返回
{ name: ' ',// 商品名 comment:' ', to_user:{ uid: , username:' ', image:' ' }, from_user:{ uid: , username: ' ', image }, gid, date:' ' }
獲取求購評論
url:
/v1.0/comments/wants/{{wid}}
methed:
get
參數
{
[page]
}-
返回
{ name: ' ', comment:' ', to_user:{ uid: , username:' ', image:' ' }, from_user:{ uid: , username: ' ', image }, wid, date:' ' }
發布商品評論
url:
/v1.0/comments/goods/{{gid}}//{{uid}}/{{token}}
methed:
post
參數
{
'comment':' ',
}-
返回
{ 'state':'ok' }
發布求購評論
url:
/v1.0/comments/wants/{{wid}}//{{uid}}/{{token}}
methed:
post
參數
{
'comment':' ',
}-
返回
{ 'state':'ok' }
發送回執
url:
/v1.0/feedback/{{uid}}/{{token}}
methed:
post
-
參數
{ 'content':' ' }
-
返回
{ 'state':' ' }
上傳圖片
url :
/v1.0/images
methed:
post
-
參數 (編碼格式 form-data)
{ 'image': '你的圖片', ‘uid': , 'token': , }
-
返回
{ 'hash':'', 'key':' ', }
訪問方法
7xjejh.dl1.z0.glb.clouddn.com /
+ key-
圖片切割
- goods
增加參數?imageView2/1/w/800/h/800/q/75/format/JPG
返回jpg格式 800*800 px 的圖片
- goods
例子
上傳圖片后KEY 為 {{key}}
則http://7xjejh.dl1.z0.glb.clouddn.com /{{key}}?imageView2/1/w/800/h/800/q/75/format/JPG
返回jpg格式 800*800 px 的圖片
舉報
url:
/v1.0/reposts/{{uid}}//{{token}}
methed:
post
-
參數
{ 'id': , //gid or wid 'type':' 舉報商品還是求購'// good or want, 'content':' 舉報內容' }
-
返回
{ 'state': 'ok', }
查看用戶發布的商品
url:
/v1.0/users/goods/{{uid}}/{{token}}
methed:
get
-
參數
{ [page] : ', }
-
返回
[ { "name": "", "views": , "price": , "gid": , "date": "", "image": " " }, ... ]
查看用戶發布的求購
url:
/v1.0/users/wants/{{uid}}/{{token}}
methed:
get
-
參數
{ [page] : ', }
-
返回
[ { "school": "", "wid": , "name": "", "views": , "price": , "date": " " }, ... ]