Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uniCloud
提交
d34373fa
H
hello-uniCloud
项目概览
DCloud
/
hello-uniCloud
通知
299
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uniCloud
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d34373fa
编写于
12月 08, 2023
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
secure-network
上级
59076fb9
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
445 addition
and
157 deletion
+445
-157
pages.json
pages.json
+129
-118
pages/cloudFunction/cloudFunction.vue
pages/cloudFunction/cloudFunction.vue
+15
-19
pages/cloudObject/cloudObject.vue
pages/cloudObject/cloudObject.vue
+16
-20
pages/secure-network/cloud-function.vue
pages/secure-network/cloud-function.vue
+90
-0
pages/secure-network/cloud-object.vue
pages/secure-network/cloud-object.vue
+82
-0
pages/secure-network/css.css
pages/secure-network/css.css
+45
-0
uniCloud-aliyun/cloudfunctions/secure-network-object/index.obj.js
...-aliyun/cloudfunctions/secure-network-object/index.obj.js
+38
-0
uniCloud-aliyun/cloudfunctions/secure-network-object/package.json
...-aliyun/cloudfunctions/secure-network-object/package.json
+7
-0
uniCloud-aliyun/cloudfunctions/secure-network/index.js
uniCloud-aliyun/cloudfunctions/secure-network/index.js
+16
-0
uniCloud-aliyun/cloudfunctions/secure-network/package.json
uniCloud-aliyun/cloudfunctions/secure-network/package.json
+7
-0
未找到文件。
pages.json
浏览文件 @
d34373fa
...
...
@@ -14,6 +14,20 @@
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/secure-network/cloud-function"
,
"style"
:
{
"navigationBarTitleText"
:
"安全网络 - 云函数"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/secure-network/cloud-object"
,
"style"
:
{
"navigationBarTitleText"
:
"安全网络 - 云对象"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/test/test"
,
"style"
:
{
...
...
@@ -49,104 +63,104 @@
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/clientDB"
,
"style"
:
{
"navigationBarTitleText"
:
"前端操作数据库"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/user-info/add"
,
"style"
:
{
"navigationBarTitleText"
:
"新增"
}
},
{
"path"
:
"pages/user-info/edit"
,
"style"
:
{
"navigationBarTitleText"
:
"修改"
}
},
{
"path"
:
"pages/user-info/list"
,
"style"
:
{
"navigationBarTitleText"
:
"列表"
}
},
{
"path"
:
"pages/user-info/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"详情"
}
},
{
"path"
:
"pages/storage/storage"
,
"style"
:
{
"navigationBarTitleText"
:
"云存储"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/storage/space-storage"
,
"style"
:
{
"navigationBarTitleText"
:
"空间内置云存储"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/storage/ext-storage-qiniu"
,
"style"
:
{
"navigationBarTitleText"
:
"扩展存储-七牛云"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/schema2code/schema2code"
,
"style"
:
{
"navigationBarTitleText"
:
"schema2code"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission/permission"
,
"style"
:
{
"navigationBarTitleText"
:
"角色权限"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission-demo/permission-demo"
,
"style"
:
{
"navigationBarTitleText"
:
"角色权限"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission-demo/readme"
,
"style"
:
{
"navigationBarTitleText"
:
"角色权限"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission-field-simple/permission-field-simple"
,
"style"
:
{
"navigationBarTitleText"
:
"简单-字段级权限控制"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/clientDB-api/clientDB-api"
,
"style"
:
{
"navigationBarTitleText"
:
"前端操作数据库的API"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/validate/validate"
,
"style"
:
{
"navigationBarTitleText"
:
"字段值域验证"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/clientDB"
,
"style"
:
{
"navigationBarTitleText"
:
"前端操作数据库"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/user-info/add"
,
"style"
:
{
"navigationBarTitleText"
:
"新增"
}
},
{
"path"
:
"pages/user-info/edit"
,
"style"
:
{
"navigationBarTitleText"
:
"修改"
}
},
{
"path"
:
"pages/user-info/list"
,
"style"
:
{
"navigationBarTitleText"
:
"列表"
}
},
{
"path"
:
"pages/user-info/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"详情"
}
},
{
"path"
:
"pages/storage/storage"
,
"style"
:
{
"navigationBarTitleText"
:
"云存储"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/storage/space-storage"
,
"style"
:
{
"navigationBarTitleText"
:
"空间内置云存储"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/storage/ext-storage-qiniu"
,
"style"
:
{
"navigationBarTitleText"
:
"扩展存储-七牛云"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/schema2code/schema2code"
,
"style"
:
{
"navigationBarTitleText"
:
"schema2code"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission/permission"
,
"style"
:
{
"navigationBarTitleText"
:
"角色权限"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission-demo/permission-demo"
,
"style"
:
{
"navigationBarTitleText"
:
"角色权限"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission-demo/readme"
,
"style"
:
{
"navigationBarTitleText"
:
"角色权限"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/permission-field-simple/permission-field-simple"
,
"style"
:
{
"navigationBarTitleText"
:
"简单-字段级权限控制"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/clientDB-api/clientDB-api"
,
"style"
:
{
"navigationBarTitleText"
:
"前端操作数据库的API"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/clientDB/validate/validate"
,
"style"
:
{
"navigationBarTitleText"
:
"字段值域验证"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/validate-demo/add"
,
...
...
@@ -195,26 +209,23 @@
"navigationBarTitleText"
:
"扩展能力Redis"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"uni_modules/uni-upgrade-center/pages/version/list"
,
"style"
:
{
"navigationBarTitleText"
:
"版本列表"
}
},
{
"path"
:
"uni_modules/uni-upgrade-center/pages/version/add"
,
"style"
:
{
"navigationBarTitleText"
:
"新版发布"
}
},
{
"path"
:
"uni_modules/uni-upgrade-center/pages/version/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"版本信息查看"
}
}
,{
"path"
:
"uni_modules/uni-upgrade-center/pages/version/list"
,
"style"
:
{
"navigationBarTitleText"
:
"版本列表"
}
}
,{
"path"
:
"uni_modules/uni-upgrade-center/pages/version/add"
,
"style"
:
{
"navigationBarTitleText"
:
"新版发布"
}
}
,{
"path"
:
"uni_modules/uni-upgrade-center/pages/version/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"版本信息查看"
}
}
],
],
"tabBar"
:
{
"color"
:
"#7A7E83"
,
"selectedColor"
:
"#1296db"
,
...
...
@@ -257,4 +268,4 @@
"navigationBarBackgroundColor"
:
"#F8F8F8"
,
"backgroundColor"
:
"#F8F8F8"
}
}
}
\ No newline at end of file
pages/cloudFunction/cloudFunction.vue
浏览文件 @
d34373fa
...
...
@@ -14,6 +14,12 @@
<button
type=
"primary"
@
click=
"get"
>
查询前10条数据
</button>
<button
type=
"primary"
@
click=
"useCommon"
>
使用公用模块
</button>
<button
type=
"primary"
@
click=
"toRedisPage"
>
使用Redis
</button>
<!-- #ifdef APP-PLUS || MP-WEIXIN -->
<navigator
url=
"../secure-network/cloud-function"
>
<button
type=
"primary"
>
安全网络
</button>
</navigator>
<!-- #endif -->
</view>
</view>
</
template
>
...
...
@@ -24,11 +30,11 @@
return
{}
},
methods
:
{
a
sync
a
dd
()
{
add
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
return
await
uniCloud
.
callFunction
({
uniCloud
.
callFunction
({
name
:
'
add
'
,
data
:
{
product
:
'
uniCloud
'
,
...
...
@@ -41,7 +47,6 @@
showCancel
:
false
})
console
.
log
(
res
)
return
res
.
result
.
id
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -49,10 +54,9 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
async
remove
()
{
remove
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
...
...
@@ -65,7 +69,6 @@
showCancel
:
false
})
console
.
log
(
res
)
return
res
.
result
.
msg
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -73,14 +76,13 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
async
update
()
{
update
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
return
await
uniCloud
.
callFunction
({
uniCloud
.
callFunction
({
name
:
'
update
'
,
data
:
{
product
:
'
uni-app
'
,
...
...
@@ -93,7 +95,6 @@
showCancel
:
false
})
console
.
log
(
res
)
return
res
.
result
.
msg
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -101,14 +102,13 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
async
get
()
{
get
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
return
await
uniCloud
.
callFunction
({
uniCloud
.
callFunction
({
name
:
'
get
'
}).
then
((
res
)
=>
{
uni
.
hideLoading
()
...
...
@@ -117,7 +117,6 @@
showCancel
:
false
})
console
.
log
(
res
)
return
res
.
result
.
data
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -125,12 +124,11 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
async
useCommon
()
{
useCommon
()
{
console
.
log
(
'
请确保自己已经阅读并按照公用模块文档操作 https://uniapp.dcloud.io/uniCloud/cf-common
'
)
return
await
uniCloud
.
callFunction
({
uniCloud
.
callFunction
({
name
:
'
use-common
'
}).
then
((
res
)
=>
{
uni
.
hideLoading
()
...
...
@@ -139,7 +137,6 @@
showCancel
:
false
})
console
.
log
(
res
)
return
res
.
result
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -147,7 +144,6 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
toRedisPage
(){
...
...
pages/cloudObject/cloudObject.vue
浏览文件 @
d34373fa
...
...
@@ -14,6 +14,12 @@
<button
type=
"primary"
@
click=
"update"
>
修改数据
</button>
<button
type=
"primary"
@
click=
"get"
>
查询前10条数据
</button>
<button
type=
"primary"
@
click=
"useCommon"
>
使用公用模块
</button>
<!-- #ifdef APP-PLUS || MP-WEIXIN -->
<navigator
url=
"../secure-network/cloud-object"
>
<button
type=
"primary"
>
安全网络
</button>
</navigator>
<!-- #endif -->
</view>
</
template
>
<
template
v-else
>
...
...
@@ -39,11 +45,11 @@
}
},
methods
:
{
a
sync
a
dd
()
{
add
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
return
await
cloudObjectDemo
.
add
({
cloudObjectDemo
.
add
({
product
:
'
uniCloud
'
,
create_time
:
Date
.
now
()
}).
then
((
res
)
=>
{
...
...
@@ -53,7 +59,6 @@
content
:
`成功添加一条数据,文档id为:
${
res
.
id
}
`
,
showCancel
:
false
})
return
res
}).
catch
((
err
)
=>
{
console
.
error
(
err
)
uni
.
hideLoading
()
...
...
@@ -61,21 +66,19 @@
content
:
`添加数据失败,错误信息为:
${
err
.
message
}
`
,
showCancel
:
false
})
return
err
})
},
async
remove
()
{
remove
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
return
await
cloudObjectDemo
.
remove
().
then
((
res
)
=>
{
cloudObjectDemo
.
remove
().
then
((
res
)
=>
{
console
.
log
(
res
)
uni
.
hideLoading
()
uni
.
showModal
({
content
:
res
.
msg
,
showCancel
:
false
})
return
res
.
msg
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -83,14 +86,13 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
async
update
()
{
update
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
return
await
cloudObjectDemo
.
update
({
cloudObjectDemo
.
update
({
product
:
'
uni-app
'
,
create_time
:
Date
.
now
()
}).
then
((
res
)
=>
{
...
...
@@ -100,7 +102,6 @@
showCancel
:
false
})
console
.
log
(
res
)
return
res
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -108,21 +109,19 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
async
get
()
{
get
()
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
return
await
cloudObjectDemo
.
get
().
then
((
res
)
=>
{
cloudObjectDemo
.
get
().
then
((
res
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
content
:
`查询成功,获取数据列表为:
${
JSON
.
stringify
(
res
)}
`
,
showCancel
:
false
})
console
.
log
(
res
)
return
res
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -130,18 +129,16 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
async
useCommon
()
{
return
await
cloudObjectDemo
.
useCommon
().
then
((
res
)
=>
{
useCommon
()
{
cloudObjectDemo
.
useCommon
().
then
((
res
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
content
:
'
云对象使用公共模块返回结果:
'
+
JSON
.
stringify
(
res
),
showCancel
:
false
})
console
.
log
(
res
)
return
res
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
...
...
@@ -149,7 +146,6 @@
showCancel
:
false
})
console
.
error
(
err
)
return
err
})
},
toRedisPage
()
{
...
...
pages/secure-network/cloud-function.vue
0 → 100644
浏览文件 @
d34373fa
<
template
>
<view
class=
"container"
>
<view
class=
"title"
>
请求数据
</view>
<input
class=
"input"
v-model=
"inputValue"
/>
<view
class=
"group"
>
<view
class=
"secret-type"
>
secretType: "both"
</view>
<view
class=
"secret-type-comment"
>
客户端和服务器上行下行数据都加密数据
</view>
<button
type=
"primary"
@
click=
"getBySecretType('both')"
>
get
</button>
</view>
<view
class=
"group"
>
<view
class=
"secret-type"
>
secretType: "request"
</view>
<view
class=
"secret-type-comment"
>
只加密客户端请求时的上行数据,服务器下发数据不加密
</view>
<button
type=
"primary"
@
click=
"getBySecretType('request')"
>
get
</button>
</view>
<view
class=
"group"
>
<view
class=
"secret-type"
>
secretType: "response"
</view>
<view
class=
"secret-type-comment"
>
客户端请求时不加密数据,只加密服务器下发的数据
</view>
<button
type=
"primary"
@
click=
"getBySecretType('response')"
>
get
</button>
</view>
<view
class=
"tips"
>
提示:
<view
class=
"tips-item"
>
当前请求的云函数强制校验 secretType: "both",返回值为请求的数据
</view>
<view
class=
"tips-item"
>
不管是客户端接收云端数据、还是云端接受客户端数据,开发者的代码拿到的数据永远都是解密后的数据
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
inputValue
:
'
uniCloud-secure-network
'
}
},
methods
:
{
getBySecretType
(
secretType
)
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
uniCloud
.
callFunction
({
name
:
'
secure-network
'
,
data
:
{
value
:
this
.
inputValue
},
secretType
,
success
:
(
res
)
=>
{
uni
.
showModal
({
content
:
JSON
.
stringify
(
res
.
result
),
showCancel
:
false
})
},
fail
:
(
err
)
=>
{
uni
.
showModal
({
content
:
err
.
message
,
showCancel
:
false
})
console
.
error
(
err
)
},
complete
:
()
=>
{
uni
.
hideLoading
()
}
})
}
}
}
</
script
>
<
style
>
@import
url("css.css")
;
</
style
>
pages/secure-network/cloud-object.vue
0 → 100644
浏览文件 @
d34373fa
<
template
>
<view
class=
"container"
>
<view
class=
"title"
>
请求数据
</view>
<input
class=
"input"
v-model=
"inputValue"
/>
<view
class=
"group"
>
<view
class=
"secret-type"
>
secretType: "both"
</view>
<view
class=
"secret-type-comment"
>
客户端和服务器上行下行数据都加密数据
</view>
<button
type=
"primary"
@
click=
"getBySecretType('both')"
>
get
</button>
</view>
<view
class=
"group"
>
<view
class=
"secret-type"
>
secretType: "request"
</view>
<view
class=
"secret-type-comment"
>
只加密客户端请求时的上行数据,服务器下发数据不加密
</view>
<button
type=
"primary"
@
click=
"getBySecretType('request')"
>
get
</button>
</view>
<view
class=
"group"
>
<view
class=
"secret-type"
>
secretType: "response"
</view>
<view
class=
"secret-type-comment"
>
客户端请求时不加密数据,只加密服务器下发的数据
</view>
<button
type=
"primary"
@
click=
"getBySecretType('response')"
>
get
</button>
</view>
<view
class=
"tips"
>
提示:
<view
class=
"tips-item"
>
当前请求的云对象强制校验 secretType: "both",返回值为请求的数据
</view>
<view
class=
"tips-item"
>
不管是客户端接收云端数据、还是云端接受客户端数据,开发者的代码拿到的数据永远都是解密后的数据
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
inputValue
:
'
uniCloud-secure-network
'
}
},
methods
:
{
getBySecretType
(
secretType
)
{
uni
.
showLoading
({
title
:
'
处理中...
'
})
const
secureNetworkObject
=
uniCloud
.
importObject
(
'
secure-network-object
'
,
{
secretMethods
:
{
'
get
'
:
secretType
}
});
secureNetworkObject
.
get
(
this
.
inputValue
).
then
((
res
)
=>
{
uni
.
hideLoading
()
uni
.
showModal
({
content
:
JSON
.
stringify
(
res
),
showCancel
:
false
})
}).
catch
((
err
)
=>
{
uni
.
hideLoading
()
console
.
error
(
err
)
})
}
}
}
</
script
>
<
style
>
@import
url("css.css")
;
</
style
>
pages/secure-network/css.css
0 → 100644
浏览文件 @
d34373fa
.container
{
padding
:
15px
;
}
.title
{
font-size
:
15px
;
}
.input
{
margin-top
:
5px
;
padding
:
5px
8px
;
border
:
1px
solid
#ccc
;
border-radius
:
5px
;
}
.group
{
margin-top
:
30px
;
}
.secret-type
{
font-weight
:
bold
;
}
.secret-type-comment
{
font-size
:
14px
;
margin-top
:
5px
;
opacity
:
.7
;
}
button
{
margin-top
:
10px
;
}
.tips
{
font-size
:
14px
;
margin-top
:
30px
;
opacity
:
.8
;
}
.tips-item
{
display
:
list-item
;
margin-left
:
20px
;
margin-top
:
5px
;
}
uniCloud-aliyun/cloudfunctions/secure-network-object/index.obj.js
0 → 100644
浏览文件 @
d34373fa
// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程:https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
module
.
exports
=
{
_before
:
function
()
{
// 通用预处理器
const
methodName
=
this
.
getMethodName
()
const
clientInfo
=
this
.
getClientInfo
()
const
secretType
=
clientInfo
.
secretType
// methodName 是客户端调用的方法名
// secretType 是客户端调用 uniCloud.importObject 传递的参数 secretMethods
console
.
log
(
secretType
);
if
(
secretType
!==
'
both
'
)
{
throw
new
Error
(
'
secretType invalid
'
)
// 拒绝返回有效数据
}
},
/**
* method1方法描述
* @param {string} param1 参数1描述
* @returns {object} 返回值描述
*/
get
(
param1
)
{
// 参数校验,如无参数则不需要
if
(
!
param1
)
{
return
{
errCode
:
'
PARAM_IS_NULL
'
,
errMsg
:
'
参数不能为空
'
}
}
// 业务逻辑
// 返回结果
return
{
param1
//请根据实际需要返回值
}
}
}
uniCloud-aliyun/cloudfunctions/secure-network-object/package.json
0 → 100644
浏览文件 @
d34373fa
{
"name"
:
"secure-object"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
uniCloud-aliyun/cloudfunctions/secure-network/index.js
0 → 100644
浏览文件 @
d34373fa
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
secretType
=
context
.
secretType
// secretType 是客户端调用 uniCloud.callFunction 传递的参数 secretType
if
(
secretType
!==
'
both
'
)
{
throw
new
Error
(
'
secretType invalid
'
)
// 拒绝返回有效数据
}
//返回数据给客户端
return
event
};
uniCloud-aliyun/cloudfunctions/secure-network/package.json
0 → 100644
浏览文件 @
d34373fa
{
"name"
:
"secure-network"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录