|
|
@@ -78,23 +78,31 @@ function App() {
|
|
|
const config = await response.json();
|
|
|
|
|
|
console.log('服务器返回配置:', config);
|
|
|
- console.log('agentId:', config.agentId);
|
|
|
- console.log('corpId:', config.corpId);
|
|
|
- console.log('timeStamp:', config.timeStamp);
|
|
|
- console.log('nonceStr:', config.nonceStr);
|
|
|
- console.log('signature:', config.signature);
|
|
|
|
|
|
- if (config.error) {
|
|
|
- console.error('服务器返回错误:', config.error);
|
|
|
+ if (config.code !== 200) {
|
|
|
+ console.error('服务器返回错误:', config.msg);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const result = config.result || {};
|
|
|
+ console.log('result:', result);
|
|
|
+ console.log('agentId:', result.agentId);
|
|
|
+ console.log('corpId:', result.corpId);
|
|
|
+ console.log('timeStamp:', result.timeStamp);
|
|
|
+ console.log('nonceStr:', result.nonceStr);
|
|
|
+ console.log('signature:', result.signature);
|
|
|
+
|
|
|
+ if (!result.agentId || !result.corpId || !result.signature) {
|
|
|
+ console.error('权限配置参数不完整');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
const permissionResult = await Dingdocs.base.host.configPermission(
|
|
|
- config.agentId,
|
|
|
- config.corpId,
|
|
|
- config.timeStamp,
|
|
|
- config.nonceStr,
|
|
|
- config.signature,
|
|
|
+ result.agentId,
|
|
|
+ result.corpId,
|
|
|
+ result.timeStamp,
|
|
|
+ result.nonceStr,
|
|
|
+ result.signature,
|
|
|
['DingdocsScript.base.readWriteAll']
|
|
|
);
|
|
|
console.log('权限配置结果:', permissionResult);
|