Skip to content

Instantly share code, notes, and snippets.

@caingougou
Last active March 22, 2021 10:20
Show Gist options
  • Save caingougou/fe5466d93215a689d94c784087fe314f to your computer and use it in GitHub Desktop.
Save caingougou/fe5466d93215a689d94c784087fe314f to your computer and use it in GitHub Desktop.
api.md
# @host = localhost:8000
@host = fission.demos.kai-dian.com
### 使用手机号+密码登录
# @name login
POST http://{{host}}/adminapi/merchant/login
Content-Type: application/json
{
"mobile": "18101655878",
"password": "123456",
"login_type": "password"
}
###
@token = {{login.response.body.data.token}}
### 发送注册验证码
# @name register_code
POST http://{{host}}/adminapi/codes
Content-Type: application/json
{
"mobile": "18101655878",
"type": 0
}
###
@code = {{register_code.response.body.data.code}}
### 注册
POST http://{{host}}/adminapi/merchant/register
Content-Type: application/json
{
"mobile": "18101655878",
"password": "123456",
"code": "{{code}}"
}
### 发送登录验证码
# @name login_code
POST http://{{host}}/adminapi/codes
Content-Type: application/json
{
"mobile": "18101655878",
"type": 1
}
###
@code = {{login_code.response.body.data.code}}
### 使用手机号+验证码登录
POST http://{{host}}/adminapi/merchant/login
Content-Type: application/json
{
"mobile": "18101655878",
"code": "{{code}}",
"login_type": "code"
}
### 获取登录用二维码
POST http://{{host}}/adminapi/merchant/login/qrcode
Content-Type: application/json
# 返回
# {
# data: {
# code: 'code', // 保存用于下个接口校验
# url: 'qrcode_url' // 显示为二维码
# }
# }
### 验证二维码 轮询(1s)
POST http://{{host}}/adminapi/merchant/login/qrcheck
Content-Type: application/json
{
code: '123456'
}
### 发送修改密码验证码
# @name resetpassword_code
POST http://{{host}}/adminapi/codes
Content-Type: application/json
{
"mobile": "18101655878",
"type": 2
}
###
@code = {{resetpassword_code.response.body.data.code}}
### 修改密码
PUT http://{{host}}/adminapi/merchant/password
Content-Type: application/json
{
"mobile": "18101655878",
"password": "123456",
"code": "{{code}}"
}
### 获取登录用户信息
GET http://{{host}}/adminapi/merchant/info
Content-Type: application/json
Authorization: Bearer {{token}}
### 提交商户基本信息
POST http://{{host}}/adminapi/merchant/info
Content-Type: application/json
Authorization: Bearer {{token}}
{
name 公司名称
industry 所属行业
size 企业规模
oper_name 联系人
position 职位
}
### 获取活动
GET http://{{host}}/adminapi/campaigns?page=1&per_page=10
Content-Type: application/json
Authorization: Bearer {{token}}
### 创建活动
POST http://{{host}}/adminapi/campaigns
Content-Type: application/json
Authorization: Bearer {{token}}
{
name: "hello"
}
# {
# starts_at 开始时间
# ends_at 结束时间
# status 状态
# desc 裂变文案
# channel 渠道
# settings 海报设置
# background_url 背景图
# }
### 获取优惠券
GET http://{{host}}/adminapi/coupons
Content-Type: application/json
Authorization: Bearer {{token}}
###
GET http://{{host}}/adminapi/coupons/1000
Content-Type: application/json
Authorization: Bearer {{token}}
### 创建优惠券
POST http://{{host}}/adminapi/coupons
Content-Type: application/json
Authorization: Bearer {{token}}
{
title 名称
starts_at 领取开始时间
ends_at 领取结束时间
type 卡券类型 默认1满减券 2折扣券
amounts 发放数量
use_limit 使用门槛 默认0无使用门槛或具体数额(分)
denomination 优惠面额 百分比或具体数额(分)
usetime_limit_type 使用时间限制 默认1具体使用日期 2当日起天可用
usetime_starts_at 使用开始日期
usetime_ends_at 使用结束日期
usetime_expire_days 领券起可用天数
generated_type 生成方式 默认1自动生成 2导入
}
### 导入优惠券
POST http://{{host}}/adminapi/couponcode/import
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary
Authorization: Bearer {{token}}
------WebKitFormBoundary
Content-Disposition: form-data; name="file"; filename="1.xlsx"
Content-Type: application/octet-stream
< ./sample-coupon-codes.xlsx
------WebKitFormBoundary--
### 测试优惠券id
@coupon_id = 1
### 券码精确查询 (用于核销)
GET http://{{host}}/adminapi/coupons/{{coupon_id}}/codes?code=1234567
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取用户
GET http://{{host}}/adminapi/users
Content-Type: application/json
Authorization: Bearer {{token}}
### 测试用户id
@user_id = 172
### 获取用户积分历史
GET http://{{host}}/adminapi/users/{{user_id}}/creditlogs
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取用户卡券
GET http://{{host}}/adminapi/users/{{user_id}}/coupons
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取用户订单 [TBD]
GET http://{{host}}/adminapi/users/{{user_id}}/orders
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取微信群
GET http://{{host}}/adminapi/groupchats
Content-Type: application/json
Authorization: Bearer {{token}}
### 测试优惠券id
@groupchat_id = 1
### 获取微信群用户
GET http://{{host}}/adminapi/groupchats/{{groupchat_id}}/users
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取微信群SOP
GET http://{{host}}/adminapi/groupchat/sops
Content-Type: application/json
Authorization: Bearer {{token}}
### 创建微信群SOP
POST http://{{host}}/adminapi/groupchat/sops
Content-Type: application/json
Authorization: Bearer {{token}}
{
name 名称
settings 设定 [{
name 名称
days 每周几 [1,2,3]
time 发送时间
contents 内容 [{
type 类型
text 文字
image 图片
news {
title
desc
link
logo
}
}]
}]
}
### 获取文件
GET http://{{host}}/adminapi/files
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取门店
GET http://{{host}}/adminapi/shops
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取系统使用人员
GET http://{{host}}/adminapi/merchant/users
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取绑定的公众号
GET http://{{host}}/adminapi/official/accounts
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取绑定的企业微信账号
GET http://{{host}}/adminapi/corp/accounts
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取员工
GET http://{{host}}/adminapi/employees
Content-Type: application/json
Authorization: Bearer {{token}}
### 获取渠道码
GET http://{{host}}/adminapi/channel/codes
Content-Type: application/json
Authorization: Bearer {{token}}
### 创建渠道码
POST http://{{host}}/adminapi/channel/codes
Content-Type: application/json
Authorization: Bearer {{token}}
{
name 活码名称 (店铺名称)
shop_id 店铺id
drainage_employee 引流成员设置
welcome_message 欢迎语设置
status 状态 默认1 启用 2 禁用
qrcodes 二维码(数组)
[
{
name 二维码名称
file_id 文件id
file_url 文件路径
}
]
}
### 测试二维码id
@qrcode_id = 1
### 更新渠道码中的二维码
PUT http://{{host}}/adminapi/qrcodes/{{qrcode_id}}
Content-Type: application/json
Authorization: Bearer {{token}}
{
status 状态 默认1 进行中 2 已停止 3 已失效
}
### ----------------- 前端接口从此开始 -----------------
### 前端token
@fe_token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3QiLCJpYXQiOjE2MTYwNjM4ODYsImV4cCI6MTYxNzI3MzQ4NiwibmJmIjoxNjE2MDYzODg2LCJqdGkiOiJTWEhUTEdybEYzRmY2QklUIiwic3ViIjoxLCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.8vV65kx0XUhGVz9eZKVps0HgN1NjVTO5F77gqNcs62s
### 测试活动id
@campaign_id = 16
### 获取活动信息(如发券宝会返回用户获取和其他人获取的券详情)
GET http://{{host}}/api/campaigns/{{campaign_id}}
Content-Type: application/json
Authorization: Bearer {{fe_token}}
### 领取优惠券
POST http://{{host}}/api/campaigns/{{campaign_id}}/coupons
Content-Type: application/json
Authorization: Bearer {{fe_token}}
### 获取用户信息
GET http://{{host}}/api/me
Content-Type: application/json
Authorization: Bearer {{fe_token}}
### 获取优惠券
GET http://{{host}}/api/coupons
Content-Type: application/json
Authorization: Bearer {{fe_token}}
### 优惠券详情
GET http://{{host}}/api/coupons/{{coupon_id}}
Content-Type: application/json
Authorization: Bearer {{fe_token}}
### 使用优惠券
PUT http://{{host}}/api/coupons/{{coupon_id}}
Content-Type: application/json
Authorization: Bearer {{fe_token}}
{
status: 2
}
### 获取积分历史
GET http://{{host}}/api/credit/histories
Content-Type: application/json
Authorization: Bearer {{fe_token}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment