@@ -7,11 +7,14 @@ const util = require('util')
7
7
const QRCode = require ( 'qrcode' )
8
8
const TencentLogin = require ( 'tencent-login' )
9
9
const tencentcloud = require ( 'tencentcloud-sdk-nodejs' )
10
- const { GetUserAuthInfo } = require ( 'serverless-tencent-tools' ) . Account
10
+ const serverlessTencentTools = require ( 'serverless-tencent-tools' )
11
+ const { GetUserAuthInfo } = serverlessTencentTools . Account
12
+ const { DataReport } = serverlessTencentTools . Others . DataReport
11
13
const ClientProfile = require ( 'tencentcloud-sdk-nodejs/tencentcloud/common/profile/client_profile.js' )
12
14
const HttpProfile = require ( 'tencentcloud-sdk-nodejs/tencentcloud/common/profile/http_profile.js' )
13
15
const AbstractModel = require ( 'tencentcloud-sdk-nodejs/tencentcloud/common/abstract_model' )
14
16
const AbstractClient = require ( 'tencentcloud-sdk-nodejs/tencentcloud/common/abstract_client' )
17
+
15
18
const constants = {
16
19
providerName : 'tencent'
17
20
}
@@ -50,6 +53,19 @@ class TencentProvider {
50
53
this . getCredentials ( this . serverless , this . options )
51
54
this . serverless . setProvider ( constants . providerName , this )
52
55
this . provider = this
56
+ let commands = ''
57
+ const commandsAttr = this . serverless . pluginManager . cliCommands
58
+ for ( let i = 0 ; i < commandsAttr . length ; i ++ ) {
59
+ commands = commands + ( i == 0 ? '' : '_' ) + commandsAttr [ i ]
60
+ }
61
+ this . reportInputs = {
62
+ name : 'serverless-tencent-scf' ,
63
+ project : this . serverless . service . service ,
64
+ action : commands
65
+ }
66
+ try {
67
+ new DataReport ( ) . report ( this . reportInputs )
68
+ } catch ( e ) { }
53
69
}
54
70
55
71
static getProviderName ( ) {
@@ -75,14 +91,19 @@ class TencentProvider {
75
91
} )
76
92
options . credentials . tencent_appid = appid . AppId
77
93
options . credentials . tencent_owneruin = appid . OwnerUin
94
+ this . tempUin = appid . OwnerUin
78
95
}
79
96
return options
80
97
}
81
98
82
99
async getUserAuth ( uin ) {
83
100
try {
101
+ try {
102
+ this . reportInputs . uin = uin
103
+ new DataReport ( ) . report ( this . reportInputs )
104
+ } catch ( e ) { }
84
105
const getUserAuthInfo = new GetUserAuthInfo ( )
85
- const result = await getUserAuthInfo . isAuth ( uin , { client : 'plugin' } )
106
+ const result = await getUserAuthInfo . isAuth ( uin , this . reportInputs )
86
107
if ( result [ 'Error' ] == true ) {
87
108
console . log ( 'Failed to get real name authentication result.' )
88
109
process . exit ( - 1 )
0 commit comments