miss接口

使用说明

  • 所有GET请求的分页都使用 limit=10&offset=0 参数控制

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

查询本机的领取模式

GET http://develop.mige.in:82/cgi-bin/api/vem/machine/?machineid=dc6bb6f6592fac911db35c7cf9aae905

machineid : 机器的二维码,也就是 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', '必须通过Missapp扫描领取'),
        ('1', '微信扫描,必须通过手机号码验证领取'),
        ('2', '微信扫描,需要付款领取'),
        ('3', '直接通过微信扫描领取'),  )
price: 需要支付的钱钱

得到手机验证码

POST http://develop.mige.in:82/cgi-bin/api/vem/getsmscode/

{
    "phone":   "13555555555"
}

返回

{
    "message": "验证码已发头送",
    "result_code": 1
}

通过微信领取礼物

GET http://develop.mige.in:82/cgi-bin/api/vem/gift/wechatbeg/

{
    "checkcode": 123456,
        "qrcode": "dc6bb6f6592fac911db35c7cf9aae905",
        "phone" : "13555555555",
        "smstoken" : "smstoken 可以由短信验证接口得到"
}

  • phone 与 checkcode 在 ('1', '微信扫描,必须通过手机号码验证领取'), 时需要
  • qrcode 为必填
  • 模式会员模式领取时(状态4) smstoken 为必填写

领取礼物

POST http://develop.mige.in:82/cgi-bin/api/vem/gift/beg/

{
    "ukey": "131b9a8f162861078b59fca70b5d02e7",
        "qrcode": "xxxxxxx",
        "token" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTQ5NzkzNzk3NSYwYTdhYTM4YzNjYzI4OWY1NzNjMWFlODEzNzAxZjhkYQ=="
}
```
* ukey:由APP传过来
* qrcode:扫码得到,由APP传过来
* token:app传过来

```json
{
    "status": 100,
        "resultData": null,
        "errorMessage": null,
        "errorCode": null,
        "resultStatus": true,
        "message": "可以领取",
        "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写死
dc6bb6f6592fac911db35c7cf9aae905 : 这个换成当前机器的 qrcode
openId也可以使用Cookie传送
cost 是要支付的钱
message 随意
```
支付成功后,可以调用发放接口wechatbeg

调用微信支付接口

wx.chooseWXPay({
timestamp: msg.data.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: msg.data.nonceStr, // 支付签名随机串,不长于 32 位
package: msg.data.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
signType: 'MD5', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: msg.data.paySign, // 支付签名
success: function (res) {
// 支付成功后的回调函数
}
});
```

* resultStatus=true 表示已经开始发放了
POST http://develop.mige.in:82/cgi-bin/api/vem/gift/query/
### 得到查询要用的数据
POST
```
{
    "ukey": "131b9a8f162861078b59fca70b5d02e7",
        "id" : 81,
        "qrcode": "dc6bb6f6592fac911db35c7cf9aae905",
        "token" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTQ5ODAxNjkzMCY3NmRmZmRjMGJkMDljNTY2Njg1NmUxYWM0OGY3YjlmMg=="
}
```
返回
```
{
    "timestamp": "1498207145",
        "oid": "81",
        "sign": "39a013bfaa1fd8a9aeadb827264748b7",
        "partnerId": "miss@2017",
        "qrcode": "dc6bb6f6592fac911db35c7cf9aae905",
        "message": "查询数据",
        "id": 81,
        "result_code": 1
}
```

* 请求发送后,每过几秒调用一下,检测是否成功,1分钟超时,超时后显示失败,重来

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表示已经发放成功

check接口返回:
-1,message=u"Token错误"
-2,message=u"二维码不正确。。。"
-3,message=u"并没有开始领取"
1,message=u"领取成功"
2,message="发放中。。。"

beg接口返回:
-1,message=u"Token错误"
-2,message=u"二维码不正确。。。"
-3,message=u"不可重复领取
-4,message=u"操作中。。。
1,message=u"领取成功"

查询领取状态
POST http://develop.mige.in:82/cgi-bin/api/vem/gift/check/

{
    "ukey": "131b9a8f162861078b59fca70b5d02e7",
        "qrcode": "xxxxxxx",
        "token" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTQ5NzkzNzk3NSYwYTdhYTM4YzNjYzI4OWY1NzNjMWFlODEzNzAxZjhkYQ=="
}
```
* ukey:由APP传过来
* qrcode:扫码得到,由APP传过来
* token:app传过来


## 会员系统

### 请求验证码
POST http://develop.mige.in:82/cgi-bin/api/misc/getsmscode/
```json
{
    "phone":   "13555555555"
}
```
返回
```
{
    "message": "验证码已发头送",
        "result_code": 1
}
```

### 验证短信短信,得到smstoken
POST http://develop.mige.in:82/cgi-bin/api/misc/verifysmscode/
```json
{
    "phone":   "13555555555",
    "checkcode" : "123456"
}

```
返回
```json
{
    "smstoken": "eyJwaG9uZSI6ICIxMzU0MDYxMzIyMCIsICJleHBpcmV0aW1lIjogMTUwNDMzNTI5NC40NDgzNzg2LCAidGltZXN0YW1wIjogMTUwNDI0ODg5NCwgImhhc2giOiAiOWM1OWU0ODFjNGM1NjEzNjJhNjkyMmVmZWZjYTc5ODUifQ==",
        "result_code": 1
}
```


### 查询某个手机号是不是会员
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
        }
        ]
}
```

### 通过UID查询自己当前绑定的手机号(仅限使用微信与微博登陆的用户使用)
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
}
```

### 绑定手机
* 在购买会员前先查询自己有没有绑定的手机号码,如果没有要先进强制绑定界面
* 即使是手机登陆的帐号也要绑定一下,作用是验证用户的手机换了号没有
POST http://develop.mige.in:82/cgi-bin/api/oauth/missappuser/
````json
{
  "phone":   "13540613220",
  "checkcode" : "123456",
  "jwt" : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTUwNTA5Nzc4MiYyMTUxNDZjMmEwNmM1ZGYyNDAyZWZhOTFkNWI5MDA5OA=="
}

checkcode:使用前面的请求验证码接口发送到手记手机
jwt: 看最上面
返回

{
    "id": 1,
    "phone": "13540613220",
    "uid": "131b9a8f162861078b59fca70b5d02e7",
    "addtime": "2017-09-12T10:38:38.933931",
    "active": true
}

查询可以购买的会员卡类型

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"
        }
        ]
}

购买会员-新建会员订单

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 支付时会用到,这个是定单ID

开始支付-支付宝

POST http://develop.mige.in:82/cgi-bin/api/payment/alipay/10/6/

  • 第一个参数

充VIP

PAYREASON_VIP_CHARGE = 10

购买小样

PAYREASON_BUY_XY = 20

  • 第二个参数是定单号
{
    "message":"我不想说什么",
        "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
}

管理系统

登陆

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"
}
```
### 机器列表
GET http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/
```json
[
{
    "id": 9,
        "name": "公司测试 - 广东省深圳市南山区粤海街道方大大厦|606",
        "machineid": "dc6bb6f6592fac911db35c7cf9aae905",
        "mode": "2",
        "price": "1.11",
        "stock": 4,
        "brand": 2
},
{
    "id": 10,
    "name": "公司测试 - 广东省深圳市南山区粤海街道方大大厦|606",
    "machineid": "dc6bb6f6592fac911db35c7cf9aae905",
    "mode": "2",
    "price": "1.11",
    "stock": 4,
    "brand": 2
}
]
```

### 修改机器品牌,工作模式,价格
PATCH http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/9/
```json
{
    "mode": "2",
    "price": "1.11",
    "brand": 2     ID
}
```
* 每一项都是可选项目,只填写需要修改的项目
* mode : 注意这里是字符串哈
```
('0', '必须通过Missapp扫描领取'),
    ('1', '微信扫描,必须通过手机号码验证领取'),
    ('2', '微信扫描,需要付款领取'),
    ('3', '直接通过微信扫描领取'),
    ```
    * brand 品牌的ID
    * price 如果是付费领取,那么这里是价格



### 查询机器信息
    POST http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/get_info_by_qrcode/


### 修改机器库存
    POST http://develop.mige.in:82/cgi-bin/api/vem/machineadmin/update_stock/
    ```json
{
    "qrcode":"dc6bb6f6592fac911db35c7cf9aae905",
    "stock" : 20
}
```
成功时返回
```
{
    "id": 9,
        "name": "公司测试 - 广东省深圳市南山区粤海街道方大大厦|606",
        "machineid": "dc6bb6f6592fac911db35c7cf9aae905",
        "mode": "2",
        "price": "1.11",
        "stock": 20,
        "brand": {
            "id": 2,
            "name": "LOL"
        },
        "result_code": 1
}

```
失败时返回
```json
{
    "message": "fail",
        "result_code": -1
}
```





# 积分相关

###查询自己当前积分
POST http://develop.mige.in:82/cgi-bin/api/score/score/getinfo/
```json
{
    "typeid":  1,
        "ruleid": 3,
        "timestamp" : 1505098932,
        "jwt"   : "MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTUwNTA5Nzc4MiYyMTUxNDZjMmEwNmM1ZGYyNDAyZWZhOTFkNWI5MDA5OA=="
}

```
* typeid 积分类型,目前固定为1
* ruleid 积分规则:
* timestamp 你猜
* jwt 你再猜,猜不到从最上面第一条开始看

返回

```json
{
    "id": 2,
    "uid": "131b9a8f162861078b59fca70b5d02e7",
    "typeid": 1,
    "score": 2.00
}
```

id: 这个是你的积分ID
score :用户当前的积分

### 给自己增加积分(前端提交,后台验证)
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
}

查询积分日志

GET http://develop.mige.in:82/cgi-bin/api/score/scorelog/?typeid=1&jwt=MTMxYjlhOGYxNjI4NjEwNzhiNTlmY2E3MGI1ZDAyZTcmMTUwNTA5Nzc4MiYyMTUxNDZjMmEwNmM1ZGYyNDAyZWZhOTFkNWI5MDA5OA==

  • typeid 积分类型,目前固定为1
  • jwt 你再猜,猜不到从最上面第一条开始看
{
    "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 带表的意思看下面这个接口,rule =的数值对面下面接查询口的ID,这个ID不会变 可以代码写死

查询每次规则的意思

GET http://develop.mige.in:82/cgi-bin/api/score/scorerule/
数据太多的时候请使用分页
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": "发图",
            "active": true,
            "ruletype": 1,
            "predayscore": "5.00",
            "singlescore": "1.00",
            "addtime": "2017-09-11T10:04:26.419982"
        },
        {
            "id": 3,
            "name": "评论",
            "active": true,
            "ruletype": 1,
            "predayscore": "2.00",
            "singlescore": "1.00",
            "addtime": "2017-09-11T10:04:48.375564"
        },
        {
            "id": 4,
            "name": "点赞",
            "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": "停留时间",
            "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": "分享到第三方平台",
            "active": true,
            "ruletype": 1,
            "predayscore": "2.00",
            "singlescore": "1.00",
            "addtime": "2017-09-11T13:53:04.532271"
        },
        {
            "id": 9,
            "name": "预留",
            "active": false,
            "ruletype": 1,
            "predayscore": "1.00",
            "singlescore": "1.00",
            "addtime": "2017-09-11T13:53:23.034482"
        },
        {
            "id": 10,
            "name": "预留2",
            "active": false,
            "ruletype": 1,
            "predayscore": "1.00",
            "singlescore": "1.00",
            "addtime": "2017-09-11T13:53:37.802519"
        }
    ]
}

美颜奇机

得到领取码
POST http://develop.mige.in:82/cgi-bin/api/voucher/voucher/distribute/
{
"phone" : 13540613220,
"flag" :1,
"checkcode" :123456
}
领取过时返回

{
    "message": "抱歉,你已经领取过了哦",
    "data": [
        {
            "vidstr": "2222222",
            "phone": "13540613220",
            "addtime": "2017-09-16T13:40:16.444975"
        }
    ],
    "result_code": -1
}

无库存

{
    "message": "抱歉,已经领完了哦",
    "result_code": -1
}

成功

{
    "message": "ok",
    "data": {
        "id": 2,
        "vid": "111111",
        "flag": 1,
        "active": true,
        "addtime": "2017-09-16T13:50:58.386885"
    },
    "result_code": 1
}

你可能感兴趣的:(miss接口)