Browse Source

Merge branch 'master' of http://git.fmode.cn:3000/bin/edu-textbook

xll 7 months ago
parent
commit
65344ae0a1

+ 3 - 3
README.md

@@ -72,14 +72,14 @@ https://lljydpt8egql.u2-dev.hep.com.cn/
 
 ### AKSK
 AccessKey ID:
-6686bffb373d06911e24a969
+6682ab96b7bd5db59d6785a0
 AccessKey Secret:
-4e978331675938d1bc81fb109e67d59a
+4cfc095a72a67e22065c97e90054315c
 
 ### 单页面应用
 AppID 6682ab96b7bd5db59d6785a0
 
-AppSecret b800ac6533c640c3d1ea2b20ebe2e990
+AppSecret 4cfc095a72a67e22065c97e90054315c
 
 Token 端点
 https://textbook.u2-dev.hep.com.cn/oidc/token

+ 3 - 3
projects/textbook/src/modules/nav-admin/modules.routes.ts

@@ -1,8 +1,8 @@
 import { NgModule } from '@angular/core';
 import { RouterModule, Routes } from '@angular/router';
-import { CollectionEditComponent } from './collection/collection-edit/collection-edit.component';
-import { CreateCollectionComponent } from './collection/create-collection/create-collection.component';
-import { PageCollectionComponent } from './collection/page-collection/page-collection.component';
+// import { CollectionEditComponent } from './collection/collection-edit/collection-edit.component';
+// import { CreateCollectionComponent } from './collection/create-collection/create-collection.component';
+// import { PageCollectionComponent } from './collection/page-collection/page-collection.component';
 import { ProcessListComponent } from './page-process/process-list/process-list.component';
 import { PageRoleComponent } from './page-role/page-role.component';
 import { PageTextbookComponent } from './page-textbook/page-textbook.component';

+ 1 - 0
projects/textbook/src/modules/nav-province-contact/submitted/export-file/export-file.component.html

@@ -18,6 +18,7 @@
         style="background: #3e49b3; border: 1px #3e49b3"
         nz-button
         nzType="primary"
+        (click)="onDownload()"
       >
         生成 PDF 并下载
       </button>

+ 20 - 5
projects/textbook/src/modules/nav-province-contact/submitted/export-file/export-file.component.ts

@@ -16,12 +16,13 @@ export class ExportFileComponent implements OnInit {
   starCount: number = 0;
   otherCount: number = 0;
   allCount: number = 0;
-
+  tbookId: any;
   constructor(private router: Router, private activeRoute: ActivatedRoute) {}
 
   ngOnInit() {
     this.activeRoute.paramMap.subscribe(async (params) => {
       let id = params.get('id');
+      this.tbookId = id;
       // let query = new Parse.Query('EduProcess');
       // query.include('branch', 'department');
       // query.equalTo('objectId', id);
@@ -40,10 +41,24 @@ export class ExportFileComponent implements OnInit {
       this.otherCount = await query.count();
     });
   }
-  close(){
-    history.back()
+  close() {
+    history.back();
+  }
+  next() {
+    this.change.emit('next');
   }
-  next(){
-    this.change.emit('next')
+  onDownload() {
+    Parse.Cloud.run('tbookExportReport', { processId: this.tbookId }).then(
+      (data) => {
+        console.log(data);
+        let url = data.zipUrl;
+        const a = document.createElement('a'); // 创建一个&lt;a&gt;元素
+        a.href = url; // 设置链接的href属性为要下载的文件的URL
+        a.download = '报送流程'; // 设置下载文件的名称
+        document.body.appendChild(a); // 将&lt;a&gt;元素添加到文档中
+        a.click(); // 模拟点击&lt;a&gt;元素
+        document.body.removeChild(a); // 下载后移除&lt;a&gt;元素
+      }
+    );
   }
 }

+ 2 - 2
server/cloud/authing/func-authing-org-sync.js

@@ -1,7 +1,7 @@
 const { ManagementClient } = require('authing-node-sdk')
 const managementClient  = new ManagementClient({
-    accessKeyId: '6686bffb373d06911e24a969',
-    accessKeySecret: "4e978331675938d1bc81fb109e67d59a",
+    accessKeyId: '669b25e1731d50c59f5494d1',
+    accessKeySecret: "4cfc095a72a67e22065c97e90054315c",
     host: 'https://textbook.u2-dev.hep.com.cn', // 应用的认证地址
 })
 

+ 14 - 9
server/cloud/authing/func-authing-session-sync.js

@@ -43,8 +43,10 @@ async function syncSessionWithIdToken(token){
     let sessionObjectId = generateObjectId(user?.id+user?.token);
     let username = user?.username || user?.phone || user?.email
     let ParseExistUser = await getParseUserByAuthingUser(user);
-    // console.log("ParseExistUser",ParseExistUser);
     let userId = ParseExistUser?.objectId || user?.id;
+    console.log("userId",userId);
+    console.log("authingUser",user);
+    console.log("ParseExistUser",ParseExistUser);
     let syncSessionSQL = `
     INSERT INTO "_User" (
         "objectId", "username","mobile","phone", "createdAt", "updatedAt",
@@ -88,7 +90,7 @@ async function syncSessionWithIdToken(token){
         try {
             // 查询:数据库版本信息
             let data = await pgClient().any(syncSessionSQL,params);
-            // console.log(data)
+            console.log("session sql",data)
             return {
                 sid:sessionObjectId,
                 uid:user?.id,
@@ -111,6 +113,7 @@ async function getParseUserByAuthingUser(user){
     "username"=$3 OR 
     "username"=$4 OR 
     "username"=$5 OR 
+    "username"=$6 OR 
     ("mobile" IS NOT NULL AND "mobile" = $4) OR 
     ("phone" IS NOT NULL AND "phone"  = $4) OR 
     ("mobile" IS NOT NULL AND "mobile" = $5) OR 
@@ -118,17 +121,17 @@ async function getParseUserByAuthingUser(user){
     ("email" IS NOT NULL AND "email" = $6)
     `
     let params = [
-        user?.id,
-        user?.externalId,
-        user?.username,
-        user?.phone,
-        user?.mobile,
-        user?.email
+        user?.id, //1
+        user?.externalId,//2
+        user?.username,//3
+        user?.phone,//4
+        user?.mobile,//5
+        user?.email//6
     ]
     let data = [] 
     try{
         data = await pgClient().any(sql,params);
-        // console.log("data",data)
+        console.log("data same user:",data)
         if(data?.length){
             return data[0]
         }
@@ -141,6 +144,8 @@ async function getParseUserByAuthingUser(user){
 
 const crypto = require('crypto');
 function generateObjectId(inputString) {
+    inputString = inputString || ""
+    inputString = String(inputString)
     const hash = crypto.createHash('sha256').update(inputString).digest('hex');
     const objectId = hash;
     return objectId;

+ 1 - 1
server/cloud/authing/test/test-verify-sms.js

@@ -3,7 +3,7 @@ const { AuthenticationClient, Models } = require('authing-node-sdk');
 const authenticationClient = new AuthenticationClient({
   // 需要替换成你的 Authing AppId、 Secret 和 Host
   appId: '6682ab96b7bd5db59d6785a0',
-  appSecret: "4e978331675938d1bc81fb109e67d59a",
+  appSecret: "4cfc095a72a67e22065c97e90054315c",
   appHost: 'https://textbook.u2-dev.hep.com.cn', // 应用的认证地址
 });
 

+ 2 - 2
server/cloud/authing/trigger-department.js

@@ -1,8 +1,8 @@
 // https://docs.authing.cn/v3/reference/sdk/node/management/%E7%AE%A1%E7%90%86%E7%BB%84%E7%BB%87%E6%9C%BA%E6%9E%84/update-department.html
 const { ManagementClient,Models } = require('authing-node-sdk')
 const managementClient  = new ManagementClient({
-    accessKeyId: '6699e5bc4767805be9cd1ddc', // 用户池级别AKSK
-    accessKeySecret: "c92f71bda13ac9e2e903410148733514",
+    accessKeyId: '669b25e1731d50c59f5494d1', // 用户池级别AKSK
+    accessKeySecret: "4cfc095a72a67e22065c97e90054315c",
     host: 'https://textbook.u2-dev.hep.com.cn', // 应用的认证地址
 })
 

+ 2 - 2
server/cloud/authing/trigger-user-save.js

@@ -1,8 +1,8 @@
 // https://docs.authing.co/v2/reference/sdk-for-node/management/UsersManagementClient.html
 const { ManagementClient } = require('authing-node-sdk')
 const managementClient  = new ManagementClient({
-    accessKeyId: '6686bffb373d06911e24a969',
-    accessKeySecret: "4e978331675938d1bc81fb109e67d59a",
+    accessKeyId: '669b25e1731d50c59f5494d1',
+    accessKeySecret: "4cfc095a72a67e22065c97e90054315c",
     host: 'https://textbook.u2-dev.hep.com.cn', // 应用的认证地址
 })