From a49f4888e0bc09f4e03b1d5e12be19eb2ae8636b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 01 九月 2022 18:05:27 +0800
Subject: [PATCH] 2022-09-01

---
 src/menu/components/form/formaction/formconfig.jsx                  |    2 
 src/menu/datasource/verifycard/utils.jsx                            |   28 +++++++++++--
 src/templates/sharecomponent/settingcomponent/settingform/index.jsx |    8 ++++
 src/menu/components/share/actioncomponent/formconfig.jsx            |    2 
 src/router/index.js                                                 |    5 +-
 src/templates/sharecomponent/settingcomponent/settingform/utils.jsx |   29 ++++++++++++--
 src/menu/datasource/verifycard/index.jsx                            |    6 +--
 7 files changed, 62 insertions(+), 18 deletions(-)

diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx
index 0f9e6e7..73b27d1 100644
--- a/src/menu/components/form/formaction/formconfig.jsx
+++ b/src/menu/components/form/formaction/formconfig.jsx
@@ -317,7 +317,7 @@
       key: 'syncComponent',
       label: '鍚屾鍒锋柊',
       initVal: card.syncComponent,
-      tooltip: '鎵ц鎴愬姛鍚庨渶瑕佸埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堛��',
+      tooltip: '鎵ц鎴愬姛鍚庨渶瑕佸埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��',
       required: false,
       options: modules
     },
diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx
index d30ff14..abacec9 100644
--- a/src/menu/components/share/actioncomponent/formconfig.jsx
+++ b/src/menu/components/share/actioncomponent/formconfig.jsx
@@ -693,7 +693,7 @@
       key: 'syncComponent',
       label: '鍒锋柊缁勪欢',
       initVal: card.syncComponent || [],
-      tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堛��',
+      tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��',
       required: false,
       options: modules
     },
diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx
index b34a013..df624b3 100644
--- a/src/menu/datasource/verifycard/index.jsx
+++ b/src/menu/datasource/verifycard/index.jsx
@@ -588,14 +588,12 @@
       let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
       let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, defaultSearch, timestamp)
 
-      if (r.error) {
+      if (r.errors) {
         notification.warning({
           top: 92,
-          message: r.error,
+          message: r.errors,
           duration: 5
         })
-        reject()
-        return
       }
 
       let param = {
diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx
index 23890a5..38cfddf 100644
--- a/src/menu/datasource/verifycard/utils.jsx
+++ b/src/menu/datasource/verifycard/utils.jsx
@@ -40,8 +40,8 @@
     //   error = '绯荤粺鍑芥暟' + _customScript.match(/\$ex@.{1,50}@ex\$/g)[0].replace(/\$ex@|@ex\$/g, '') + '鏈畾涔�'
     // }
 
-    _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`)
-    _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`)
+    _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`)
+    _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`)
 
     _dataresource = _dataresource.replace(/@\$|\$@/ig, '')
     _customScript = _customScript.replace(/@\$|\$@/ig, '')
@@ -170,7 +170,7 @@
           ${_sql}
           aaa:
           if @ErrorCode!=''
-            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
+            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}'
         `
       } else {
         sumSql = `/* sql sum楠岃瘉 */
@@ -198,7 +198,7 @@
         ${_dataresource}
         aaa:
         if @ErrorCode!=''
-          insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
+          insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}'
       `
     } else {
       sql = `/* sql 楠岃瘉 */
@@ -209,12 +209,30 @@
 
     console.info(sql)
 
+    let errors = []
+
+    if (/@[0-9a-zA-Z_]+@/ig.test(sql)) {
+      let arr = sql.match(/@[0-9a-zA-Z_]+@/ig)
+
+      arr.forEach(item => {
+        let reg = new RegExp(item, 'ig')
+        if (reg.test(_dataresource)) {
+          errors.push(`鏁版嵁婧愪腑瀛樺湪鏈浛鎹㈠��${item}`)
+        }
+        scripts && scripts.forEach(script => {
+          if (reg.test(script.sql)) {
+            errors.push(`鑷畾涔夎剼鏈�(${script.$index})瀛樺湪鏈浛鎹㈠��${item}`)
+          }
+        })
+      })
+    }
+
     if (sumSql) {
       sumSql = sumSql.replace(/\n\s{10}/ig, '\n')
 
       console.info(sumSql)
     }
     
-    return { error, sql, sumSql }
+    return { error, sql, sumSql, errors: errors.join('锛�') }
   }
 }
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index a4a55f7..d923557 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -54,10 +54,11 @@
 
 export default class RouteConfig extends Component {
   controlRoute (item, props) {
-    if (!item.auth) {            // 涓嶉渶瑕佹巿鏉冿紝鐩存帴璺宠浆
+    if (!item.auth) { // 涓嶉渶瑕佹巿鏉冿紝鐩存帴璺宠浆
       return (<item.component {...props}/>)
     }
     
+    let userId = sessionStorage.getItem('UserID') // 鍒ゆ柇鐧诲綍淇℃伅鏄惁瀛樺湪锛屾敞鐢ㄦ埛鍙兘淇濆瓨涓婚〉閾炬帴
     let authCode = localStorage.getItem(window.location.href.split('#')[0] + 'AuthCode') // 鍒ゆ柇绯荤粺鏄惁鍦ㄦ巿鏉冩湡闄愬唴
     let _s = md5('mksoft' + moment().format('YYYYMMDD'))
     let isauth = authCode && authCode.includes(_s)
@@ -68,7 +69,7 @@
       isauth = true
     }
 
-    if (isauth) {
+    if (userId && isauth) {
       return (<item.component {...props}/>)
     } else {
       return (<Redirect to={{ pathname: '/login'}}/>)
diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx
index 26f8ae0..eb8577c 100644
--- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx
+++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx
@@ -334,6 +334,14 @@
       param.timestamp = timestamp
       param.secretkey = Utils.encrypt('', timestamp)
 
+      if (r.errors) {
+        notification.warning({
+          top: 92,
+          message: r.errors,
+          duration: 5
+        })
+      }
+
       let sumParam = null
       if (r.sumSql) {
         sumParam = {
diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
index a786dfa..2f6b872 100644
--- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
+++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
@@ -35,8 +35,8 @@
       })
     }
     
-    _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`)
-    _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`)
+    _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`)
+    _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`)
     _dataresource = _dataresource.replace(/@\$|\$@/ig, '')
     _customScript = _customScript.replace(/@\$|\$@/ig, '')
     _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '')
@@ -110,7 +110,7 @@
           ${_sql}
           aaa:
           if @ErrorCode!=''
-            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
+            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}'
         `
       } else {
         sumSql = `/* sql sum楠岃瘉 */
@@ -134,22 +134,41 @@
         ${_dataresource}
         aaa:
         if @ErrorCode!=''
-          insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
+          insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}'
       `
     } else {
       sql = `/* sql 楠岃瘉 */
         declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg =''
         ${_dataresource}`
     }
+
     sql = sql.replace(/\n\s{8}/ig, '\n')
     console.info(sql)
+
+    let errors = []
+
+    if (/@[0-9a-zA-Z_]+@/ig.test(sql)) {
+      let arr = sql.match(/@[0-9a-zA-Z_]+@/ig)
+
+      arr.forEach(item => {
+        let reg = new RegExp(item, 'ig')
+        if (reg.test(_dataresource)) {
+          errors.push(`鏁版嵁婧愪腑瀛樺湪鏈浛鎹㈠��${item}`)
+        }
+        scripts && scripts.forEach(script => {
+          if (reg.test(script.sql)) {
+            errors.push(`鑷畾涔夎剼鏈�(${script.$index})瀛樺湪鏈浛鎹㈠��${item}`)
+          }
+        })
+      })
+    }
 
     if (sumSql) {
       sumSql = sumSql.replace(/\n\s{10}/ig, '\n')
       console.info(sumSql)
     }
 
-    return { sql, sumSql }
+    return { sql, sumSql, errors: errors.join('锛�') }
   }
 
   /**

--
Gitblit v1.8.0