批量修改会员等级
POST
/openapi/v3/customer/category/batch-update
按会员 UID 或会员编号批量修改会员等级;单次最多 100 条,支持逐条返回处理结果。
Token 消耗 按 max(100, 会员条数 × 10) 计算,最低 100 token/次;单次最多 1000 token。
请求参数
| 参数 | 类型 | 必填 | 说明 |
account | string | 是 | 目标门店或总部账号。 |
items | array<object> | 是 | 会员明细,单次 1~100 条。 |
items[].customerUid | long | 二选一 | 会员 UID;与 customerNumber 不能同时传。 |
items[].customerNumber | string | 二选一 | 会员编号;与 customerUid 不能同时传。 |
items[].customerCategoryUid | long | 是 | 目标等级 UID;传 0 表示清除等级。 |
items[].discount | decimal | 否 | 会员专属折扣,不传则保留原值。 |
业务说明
items 是 v3 标准字段,同时兼容旧版字段名 customerCategories。
- 同一请求内不允许重复提交同一会员。
- 目标等级必须属于会员归属账号且未删除;
0 表示无等级。
- 会员不存在或无权限时,该条返回失败,其他有效明细继续处理。
- 相同
X-Request-Id 重试不会重复执行;失败请求请更换请求号后重试。
请求示例
{
"account": "store001",
"items": [
{
"customerUid": 3002001001,
"customerCategoryUid": 6001
},
{
"customerNumber": "VIP0002",
"customerCategoryUid": 6002,
"discount": 95
}
]
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"successCount": 1,
"failCount": 1,
"results": [
{
"customerUid": "3002001001",
"customerNumber": "VIP0001",
"success": true,
"message": "success",
"oldCustomerCategoryUid": "5001",
"customerCategoryUid": "6001",
"oldDiscount": "100",
"discount": "95"
},
{
"customerNumber": "VIP0002",
"success": false,
"message": "会员不存在或无权修改"
}
]
}
}
添加会员
POST
/openapi/v3/customer/add
新增会员基础资料,可选写入会员扩展表的性别、昵称、阴历生日。
Token 消耗 固定 200 token/次
请求参数
| 参数 | 类型 | 必填 | 说明 |
account | string | 是 | 开卡门店。 |
number | string | 是 | 会员编号,长度不超过 32;同一连锁下唯一。 |
tel | string | 是 | 手机号,长度不超过 32。 |
customerCategoryUid | long | 否 | 会员等级 UID。不传或传 0 时落库 0;传大于 0 的值时校验总部会员等级存在且未删除。 |
validateTelUnique | boolean | 否 | 是否校验手机号唯一。true 时同一 customer.userId 下不可存在相同手机号且 enable != -1 的会员;默认 false。 |
name | string | 否 | 会员姓名,长度不超过 128;不传默认使用 tel。 |
point | decimal | 否 | 积分,默认 0,范围 -1000000.00 到 1000000.00。 |
discount | decimal | 否 | 折扣,默认 100。 |
credit | int | 否 | 是否允许赊账,默认 0;大于等于 1 按 1 落库,否则按 0 落库。 |
enable | int | 否 | 会员状态,只允许 0/1,默认 1。 |
birthday | string | 否 | 公历生日,支持 yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss。 |
qq | string | 否 | QQ,长度不超过 16。 |
email | string | 否 | 邮箱,长度不超过 64。 |
address | string | 否 | 地址,长度不超过 255。 |
remarks | string | 否 | 备注,长度不超过 255。 |
expiryDate | string | 否 | 过期时间,支持 yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss。 |
customerExt | object | 否 | 会员扩展资料;首期只支持 sex、nickName、lunarBirthday。 |
customerTagUids | array<long> | 否 | 会员标签 UID 列表;UID 必须属于会员归属账号,重复 UID 会自动去重。 |
customerExt 字段
| 字段 | 类型 | 必填 | 说明 |
sex | int | 否 | 性别:1 男,0 女。 |
nickName | string | 否 | 会员昵称,长度不超过 64。 |
lunarBirthday | string | 否 | 阴历生日,支持 yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss,会同步写入 lunarYear、lunarMonthDay。 |
请求示例
{
"account": "store001",
"number": "VIP0001",
"tel": "13800138000",
"name": "张三",
"customerCategoryUid": 0,
"validateTelUnique": true,
"point": 0,
"discount": 100,
"credit": 0,
"enable": 1,
"birthday": "1995-08-15",
"qq": "123456",
"email": "test@example.com",
"address": "厦门市",
"remarks": "开放平台新增",
"expiryDate": "2030-12-31 23:59:59",
"customerTagUids": [7001, 7002],
"customerExt": {
"sex": 1,
"nickName": "小张",
"lunarBirthday": "1995-07-20"
}
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"id": "27051829",
"uid": "3002001001",
"number": "VIP0001",
"name": "张三",
"tel": "13800138000",
"customerCategoryUid": "0",
"customerTagUids": [7001, 7002],
"createUserId": 10001,
"sysUpdateTime": "2026-07-23 10:00:00"
}
}
修改会员
POST
/openapi/v3/customer/update
按会员 uid 或 number 二选一定位会员,通过 updateMask 与 clearFields 修改会员基础资料和扩展资料。定位时包含已删除会员,因此可通过修改 enable 恢复会员。
Token 消耗 固定 100 token/次
请求参数
| 参数 | 类型 | 必填 | 说明 |
account | string | 是 | 目标门店账号,会员归属和门店权限沿用会员查询规则。 |
uid | long | 二选一 | 会员 UID,与 number 必须且只能传一个。 |
number | string | 二选一 | 会员编号,仅作为定位条件,不支持修改。 |
updateMask | array<string> | 条件必填 | 需要设置的字段;与 clearFields 不能同时为空。 |
clearFields | array<string> | 条件必填 | 需要清空的字段;同一字段不能同时出现在两个列表中。 |
validateTelUnique | boolean | 否 | 传 true 时,修改手机号或恢复会员会排除当前会员并校验有效会员手机号唯一。 |
name | string | 否 | 会员姓名,可修改,不可清空。 |
tel | string | 否 | 手机号,可修改,不可清空。 |
customerCategoryUid | long | 否 | 会员等级 UID;传 0 表示无等级,大于 0 时校验等级存在。 |
discount | decimal | 否 | 会员折扣,必须大于等于 0。 |
credit | int | 否 | 是否允许赊账,只允许 0/1。 |
enable | int | 否 | 只允许 -1 删除、0 禁用、1 启用或恢复。 |
birthday | string | 否 | 公历生日,支持修改或清空。 |
qq | string | 否 | QQ,支持修改或清空。 |
email | string | 否 | 邮箱,支持修改或清空。 |
address | string | 否 | 地址,支持修改或清空。 |
remarks | string | 否 | 备注,支持修改或清空。 |
expiryDate | string | 否 | 到期时间,支持修改或清空。 |
customerExt | object | 否 | 扩展资料,只支持通过叶子路径修改。 |
customerTagUids | array<long> | 否 | 会员标签 UID 列表;需在 updateMask 中加入该字段进行整体替换,UID 必须属于会员归属账号。 |
字段规则
updateMask 支持:name、tel、customerCategoryUid、discount、credit、enable、birthday、qq、email、address、remarks、expiryDate、customerExt.sex、customerExt.nickName、customerExt.lunarBirthday、customerTagUids。
clearFields 支持:birthday、qq、email、address、remarks、expiryDate、三个 customerExt.xxx 字段及 customerTagUids;清空标签时不要再传 customerTagUids 请求体字段。
customerTagUids 按整体替换处理;传入空数组时不能用于 updateMask,如需清空全部标签请将其放入 clearFields。
- 日期字段支持
yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss。
- 余额、赠送余额和积分不支持直接修改,请使用会员余额积分调整接口。
- 接口只记录实际发生变化的字段;每个字段写一条
entitypropertychangelog,会员资料和日志在同一事务提交。
请求示例
{
"account": "store001",
"number": "VIP0001",
"updateMask": ["name", "tel", "enable", "customerExt.nickName", "customerTagUids"],
"clearFields": ["email", "remarks"],
"validateTelUnique": true,
"name": "李四",
"tel": "13900139000",
"enable": 1,
"customerTagUids": [7001, 7002],
"customerExt": {
"nickName": "小李"
}
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"id": "27051829",
"uid": "3002001001",
"number": "VIP0001",
"name": "李四",
"tel": "13900139000",
"customerCategoryUid": "0",
"enable": 1,
"customerTagUids": [7001, 7002],
"sysUpdateTime": "2026-08-27 15:30:00"
}
}
查询会员
POST
/openapi/v3/customer/increment-page
用于按主键游标分页查询会员基础信息,可按需返回扩展资料、分类、标签。
连锁规则:如果调用方是总部 appId,传总部 account 表示查询全部会员,传子门店 account 表示只查询该子门店创建的会员;如果调用方是子门店 appId,则只能传自己的 account,且只查询自己创建的会员。
Token 消耗 基础 100 token/次
每开启一个扩展返回开关,额外 +20 token
请求参数
| 参数 |
类型 |
必填 |
说明 |
account |
string |
是 |
查询范围账号。非连锁门店传当前门店账号;连锁门店中,总部 appId 传总部账号查全部会员、传子门店账号查该门店创建的会员;子门店 appId 只能传自己的账号。 |
uid | long | 否 | 按会员 UID 精确查询。 |
number | string | 否 | 按会员编号精确查询。 |
name | string | 否 | 按会员名称精确查询。 |
tel | string | 否 | 按手机号精确查询。 |
customerCategoryUid | long | 否 | 按会员分类 UID 精确查询。 |
customerCategoryName | string | 否 | 按会员分类 名称 精确查询。 |
lastId |
long |
否 |
翻页游标。首次传 0 或不传;后续传上一次响应中的 nextLastId。 |
order |
string |
否 |
排序方向,仅支持 asc、desc,默认 asc。 |
limit |
int |
否 |
分页大小,默认 100,最大 100,超过按 100 处理。 |
needCustomerExt | boolean | 否 | 传 true 时返回会员扩展资料。 |
needCustomerCategory | boolean | 否 | 传 true 时返回会员分类对象。 |
needCustomerTag | boolean | 否 | 传 true 时返回会员标签列表。 |
needCustomerIdentity | boolean | 否 | 传 true 时返回会员外部身份标识列表,字段名为 customerIdentities。 |
needShoppingCard | boolean | 否 | 传 true 时返回会员购物卡列表。 |
needArchives | boolean | 否 | 传 true 时返回会员档案自定义属性,字段名为 archives。 |
请求示例
{
"account": "store001",
"uid": 3002001001,
"number": "VIP0001",
"name": "张三",
"tel": "13800138000",
"customerCategoryUid": 6001,
"customerCategoryName": "金卡会员",
"lastId": 0,
"order": "asc",
"limit": 100,
"needCustomerExt": true,
"needCustomerCategory": true,
"needCustomerTag": false,
"needCustomerIdentity": true,
"needShoppingCard": true,
"needArchives": true
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "201",
"uid": "3002001001",
"customerCategoryUid": "6001",
"number": "VIP0001",
"name": "张三",
"point": "1200",
"discount": "85",
"money": "88.60",
"tel": "13800138000",
"birthday": "1990-05-20",
"qq": "12345678",
"email": "vip001@example.com",
"address": "上海市浦东新区世纪大道100号",
"remarks": "高频到店会员",
"createdDate": "2025-01-10 12:00:00",
"credit": 1000,
"enable": 1,
"account": "vip001",
"active": 0,
"isLoss": 0,
"expiryDate": "2026-12-31 23:59:59",
"guiderUid": "8001001",
"importDate": "2025-01-10 12:00:00.0000",
"giftMoney": 20.00,
"isPayMember": 1,
"birthYear": 1990,
"birthMonthDay": 520,
"lunarYear": 1990,
"lunarMonthDay": 426,
"sysUpdateTime": "2026-04-01 10:20:00",
"createUserAccount": "store001",
"customerExt": {
"sex": 1,
"photoPath": "https://cdn.example.com/customer/3002001001/avatar.jpg",
"nickName": "三哥",
"totalPoint": 3200,
"totalTicketAmount": 5680.50,
"totalRechargeAmount": 2000.00,
"totalTicketNum": 36,
"creditLimit": 1000.00,
"creditPeriod": 30,
"creditType": 1,
"amountInArrear": 0.00,
"contactName": "张三",
"vipCompany": "示例商贸有限公司"
},
"customerCategory": {
"uid": "6001",
"name": "金卡会员",
"discount": "85",
"enable": 1,
"isPoint": 1,
"sortValue": 10
},
"customerTags": [
"高净值",
"常购饮料"
],
"customerIdentities": [
{
"key": 0,
"value": "公众号OpenID"
},
{
"key": 1,
"value": "小程序OpenID",
"appType": 100
},
{
"key": 1000,
"value": "微信UnionID"
},
{
"key": 2000,
"value": "支付宝用户标识"
},
{
"key": 4000,
"value": "抖音用户标识"
}
],
"shoppingCards": [
{
"uid": "7001001",
"name": "通用购物卡",
"balance": 100.00,
"giftBalance": 20.00,
"cardType": 1,
"purchaseDateTime": "2026-01-01 10:00:00",
"startUseDateTime": "2026-01-01 10:00:00",
"expireDateTime": "2026-12-31 23:59:59",
"enable": 1,
"isWaitToActive": 0,
"chargeAccount": "store001"
}
],
"archives": {
"attribute1": "示例属性1",
"attribute2": "示例属性2"
}
}
],
"hasMore": false,
"nextLastId": "201"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[] 及扩展对象。
| 字段 |
类型 |
说明 |
id | string | 会员主键 ID。 |
uid | string | 会员业务 UID。 |
customerCategoryUid | string | 会员分类UID。 |
number | string | 会员编号。 |
name | string | 会员名称。 |
point | string | 当前积分。 |
discount | string | 分类折扣。85表示85折 |
money | string | 储值余额。 |
tel | string | 手机号。 |
birthday | string | 生日。 |
qq | string | QQ。 |
email | string | 邮箱地址。 |
address | string | 联系地址。 |
remarks | string | 备注信息。 |
createdDate | string | 业务创建时间,按表字段原样返回。 |
credit | int | 是否允许赊账 1 允许 0/null 不允许。 |
enable | int | 会员状态,1 可用,0 禁用,-1 删除;接口仅返回 enable != -1 的会员。 |
account | string | 会员账号。 |
active | int | 会员状态,0 为正常,-10 为挂失。 |
isLoss | int | 是否挂失,0/null 否,1 是。 |
expiryDate | string | 会员到期时间。 |
guiderUid | string | 导购员 UID。 |
importDate | string | 导入时间。 |
giftMoney | decimal | 剩余赠送金额,该金额已包含在 money 中。 |
isPayMember | int | 是否付费会员,0/null 否,1 是。 |
birthYear | int | 公历生日年份。 |
birthMonthDay | int | 公历生日月日,例如 5 月 20 日返回 520。 |
lunarYear | int | 农历生日年份。 |
lunarMonthDay | int | 农历生日月日。 |
sysUpdateTime | string | 系统更新时间。 |
createUserAccount | string | 创建该会员的门店账号。 |
customerExt | object | 会员扩展资料,需传 needCustomerExt=true。 |
customerCategory | object | 会员分类对象,需传 needCustomerCategory=true。 |
customerTags | array<string> | 会员标签列表,需传 needCustomerTag=true。 |
customerIdentities | array<object> | 会员外部身份标识列表,需传 needCustomerIdentity=true。key 为身份类型,value 为身份值,appType 用于区分不同小程序。 |
shoppingCards | array<object> | 会员购物卡列表,需传 needShoppingCard=true。 |
archives | object | 会员档案自定义属性,需传 needArchives=true;包含 attribute1 ~ attribute30,未填写的属性不返回。 |
customerIdentities.key 类型说明
| key | 说明 |
0 | 微信公众号 OpenID |
1 | 微信小程序 OpenID(不同小程序由 appType 区分) |
1000 | 微信 UnionID |
2000 | 支付宝用户标识 |
4000 | 抖音用户标识 |
扩展对象字段
| 对象 |
字段 |
类型 |
说明 |
customerExt | sex | int | 性别 1-男,0-女,NULL未填写。 |
customerExt | photoPath | string | 头像地址。 |
customerExt | nickName | string | 昵称。 |
customerExt | totalPoint | decimal | 累计积分。 |
customerExt | totalTicketAmount | decimal | 累计消费金额。 |
customerExt | totalRechargeAmount | decimal | 累计充值金额。 |
customerExt | totalTicketNum | int | 累计消费次数。 |
customerExt | creditLimit | decimal | 赊账额度。 |
customerExt | creditPeriod | int | 账期天数。 |
customerExt | creditType | int | 赊账类型。 |
customerExt | amountInArrear | decimal | 欠款金额。 |
customerExt | contactName | string | 联系人姓名。 |
customerExt | vipCompany | string | 所属公司/单位。 |
customerCategory | uid | string | 会员分类UID。 |
customerCategory | name | string | 会员分类名称。 |
customerCategory | discount | string | 分类折扣。85表示85折 |
customerCategory | enable | int | 分类启用状态。 |
customerCategory | isPoint | int | 是否参与积分。 |
customerCategory | sortValue | int | 分类排序值。 |
shoppingCards | uid | string | 购物卡 UID。 |
shoppingCards | name | string | 购物卡名称。 |
shoppingCards | balance | decimal | 购物卡余额。 |
shoppingCards | giftBalance | decimal | 购物卡剩余赠送余额。 |
shoppingCards | cardType | int | 卡类型,1-通用卡,2-分期返还旧卡。 |
shoppingCards | purchaseDateTime | string | 购买时间。 |
shoppingCards | startUseDateTime | string | 开始使用时间。 |
shoppingCards | expireDateTime | string | 过期时间。 |
shoppingCards | enable | int | 购物卡状态。 |
shoppingCards | isWaitToActive | int | 是否待激活,0-已激活,1-待激活。 |
shoppingCards | chargeAccount | string | 购物卡开卡门店账号。 |
archives | attribute1 ~ attribute30 | string | 会员档案自定义属性,按档案表原值返回。 |