Browse Source

用户证书名及类型补齐

ellisran 7 months ago
parent
commit
8f3f743335
2 changed files with 17 additions and 0 deletions
  1. 12 0
      app/service/account_cert.js
  2. 5 0
      sql/update.sql

+ 12 - 0
app/service/account_cert.js

@@ -47,8 +47,20 @@ module.exports = app => {
             // 判断key是否在常量里,并转换为对应的值
             if (!this._.includes(profileConst.cert.postCertConst, data.key)) throw '参数有误';
             updateData[data.key] = data.value ? data.value : null;
+            if (data.key === 'type') {
+                const cert_type = this._.find(profileConst.cert.certType, { value: data.value });
+                updateData.cert_type = cert_type ? cert_type.name : '';
+            } else if (data.key === 'name') {
+                const cert_name = this._.find(profileConst.cert.certReg, { value: data.value }) || this._.find(profileConst.cert.certQual, { value: data.value });
+                updateData.cert_name = cert_name ? cert_name.name : '';
+            }
             if (data.other && this._.includes(profileConst.cert.postCertConst, data.other.key)) {
                 updateData[data.other.key] = data.other.value ? data.other.value : null;
+                if (data.other.key === 'name') {
+                    console.log(data.other.value);
+                    const cert_name = this._.find(profileConst.cert.certReg, { value: data.other.value }) || this._.find(profileConst.cert.certQual, { value: data.other.value });
+                    updateData.cert_name = cert_name ? cert_name.name : '';
+                }
             }
             return await this.db.update(this.tableName, updateData);
         }

+ 5 - 0
sql/update.sql

@@ -363,6 +363,11 @@ CREATE TABLE `zh_financial_transfer_tender_attachment` (
   KEY `idx_trid` (`trid`) USING BTREE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='资金划拨文件表';
 
+
+ALTER TABLE `zh_account_cert`
+ADD COLUMN `cert_type` varchar(255) NULL DEFAULT '' COMMENT '证书分类字符' AFTER `type`,
+ADD COLUMN `cert_name` varchar(255) NULL DEFAULT '' COMMENT '证书名称字符' AFTER `name`;
+
 -- update请放在最后
 
 Update zh_filing_template SET is_fixed = 1 WHERE tree_level = 1;