备注
- 注1:状态码表格
code | desc |
---|---|
200 | 操作成功 |
401 | 用户未登录,需进行登录流程 |
500 | 操作错误或服务器错误,一般伴有提示信息 |
注2:所有访问均通过网关转发,网关地址:http://39.98.48.120:63010/
,在其后跟接口路径即可访问对应接口,开发阶段仅为特定Ip开放.
如需查看swagger文档,由于项目精简了模块,user合并了log,pay合并了cashback。该操作并不会影响接口访问网关代理,仅会影响swagger,导致其不能被网关管理,因此:
- 如需访问user&log模块swagger文档,走:
http://39.98.48.120:63050/swagger-ui.html
- 如需访问pay&cashback模块swagger文档,走:
http://39.98.48.120:63070/swagger-ui.html
注3:rewards
字段的所有请求均应以分为单位方便录入,如52元应传输5200;所有响应均以元为单位呈现方便展示,如52元返回“52.00”,为行区分之意,响应字段的rewards将被称为rewardsFloat
注4:小程序的带参分享二维码由前端根据用户手机号直接生成,如何获取带参数(即用户手机号)二维码的教程如下:获取带参小程序二维码设置流程
/user
GET /user/phone?code
向后端传递wx.getPhoneNumber()获取到的code, 后端为前端返回获取到的phone
No RequestBody:
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": "18100210000"
}
POST /user/login
向后端传递wx.login()获取到的code, 通过GET /user/phone?code
获取到的手机号, 扫码进来时携带的邀请手机号(可能有), 后端为前端返回登录态令牌以及用户的非敏感信息
RequestBody:
{
"code": "{wx.login()获取到的code}",
"phone": "{GET /user/phone?code获取到的手机号}",
"invitePhone": (可选字段,如不存在则传"")"{扫码时二维码所携带的手机号}"
}
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": {
"token": "{jwt令牌,存于wx.storage()}",
"username": "{微信的昵称}"
}
}
POST /user/claim(既可以用于申领终端,也可以用于申领商品)
RequestBody:
{
"username": "{用户姓名}",
"address": "{地址}",
"phone": "{用户电话}",
"name": "{商品名}"
}
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": ""
}
GET /user/sign?phone
用户签到接口
No RequestBody
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": ""
}
GET /user/message/base?phone
No RequestBody
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": {
"username": "张三",
"phone": "18150000000",
"rewardsFloat": (类型为number,单位为元)52.00,
"outcomeFloat": (类型为number,单位为元)52.00,
"points": (类型为number)1000,
"vip": (类型为number,vip标识)1 or 0,
"staff": (类型为number,员工标识)1 or 0
}
}
GET /user/message/coupons?phone
No RequestBody
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": [
{
"type": (类型为number){抵用券类别,0-满1000减1;1-满10000减10;2-无门槛减3}
"startDate": "{生效时间}",
"endDate": "{截止时间,类型2时此值为null(不是"")}",
}
]
}
GET /user/message/invite?phone
No RequestBody
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": {
"invite": (用户邀请列表)["phone1"...],
"inviteBy": (邀请人信息)"phone"
}
POST /user/byother
RequestBody:
{
"phone": "18150000000",
"rewards": (必传字段,类型为number,传正负,如非修改字段则传0,单位为分,1元则传入100)100,
"points": (必传字段,类型为number,传正负,如非修改字段则传0)-1000,
"address": (必传字段,如非修改字段则传"")"xx路1037号",
"description": (必传字段,传入拼接描述时的头部内容)"积分抽奖"
}
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": ""
}
POST /user/byself(不可调用)
RequestBody:
{
"phone": "18150000000",
"rewards": (可选字段,类型为number,单位为分,如此处表示52.00元)5200,
"points": (可选字段,类型为number)1100,
"vip": (可选字段,类型为number)1,
"description": ""
}
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": ""
}
/log
GET /log/rewards?phone
{
"page": "{当前展示页}",
"size": "{每页展示数}",
"date": "{查询的最新时间节点,同一次浏览应传递相同的时间节点,以避免浏览时新数据的写入而导致的观感不一致}"
}
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": {
"pageLog":
[
{
"date": "2023-1-1 00:00:00",
"updateMessage": (类型为number,单位元)1.00,
"description": "刷卡满10000元返利"
},
{
"date": "2023-1-1 13:00:00",
"updateMessage": (类型为number,单位元)-1.00,
"description": "用户提现"
},
...
],
"total": (类型为number){符合要求的总条目数},
"page": (类型为number){当前展示页},
"size": (类型为number){每页展示数},
"income": (类型为number){总条目数的收入数,单位元},
"outcome": (类型为number){总条目数的支出数,单位元}
}
}
GET /log/points?phone
{
"page": "{当前展示页}",
"size": "{每页展示数}",
"date": "{查询的最新时间节点,同一次浏览应传递相同的时间节点,以避免浏览时新数据的写入而导致的观感不一致}"
}
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": {
"pageLog":
[
{
"date": "2023-1-1 00:00:00",
"updateMessage": (类型为number,单位元)1000,
"description": "刷卡满10000元返利"
},
{
"date": "2023-1-1 13:00:00",
"updateMessage": (类型为number,单位元)-1000,
"description": "积分抽奖"
},
...
],
"total": (类型为number){符合要求的总条目数},
"page": (类型为number){当前展示页},
"size": (类型为number){每页展示数},
"income": (类型为number){总条目数的收入数,单位元},
"outcome": (类型为number){总条目数的支出数,单位元}
}
}
/pay
POST /pay/prepay
RequestBody:
{
"phone": "{用户手机号}",
"description": "君享惠-购买会员",
"total": (类型为number,单位为分,1元则传入100)29800
}
ResponseBody:
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": {
"appId": "{商户id}"
"timeStamp": "{时间戳}"
"nonceStr": "{随机字符}"
"package": "{预支付会话标识}"
"signType": "MD5"
}
}
POST /pay/notify
RequestBody:
{
"id": "EV-2018022511223320873",
"create_time": "2015-05-20T13:29:35+08:00",
"resource_type": "encrypt-resource",
"event_type": "TRANSACTION.SUCCESS",
"summary": "支付成功",
"resource": {
"original_type": "transaction",
"algorithm": "AEAD_AES_256_GCM",
"ciphertext": "",
"associated_data": "",
"nonce": ""
}
}
ResponsBody:
{
"code": "{SUCCESS OR FAIL}",
"message": "" or "{失败原因}"
}
/cashback
POST /cashback/cash
RequestBody:文章来源:https://www.toymoban.com/news/detail-438257.html
{
"phone": "{用户手机号}",
"description": "君享惠-用户提现",
"total": (类型为number,单位为分,1元则传入100)100
}
ResponseBody:文章来源地址https://www.toymoban.com/news/detail-438257.html
{
"code": "{状态码,参见注1}",
"message": "{每个状态码将对应一个message}",
"data": ""
}
到了这里,关于项目接口文档信息的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!