使用說(shuō)明
- 所有GET請(qǐng)求的分頁(yè)都使用 limit=10&offset=0 參數(shù)控制
APP
APP取得JWT Token
http://develop.mige.in:81/UserModule.cgi
{
"skey" : "ZTM0MTU1NDQ1ZTRiZTBkZGM4ZTBmODY2MTAzMzU4ODc=",
"body" : "",
"uid" : "131b9a8f162861078b59fca70b5d02e7",
"command" : "jwt",
"c_ts" : 1441684870,
"is_plaintext":true,
"data" : ""
}
把反回的token傳給WEB端
WEB
查詢(xún)本機(jī)的領(lǐng)取模式
GET http://develop.mige.in:82/cgi-bin/api/vem/machine/?machineid=dc6bb6f6592fac911db35c7cf9aae905
machineid : 機(jī)器的二維碼昼扛,也就是 qrcode
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "古里古怪",
"machineid": "dc6bb6f6592fac911db35c7cf9aae905",
"mode": "0",
"checkphone": false,
"price": "0.00",
"stock": 0,
"brand": {
"id": 2,
"name": "LOL"
}
}
]
}
mode:
MODE_CHIOCES = (
('0', '必須通過(guò)Missapp掃描領(lǐng)取'),
('1', '微信掃描,必須通過(guò)手機(jī)號(hào)碼驗(yàn)證領(lǐng)取'),
('2', '微信掃描欲诺,需要付款領(lǐng)取'),
('3', '直接通過(guò)微信掃描領(lǐng)取'), )
price: 需要支付的錢(qián)錢(qián)
得到手機(jī)驗(yàn)證碼
POST http://develop.mige.in:82/cgi-bin/api/vem/getsmscode/
{
"phone": "13555555555"
}
返回
{
"message": "驗(yàn)證碼已發(fā)頭送",
"result_code": 1
}
通過(guò)微信領(lǐng)取禮物
GET http://develop.mige.in:82/cgi-bin/api/vem/gift/wechatbeg/
{
"checkcode": 123456,
"qrcode": "dc6bb6f6592fac911db35c7cf9aae905",
"phone" : "13555555555",
"smstoken" : "smstoken 可以由短信驗(yàn)證接口得到"
}
- phone 與 checkcode 在 ('1', '微信掃描抄谐,必須通過(guò)手機(jī)號(hào)碼驗(yàn)證領(lǐng)取'), 時(shí)需要
- qrcode 為必填
- 模式會(huì)員模式領(lǐng)取時(shí)(狀態(tài)4) smstoken 為必填寫(xiě)
領(lǐng)取禮物
POST http://develop.mige.in:82/cgi-bin/api/vem/gift/beg/
{
"ukey": "131b9a8f162861078b59fca70b5d02e7",
"qrcode": "xxxxxxx",
"token" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTQ5NzkzNzk3NSYwYTdhYTM4YzNjYzI4OWY1NzNjMWFlODEzNzAxZjhkYQ=="
}
```
* ukey:由APP傳過(guò)來(lái)
* qrcode:掃碼得到,由APP傳過(guò)來(lái)
* token:app傳過(guò)來(lái)
```json
{
"status": 100,
"resultData": null,
"errorMessage": null,
"errorCode": null,
"resultStatus": true,
"message": "可以領(lǐng)取",
"id": 81,
"result_code": 1
}
```
### 支付
POST http://develop.mige.in:82/cgi-bin/api/vem/wxuserpayment/0/dc6bb6f6592fac911db35c7cf9aae905/
```json
{
"openId": "oik1_vxQdd-GDurBcUVi4geCSbi0",
"cost" : "0.02",
"message" : "qrcode"
}
```
url中的0寫(xiě)死
dc6bb6f6592fac911db35c7cf9aae905 : 這個(gè)換成當(dāng)前機(jī)器的 qrcode
openId也可以使用Cookie傳送
cost 是要支付的錢(qián)
message 隨意
```
支付成功后,可以調(diào)用發(fā)放接口wechatbeg
調(diào)用微信支付接口
wx.chooseWXPay({
timestamp: msg.data.timeStamp, // 支付簽名時(shí)間戳扰法,注意微信jssdk中的所有使用timestamp字段均為小寫(xiě)蛹含。但最新版的支付后臺(tái)生成簽名使用的timeStamp字段名需大寫(xiě)其中的S字符
nonceStr: msg.data.nonceStr, // 支付簽名隨機(jī)串,不長(zhǎng)于 32 位
package: msg.data.package, // 統(tǒng)一支付接口返回的prepay_id參數(shù)值塞颁,提交格式如:prepay_id=***)
signType: 'MD5', // 簽名方式浦箱,默認(rèn)為'SHA1',使用新版支付需傳入'MD5'
paySign: msg.data.paySign, // 支付簽名
success: function (res) {
// 支付成功后的回調(diào)函數(shù)
}
});
```
* resultStatus=true 表示已經(jīng)開(kāi)始發(fā)放了
POST http://develop.mige.in:82/cgi-bin/api/vem/gift/query/
### 得到查詢(xún)要用的數(shù)據(jù)
POST
```
{
"ukey": "131b9a8f162861078b59fca70b5d02e7",
"id" : 81,
"qrcode": "dc6bb6f6592fac911db35c7cf9aae905",
"token" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTQ5ODAxNjkzMCY3NmRmZmRjMGJkMDljNTY2Njg1NmUxYWM0OGY3YjlmMg=="
}
```
返回
```
{
"timestamp": "1498207145",
"oid": "81",
"sign": "39a013bfaa1fd8a9aeadb827264748b7",
"partnerId": "miss@2017",
"qrcode": "dc6bb6f6592fac911db35c7cf9aae905",
"message": "查詢(xún)數(shù)據(jù)",
"id": 81,
"result_code": 1
}
```
* 請(qǐng)求發(fā)送后,每過(guò)幾秒調(diào)用一下,檢測(cè)是否成功祠锣,1分鐘超時(shí),超時(shí)后顯示失敗酷窥,重來(lái)
POST http://server.songzb.com:30000/partner/getGift
```json
{
"timestamp": "1497925196",
"oid": "81",
"partnerId": "miss@2017",
"qrcode": "dc6bb6f6592fac911db35c7cf9aae905",
"sign": "d8bb69c944425415e9d9362d482909d2",
}
```
````json
{
"resultStatus":true,
"errorMessage":null,
"errorCode":null,
"resultData":1
}
- resultData=1表示已經(jīng)發(fā)放成功
check接口返回:
-1,message=u"Token錯(cuò)誤"
-2,message=u"二維碼不正確。伴网。蓬推。"
-3,message=u"并沒(méi)有開(kāi)始領(lǐng)取"
1,message=u"領(lǐng)取成功"
2,message="發(fā)放中。澡腾。拳氢。"
beg接口返回:
-1,message=u"Token錯(cuò)誤"
-2,message=u"二維碼不正確募逞。。馋评。"
-3,message=u"不可重復(fù)領(lǐng)取
-4,message=u"操作中。刺啦。留特。
1,message=u"領(lǐng)取成功"
查詢(xún)領(lǐng)取狀態(tài)
POST http://develop.mige.in:82/cgi-bin/api/vem/gift/check/
{
"ukey": "131b9a8f162861078b59fca70b5d02e7",
"qrcode": "xxxxxxx",
"token" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTQ5NzkzNzk3NSYwYTdhYTM4YzNjYzI4OWY1NzNjMWFlODEzNzAxZjhkYQ=="
}
```
* ukey:由APP傳過(guò)來(lái)
* qrcode:掃碼得到,由APP傳過(guò)來(lái)
* token:app傳過(guò)來(lái)
## 會(huì)員系統(tǒng)
### 請(qǐng)求驗(yàn)證碼
POST http://develop.mige.in:82/cgi-bin/api/misc/getsmscode/
```json
{
"phone": "13555555555"
}
```
返回
```
{
"message": "驗(yàn)證碼已發(fā)頭送",
"result_code": 1
}
```
### 驗(yàn)證短信短信玛瘸,得到smstoken
POST http://develop.mige.in:82/cgi-bin/api/misc/verifysmscode/
```json
{
"phone": "13555555555",
"checkcode" : "123456"
}
```
返回
```json
{
"smstoken": "eyJwaG9uZSI6ICIxMzU0MDYxMzIyMCIsICJleHBpcmV0aW1lIjogMTUwNDMzNTI5NC40NDgzNzg2LCAidGltZXN0YW1wIjogMTUwNDI0ODg5NCwgImhhc2giOiAiOWM1OWU0ODFjNGM1NjEzNjJhNjkyMmVmZWZjYTc5ODUifQ==",
"result_code": 1
}
```
### 查詢(xún)某個(gè)手機(jī)號(hào)是不是會(huì)員
GET http://develop.mige.in:82/cgi-bin/api/vip/vip/?phone=123456
返回
```json
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"phone": "123456",
"expiretime": "2017-09-15T10:56:17",
"vip": true
}
]
}
```
### 通過(guò)UID查詢(xún)自己當(dāng)前綁定的手機(jī)號(hào)(僅限使用微信與微博登陸的用戶(hù)使用)
GET http://develop.mige.in:82/cgi-bin/api/oauth/missappuser/getphone/?uid=131b9a8f162861078b59fca70b5d02e7
```json
{
"message": "ok",
"id": 1,
"phone": "13000000",
"uid": "131b9a8f162861078b59fca70b5d02e7",
"addtime": "2017-09-12T10:38:38.933931",
"active": true,
"result_code": 1
}
```
### 綁定手機(jī)
* 在購(gòu)買(mǎi)會(huì)員前先查詢(xún)自己有沒(méi)有綁定的手機(jī)號(hào)碼,如果沒(méi)有要先進(jìn)強(qiáng)制綁定界面
* 即使是手機(jī)登陸的帳號(hào)也要綁定一下,作用是驗(yàn)證用戶(hù)的手機(jī)換了號(hào)沒(méi)有
POST http://develop.mige.in:82/cgi-bin/api/oauth/missappuser/
````json
{
"phone": "13540613220",
"checkcode" : "123456",
"jwt" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTUwNTA5Nzc4MiYyMTUxNDZjMmEwNmM1ZGYyNDAyZWZhOTFkNWI5MDA5OA=="
}
checkcode:使用前面的請(qǐng)求驗(yàn)證碼接口發(fā)送到手記手機(jī)
jwt: 看最上面
返回
{
"id": 1,
"phone": "13540613220",
"uid": "131b9a8f162861078b59fca70b5d02e7",
"addtime": "2017-09-12T10:38:38.933931",
"active": true
}
查詢(xún)可以購(gòu)買(mǎi)的會(huì)員卡類(lèi)型
GET http://develop.mige.in:82/cgi-bin/api/vip/vipprice/
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 3,
"name": "包年",
"days": 365,
"price": "300.00"
},
{
"id": 2,
"name": "包季度",
"days": 120,
"price": "100.00"
},
{
"id": 1,
"name": "包月",
"days": 30,
"price": "30.00"
}
]
}
購(gòu)買(mǎi)會(huì)員-新建會(huì)員訂單
POST http://develop.mige.in:82/cgi-bin/api/vip/order/neworder/
{
"phone": "13540613222",
"checkcode" : "123456",
"smstoken": "eyJwaG9uZSI6ICIxMzU0MDYxMzIyMCIsICJleHBpcmV0aW1lIjogMTUwNDMzNTI5NC40NDgzNzg2LCAidGltZXN0YW1wIjogMTUwNDI0ODg5NCwgImhhc2giOiAiOWM1OWU0ODFjNGM1NjEzNjJhNjkyMmVmZWZjYTc5ODUifQ==",
"price" : "100.00"
}
返回
{"orderid":6,"result_code":1}
- orderid 支付時(shí)會(huì)用到蜕青,這個(gè)是定單ID
開(kāi)始支付-支付寶
POST http://develop.mige.in:82/cgi-bin/api/payment/alipay/10/6/
- 第一個(gè)參數(shù)
充VIP
PAYREASON_VIP_CHARGE = 10
購(gòu)買(mǎi)小樣
PAYREASON_BUY_XY = 20
- 第二個(gè)參數(shù)是定單號(hào)
{
"message":"我不想說(shuō)什么",
"fee" : 100.00
}
返回
{
"message": "OK",
"data": "app_id=2017051807277879&biz_content=%7B%22subject%22%3A%22%5Cu652f%5Cu4ed8100.00%5Cu5143%22%2C%22out_trade_no%22%3A%22001000000006000000011504251282%22%2C%22total_amount%22%3A%22100.00%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22attach%22%3A%2210%7C6%22%7D&charset=utf-8&method=alipay.trade.app.pay¬ify_url=http%3A%2F%2Fdevelop.mige.in%3A82%2Fcgi-bin%2Fapi%2Fpayment%2Falipaynotify%2F10%2F1%2F&sign_type=RSA2×tamp=2017-09-01+15%3A36%3A20&version=1.0&sign=uTy8iEAM5wTtBdIejue%2B6EHt6ESDK%2Bfb2WV%2FMsMxDt0Jwk4cf73VXQlghvVMU0xK8SlO6pfx6yjsXUxjtG4ja2zdDY1MXMVB89ntpySbXj183oQ27jzBS%2BDUZauQBj7MD1jLzKWn2cfYiLgO%2BRL4QWZfxIOgsi7gBZf8c3Z%2BUE4BhgugY4EEC7G8YA0TRVcbK%2Bni8vJJwfy7T8FQgFBsM23QizvBVoU5kziMtgRo7TKBRjcZVw6ztDiYTnMMReU0LMmsRjeoAl%2B%2B%2FoS3AL8JVjbfZbus9rw8fSVD6PCQQVCbDQtnHNGDW6NgHNPR7miQnbhh8q%2Fg4qOnrU4btsW3PQ%3D%3D",
"result_code": 1
}
管理系統(tǒng)
登陸
POST http://develop.mige.in:82/cgi-bin/api/api-token-auth/
{
"username": "missvem",
"password": "missvemmissvem"
}
```
### 品牌列表
GET http://develop.mige.in:82/cgi-bin/api/vem/brand/
```json
[
{
"id": 2,
"name": "LOL"
},
{
"id": 1,
"name": "TEST"
},
{
"id": 3,
"name": "WOT"
}
]
```
### 添加品牌
POST http://develop.mige.in:82/cgi-bin/api/vem/brand/
```json
{
"name": "POD"
}
```
### 刪除品牌
DELETE http://develop.mige.in:82/cgi-bin/api/vem/brand/`4`/
### 修改品牌名字
PATCH http://develop.mige.in:82/cgi-bin/api/vem/brand/`4`/
```json
{
"name": "POD"
}
```
### 機(jī)器列表
GET http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/
```json
[
{
"id": 9,
"name": "公司測(cè)試 - 廣東省深圳市南山區(qū)粵海街道方大大廈|606",
"machineid": "dc6bb6f6592fac911db35c7cf9aae905",
"mode": "2",
"price": "1.11",
"stock": 4,
"brand": 2
},
{
"id": 10,
"name": "公司測(cè)試 - 廣東省深圳市南山區(qū)粵海街道方大大廈|606",
"machineid": "dc6bb6f6592fac911db35c7cf9aae905",
"mode": "2",
"price": "1.11",
"stock": 4,
"brand": 2
}
]
```
### 修改機(jī)器品牌,工作模式,價(jià)格
PATCH http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/9/
```json
{
"mode": "2",
"price": "1.11",
"brand": 2 ID
}
```
* 每一項(xiàng)都是可選項(xiàng)目,只填寫(xiě)需要修改的項(xiàng)目
* mode : 注意這里是字符串哈
```
('0', '必須通過(guò)Missapp掃描領(lǐng)取'),
('1', '微信掃描,必須通過(guò)手機(jī)號(hào)碼驗(yàn)證領(lǐng)取'),
('2', '微信掃描糊渊,需要付款領(lǐng)取'),
('3', '直接通過(guò)微信掃描領(lǐng)取'),
```
* brand 品牌的ID
* price 如果是付費(fèi)領(lǐng)取,那么這里是價(jià)格
### 查詢(xún)機(jī)器信息
POST http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/get_info_by_qrcode/
### 修改機(jī)器庫(kù)存
POST http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/update_stock/
```json
{
"qrcode":"dc6bb6f6592fac911db35c7cf9aae905",
"stock" : 20
}
```
成功時(shí)返回
```
{
"id": 9,
"name": "公司測(cè)試 - 廣東省深圳市南山區(qū)粵海街道方大大廈|606",
"machineid": "dc6bb6f6592fac911db35c7cf9aae905",
"mode": "2",
"price": "1.11",
"stock": 20,
"brand": {
"id": 2,
"name": "LOL"
},
"result_code": 1
}
```
失敗時(shí)返回
```json
{
"message": "fail",
"result_code": -1
}
```
# 積分相關(guān)
###查詢(xún)自己當(dāng)前積分
POST http://develop.mige.in:82/cgi-bin/api/score/score/getinfo/
```json
{
"typeid": 1,
"ruleid": 3,
"timestamp" : 1505098932,
"jwt" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTUwNTA5Nzc4MiYyMTUxNDZjMmEwNmM1ZGYyNDAyZWZhOTFkNWI5MDA5OA=="
}
```
* typeid 積分類(lèi)型,目前固定為1
* ruleid 積分規(guī)則:
* timestamp 你猜
* jwt 你再猜,猜不到從最上面第一條開(kāi)始看
返回
```json
{
"id": 2,
"uid": "131b9a8f162861078b59fca70b5d02e7",
"typeid": 1,
"score": 2.00
}
```
id: 這個(gè)是你的積分ID
score :用戶(hù)當(dāng)前的積分
### 給自己增加積分(前端提交右核,后臺(tái)驗(yàn)證)
POST http://develop.mige.in:82/cgi-bin/api/score/score/action/
```json
{
"typeid": 1,
"ruleid": 2,
"timestamp" : 1505098932,
"jwt" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTUwNTA5Nzc4MiYyMTUxNDZjMmEwNmM1ZGYyNDAyZWZhOTFkNWI5MDA5OA=="
}
返回
{
"message": "Ok",
"score": 8.00,
"result_code": 1
}
失敗返回
{
"message": "超出每日限額",
"result_code": -2
}
查詢(xún)積分日志
- typeid 積分類(lèi)型,目前固定為1
- jwt 你再猜,猜不到從最上面第一條開(kāi)始看
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"score": "1.00",
"typeid": 1,
"specialid": 0,
"addtime": "2017-09-11T13:23:23.326619",
"scoreown": 2,
"rule": 2
},
{
"id": 1,
"score": "1.00",
"typeid": 1,
"specialid": 0,
"addtime": "2017-09-11T11:22:36.095089",
"scoreown": 2,
"rule": 3
}
]
}
- rule 帶表的意思看下面這個(gè)接口,rule =的數(shù)值對(duì)面下面接查詢(xún)口的ID渺绒,這個(gè)ID不會(huì)變 可以代碼寫(xiě)死
查詢(xún)每次規(guī)則的意思
GET http://develop.mige.in:82/cgi-bin/api/score/scorerule/
數(shù)據(jù)太多的時(shí)候請(qǐng)使用分頁(yè)
http://develop.mige.in:82/cgi-bin/api/score/scorerule/?limit=10&offset=10
{
"count": 18,
"next": "http://develop.mige.in:82/cgi-bin/api/score/scorerule/?limit=10&offset=10",
"previous": null,
"results": [
{
"id": 1,
"name": "登陸Miss APP",
"active": true,
"ruletype": 1,
"predayscore": "1.00",
"singlescore": "1.00",
"addtime": "2017-09-11T10:03:55.422029"
},
{
"id": 2,
"name": "發(fā)圖",
"active": true,
"ruletype": 1,
"predayscore": "5.00",
"singlescore": "1.00",
"addtime": "2017-09-11T10:04:26.419982"
},
{
"id": 3,
"name": "評(píng)論",
"active": true,
"ruletype": 1,
"predayscore": "2.00",
"singlescore": "1.00",
"addtime": "2017-09-11T10:04:48.375564"
},
{
"id": 4,
"name": "點(diǎn)贊",
"active": true,
"ruletype": 1,
"predayscore": "1.00",
"singlescore": "0.10",
"addtime": "2017-09-11T13:52:20.176327"
},
{
"id": 5,
"name": "添加好友",
"active": true,
"ruletype": 1,
"predayscore": "5.00",
"singlescore": "1.00",
"addtime": "2017-09-11T13:52:29.044596"
},
{
"id": 6,
"name": "停留時(shí)間",
"active": true,
"ruletype": 1,
"predayscore": "2.00",
"singlescore": "1.00",
"addtime": "2017-09-11T13:52:45.699631"
},
{
"id": 7,
"name": "打卡",
"active": true,
"ruletype": 1,
"predayscore": "1.00",
"singlescore": "1.00",
"addtime": "2017-09-11T13:52:53.890897"
},
{
"id": 8,
"name": "分享到第三方平臺(tái)",
"active": true,
"ruletype": 1,
"predayscore": "2.00",
"singlescore": "1.00",
"addtime": "2017-09-11T13:53:04.532271"
},
{
"id": 9,
"name": "預(yù)留",
"active": false,
"ruletype": 1,
"predayscore": "1.00",
"singlescore": "1.00",
"addtime": "2017-09-11T13:53:23.034482"
},
{
"id": 10,
"name": "預(yù)留2",
"active": false,
"ruletype": 1,
"predayscore": "1.00",
"singlescore": "1.00",
"addtime": "2017-09-11T13:53:37.802519"
}
]
}
美顏奇機(jī)
得到領(lǐng)取碼
POST http://develop.mige.in:82/cgi-bin/api/voucher/voucher/distribute/
{
"phone" : 13540613220,
"flag" :1,
"checkcode" :123456
}
領(lǐng)取過(guò)時(shí)返回
{
"message": "抱歉贺喝,你已經(jīng)領(lǐng)取過(guò)了哦",
"data": [
{
"vidstr": "2222222",
"phone": "13540613220",
"addtime": "2017-09-16T13:40:16.444975"
}
],
"result_code": -1
}
無(wú)庫(kù)存
{
"message": "抱歉,已經(jīng)領(lǐng)完了哦",
"result_code": -1
}
成功
{
"message": "ok",
"data": {
"id": 2,
"vid": "111111",
"flag": 1,
"active": true,
"addtime": "2017-09-16T13:50:58.386885"
},
"result_code": 1
}