# potato_cloud_node_sdk
# 介绍
potato cloud node sdk开发包,potato cloud 全放位的后端服务平台
# 软件架构
potato cloud 平台服务支持
axios 网络请求
crypto-js 加解密
js-md5 md5加密
qs get请求参数转换
# 安装教程
npm install potato_cloud_sdk
1
# 使用说明
const {
verifyCardV2,
initialize,
login,
registerV2,
setUserToken,
getLabelList,
execFunction
} = require("potato_cloud_sdk");
/**
* 初始化方法
* askKey askey
* signSecretKey 验签秘钥
* signType 验签类型 signType 0 不验签 1 验签V1 2 验签V2
* requestEncryptType 响应加密类型 0不加密,1 Base64,2 AES/ECB/PKCS5Padding,3 DES/ECB/PKCS7,4 AES/ECB/NOPadding(16位秘钥),5 RC4
* responseEncryptType 请求加密类型 0不加密,1 Base64,2 AES/ECB/PKCS5Padding,3 DES/ECB/PKCS7,4 AES/ECB/NOPadding(16位秘钥),5 RC4
* encryptSecretKey 加密秘钥
*/
initialize({
askKey:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcHBJZCI6OTEyOTY2ODA2ODM5ODQwNzY4LCJnZXRNYW5hZ2VtZW50SWQiOjY5ODExOTE5MzkxODc4NzU4NCwiVElNRSI6MTcwNjc3OTg1OTA5OX0.4qMMQitEx8memjOKOsAs9zs-qarH_va1H6UmocV1W50",
signSecretKey:"123456",
signType:"1",
requestEncryptType:0,
responseEncryptType:5,
encryptSecretKey:'1111111111111111'
})
/**
* 卡密验证
*/
const param={
'cardStr':'420A14B0FB9AD7306B0CE240318BE90E',
'mac':'12121'
}
verifyCardV2(param).then(res=>{
if(res.code==200){
// 判断验证结果
console.log(res.data)
}
})
/**
* 用户登陆
*/
const loginParam={
'userNumber':'123456789',
'passWord':'123456',
}
login(loginParam).then(res=>{
if(res.code==200){
// 设置token
setUserToken(res.data.apiUserToken)
}
})
/**
* 自动携带用户token
* 获取标签列表
*/
const getLabelParam={
'name':'12',
'id':'1'
}
getLabelList(getLabelParam).then(res=>{
console.log(res)
})
/**
* 用户注册V2
*/
const registerParam={
'userNumber':'313097897',
'passWord':'123456',
'email':'313097897@qq.com'
}
registerV2(registerParam).then(res=>{
//console.log(res.code)
})
/**
* 云函数带参调用
*/
const params = {
"name": "土豆api"
}
const funParam = {
"name": "test11",
"params": JSON.stringify(params)
}
execFunction(funParam).then(res => {
if (res.code == 200) {
// 判断验证结果
console.log(res)
} else {
console.log(res)
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# 参与贡献
- potato cloud 全体开发人员
← 懒人精灵