From 61a66323c0760a986da7b0d5f8b801b172e77f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=9D=B0?= Date: Sat, 22 Jul 2023 11:01:18 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9policy=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 徐杰 --- .../reference/apis/js-apis-net-policy.md | 59 ++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md index e8062b359d..37a509ff5a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md @@ -531,17 +531,21 @@ setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallba import connection from '@ohos.net.connection'; let netQuotaPolicyList = [] - let netquotapolicy = { - netType: connection.NetBearType.BEARER_CELLULAR, - simId: 1, - identity: "", - periodDuration: "M1", - warningBytes: 40000, - limitBytes: 50000, - metered: true, - limitAction: policy.LimitAction.LIMIT_ACTION_NONE -}; + networkMatchRule: { + netType: connection.NetBearType.BEARER_CELLULAR, + identity:"", + simId:"1" + }, + quotaPolicy: { + periodDuration: "M1", + warningBytes: 40000, + limitBytes: 50000, + metered: true, + limitAction: policy.LimitAction.LIMIT_ACTION_NONE + }, +} + netQuotaPolicyList.push(netquotapolicy); policy.setNetQuotaPolicies(netQuotaPolicyList, (error) => { @@ -590,17 +594,21 @@ setNetQuotaPolicies(quotaPolicies: Array\): Promise\; import connection from '@ohos.net.connection'; let netQuotaPolicyList = [] - let netquotapolicy = { - netType: connection.NetBearType.BEARER_CELLULAR, - simId: 1, - identity: "", - periodDuration: "M1", - warningBytes: 40000, - limitBytes: 50000, - metered: true, - limitAction: policy.LimitAction.LIMIT_ACTION_NONE -}; + networkMatchRule: { + netType: connection.NetBearType.BEARER_CELLULAR, + identity:"", + simId:"1" + }, + quotaPolicy: { + periodDuration: "M1", + warningBytes: 40000, + limitBytes: 50000, + metered: true, + limitAction: policy.LimitAction.LIMIT_ACTION_NONE + }, +} + netQuotaPolicyList.push(netquotapolicy); policy.setNetQuotaPolicies(netQuotaPolicyList).then(function (error) { @@ -1051,7 +1059,7 @@ resetPolicies(simId: string, callback: AsyncCallback\): void **示例:** ```js -policy.resetPolicies(1, (error) => { +policy.resetPolicies('1', (error) => { console.log(JSON.stringify(error)) }); ``` @@ -1094,7 +1102,7 @@ resetPolicies(simId: string): Promise\; **示例:** ```js -policy.resetPolicies(1).then(function (error) { +policy.resetPolicies('1').then(function (error) { console.log(JSON.stringify(error)) }) ``` @@ -1135,7 +1143,7 @@ updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType, ```js import connection from '@ohos.net.connection'; -policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, 1, policy.NetUidPolicy.NET_POLICY_NONE, (error) => { +policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING, (error) => { console.log(JSON.stringify(error)) }); ``` @@ -1181,7 +1189,7 @@ updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType): ```js import connection from '@ohos.net.connection'; -policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, 1, policy.NetUidPolicy.NET_POLICY_NONE).then(function (error) { +policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(function (error) { console.log(JSON.stringify(error)) }) ``` @@ -1220,9 +1228,6 @@ setPowerSaveTrustlist(uids: Array\, isAllowed: boolean, callback: AsyncC **示例:** ```js -let param = { - uids: [11111,22222], isAllowed: true -} policy.setDeviceIdleTrustlist([11111,22222], true, (error) => { console.log(JSON.stringify(error)) }); -- GitLab