Last Updated on : 2024-12-06 05:54:29download
@ray-js/wechat-ms-voip
SDK 提供了小程序 VoIP 通话和增值服务商城能力。
yarn add @ray-js/wechat-ms-voip
// or
npm install @ray-js/wechat-ms-voip
getCommodityList
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
commodityCode |
string | 商品代码 |
serviceCode |
string | 服务代码 |
title |
string | 商品标题 |
subTitle |
string | 商品副标题 |
commodityUrl |
string | 购买商品的 URL |
targetUrlType |
number | 目标 URL 类型:
|
prices |
Price[] | 价格列表 |
uuid |
string | 设备的 UUID |
skuCode |
string | 商品的 SKU 代码 |
type |
number | 商品类型:
|
Price
说明
参数名 | 类型 | 描述 |
---|---|---|
price |
number | 价格 |
strPrice |
string | 价格字符串 |
originalPrice |
number | 原始价格 |
strOriginalPrice |
string | 原始价格字符串 |
currency |
string | 货币 |
periodUnit |
number | 周期单位:
|
periodValue |
number | 周期值 |
periodType |
number | 周期类型:
|
marketingStrategy |
IMarketingStrategy | 营销策略 |
optionType |
number | 选项类型 |
optionNo |
number | 选项编号 |
IMarketingStrategy
说明
参数名 | 类型 | 描述 |
---|---|---|
discount |
number | 折扣百分比。如,返回数值 20,即 20% |
periodUnit |
number | 试用期单位:
|
periodValue |
number | 试用期周期数 |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getCommodityList({
device_id: 'xxx',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
[
{
"subTitle": "VoIP",
"serviceCode": "voip",
"targetUrlType": 0,
"commodityCode": "xxx",
"commodityUrl": "https://xxx.com/",
"prices": [
{
"optionType": 0,
"periodType": 0,
"originalPrice": {
"Value": "0.01"
},
"strOriginalPrice": "0.01",
"price": {
"Value": "0.01"
},
"strPrice": "0.01",
"currency": "CNY",
"optionNo": 0,
"periodUnit": 1,
"periodValue": 1
}
],
"title": "微信视频通话(VoIP)",
"type": 1,
"uuid": "xxx",
"skuCode": "xxx"
}
]
getAppMallInfo
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
catalog_code |
string | 服务大类 Code。云存储: CLOUD_STORAGE | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
mallCode |
string | 商城编码 |
shopCode |
string | 店铺编码 |
siteCode |
string | 销售站点 |
currency |
string | 销售币种 |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getAppMallInfo({
device_id: "vdevo172477044742560",
catalog_code: "CLOUD_STORAGE"
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
currency: "CNY"
mallCode: "xxxxxxx"
shopCode: "xxxxxxx"
siteCode: "CN"
}
getDeviceAddValueType
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
icon |
string | 图标 |
id |
string | ID |
name |
string | 名称 |
types |
array | 设备支持的增值服务类型:
|
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getDeviceAddValueType({})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
"types": [0,1],
"icon": "smart/icon/bay1591770978438Acm2/0a0b4a644f5339732720a221a7693a1b.png",
"name": "VoIP 调试 - 可视对讲",
"id": "xxxxx"
}
getDeviceList
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
owner_id |
string | 家庭 ID | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
name |
string | 设备名称 |
id |
string | 设备 ID |
icon |
string | 设备图标 |
locationName |
string | 设备位置名称 |
types |
array | 商品类型:
|
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getDeviceList('xxxx')
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
[
{
"types": [0,1],
"icon": "smart/icon/bay1591770978438Acm2/0a0b4a644f5339732720a221a7693a1b.png",
"name": "VoIP 调试 - 可视对讲",
"id": "xxxxx"
},
{
"types": [0,1],
"icon": "smart/icon/bay1591770978438Acm2/0a0b4a644f5339732720a221a7693a1b.png",
"name": "VoIP 调试 - 可视对讲1",
"id": "xxxxx"
},
]
用于获取设备绑定的 AppID、modelID、原始 ID 等信息。
getDeviceCapability
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
code |
string | 设备的高级能力 Code。 VoIP 高级能力 code:tyabiwxrn9 | true |
返回参数
有返回结果则代表设备有这个高级能力。
参数名 | 类型 | 描述 |
---|---|---|
WechatMPAppid |
string | 设备绑定的微信小程序 AppID |
WechatMPMid |
string | 设备绑定的微信小程序 Mid |
WechatMPOid |
string | 设备绑定的微信小程序 Oid |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getDeviceCapability({
device_id: "vdevo172477044742560",
code: 'tyabiwxrn9'
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
"WechatMPAppid": "xxxxxx",
"WechatMPOid": "xxxxxx",
"WechatMPMid": "xxxxxx"
}
getOrderList
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
mallCode |
string | 商城 Code | true |
siteCode |
string | 站点 Code | true |
searchKey |
string | 搜索关键字 | false |
orderStatusList |
OrderStatus[] | 订单状态列表 | false |
pageNo |
number | 页码 | true |
pageSize |
number | 每页大小 | true |
OrderStatus
说明
示例
值 | 含义 |
---|---|
created |
已创建,待支付 |
pending_audit_paid |
待审核 |
paying |
支付中 |
paid |
已支付 |
delivering |
发货中 |
delivered |
已发货 |
part_delivered |
已部分发货 |
finished |
已完成 |
canceled |
已取消 |
closed |
已关闭 |
refunded |
已退款 |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
data |
IOrderInfo[] | 订单信息列表 |
pageCount |
number | 页数 |
pageNum |
number | 页码 |
pageSize |
number | 每页数量 |
totalRecord |
number | 总记录数 |
IOrderInfo
说明
参数名 | 类型 | 描述 |
---|---|---|
orderBaseInfo |
IOrderBaseInfo | 订单基础信息 |
orderCommodityInfos |
IOrderCommodityInfo[] | 商品信息列表 |
orderLogisticsInfo |
IOrderLogisticsInfo | 物流信息 |
IOrderBaseInfo
说明
参数名 | 类型 | 描述 |
---|---|---|
afterSaleEnabled |
boolean | 是否支持售后 |
amOrder |
boolean | 是否 AM 订单 |
amountOrigin |
number | 原始金额 |
amountTrade |
number | 成交金额 |
currency |
string | 货币 |
gmtCreate |
string | 创建时间 |
mallInfo |
IMallInfo | 商城信息 |
orderId |
string | 订单号 |
orderStatus |
string | 订单状态 |
orderTypeCode |
string | 订单类型代码 |
tradeType |
string | 交易类型 |
totalQuantity |
number | 总数量 |
IMallInfo
说明
参数名 | 类型 | 描述 |
---|---|---|
mallCode |
string | 商城编码 |
shopCode |
string | 店铺编码 |
siteCode |
string | 销售站点 |
IOrderCommodityInfo
说明
参数名 | 类型 | 描述 |
---|---|---|
afterSaleEnabled |
boolean | 是否支持售后 |
commodityCode |
string | 商品代码 |
commodityName |
string | 商品名称 |
commodityType |
number | 商品类型 |
iconUrl |
string | 图标 URL |
quantity |
number | 数量 |
skuCode |
string | SKU 代码 |
skuSrvPeriodDTO |
ISkuSrvPeriodDTO | SKU 服务周期 |
skuValueList |
string[] | SKU 值列表 |
unitPriceOrigin |
number | 原始单价 |
unitPriceTrade |
number | 成交单价 |
ISkuSrvPeriodDTO
说明
参数名 | 类型 | 描述 |
---|---|---|
skuCode |
string | SKU 代码 |
srvCode |
string | 服务代码 |
srvPeriodUnit |
number | 服务周期单位 |
srvPeriodValue |
number | 服务周期值 |
IOrderLogisticsInfo
说明
参数名 | 类型 | 描述 |
---|---|---|
orderLogisticsTag |
boolean | 物流标签 |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getOrderList({
mallCode: 'xxx',
siteCode: 'xxx',
searchKey: 'xxx',
orderStatusList: [
'created',
'finished',
'canceled',
'closed',
],
pageNo: 1,
pageSize: 1
}).then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
"pageCount": 2,
"data": [
{
"orderBaseInfo": {
"orderTypeCode": "xxxx",
"totalQuantity": 1,
"orderId": "xxxxxx",
"amountOrigin": {
"Value": "1.00"
},
"amOrder": true,
"orderStatus": "finished",
"currency": "CNY",
"afterSaleEnabled": false,
"amountTrade": {
"Value": "1.00"
},
"gmtCreate": "1723536905517",
"mallInfo": {
"shopCode": "xxx",
"siteCode": "CN",
"mallCode": "xxx"
}
},
"orderCommodityInfos": [
{
"quantity": 1,
"skuSrvPeriodDTO": {
"srvCode": "xxx",
"srvPeriodUnit": 1,
"srvPeriodValue": 1,
"skuCode": "xxx"
},
"unitPriceOrigin": {
"Value": "1.00"
},
"commodityCode": "xxx",
"unitPriceTrade": {
"Value": "1.00"
},
"afterSaleEnabled": false,
"iconUrl": "ecommerce/17229243039995edff2e6.png",
"commodityType": 5,
"skuValueList": [],
"skuCode": "xxx",
"commodityName": "微信视频通话(VoIP)"
}
],
"orderLogisticsInfo": {
"orderLogisticsTag": false
}
}
],
"pageSize": 1,
"totalRecord": 14,
"pageNum": 1,
"empty": false
}
getSubscriptionOrderList
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
mallCode |
string | 商城 Code | true |
siteCode |
string | 站点 Code | true |
pageNo |
number | 页码 | true |
pageSize |
number | 每页大小 | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
data |
ISubscribeData[] | 订阅数据列表 |
index |
number | 索引 |
pageNum |
number | 页码 |
pageSize |
number | 每页数量 |
ISubscribeData
说明
参数名 | 类型 | 描述 |
---|---|---|
gmtNextTime |
number | 下次时间 |
orderListModel |
IOrderListModel | 订单列表模型 |
paidProvider |
number | 支付提供商 |
regularInterval |
number | 定期间隔 |
regularUnit |
number | 定期单位 |
status |
number | 状态 |
subscribeId |
string | 订阅 ID |
IOrderListModel
说明
参数名 | 类型 | 描述 |
---|---|---|
amountOrigin |
number | 原始金额 |
amountTrade |
number | 成交金额 |
currency |
string | 货币 |
mallInfo |
IMallInfo | 商城信息 |
orderGmtCreate |
number | 订单创建时间 |
orderId |
string | 订单 ID |
orderItemList |
IOrderItem[] | 订单项列表 |
orderStatus |
string | 订单状态 |
quantity |
number | 数量 |
IOrderItem
说明
参数名 | 类型 | 描述 |
---|---|---|
amountOrigin |
number | 原始金额 |
amountTrade |
number | 成交金额 |
currency |
string | 货币 |
quantity |
number | 数量 |
skuCode |
string | SKU 代码 |
skuPic |
string | SKU 图片 |
skuValueList |
string[] | SKU 值列表 |
title |
string | 标题 |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getSubscriptionOrderList({
mallCode: 'xxx',
siteCode: 'xxx',
pageNo: 1,
pageSize: 1,
}).then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
"data": [],
"index": 0,
"pageSize": 1,
"totalRecord": 0,
"pageNum": 1,
"empty": true
}
getServiceIntroduction
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
categoryCode |
string | 服务 Code:
|
true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
moduleList |
ModuleList |
ModuleList
说明
参数名 | 类型 | 描述 |
---|---|---|
serviceProtocol |
ServiceProtocol[] | 服务协议 |
serviceIntro |
ServiceIntro[] | 服务介绍 |
serviceLightSpot |
ServiceLightSpot[] | 服务亮点 |
serviceName |
ServiceName[] | 服务名称 |
configItem |
ConfigItem[] | 配置项 |
ServiceProtocol
说明
参数名 | 类型 | 描述 |
---|---|---|
color |
string | 颜色 |
display |
number | 显示 |
subtitle |
string | 副标题 |
subType |
string | 子类型 |
id |
number | ID |
cfgId |
number | 配置 ID |
lang |
string | 语言 |
title |
string | 标题 |
type |
string | 类型 |
content |
string | 内容 |
seq |
number | 序列 |
ServiceIntro
说明
参数名 | 类型 | 描述 |
---|---|---|
color |
string | 颜色 |
display |
number | 显示 |
subtitle |
string | 副标题 |
attachmentJson |
object | 附件 JSON |
subType |
string | 子类型 |
id |
number | ID |
cfgId |
number | 配置 ID |
lang |
string | 语言 |
title |
string | 标题 |
type |
string | 类型 |
content |
string | 内容 |
seq |
number | 序列 |
ServiceLightSpot
说明
参数名 | 类型 | 描述 |
---|---|---|
color |
string | 颜色 |
display |
number | 显示 |
subtitle |
string | 副标题 |
attachmentJson |
object | 附件 JSON |
subType |
string | 子类型 |
id |
number | ID |
cfgId |
number | 配置 ID |
lang |
string | 语言 |
title |
string | 标题 |
type |
string | 类型 |
content |
string | 内容 |
seq |
number | 序列 |
ServiceName
说明
参数名 | 类型 | 描述 |
---|---|---|
color |
string | 颜色 |
display |
number | 显示 |
subtitle |
string | 副标题 |
attachmentJson |
object | 附件 JSON |
subType |
string | 子类型 |
id |
number | ID |
cfgId |
number | 配置 ID |
lang |
string | 语言 |
title |
string | 标题 |
type |
string | 类型 |
content |
string | 内容 |
seq |
number | 序列 |
ConfigItem
说明
参数名 | 类型 | 描述 |
---|---|---|
color |
string | 颜色 |
display |
number | 显示 |
subtitle |
string | 副标题 |
subType |
string | 子类型 |
id |
number | ID |
cfgId |
number | 配置 ID |
lang |
string | 语言 |
title |
string | 标题 |
type |
string | 类型 |
content |
string | 内容 |
seq |
number | 序列 |
ServiceIntro
说明
参数名 | 类型 | 描述 |
---|---|---|
color |
string | 颜色 |
display |
number | 显示 |
subtitle |
string | 副标题 |
attachmentJson |
object | 附件 JSON |
subType |
string | 子类型 |
id |
number | ID |
cfgId |
number | 配置 ID |
lang |
string | 语言 |
title |
string | 标题 |
type |
string | 类型 |
content |
string | 内容 |
seq |
number | 序列 |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getServiceIntroduction().then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
"moduleList": {
"serviceProtocol": [
{
"color": "",
"display": 1,
"subtitle": "",
"subType": "serviceProtocol",
"id": xxx,
"cfgId": xxx,
"lang": "zh",
"title": "简体中文服务协议",
"type": "serviceProtocol",
"content": "https://xxx.xxx.com/xxx/xxxx?lang=zh",
"seq": 1
},
{
"color": "",
"display": 1,
"subtitle": "",
"subType": "serviceProtocol",
"id": xxx,
"cfgId": xxx,
"lang": "en",
"title": "英语服务协议",
"type": "serviceProtocol",
"content": "https://xxx.xxx.com/xxx/xxxx?lang=zh",
"seq": 4
}
],
"serviceIntro": [
{
"color": "#2f9c8e",
"display": 1,
"subtitle": "",
"attachmentJson": {
"attachment1": "https://xxx.xxx.com/xxx/xxx/xxx.png"
},
"subType": "serviceIntro",
"id": xxx,
"cfgId": xxx,
"lang": "",
"title": "微信视频通话(VoIP)",
"type": "serviceIntro",
"content": "门铃呼叫,微信接听",
"seq": 0
}
],
"serviceLightSpot": [
{
"color": "",
"display": 1,
"subtitle": "",
"attachmentJson": {
"attachment1": "https://xxx.xxx.com/xxx/xxx/xxx.png"
},
"subType": "serviceLightSpot",
"id": xxx,
"cfgId": xxx,
"lang": "",
"title": "门铃不漏接",
"type": "serviceLightSpot",
"content": "有人按门铃,手机微信强提醒,避免漏接听",
"seq": 0
},
{
"color": "",
"display": 1,
"subtitle": "",
"attachmentJson": {
"attachment1": "https://xxx.xxx.com/xxx/xxx/xxx.png"
},
"subType": "serviceLightSpot",
"id": xxx,
"cfgId": xxx,
"lang": "",
"title": "通话更便捷",
"type": "serviceLightSpot",
"content": "采用微信视频通话能力:一键接听,避免繁琐操作;功能熟悉,无需额外学习",
"seq": 1
},
{
"color": "",
"display": 1,
"subtitle": "",
"attachmentJson": {
"attachment1": "https://xxx.xxx.com/xxx/xxx/xxx.png"
},
"subType": "serviceLightSpot",
"id": xxx,
"cfgId": xxx,
"lang": "",
"title": "微信开门",
"type": "serviceLightSpot",
"content": "全新开门方式,微信通话过程中一键开门、一键生成临时密码(功能开发中,敬请期待)",
"seq": 2
}
],
"serviceName": [
{
"color": "",
"display": 1,
"subtitle": "门铃呼叫,微信接听",
"attachmentJson": {
"attachment2": "https://xxx.xxx.com/xxx/xxx/xxx.png",
"attachment1": "https://xxx.xxx.com/xxx/xxx/xxx.png"
},
"subType": "serviceName",
"id": xxx,
"cfgId": xxx,
"lang": "",
"title": "微信视频通话(VoIP)",
"type": "serviceName",
"content": "",
"seq": 0
}
],
"configItem": [
{
"color": "",
"display": 1,
"subtitle": "",
"subType": "protocol",
"id": xxx,
"cfgId": xxx,
"lang": "",
"title": "展示服务协议",
"type": "configItem",
"content": "",
"seq": 0
},
{
"color": "",
"display": 1,
"subtitle": "",
"subType": "exchange",
"id": xxx,
"cfgId": xxx,
"lang": "",
"title": "兑换券入口",
"type": "configItem",
"content": "",
"seq": 0
}
]
}
}
getServiceListByDevice
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
name |
string | 服务名称 |
code |
string | 服务代码 |
startTime |
number | 开始时间 |
endTime |
number | 结束时间 |
tags |
ServiceTag[] | 标签列表 |
isFree |
boolean | 是否免费 |
isAY |
boolean | 是否为国区 |
isExit |
boolean | 是否退出 |
type |
number | 商品类型:
|
isPermanent |
boolean | 是否永久 |
ServiceTag
说明
参数名 | 描述 |
---|---|
freeTrial |
免费试用 |
automaticRenewal |
自动续期 |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getServiceListByDevice("vdevo172477044742560")
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
[
{
"duration": 3,
"code": "tuya_camera_store_3day_event_1_1095",
"isAY": true,
"isFree": true,
"name": "3 天滚动存储",
"isExit": true,
"hasPurchasedOrder": false,
"type": 0,
"tags": [
"freeTrial"
]
},
{
"code": "voip",
"isAY": true,
"isFree": false,
"name": "微信视频通话(VoIP)",
"isExit": true,
"startTime": 1722939139094,
"endTime": 1943777539094,
"type": 1,
"tags": []
}
]
getVoipAuthUser
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
userId |
string | 用户 ID |
avatarUrl |
string | 用户头像 URL |
userName |
string | 用户名称 |
isAuth |
boolean | 云端保存的 VoIP 授权状态,不一定准确 |
isValid |
boolean | 用户状态是否失效 |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getVoipAuthUser("vdevo172477044742560")
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
"isAuth": true,
"avatarUrl": "https://images.tuyacn.com/app/default_avatar/avatar9.png",
"isValid": true,
"userName": "xxx",
"userId": "xxx"
}
用于通过微信 API 获取 VoIP 的授权状态后同步到云,避免出现云端和微信 API 获取到授权状态不一致的情况。
saveWXVoipAuth
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
auth_tag |
number | VoIP 授权状态:
|
true |
返回参数
返回参数为 Boolean 类型,表示是否保存成功。
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.saveWXVoipAuth({ device_id: 'xxx', auth_tag: 1 })
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
true;
saveVoipAuthUser
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
user_id |
string | 用户的 UID | true |
返回参数
返回参数为 Boolean 类型,表示是否保存成功。
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.saveVoipAuthUser({ device_id: 'xxx', user_id: 'xxx' })
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
true;
用于查询云端提供的用户的 openId,即当前登录的微信用户的 OpenID。
getDeviceWXUserInfo
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
app_id |
string | 微信小程序 AppID | true |
返回参数
参数名 | 类型 | 描述 |
---|---|---|
openId |
string | 云端提供的用户的 OpenID |
userId |
string | 用户 ID |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.getDeviceWXUserInfo({ device_id: 'xxx', user_id: 'xxx' })
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
返回示例
{
"openId": "xxx",
"userId": "xxx"
}
buyIncreaseServiceByWx
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
mallCode |
string | 商城 Code | true |
siteCode |
string | 商城站点 Code | true |
currency |
string | 商城 货币 | true |
skuCode |
string | 当前选中商品的 SKU 代码 | true |
optionType |
string | 当前选中商品的付费方式 | true |
optionNo |
string | 当前选中商品的付费项 | true |
homeId |
string | 家庭 ID | true |
openId |
string | 微信 OpenID | true |
name |
string | 设备名称 | true |
uuid |
string | 设备 UUID | true |
wxAppId |
string | 微信小程序 AppID | true |
success |
(success) => void | 购买成功回调 | false |
fail |
(fail) => void | 购买失败回调 | false |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.buyIncreaseServiceByWx({
device_id: 'xxx',
mallCode: 'xxx',
siteCode: 'xxx',
currency: 'xxx',
skuCode: 'xxx',
optionType: 'xxx',
optionNo: 'xxx',
homeId: 'xxx',
openId: 'xxx',
wxAppId: 'xxx',
name: 'xxx',
uuid: : 'xxx',
success: res => {
console.log('success =>', res);
},
fail: err => {
console.log('err =>', err);
},
});
voipServiceAuthorization
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
name |
string | 设备名称 | true |
uuid |
string | 设备 UUID | true |
success |
(success) => void | 授权成功回调 | false |
fail |
(fail) => void | 授权失败回调 | false |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.voipServiceAuthorization({
device_id: 'xxx',
name: 'xxx',
uuid: 'xxx',
success: res => {
console.log('success =>', res);
},
fail: err => {
console.log('err =>', err);
},
});
exchangeCode
请求参数
参数名 | 类型 | 描述 | 是否必传 |
---|---|---|---|
device_id |
string | 设备 ID | true |
catalog_code |
string | 服务大类 Code。云存储:CLOUD_STORAGE | true |
homeId |
string | 家庭 ID | true |
code |
string | 兑换码 | true |
name |
string | 设备名称 | true |
uuid |
string | 设备 UUID | true |
success |
(success) => void | 兑换成功回调 | false |
fail |
(fail) => void | 兑换失败回调 | false |
请求示例
import MsVoipApi from '@ray-js/wechat-ms-voip';
MsVoipApi.exchangeCode({
device_id: 'xxx',
catalog_code: 'CLOUD_STORAGE'
homeId: 'xxx',
code: 'xxx',
name: 'xxx',
uuid: : 'xxx',
success: res => {
console.log('success =>', res);
},
fail: err => {
console.log('err =>', err);
},
});
Is this page helpful?
YesFeedback