Browse Source

游客权限增加

laiguoran 3 years ago
parent
commit
e510376fe9

+ 18 - 0
app/const/tourist_permission.js

@@ -0,0 +1,18 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date
+ * @version
+ */
+
+const defaultPermission = {
+    file: 0,
+    tag: 0,
+};
+
+module.exports = {
+    defaultPermission,
+};

+ 2 - 0
app/middleware/tender_check.js

@@ -64,6 +64,8 @@ module.exports = options => {
             const isTenderTourist = yield this.service.tenderTourist.getDataByCondition({ tid: tender.id, user_id: accountId });
             // 判断访问人是否具有游客身份
             tender.isTourist = isTenderTourist !== null;
+            tender.touristPermission = yield this.service.tenderTourist.getTouristPermission(isTenderTourist);
+            console.log(tender.touristPermission);
             if (auditorsId.indexOf(accountId) === -1 && tender.data.user_id !== accountId &&
                 (tenderPermission === null || tenderPermission === undefined || tenderPermission.indexOf('2') === -1) &&
                 stageAuditorsId.indexOf(accountId) === -1 && changeAuditorsId.indexOf(accountId) === -1 &&

+ 8 - 1
app/service/tender_tourist.js

@@ -7,7 +7,7 @@
  * @date 2021/4/8
  * @version
  */
-
+const touristPermission = require('../const/tourist_permission').defaultPermission;
 module.exports = app => {
 
     class TenderTourist extends app.BaseService {
@@ -60,6 +60,13 @@ module.exports = app => {
                 throw err;
             }
         }
+
+        async getTouristPermission(info) {
+            if (info && info.permission) {
+                return info.permission;
+            }
+            return touristPermission;
+        }
     }
 
     return TenderTourist;

+ 1 - 14
sql/update.sql

@@ -1,14 +1 @@
-CREATE TABLE `calculation`.`zh_rpt_archive_encryption` (
-  `id` INT NOT NULL AUTO_INCREMENT,
-  `prj_id` INT NULL,
-  `stage_id` INT NULL,
-  `content` JSON NULL,
-  PRIMARY KEY (`id`),
-  INDEX `PRJ_STG` (`prj_id` ASC, `stage_id` ASC))
-COMMENT = '归档文档的需要加密签名的坐标及其他key信息(如签名角色id,签名角色名称等)';
-
-ALTER TABLE `zh_material_list` ADD `expr` VARCHAR(500) NULL DEFAULT '' COMMENT '公式' AFTER `quantity`;
-
-ALTER TABLE `zh_s2b_proj`
-ADD COLUMN `gxby_ratio_valid`  tinyint(1) NULL DEFAULT 0 COMMENT '工序报验,ratio是否生效' AFTER `gxby_status`,
-ADD COLUMN `dagl_ratio_valid`  tinyint(1) NOT NULL DEFAULT 1 COMMENT '工序报验,ratio是否生效' AFTER `dagl_status`;
+ALTER TABLE `zh_tender_tourist` ADD `permission` VARCHAR(1000) NULL DEFAULT NULL COMMENT '游客权限JSON格式' AFTER `user_id`;

+ 14 - 0
sql/update20210715.sql

@@ -0,0 +1,14 @@
+CREATE TABLE `calculation`.`zh_rpt_archive_encryption` (
+  `id` INT NOT NULL AUTO_INCREMENT,
+  `prj_id` INT NULL,
+  `stage_id` INT NULL,
+  `content` JSON NULL,
+  PRIMARY KEY (`id`),
+  INDEX `PRJ_STG` (`prj_id` ASC, `stage_id` ASC))
+COMMENT = '归档文档的需要加密签名的坐标及其他key信息(如签名角色id,签名角色名称等)';
+
+ALTER TABLE `zh_material_list` ADD `expr` VARCHAR(500) NULL DEFAULT '' COMMENT '公式' AFTER `quantity`;
+
+ALTER TABLE `zh_s2b_proj`
+ADD COLUMN `gxby_ratio_valid`  tinyint(1) NULL DEFAULT 0 COMMENT '工序报验,ratio是否生效' AFTER `gxby_status`,
+ADD COLUMN `dagl_ratio_valid`  tinyint(1) NOT NULL DEFAULT 1 COMMENT '工序报验,ratio是否生效' AFTER `dagl_status`;