企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 第三方接入线上会员接口 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#%E5%9F%BA%E6%9C%AC%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E)基本格式说明 1,所有请求都会带上一个`token`,用于身份验证,`token`由双方系统约定,每个第三方接入商都会有不同的token表明身份,每次请求时,将token放到请求头的AUTHORIZATION属性,当前token默认使用代理商系统登录名称 2,每个餐厅都有一个餐厅ID,新建会员系统时生成,不可更改,请求需要把此餐厅ID放到请求头的CUSTOMERGUID属性以对该餐厅做操作 3,所有POST请求参数为json格式 测试服务器host:[http://vip.sandyvip.com](http://vip.sandyvip.com/) 上线需要换正式服务器host:[http://vip.sandypos.com](http://vip.sandypos.com/) 测试代理商登录名:test 测试商户ID:{DEFAULT-AUTO-8E5A-BDE2-34ABA1BD956C9} 测试商户分店ID: {DEFAULT-AUTO-E207-8CC9-44AD86AEEB6DD} curl示例: ~~~ curl -X POST -H 'CUSTOMERGUID: {DEFAULT-AUTO-8E5A-BDE2-34ABA1BD956C9}' -H 'AUTHORIZATION: test' -i 'http://vip.sandyvip.com/api2/member-cjb/getrechargerules' --data '{"card_id": "000001" }' ~~~ 4,出错返回数据结构: ~~~ { "errcode": "", // 错误代码 "errmsg": "" // 错误信息 } ~~~ `errcode`: * `1`\- 参数不足 * `2`\- 卡不存在 * `3`\- 卡已存在 * `4`\- 余额不足 * `300`\- 系统过期 * `400`\- 参数错误 * `500`\- 内部错误 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#%E5%85%AC%E5%85%B1%E8%AF%B7%E6%B1%82)公共请求 ### [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#%E8%8E%B7%E5%8F%96%E5%8D%A1%E7%AD%89%E7%BA%A7)获取卡等级 `GET /api2/member-cjb/cardlevellist` 成功返回数据结构 ~~~ [{ "card_lel_name": "普通会员", "id": 1 }, { "card_lel_name": "高级会员", "id": 2 }] ~~~ 字段解释: * id - 卡等级ID * card\_lel\_name - 卡等级名称 ### [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#%E8%8E%B7%E5%8F%96%E5%85%85%E5%80%BC%E8%A7%84%E6%A0%BC%E5%85%85%E5%80%BC%E6%96%B9%E5%BC%8F)获取充值规格&充值方式 `POST /api2/member-cjb/getrechargerules` 请求参数 ~~~ { "card_id“: "000001" } ~~~ 字段解释: * card\_id - 需要充值的卡号 成功返回数据结构: ~~~ { "rules": [{ "money": 1, "add_score": 0.0, "description": "充值送10%", "add_money": 0.1 }, { "money": 500, "add_score": 0.0, "description": "冲500送100", "add_money": 100.0 }], "paytypes": [ [1, "现金"], [2, "银行卡"], [4, "支付宝"], [3, "微信"] ] } ~~~ 字段解释: * money - 充值金额,0为每次充值生效,1为按百分比生效 * add\_score - 赠送积分 * add\_money - 赠送金额 * description - 规则名称 * paytypes - 可选支付方式 ### [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#%E6%A0%B9%E6%8D%AE%E5%85%B3%E9%94%AE%E5%AD%97%E6%9F%A5%E8%AF%A2%E4%BC%9A%E5%91%98%E5%88%97%E8%A1%A8)根据关键字查询会员列表 `POST /api2/member-cjb/getcards` 请求参数 ~~~ { "key": "123" } ~~~ 字段解释 * key - 查询关键字,可以部分匹配卡号、姓名、手机号 成功返回数据结构 ~~~ { "cards": [{ "cur_score": 2555, "phone": "66538536", "amount": 14493.80, "uname": "Chan Kan Seng", "card_level_name": "普通卡", "card_status": "正常", "id": 200889, "card_id": "M000123" }, ... ] } ~~~ 字段解释 * cur\_score - 当前积分 * phone - 手机号码 * amount - 余额 * uname - 持卡者姓名 * card\_level\_name - 卡等级 * card\_status - 卡状态 * id - 卡id * card\_id - 卡号 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#1-%E5%BC%80%E5%8D%A1)1\. 开卡 `POST /api2/member-cjb/cardopen` 请求参数 ~~~ { "cardID": "12345", "cardLevelID": "1", "uname": "Mr.Wang", "phone": "186xxxxxxxx", "gender": "1" } ~~~ 字段解释 * cardID - 卡号 * cardLevelID - 卡等级ID * uname - 会员姓名 * phone -会员手机 * gender - 性别 1-男,0-女 成功返回数据结构: ~~~ { "org_name": "ASDFG", "phone": "186xxxxxxxx", "amount": 100, "card_id": "12345", "cur_score": 0 } ~~~ 字段解释 * org\_name - 开卡商户名称 * phone - 会员手机号 * amount -当前余额 * card\_id - 卡号 * cur\_score -当前积分 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#2-%E5%85%85%E5%80%BC)2\. 充值 `POST /api2/member-cjb/recharge` 请求参数 ~~~ { "card_id": "wx001", // 卡号 "money": "100", // 充值金额 "pay_type": 1 //充值方式 } ~~~ 字段解释 * card\_id - 卡号 * money - 充值金额 * pay\_type -充值方式,根据公共接口“获取充值规格&充值方式”获取 成功返回数据结构: ~~~ { "cur_score": 0, "add_money": 10.0, "amount": "1420.00", "add_score": 0.0, "card_id": "12345" } ~~~ 字段解释 * card\_id - 卡号 * money - 充值金额 * amount - 当前余额 * add\_money - 赠送金额 * add\_score - 赠送积分 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#3-%E6%B6%88%E8%B4%B9)3\. 消费 `POST /api2/member-cjb/consume` 请求参数 ~~~ { "card_id": "wx001", "money": 100, "money_discount": 100 } ~~~ 字段解释 * card\_id - 卡号 * money - 消费金额 * money\_discount - 可打折金额,可选。默认全部打折 成功返回数据结构: ~~~ { "cur_score": 2555, "ori_money": 100.0, "amount": "14493.80", "discount_money": 20.0, "card_money": 80.0, "discount": 0.8, "depot_money": 0, "card_id": "M000123", "act_money": 80.0 } ~~~ 字段解释 * card\_id - 卡号 * cur\_score - 当前积分 * ori\_money - 原始消费金额 * act\_money - 实际消费金额 * amount - 当前余额 * discount - 折扣,0.8表示8折 * discount\_money - 折扣金额 * card\_money - 卡内扣款 * depot\_money - 应付款项(某些场景下,余额不足时出现) ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#4-%E8%8E%B7%E5%8F%96%E4%BC%9A%E5%91%98%E4%BF%A1%E6%81%AF)4\. 获取会员信息 `POST /api2/member-cjb/getcardinfo`备注:此接口根据卡号精确查询特定卡信息,如果不能确定会员卡号,先使用公共请求“根据关键字查询会员列表”查找信息,以确定卡号 ~~~ { "card_id": "wx001" } ~~~ 字段解释 * card\_id - 卡号 成功返回数据结构 ~~~ { "cur_score": 2555, "phone": "66538536", "amount": 14493.80, "birthday": "", "uname": "Chan Kan Seng", "gender": 0, "card_level_name": "普通卡", "card_id": "M000123", "sum_consume": 1000, "sum_recharge": 529 } ~~~ 字段解释 * cur\_score - 当前积分 * phone - 手机号码 * amount - 余额 * birthday - 生日,格式为YYYY-mm-dd,没记录时为空 * uname - 持卡者姓名, * gender - 性别 0-女,1-男 * card\_level\_name - 卡等级, * card\_id - 卡号 * sum\_consume - 累计消费金额 * sum\_recharge - 累计充值金额 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#5-%E4%BF%AE%E6%94%B9%E4%BC%9A%E5%91%98%E4%BF%A1%E6%81%AF)5\. 修改会员信息 `POST /api2/member-cjb/modcardinfo` 请求参数 ~~~ { "card_id": "M000123", "uname": "huang", "phone": "1234", "birthday": "1999-9-9", "gender": 1 } ~~~ 字段解释 * card\_id - 卡号,必填 * uname - 新名称,可选,不传该字段则不做修改 * phone - 新的手机号,可选,不传该字段则不做修改 * birthday - 新的生日,不传该字段则不做修改 * gender - 新的性别, 0-女,1-男,不传该字段则不做修改 成功返回数据结构 ~~~ { "cur_score": 2555, "phone": "66538536", "amount": 14493.80, "birthday": "", "uname": "Chan Kan Seng", "gender": 0, "card_level_name": "普通卡", "card_id": "M000123" } ~~~ 字段解释 * cur\_score - 当前积分 * phone - 手机号码 * amount - 余额 * birthday - 生日,格式为YYYY-mm-dd,没记录时为空 * uname - 持卡者姓名, * gender - 性别 0-女,1-男 * card\_level\_name - 卡等级, * card\_id - 卡号 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#6-%E6%9F%A5%E8%AF%A2%E4%BD%BF%E7%94%A8%E5%8E%86%E5%8F%B2)6\. 查询使用历史 `POST /api2/member-cjb/getcardhis` 请求参数 ~~~ { "card_id": "M000123", "only_score_change": 1, "start_timestamp": 1570761560, "end_timestamp": 1570761560, "event_type": 0, "page_size": 20, "page": 1 } ~~~ 字段解释 * card\_id - 卡号,必填 * only\_score\_change - 可选,仅列出有积分变动的记录1-仅列出积分变动 * start\_timestamp - 可选,查询起始时间,秒级时间戳 * end\_timestamp - 可选,查询截止时间,秒级时间戳 * page\_size - 每页显示的条数,可选,默认值20 * page - 查询的页数,默认第一页 * event\_type - 记录类型,可选,默认查询全部,类型列表如下 | event\_type 值 | 类型描述 | | --- | --- | | 1 | 开卡 | | 2 | 退卡 | | 3 | 换卡 | | 4 | 挂失 | | 5 | 解挂 | | 6 | 充值 | | 7 | 消费 | | 20 | 转出 | | 21 | 转入 | | 30 | 提现 | 成功返回数据结构 ~~~ { "data": [{ "ori_money": 100.0, "act_money": 115.0, "amount": 14608.8, "score": 2560, "pay_type_text": "现金", "description": "充值送10%:充值100.0赠送金额10.0<br/>单次送5元:充值100.0赠送金额5.0赠送积分5.0", "time": 1570592439, "type": 6, "org_name": "聚客西餐", "id": 1003 }, { "ori_money": 100.0, "act_money": 80.0, "amount": 14493.8, "score": 2555, "pay_type_text": "", "description": "8折(0.8)<br/>消费80.0,获得积分80\n", "time": 1570592439, "type": 7, "org_name": "聚客西餐", "id": 1000 }], "pages": 30.0, "page_size": 2, "page": 1 } ~~~ 字段解释 * ori\_money - 原始金额 * act\_money - 实际金额 * description - 记录描述 * org\_name - 商户名称 * amount - 余额 * time - 时间,秒级时间戳格式 * type - 类型,见参数列表解释 * pages - 记录总计条数 * page\_size - 每页显示条数 * page - 当前页 * id - 记录的数据库ID值 ## [](https://note.youdao.com/md/preview.html?file=%2Fyws%2Fapi%2Fpersonal%2Ffile%2FF3F0826A106742DFA2ECA63860883D12%3Fmethod%3Ddownload%26read%3Dtrue%26shareKey%3D5d2e0f7e7d86aac1e985338572a03c64#7-%E6%B6%88%E8%B4%B9%E7%A7%AF%E5%88%86)7\. 消费积分 `POST /api2/member-cjb/consume_score` 请求参数 ~~~ { "card_id": "wx001", "score": 100 } ~~~ 字段解释 * card\_id - 卡号 * score - 消费积分,如果有小数部分,将忽略 成功返回数据结构: ~~~ { "cur_score": 2555, "amount": 80.0, "card_id": "M000123", } ~~~ 字段解释 * card\_id - 卡号 * cur\_score - 当前积分 * amount - 当前余额