@lina
2020-08-17T15:23:07.000000Z
字数 11033
阅读 346
列表项
新版货达人 1.1 小程序
- 【测试url】http://api.volunteer.alpha.flashdiet.cn/api
- 【线上url】/api
X-auth-token: [string] 登录后获取的token信息, 取window.token 请求头带此字段X-org-code: [string]https://www.zybuluo.com/mdeditor# 机构表识字段,所有请求均需要此字段,取window.orgCode 请求头带此字段X-location: [string] 坐标 lng-lat 请求头带此字段X-unique-key: [string] 服务端下发的标识,取window.uniqueKey 请求头带此字段X-city: [string] 所在城市名称 请求头带此字段X-platform-code: [string] 平台标识字段,所有请求均需要此字段,取window.platformCode 请求头带此字段
- POST请求Content-Type为:Content-Type:application/x-www-form-urlencoded
- 文件上传时Content-Type为:Content-Type:multipart/form-data
- 对于:Content-Type:application/json:Content-Type:application/xml不保证完全支持,请谨慎使用
- 【线上url】待定
- 【测试url】http://api.volunteer.alpha.flashdiet.cn/api/
- 【线上url】/api/
通用图片上传文件服务
请求URL
POST
/imgupload
请求参数
file: 文件
响应
{error_code: 0,data: {url: 'http://xxx'}}
url: [string] 文件的访问URL
注:请求图片时,需解析图片的cookie,不然无法认证
GET
/captcha
POST
/verifycode
请求参数
captcha_code: [string] 图形验证码phone: [string] 手机号
响应
{error_code: 0,data: {}}
error_code: [int] 服务器状态码,0 为正常状态,异常状态待定。error_message:[string] 错误信息,但error_code不为 0 时返回
data: [object] 数据字段,所有响应数据都在此字段中list: [array],当返回数据为列表时会将数据放在该字段
page: [object] 分页信息,当返回数组数据时会携带该字段
current_page: [int] 当前页码,默认为1total_page: [int] 总页数page_size: [int] 每页数量:本项目常用page_size==10
示例
{error_code: 0,data: {key: value,list: [{key: value}],page {}}}
sex:[int]0: 未知
1: 男
2: 女
verify_status:[int]0: 审核中
1: 通过
2: 驳回
status: [int]0:未启用
1:启用
status: [int]0:待抢单
1:已抢单
2:已拒绝
{id: 123,nick_name: '梦里花落知多少',real_name: 'xx',phone: '15500000000',sex: 1,avatars: 'http://image.com/1.jpeg',id_number: 110101198803031321,bank_number: '7112312321',id_card_front: 'url',id_card_back: 'url',sign_photo: 'url',company_id: 12,region_id: 12,bus_quarter_id: 23,department_id: 12,bus_depart_id: 12}
id: [int] 用户IDnick_name: [string] 用户名phone: [string] 用户手机avatars: [string] 头像real_name: [string] 姓名sex: [integer] 性别id_number: [string] 身份证号bank_number: [string] 银行卡号bank_name: [string] 银行名称id_card_front: [string] 身份证正面照片urlid_card_back: [string] 身份证反面照片urlsign_photo: [string] 签字照片company_id: [int] 快递公司idregion_id: [int] 大区idbus_quarter_id: [int] 营业区iddepartment_id: [int] 分部id,可能为空bus_depart_id: [int] 营业部id
{@用户基本信息,token: 'ssadaf',last_month_income: 7777.23,total_income: 121323.23,bonus_left: 12.22, // 可提现奖励金数undo_order: [@待抢订单],company:{@快递公司},region: {@大区},bus_quarter: {@营业区},department: {@分部},bus_depart: {@营业部}}
- @用户基本信息
token: [string] 下发的token,需要每次请求带上last_month_income: [float] 上月收入total_income: [float] 总收入undo_order: [array] 待抢订单列表company: [string] 快递公司信息region: [string] 大区信息bus_quarter: [obj] 营业区信息department: [obj] 分部信息(可能为null)bus_depart: [string] 营业部信息
{id: 12,courier_id: 1232,remark: '中关村南大街',start_time: '7112312321',end_time: 7777.23,status: 0,company:{@快递公司},region: {@大区},bus_quarter: {@营业区},department: {@分部},bus_depart: {@营业部}}
id: [int] 订单IDcourier_id: [string] 快递员用户idremark: [string] 线路备注start_time: [date] 开始时间end_time: [date] 结束时间status: [integer] 订单状态company: [obj] 快递公司信息region: [obj] 大区信息bus_quarter: [obj] 营业区信息department: [obj] 分部信息(可能为null)bus_depart: [obj] 营业部信息
公司
{id: 12,company_name: 1232,contact_name: '中关村南大街',contact_phone: '7112312321',status: 0,province_id: 0,province_name: 0,city_id: 0,city_name: 0,county_id: 0,county_name: 0,addr: 0,}
id: [int] 公司IDcompany_name: [string] 公司名称contact_name: [string] 联系人姓名contact_phone: [string] 联系人电话status: [int] 启用弃用状态province_id: [string] 省份idprovince_name: [string] 省份名称city_id: [string] 城市idcity_name: [string] 城市名称county_id: [string] 区县idcounty_name: [string] 区县名称addr: [string] 具体地址
其他的看数据库吧,就不一一写出来,字段基本都一样的
分部相对于公司等,多个一个后台管理用户对象
{id: 12,department_name: 1232,contact_name: '中关村南大街',contact_phone: '7112312321',status: 0,province_id: 0,province_name: 0,city_id: 0,city_name: 0,county_id: 0,county_name: 0,addr: 0,user: {username: 'xxx'}}
id: [int] 分部IDdepartment_name: [string] 分部名称contact_name: [string] 联系人姓名contact_phone: [string] 联系人电话status: [int] 启用弃用状态province_id: [string] 省份idprovince_name: [string] 省份名称city_id: [string] 城市idcity_name: [string] 城市名称county_id: [string] 区县idcounty_name: [string] 区县名称addr: [string] 具体地址user: [obj] 后台管理对象
营业部就不列出来,字段基本都一样的
请求URL
POST
/register
请求参数
photo: [string] 手机号码 【必填】real_name: [string] 真实姓名【必填】verify_code: [string] 验证码 【必填】id_card_front: [string] 身份证正面照片url【必填】id_card_back: [string] 身份证反面照片url【必填】id_number: [string] 身份证号【必填】bank_name: [string] 银行名称【必填】bank_number: [string] 银行卡号号【必填】sign_photo: [string] 签字照片【必填】company_id: [int] 快递公司id【必填】region_id: [int] 大区id【必填】bus_quarter_id: [int] 营业区id【必填】bus_depart_id: [int] 营业部id【必填】token: [string] token【必填】raw_data: wx.getUserInfo返回值iv: wx.getUserInfo返回值signature: wx.getUserInfo返回值encrypted_data: wx.getUserInfo返回值introduce_token: 推荐人的tokenleader_id: [string] 角色为队员时必填,为队长的courier_idrole_type: [int] 0队长,1队员【必填】
响应
{"error_code": 0,"data":{@首页数据},"error_message": ""}
请求URL
GET
/user/info
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{@首页数据,leader: {"id": 12,"real_name": "xx","leader_id": 1}},"error_message": ""}
请求URL
GET
/courier/get_leader
请求参数
phone: [string] 手机号必须是11位手机号 【必填】
响应
{"status": 0,"msg": "保存成功","data": [{"id": 1, // courier表对应的id"real_name": "姚明",}]}
请求URL
GET
/my_team
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{@队长信息team_total_income: 1222, // 团队总收入teammates: [ // 队员信息{"id": 12,"total_income": 121323.23,"real_name":"111",}]},"error_message": ""}
请求URL
GET
/courier/${courier_id}/income
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{hist_income: 1222, // 历史总收入last_income: 1222, // 最近收入'total_liability_compensation': 111,'total_platform_award': 11,},"error_message": ""}
请求URL(请求头需要有token信息),原来的/income接口不再下发每日数据
GET
/courier/${courier_id}/income_by_month
请求参数
month_time: [string] 月份,例如2019-01pageSize: [integer] 分页,默认10page: [integer] 当前页数,默认1
{"error_code": 0,"data": {"total": 25,"total_page": 3,"list": [{"id": 71,"courier_id": 229,"status": 1,"amount": 600, // 当日收入,已经计算过了"month_time": "2019-01-07 00:00:00","available_withdraw": "0.00","cur_month_already_withdraw": "600.00","cur_month_remain_withdraw": "3500.00","star": 4,"order_desc": "第7次,80个包裹,其中10个重型包裹,超长包裹13,超长距离包裹5个。","bus_require": "妙衡公司","sign_photo": "http://api.ztb.alpha.flashdiet.cn/uploads/2019-01/784631547027035.png","sign_time": "2019-01-09 17:43:56","liability_compensation": null,"platform_award": null}],}"error_message": "签到成功"}
这接口返回的数据和3.2.2接口返回的数据格式一致
请求URL
GET
/income
/user/info接口返回用户信息不再下发财务相关的信息
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{hist_income: 1222, // 历史总收入last_income: 1222, // 最近收入withdraw_amt: 122, //可提现收入'total_liability_compensation': 111,'total_platform_award': 11,can_withdraw: true, // true表示可以提现(提现按钮可以点击,否则不可以点击)},"error_message": ""}
请求URL
GET
/income/withdraw
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{start_date: '2019-09-01',end_date: '2019-09-15',bus_require: '业务需求方',item_name: '费用项目',amount: 1222,// 总金额withdraw_amt: 111,// 可提现金额fee: 12,fee_rate: 0.03,//前端需求转成3%其他信息在用户信息里},"error_message": ""}
请求URL(请求头需要有token信息)
PUT
/income/withdraw
(提交前一个接口下发的start_date、end_date,amount用于校验提现信息)
请求参数
amount: [number] 总金额start_date: [string] 开始时间end_date: [string] 结束时间sign_photo: [string] 签字图片
响应
{"error_code": 0,"data": null,"error_message": "当前无法提现|提现金额不正确"}
请求URL(请求头需要有token信息)
GET
/income/hist
(提交前一个接口下发的amount、fee,用于校验提现信息)
请求参数
pageSize: [number] 分页page: [number] 分页
响应
{"error_code": 0,"data": {"total": 25,"total_page": 3,"list": [{withdraw_amt: 111,// 提现金额fee: 12,draw_time: '2012-01-01 12:21:21'}]},"error_message": "当前无法提现|提现金额不正确"}
请求URL
GET
/envelope
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{hist_elp: 1222,withdraw_elp: 1222,expire_time: '2018-01-01 12:00:00', // 拆红包的过期时间has_elp: true, // true表示可以有拆红包can_withdraw: true, // true表示可以点击红包提现},"error_message": ""}
请求URL
GET
/envelope/withdraw
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{start_date: '2019-09-01',end_date: '2019-09-15',bus_require: '业务需求方',item_name: '费用项目',amount: 1222,// 总金额withdraw_amt: 111,// 可提现金额fee: 12,fee_rate: 0.03,//前端需求转成3%其他信息在用户信息里},"error_message": ""}
请求URL(请求头需要有token信息)
PUT
/envelope/withdraw
(提交前一个接口下发的start_date、end_date,amount用于校验提现信息)
请求参数
amount: [number] 总金额start_date: [string] 开始时间end_date: [string] 结束时间sign_photo: [string] 签字图片
header中X-auth-token为下发的token
响应
{"error_code": 0,"data": null,"error_message": "当前无法提现|提现金额不正确"}
请求URL(请求头需要有token信息)
POST
/envelope/open
请求参数
expire_time: [string] 下发的过期时间,用来校验是哪个红包
header中X-auth-token为下发的token
响应
{"error_code": 0,"data": 1.5,// 红包金额"error_message": "红包已过期"}
注册红包是在用户注册,被管理员第一次审批通过后才会有的(再次驳回第二次审批通过后不会有注册红包),而且一个用户最多只有一个注册红包
用户表里courier添加pass_elp_amt和elp_status两个字段,
elp_status注册红包状态
0 - 当前木有红包
1 - 有红包待拆
2 - 已拆过领过红包
小程序端应该先调用用户信息接口,如果elp_status == 1表示有注册红包可以拆,弹窗给用户拆红包,然后调用下面拆注册红包的接口
请求URL
POST
/wechat/withdraw
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0, // 不为0 的时候表示出现异常了,比如企业账户没钱等情况下"data": 1.2, // 红包金额"error_message": ""}
请求URL
GET
/income
请求参数
header中X-auth-token为下发的token
响应
{"error_code": 0,"data":{courier: {amount: 122, //可提现收入,快递员信息,包括历史收入啥的},can_withdraw: true, // true表示可以提现(提现按钮可以点击,否则不可以点击),withdraw_info: { // 提现信息,只有can_withdraw为true才有start_date: '2019-09-01',end_date: '2019-09-15',bus_require: '业务需求方',item_name: '费用项目',amount: 1222,// 提现金额}},"error_message": ""}
请求URL(请求头需要有token信息)
PUT
/income/withdraw
(提交前一个接口下发的start_date、end_date,amount用于校验提现信息)
请求参数
amount: [number] 提现金额start_date: [string] 开始时间end_date: [string] 结束时间sign_photo: [string] 签字图片
响应
{"error_code": 0,"data": null,"error_message": "当前无法提现|提现金额不正确"}
请求URL(请求头需要有token信息)
GET
/income/hist
请求参数
pageSize: [number] 分页page: [number] 分页
响应
{"error_code": 0,"data": {"total": 25,"total_page": 3,"list": [{withdraw_amt: 111,// 提现金额draw_time: '2012-01-01 12:21:21'}]},"error_message": ""}
请求URL
GET
/withdrawal/config
请求参数
响应
{"error_code": 0,"error_message": "","data": {"config": {"type": 2,"after_day": 5,"percent_wages": 5,"withdrawal_config": [{"month_type": 1,"day": 15,"fee": 3},{"month_type": 1,"day": 25,"fee": 2},{"month_type": 2,"day": 3,"fee": 1},{"month_type": 2,"day": 5,"fee": 0.5}]}}}
请求URL
GET
/withdrawal/list
请求参数
pageSize: [integer] 分页,默认10page: [integer] 当前页数,默认1
响应
{"error_code": 0,"error_message": "","data": {"list": [{"id": 41,"courier_id": 84,"month_start": "2020-06","month_end": "2020-07","amount": "4000.00", //预支金额"withdraw_amt": "3880.00",//实际到账金额"fee": "3.00",//手续费"draw_time": "2020-08-10 23:43:49", //预支时间"sign_photo": "https://api.ane.huodaren.net/uploads/2020-06/223681591376047.png","order_sn": "","status": 2,//状态 1提现中 2提现成功 3提现失败"last_reply_state": "","withdrawal_config": null,"created_at": "-0001-11-30 00:00:00","updated_at": "2020-08-12 23:04:31","month": "2020-06,2020-07" //涉及金额月份}],"total": 1,"total_page": 1}}
请求URL
GET
/withdrawal/amount
请求参数
响应
{"error_code": 0,"error_message": "","data": {"total": "3000.00",//累计收入 未计算百分比"amount": "2100.00",//可预支金额 total * 预支比例"withdraw": "2058.00", //实际到账金额"fee": "42.00",//手续费"income_list": [//关联的收入记录],"month": ["2020-07"//涉及月份]}}
请求URL
POST
/withdrawal/cash
请求参数
sign_photo: [string] 签名的图片地址
响应
{"error_code": 0,"error_message": "您的申请已成功,请关注订单状态","data": {"withdraw": 100}}