github-advanced-security[bot] commented on code in PR #697:
URL: https://github.com/apache/dubbo-go-pixiu/pull/697#discussion_r2217538999


##########
admin/web/src/utils/fetch.js:
##########
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import axios from 'axios'
+import {Message} from 'element-ui'
+import {getToken, getLocalStorage, setLocalStorage} from '@/utils/auth'
+import store from '@/store/store.js'
+import * as dlgUtils from '../utils/dialogUtils'
+import Vue from 'vue'
+import ElementUI from 'element-ui'
+const SUCCESS_CODE = 200;
+import wsConsts from '@/utils/wsConsts'
+
+// 创建axios实例
+const service = axios.create({
+    baseURL: "/config", // api的base_url
+    dataType:"json",
+    headers: {"Content-Type": "multipart/form-data; 
boundary=----WebKitFormBoundaryn8D9asOnAnEU4Js0" },
+    timeout: 5000 // 请求超时时间
+})
+
+
+// request拦截器
+service.interceptors.request.use(config => {
+    console.log(store.getters)
+    let tk = getLocalStorage('operatorInfo').token
+    if (tk && tk != '') {
+        config.headers.token = tk;
+        config.headers.username = getLocalStorage('operatorInfo').username;
+    }
+
+
+    // if (config.method.toLowerCase() !== 'get' && 
Object.keys(config.data).length > 0) {
+    //     let body = {};
+    //     let data = {};
+
+    //     for (let key in config.data) {
+    //         if (key != 'method') {
+    //             body[key] = config.data[key];
+    //         }
+    //     }
+    //     data = body
+    //     // if (getToken()) {
+    //     //     data.ticket = getToken() || '';
+    //     // }
+
+    //     config.data = JSON.stringify(data)
+    // }
+
+    return config
+}, error => {
+    console.log(error) // for debug
+    Promise.reject(error)
+})
+Vue.prototype.$http = service
+
+Vue.prototype.$post = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.post(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$put = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.put(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$delete = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.delete(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+
+Vue.prototype.$get = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.get(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+
+    })
+  })
+}
+// respone拦截器
+service.interceptors.response.use(response => {
+    if (!response.data) {
+        return Promise.reject({code: "", message: '网络异常'});
+    }
+    const res = response.data;
+    console.log(res)
+    if (!res.hasOwnProperty('code')) {
+        return res;
+    }
+
+    let expireTime = getLocalStorage('expireTime');
+    if(res.code == 503){
+        console.log(res)
+        dlgUtils.loginTimeout()
+        return Promise.reject({code: res.code, message: res.data})
+    }else{
+        setLocalStorage('expireTime', new Date().getTime() + 1000*60*60*24*7)
+        return res;
+    }
+
+    return Promise.reject({code: res.code, message: res.msg})

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgTIGTjcNxZo45c-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgTIGTjcNxZo45c&open=AZgRXGgTIGTjcNxZo45c&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/252)



##########
admin/web/src/views/dashboard/personInfo/index.vue:
##########
@@ -0,0 +1,191 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<template>
+  <div class="app-container">
+    <el-row :gutter="20">
+      <el-col :span="6" :xs="24">
+        <el-card class="box-card">
+          <div slot="header" class="clearfix">
+            <span>个人信息</span>
+          </div>
+          <div>
+            <div class="text-center">
+              <userAvatar :user="user" />
+            </div>
+            <ul class="list-group list-group-striped">
+              <li class="list-group-item">
+                用户名称
+                <div class="pull-right">{{ userInfo.username }}</div>
+              </li>
+              <li class="list-group-item">
+                用户ID
+                <div class="pull-right">{{ userInfo.userId }}</div>
+              </li>
+              <!-- <li class="list-group-item">
+                手机号码
+                <div class="pull-right">{{ operatorInfo.phone }}</div>
+              </li>
+              <li class="list-group-item">
+                用户邮箱
+                <div class="pull-right">{{ operatorInfo.email }}</div>
+              </li>
+              <li class="list-group-item">
+                所属部门
+                <div class="pull-right" v-if="operatorInfo.branch_name">{{ 
operatorInfo.branch_name }} </div>
+              </li> -->
+              <li class="list-group-item">
+                所属角色
+                <div class="pull-right">{{userInfo.role == 1 ? 'admin' : 
'admin'}}</div> 
+              </li>
+              <!-- <li class="list-group-item">
+                <svg-icon icon-class="date" />创建日期
+                <div class="pull-right">{{ user.createTime }}</div>
+              </li> -->
+            </ul>
+          </div>
+        </el-card>
+      </el-col>
+      <el-col :span="18" :xs="24">
+        <el-card>
+          <div slot="header" class="clearfix">
+            <span>基本资料</span>
+          </div>
+          <el-tabs v-model="activeTab" :before-leave="beforeLeave">
+            <el-tab-pane label="修改密码" name="userinfo">
+              <userInfo :user="user" />
+            </el-tab-pane>
+            <!-- <el-tab-pane label="修改密码" name="resetPwd">
+              <resetPwd :user="user" />
+            </el-tab-pane> -->
+          </el-tabs>
+        </el-card>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import userAvatar from "./userAvatar";
+import userInfo from "./userInfo";
+import resetPwd from "./resetPwd";
+import {mapGetters, mapActions} from 'vuex'
+import api from '@/api'
+import { getToken, setToken, removeToken, getLocalStorage, 
setLocalStorage,clearLocalStorage } from '@/utils/auth'
+import fetch from '@/utils/tafetch';
+export default {
+  name: "Profile",
+  components: { userAvatar, userInfo, resetPwd },
+  data() {
+    return {
+      user: {},
+      roleGroup: {},
+      postGroup: {},
+      activeTab: "userinfo",
+      roleMap:new Map([
+          [1, "本部"],
+          [2, "片区"],
+          [3, "网点"],
+      ]),
+      role:'',
+      userInfo:{}
+    };
+  },
+    computed: {
+        ...mapGetters([
+            'operatorInfo'
+        ])
+    },
+    watch:{
+      
+    },
+  created() {
+    this.getUser();
+    const role = this.operatorInfo.department
+    this.role = this.roleMap.get(role)
+  },
+  methods: {
+    getUser() {
+      let formData = new FormData();

Review Comment:
   ## Unused assignments should be removed
   
   <!--SONAR_ISSUE_KEY:AZgRXGg8IGTjcNxZo46s-->Remove this useless assignment to 
variable "formData". <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGg8IGTjcNxZo46s&open=AZgRXGg8IGTjcNxZo46s&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/237)



##########
admin/web/src/utils/utils.js:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 一些工具类的集合
+ */
+
+//dataURL to blob,
+export function dataUrlToBlob(dataURI){
+  let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // mime类型
+  let byteString = atob(dataURI.split(',')[1]); //base64 解码
+
+  let arrayBuffer = new ArrayBuffer(byteString.length); //创建缓冲数组
+  let intArray = new Uint8Array(arrayBuffer); //创建视图
+
+  for (let i = 0; i < byteString.length; i++) {
+    intArray[i] = byteString.charCodeAt(i);
+  }
+  return new Blob([intArray], {type: mimeString});
+}
+
+export  function format(time, format){
+  var t = new Date(time);
+  var tf = function(i){return (i < 10 ? '0' : '') + i};
+  return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
+    switch(a){
+      case 'yyyy':
+        return tf(t.getFullYear());
+        break;
+      case 'MM':
+        return tf(t.getMonth() + 1);
+        break;
+      case 'mm':
+        return tf(t.getMinutes());
+        break;

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgEIGTjcNxZo447-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgEIGTjcNxZo447&open=AZgRXGgEIGTjcNxZo447&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/243)



##########
admin/web/src/utils/socket.js:
##########
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* jshint esversion:6 */
+class socket {
+    constructor(params) {
+        this._params = params
+        this.init()
+    }
+
+    /* 初始化 */
+    init() {
+        // 重中之重,不然重连的时候会越来越快
+        clearInterval(this._reconnect_timer)
+        clearInterval(this._heart_timer)
+
+        // 取出所有参数
+        const params = this._params
+            // 设置连接路径
+        const {
+            url,
+            port
+        } = params
+        const global_params = ['heartBeat', 'heartMsg', 'reconnect', 
'reconnectTime', 'reconnectTimes']
+
+        // 定义全局变量
+        Object.keys(params).forEach(key => {
+            if (global_params.indexOf(key) !== -1) {
+                this[key] = params[key]
+            }
+        })
+
+        const ws_url = port ? url + ':' + port : url
+
+        this._ws = new WebSocket(ws_url)
+
+        // 默认绑定事件
+        this._ws.onopen = () => {
+            // 设置状态为开启
+            this._alive = true
+            clearInterval(this._reconnect_timer)
+                // 连接后进入心跳状态
+                //this.onheartbeat()
+        }
+
+        this._ws.onclose = () => {
+            // 设置状态为断开
+            this._alive = false
+
+            clearInterval(this._heart_timer)
+
+            // 自动重连开启  +  不在重连状态下
+            if (this.reconnect === true) {
+                /* 断开后立刻重连 */
+                this.onreconnect()
+            }
+        }
+    }
+
+    /* 心跳事件 */
+    onheartbeat(func) {
+        // 在连接状态下
+        setTimeout(() => {
+            if (this._alive === true) {
+                if (!this.first === true) {
+                    this.first = true
+                        /* 心跳计时器 */
+                    this._heart_timer = setInterval(() => {
+                        // 发送心跳信息
+                        
this.send('{"bissnessType":"doSale","chargeWay":"03","data":"{amount:1}"}')
+                        func ? func(this) : false

Review Comment:
   ## Non-empty statements should change control flow or have at least one 
side-effect
   
   <!--SONAR_ISSUE_KEY:AZgRXGgHIGTjcNxZo45B-->Expected an assignment or 
function call and instead saw an expression. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgHIGTjcNxZo45B&open=AZgRXGgHIGTjcNxZo45B&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/246)



##########
admin/web/src/utils/fetch.js:
##########
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import axios from 'axios'
+import {Message} from 'element-ui'
+import {getToken, getLocalStorage, setLocalStorage} from '@/utils/auth'
+import store from '@/store/store.js'
+import * as dlgUtils from '../utils/dialogUtils'
+import Vue from 'vue'
+import ElementUI from 'element-ui'
+const SUCCESS_CODE = 200;
+import wsConsts from '@/utils/wsConsts'
+
+// 创建axios实例
+const service = axios.create({
+    baseURL: "/config", // api的base_url
+    dataType:"json",
+    headers: {"Content-Type": "multipart/form-data; 
boundary=----WebKitFormBoundaryn8D9asOnAnEU4Js0" },
+    timeout: 5000 // 请求超时时间
+})
+
+
+// request拦截器
+service.interceptors.request.use(config => {
+    console.log(store.getters)
+    let tk = getLocalStorage('operatorInfo').token
+    if (tk && tk != '') {
+        config.headers.token = tk;
+        config.headers.username = getLocalStorage('operatorInfo').username;
+    }
+
+
+    // if (config.method.toLowerCase() !== 'get' && 
Object.keys(config.data).length > 0) {
+    //     let body = {};
+    //     let data = {};
+
+    //     for (let key in config.data) {
+    //         if (key != 'method') {
+    //             body[key] = config.data[key];
+    //         }
+    //     }
+    //     data = body
+    //     // if (getToken()) {
+    //     //     data.ticket = getToken() || '';
+    //     // }
+
+    //     config.data = JSON.stringify(data)
+    // }
+
+    return config
+}, error => {
+    console.log(error) // for debug
+    Promise.reject(error)
+})
+Vue.prototype.$http = service
+
+Vue.prototype.$post = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.post(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$put = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.put(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$delete = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.delete(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+
+Vue.prototype.$get = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.get(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+
+    })
+  })
+}
+// respone拦截器
+service.interceptors.response.use(response => {
+    if (!response.data) {
+        return Promise.reject({code: "", message: '网络异常'});
+    }
+    const res = response.data;
+    console.log(res)
+    if (!res.hasOwnProperty('code')) {
+        return res;
+    }
+
+    let expireTime = getLocalStorage('expireTime');

Review Comment:
   ## Unused assignments should be removed
   
   <!--SONAR_ISSUE_KEY:AZgRXGgTIGTjcNxZo45b-->Remove this useless assignment to 
variable "expireTime". <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgTIGTjcNxZo45b&open=AZgRXGgTIGTjcNxZo45b&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/251)



##########
admin/web/src/components/common/CustomLayout.vue:
##########
@@ -0,0 +1,246 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<template>
+  <div class="page">
+    <div class="page-head" v-if="fromType">
+      <div class="page-head__title">
+        <span v-if="!subTitle">{{ title }}</span>
+        <el-breadcrumb separator="/" v-else>
+          <el-breadcrumb-item>
+            <div @click="goBack" class="previous-route">
+              {{ title && title.length > 4 ? `${title.substring(0, 4)}...` : 
title }}
+            </div>
+          </el-breadcrumb-item>
+          <el-breadcrumb-item> {{ subTitle }}</el-breadcrumb-item>
+          <el-breadcrumb-item v-if="thirdTitle">{{
+            thirdTitle
+          }}</el-breadcrumb-item>
+        </el-breadcrumb>
+      </div>
+      <div class="page-head__toolbox">
+        <slot name="toolbox"></slot>
+      </div>
+    </div>
+    <el-scrollbar class="page-content" :class="{ 
'page-content--have-fixed-bottom': fixedBottom,
+      'page-content--fromType' : !fromType }">
+      <slot></slot>
+      <!-- <div class="page-logo"></div> -->
+    </el-scrollbar>
+  </div>
+</template>
+
+<script>
+import { getLocationSearchObj } from '@/utils/common.js'
+
+export default {
+  namne: 'CustomLayout',
+  props: {
+    title: String,
+    subTitle: String,
+    thirdTitle: String,
+    fixedBottom: Boolean
+  },
+  data () {
+    return {
+      fromType: false
+    }
+  },
+  methods: {
+    init() {
+      let params = getLocationSearchObj()

Review Comment:
   ## Unused assignments should be removed
   
   <!--SONAR_ISSUE_KEY:AZgRXGf1IGTjcNxZo44b-->Remove this useless assignment to 
variable "params". <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGf1IGTjcNxZo44b&open=AZgRXGf1IGTjcNxZo44b&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/234)



##########
admin/web/src/utils/socket.js:
##########
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* jshint esversion:6 */
+class socket {
+    constructor(params) {
+        this._params = params
+        this.init()
+    }
+
+    /* 初始化 */
+    init() {
+        // 重中之重,不然重连的时候会越来越快
+        clearInterval(this._reconnect_timer)
+        clearInterval(this._heart_timer)
+
+        // 取出所有参数
+        const params = this._params
+            // 设置连接路径
+        const {
+            url,
+            port
+        } = params
+        const global_params = ['heartBeat', 'heartMsg', 'reconnect', 
'reconnectTime', 'reconnectTimes']
+
+        // 定义全局变量
+        Object.keys(params).forEach(key => {
+            if (global_params.indexOf(key) !== -1) {
+                this[key] = params[key]
+            }
+        })
+
+        const ws_url = port ? url + ':' + port : url
+
+        this._ws = new WebSocket(ws_url)
+
+        // 默认绑定事件
+        this._ws.onopen = () => {
+            // 设置状态为开启
+            this._alive = true
+            clearInterval(this._reconnect_timer)
+                // 连接后进入心跳状态
+                //this.onheartbeat()
+        }
+
+        this._ws.onclose = () => {
+            // 设置状态为断开
+            this._alive = false
+
+            clearInterval(this._heart_timer)
+
+            // 自动重连开启  +  不在重连状态下
+            if (this.reconnect === true) {
+                /* 断开后立刻重连 */
+                this.onreconnect()
+            }
+        }
+    }
+
+    /* 心跳事件 */
+    onheartbeat(func) {
+        // 在连接状态下
+        setTimeout(() => {
+            if (this._alive === true) {
+                if (!this.first === true) {
+                    this.first = true
+                        /* 心跳计时器 */
+                    this._heart_timer = setInterval(() => {
+                        // 发送心跳信息
+                        
this.send('{"bissnessType":"doSale","chargeWay":"03","data":"{amount:1}"}')
+                        func ? func(this) : false
+                    }, this.heartBeat)
+                }
+            }
+        }, 500)
+    }
+
+    /* 重连事件 */
+    onreconnect(func) {
+        /* 重连间隔计时器 */
+        this._reconnect_timer = setInterval(() => {
+            // 限制重连次数
+            if (this.reconnectTimes <= 0) {
+                // 关闭定时器
+                // this._isReconnect = false
+                clearInterval(this._reconnect_timer)
+                    // 跳出函数之间的循环
+                return
+            } else {
+                // 重连一次-1
+                this.reconnectTimes--
+            }
+            // 进入初始状态
+            this.init()
+            func ? func(this) : false
+        }, this.reconnectTime)
+    }
+
+    // 发送消息
+    send(text) {
+        if (text === 'undefined') return
+        if (this._alive === true) {
+            text = typeof text === 'string' ? text : JSON.stringify(text)
+            this._ws.send(text)
+        }
+    }
+
+    /**断开连接 */
+    close() {
+        if (this._alive === true) {
+            // 关闭自动连接
+            this.reconnect = false
+            this._ws.close()
+        }
+    }
+
+    /**接受消息 */
+    onmessage(func, all = false) {
+        this._ws.onmessage = data => func(!all ? data.data : data)
+    }
+
+    /**websocket连接成功事件 */
+    onopen(func) {
+            this._ws.onopen = event => {
+                this._alive = true
+                func ? func(event) : false
+            }
+        }
+        /**websocket关闭事件 */
+    onclose(func) {
+            this._ws.onclose = event => {
+                // 设置状态为断开
+                this._alive = false
+
+                clearInterval(this._heart_timer)
+
+                // 自动重连开启  +  不在重连状态下
+                if (this.reconnect === true) {
+                    /* 断开后立刻重连 */
+                    this.onreconnect()
+                }
+                func ? func(event) : false
+            }
+        }
+        /**websocket错误事件 */
+    onerror(func) {
+        this._ws.onerror = event => {
+            func ? func(event) : false

Review Comment:
   ## Non-empty statements should change control flow or have at least one 
side-effect
   
   <!--SONAR_ISSUE_KEY:AZgRXGgHIGTjcNxZo45G-->Expected an assignment or 
function call and instead saw an expression. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgHIGTjcNxZo45G&open=AZgRXGgHIGTjcNxZo45G&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/250)



##########
admin/web/src/utils/cofetch.js:
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import axios from 'axios'
+import {Message} from 'element-ui'
+import {getToken, getLocalStorage, setLocalStorage} from '@/utils/auth'
+import store from '@/store/store.js'
+import * as dlgUtils from './dialogUtils'
+import Vue from 'vue'
+import ElementUI from 'element-ui'
+const SUCCESS_CODE = 200;
+import wsConsts from '@/utils/wsConsts'
+
+// 创建axios实例
+const service = axios.create({
+    baseURL: "/login", // api的base_url
+    dataType:"json",
+    headers: {"Content-Type": "multipart/form-data; 
boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" },
+    timeout: 5000 // 请求超时时间
+})
+
+
+// request拦截器
+service.interceptors.request.use(config => {
+    // console.log(store.getters)
+    // if (store.getters.token) {
+    //     config.headers.token = getToken();
+    // }
+
+
+    // if (config.method.toLowerCase() !== 'get' && 
Object.keys(config.data).length > 0) {
+    //     let body = {};
+    //     let data = {};
+
+    //     for (let key in config.data) {
+    //         if (key != 'method') {
+    //             body[key] = config.data[key];
+    //         }
+    //     }
+    //     data = body
+    //     // if (getToken()) {
+    //     //     data.ticket = getToken() || '';
+    //     // }
+
+    //     config.data = JSON.stringify(data)
+    // }
+
+    return config
+}, error => {
+    console.log(error) // for debug
+    Promise.reject(error)
+})
+Vue.prototype.$http = service
+
+Vue.prototype.$post = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.post(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$put = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.put(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$delete = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.delete(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+
+Vue.prototype.$get = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.get(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+
+    })
+  })
+}
+// respone拦截器
+service.interceptors.response.use(response => {
+    if (!response.data) {
+        return Promise.reject({code: "", message: '网络异常'});
+    }
+    const res = response.data;
+    console.log(res)
+    if (!res.hasOwnProperty('code')) {
+        return res;
+    }
+
+    let expireTime = getLocalStorage('expireTime');

Review Comment:
   ## Unused assignments should be removed
   
   <!--SONAR_ISSUE_KEY:AZgRXGgBIGTjcNxZo441-->Remove this useless assignment to 
variable "expireTime". <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgBIGTjcNxZo441&open=AZgRXGgBIGTjcNxZo441&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/238)



##########
admin/web/src/utils/socket.js:
##########
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* jshint esversion:6 */
+class socket {
+    constructor(params) {
+        this._params = params
+        this.init()
+    }
+
+    /* 初始化 */
+    init() {
+        // 重中之重,不然重连的时候会越来越快
+        clearInterval(this._reconnect_timer)
+        clearInterval(this._heart_timer)
+
+        // 取出所有参数
+        const params = this._params
+            // 设置连接路径
+        const {
+            url,
+            port
+        } = params
+        const global_params = ['heartBeat', 'heartMsg', 'reconnect', 
'reconnectTime', 'reconnectTimes']
+
+        // 定义全局变量
+        Object.keys(params).forEach(key => {
+            if (global_params.indexOf(key) !== -1) {
+                this[key] = params[key]
+            }
+        })
+
+        const ws_url = port ? url + ':' + port : url
+
+        this._ws = new WebSocket(ws_url)
+
+        // 默认绑定事件
+        this._ws.onopen = () => {
+            // 设置状态为开启
+            this._alive = true
+            clearInterval(this._reconnect_timer)
+                // 连接后进入心跳状态
+                //this.onheartbeat()
+        }
+
+        this._ws.onclose = () => {
+            // 设置状态为断开
+            this._alive = false
+
+            clearInterval(this._heart_timer)
+
+            // 自动重连开启  +  不在重连状态下
+            if (this.reconnect === true) {
+                /* 断开后立刻重连 */
+                this.onreconnect()
+            }
+        }
+    }
+
+    /* 心跳事件 */
+    onheartbeat(func) {
+        // 在连接状态下
+        setTimeout(() => {
+            if (this._alive === true) {
+                if (!this.first === true) {
+                    this.first = true
+                        /* 心跳计时器 */
+                    this._heart_timer = setInterval(() => {
+                        // 发送心跳信息
+                        
this.send('{"bissnessType":"doSale","chargeWay":"03","data":"{amount:1}"}')
+                        func ? func(this) : false
+                    }, this.heartBeat)
+                }
+            }
+        }, 500)
+    }
+
+    /* 重连事件 */
+    onreconnect(func) {
+        /* 重连间隔计时器 */
+        this._reconnect_timer = setInterval(() => {
+            // 限制重连次数
+            if (this.reconnectTimes <= 0) {
+                // 关闭定时器
+                // this._isReconnect = false
+                clearInterval(this._reconnect_timer)
+                    // 跳出函数之间的循环
+                return
+            } else {
+                // 重连一次-1
+                this.reconnectTimes--
+            }
+            // 进入初始状态
+            this.init()
+            func ? func(this) : false

Review Comment:
   ## Non-empty statements should change control flow or have at least one 
side-effect
   
   <!--SONAR_ISSUE_KEY:AZgRXGgHIGTjcNxZo45D-->Expected an assignment or 
function call and instead saw an expression. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgHIGTjcNxZo45D&open=AZgRXGgHIGTjcNxZo45D&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/247)



##########
admin/web/src/components/CustomMenu.vue:
##########
@@ -0,0 +1,280 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<template>
+  <div class="custom-menu" v-if="fromType">
+    <!-- <div class="menu-title">内容管理</div>
+    <div class="menu-search">
+      <el-input
+        placeholder="搜索"
+        v-model="keyWord">
+        <i slot="suffix" class="el-input__icon el-icon-search"></i>
+      </el-input>
+      <div class="menu-search-container" v-show="searchBox">
+        <div class="menu-search-item" v-for="item in searchList"
+         :key="item.id" 
@click="handleSearchMenuClick(item)">{{item.title}}</div>
+        <div class="menu-search--empty" v-show="searchList.length == 
0">暂无数据</div>
+      </div>
+    </div> -->
+    <el-menu
+      :default-active="defaultActive"
+      class="custom-menu-container"
+      @open="handleOpen"
+      @close="handleClose">
+      <div v-for="(item, index) in menuList" :key="index">
+        <el-submenu v-if="item.children.length >= 0" :index="item.id">
+          <template slot="title">{{item.name}}</template>
+          <el-menu-item :index="String(child.id)" 
@click="handleMenuClick(child)"
+            :data-index="child.id"
+            v-for="(child, childIdx) in item.children"
+            :key="childIdx">{{child.name}}</el-menu-item>
+        </el-submenu>
+        <!-- <el-menu-item v-if="item.children.length === 0"
+          :index="item.index"
+          :data-index="item.index"
+          @click="handleMenuClick(item)">{{item.title}}</el-menu-item> -->
+      </div>
+    </el-menu>
+  </div>
+</template>
+
+<script>
+import {getLocationSearchObj} from '@/utils/common.js'
+import {mapMutations, mapGetters} from 'vuex'
+import {clearLocalStorage} from '@/utils/auth.js'
+const debounce = require('lodash/debounce')
+import {menuList} from '@/api/menu-config.js'
+export default {
+  name: 'CustomMenu',
+  data () {
+    return {
+      defaultActive: '', // active menu
+      menuList: menuList, // menu list
+      searchList: [], // search list
+      keyWord: '', // keyword
+      searchBox: false, // search area
+      fromType: true, // true: 显示原有内容, false:隐藏部分内容 
是否嵌入到其他项目中,需要对应隐藏部分内容(菜单,header)
+    }
+  },
+  watch: {
+    keyWord (val) {
+      if (val !== '' && val !== undefined) {
+        this.searchBox = true
+        this.handleSearch()
+      } else {
+        this.searchBox = false
+      }
+    }
+  },
+  methods: {
+    ...mapMutations(['setOrgId', 'setCurrentMenu']),
+    // clear page cache
+    clearPagination () {
+      clearLocalStorage('picTxtIdx')
+      clearLocalStorage('picTxtSize')
+    },
+    // 搜索过滤菜单内容
+    handleSearch: debounce(function () {
+      this.$get('/menu/search', {
+        keyWord: this.keyWord
+      }).then(res => {
+        if (res.code === 200) {
+          this.searchList = res.data
+        }
+      }).catch(err => {
+        console.log(err)
+      })
+    }, 200),
+    handleScrollPosition () {
+      let el = document.querySelector('.custom-menu-container')
+      let top = el.scrollTop
+      let current = 
document.querySelector(`[data-index=${this.defaultActive}]`)
+      let y = current.getBoundingClientRect().y
+      top = top + y - 60 - 56
+      el.scrollTop = top
+    },
+    handleSearchMenuClick (item) {
+      this.keyWord = ''
+      this.searchBox = false
+      this.searchList = []
+      this.handleMenuClick(item)
+      this.defaultActive = item.index
+      setTimeout(() => {
+        this.handleScrollPosition()
+      }, 300)
+    },
+    switchRouter (item) {
+      this.clearPagination()
+      this.$router.push({
+        path: item.componentName,
+        query: {
+          id: new Date().getTime()
+        }
+      })
+      let el = document.querySelector('.page-content .el-scrollbar__wrap')
+      if (el) {
+        el.scrollTop = 0
+      }
+    },
+    handleMenuClick (item) {
+      this.switchRouter(item)
+    },
+    handleOpen(key, keyPath) {
+      // console.log(key, keyPath)
+    },
+    handleClose(key, keyPath) {
+      // console.log(key, keyPath)
+    },
+    initMenu () {
+      // 0: default load method
+      // 1: external tool open
+      // 2: new window open
+      // 3: cover current window open
+      // 4: cloud listen backend content embed
+      // 5: notice not open
+      // 6: application router jump
+      console.log(this.menuList)
+      let findShow = this.menuList.find(item => item.children.length>0)
+      if(findShow){
+        this.initDefaultActive()
+      }else{
+        // this.$router.push({
+        //   path:'/403'
+        // })
+      }
+      return;
+      // var type = current.openType
+      this.$get('/menu/getMenuList').then(res => {
+        if (res.code === 200 && res.data && res.data.length > 0) {
+          this.menuList = res.data
+          let findShow = this.menuList.find(item => item.children.length>0)
+          if(findShow){
+            this.initDefaultActive()
+          }else{
+            this.$router.push({
+              path:'/403'
+            })
+          }
+
+        } else {
+          this.$router.push({
+            path:'/403'
+          })
+          // this.$message.error(res.msg)
+        }
+      }).catch(err => {
+        console.log(err)
+      })

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGf5IGTjcNxZo44f-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGf5IGTjcNxZo44f&open=AZgRXGf5IGTjcNxZo44f&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/235)



##########
admin/web/src/views/dashboard/manage/index.vue:
##########
@@ -0,0 +1,195 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<template>
+  <div class="manage">
+    <div class="manage-head hd_bar">
+        <div class="manage-head__name">Dubbo Go Pixiu</div>
+        <div class="right-menu el-menu-demo">
+            <el-dropdown class="avatar-container right-menu-item hover-effect" 
trigger="click">
+                <div class="avatar-wrapper">
+                    <div class="name">{{operatorInfo.username}}</div>
+                <!-- <img :src="avatar" class="user-avatar"> -->
+                <i class="el-icon-caret-bottom" />
+                </div>
+                <el-dropdown-menu slot="dropdown">
+                    <el-dropdown-item>
+                        <span>你好 - {{operatorInfo.username}}</span>
+                    </el-dropdown-item>
+                    <!-- <el-dropdown-item divided 
@click.native="handleOnOpen">
+                        <span>发行系统</span>
+                    </el-dropdown-item> -->
+                    <el-dropdown-item divided @click.native="handlePersonInfo">
+                        <span>个人中心</span>
+                    </el-dropdown-item>
+                    <el-dropdown-item divided @click.native="handleOnLogOut">
+                        <span>退出登录</span>
+                    </el-dropdown-item>
+                </el-dropdown-menu>
+            </el-dropdown>
+        </div>
+    </div>
+    <div class="manage-foot">
+        <div class="menu-container" :class="{'menu-container--hide': 
!fromType}">
+            <custom-menu></custom-menu>
+        </div>
+        <div class="lyt-container">
+            <router-view></router-view>
+        </div>
+    </div>
+    
+  </div>
+</template>
+
+<script>
+import CustomMenu from '@/components/CustomMenu.vue'
+import { getLocationSearchObj } from '@/utils/common.js'
+import { getToken, setToken, removeToken, getLocalStorage, 
setLocalStorage,clearLocalStorage } from '@/utils/auth'
+import {mapGetters, mapActions} from 'vuex'
+export default {
+  name: 'Manage',
+  data() {
+    return {
+      fromType: true,
+      operatorInfo:{}
+    }
+  },
+  components: {
+    CustomMenu
+  },
+  computed: {
+      // ...mapGetters([
+      //     'operatorInfo'
+      // ])
+  },
+  methods: {
+    ...mapActions([
+        'FedLogOut',
+    ]),
+    init() {
+      this.operatorInfo = getLocalStorage('operatorInfo')
+      let params = getLocationSearchObj()
+      this.fromType = params.from == 1 ? false : true // 判断是否隐藏左侧菜单 true是不隐藏 
false的隐藏
+    },
+    handlePersonInfo() {
+        this.$router.push({
+            path:'/personInfo'
+        })
+    },
+    handleOnLogOut() {
+        console.log(1);
+        this.FedLogOut().then(res => {
+            this.$router.push({path: '/login'});
+        });
+    },
+    handleOnOpen() {
+        let port = '30026';

Review Comment:
   ## Unused assignments should be removed
   
   <!--SONAR_ISSUE_KEY:AZgRXGg0IGTjcNxZo46Z-->Remove this useless assignment to 
variable "port". <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGg0IGTjcNxZo46Z&open=AZgRXGg0IGTjcNxZo46Z&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/236)



##########
admin/web/src/utils/socket.js:
##########
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* jshint esversion:6 */
+class socket {
+    constructor(params) {
+        this._params = params
+        this.init()
+    }
+
+    /* 初始化 */
+    init() {
+        // 重中之重,不然重连的时候会越来越快
+        clearInterval(this._reconnect_timer)
+        clearInterval(this._heart_timer)
+
+        // 取出所有参数
+        const params = this._params
+            // 设置连接路径
+        const {
+            url,
+            port
+        } = params
+        const global_params = ['heartBeat', 'heartMsg', 'reconnect', 
'reconnectTime', 'reconnectTimes']
+
+        // 定义全局变量
+        Object.keys(params).forEach(key => {
+            if (global_params.indexOf(key) !== -1) {
+                this[key] = params[key]
+            }
+        })
+
+        const ws_url = port ? url + ':' + port : url
+
+        this._ws = new WebSocket(ws_url)
+
+        // 默认绑定事件
+        this._ws.onopen = () => {
+            // 设置状态为开启
+            this._alive = true
+            clearInterval(this._reconnect_timer)
+                // 连接后进入心跳状态
+                //this.onheartbeat()
+        }
+
+        this._ws.onclose = () => {
+            // 设置状态为断开
+            this._alive = false
+
+            clearInterval(this._heart_timer)
+
+            // 自动重连开启  +  不在重连状态下
+            if (this.reconnect === true) {
+                /* 断开后立刻重连 */
+                this.onreconnect()
+            }
+        }
+    }
+
+    /* 心跳事件 */
+    onheartbeat(func) {
+        // 在连接状态下
+        setTimeout(() => {
+            if (this._alive === true) {
+                if (!this.first === true) {
+                    this.first = true
+                        /* 心跳计时器 */
+                    this._heart_timer = setInterval(() => {
+                        // 发送心跳信息
+                        
this.send('{"bissnessType":"doSale","chargeWay":"03","data":"{amount:1}"}')
+                        func ? func(this) : false
+                    }, this.heartBeat)
+                }
+            }
+        }, 500)
+    }
+
+    /* 重连事件 */
+    onreconnect(func) {
+        /* 重连间隔计时器 */
+        this._reconnect_timer = setInterval(() => {
+            // 限制重连次数
+            if (this.reconnectTimes <= 0) {
+                // 关闭定时器
+                // this._isReconnect = false
+                clearInterval(this._reconnect_timer)
+                    // 跳出函数之间的循环
+                return
+            } else {
+                // 重连一次-1
+                this.reconnectTimes--
+            }
+            // 进入初始状态
+            this.init()
+            func ? func(this) : false
+        }, this.reconnectTime)
+    }
+
+    // 发送消息
+    send(text) {
+        if (text === 'undefined') return
+        if (this._alive === true) {
+            text = typeof text === 'string' ? text : JSON.stringify(text)
+            this._ws.send(text)
+        }
+    }
+
+    /**断开连接 */
+    close() {
+        if (this._alive === true) {
+            // 关闭自动连接
+            this.reconnect = false
+            this._ws.close()
+        }
+    }
+
+    /**接受消息 */
+    onmessage(func, all = false) {
+        this._ws.onmessage = data => func(!all ? data.data : data)
+    }
+
+    /**websocket连接成功事件 */
+    onopen(func) {
+            this._ws.onopen = event => {
+                this._alive = true
+                func ? func(event) : false
+            }
+        }
+        /**websocket关闭事件 */
+    onclose(func) {
+            this._ws.onclose = event => {
+                // 设置状态为断开
+                this._alive = false
+
+                clearInterval(this._heart_timer)
+
+                // 自动重连开启  +  不在重连状态下
+                if (this.reconnect === true) {
+                    /* 断开后立刻重连 */
+                    this.onreconnect()
+                }
+                func ? func(event) : false

Review Comment:
   ## Non-empty statements should change control flow or have at least one 
side-effect
   
   <!--SONAR_ISSUE_KEY:AZgRXGgHIGTjcNxZo45F-->Expected an assignment or 
function call and instead saw an expression. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgHIGTjcNxZo45F&open=AZgRXGgHIGTjcNxZo45F&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/249)



##########
admin/web/src/utils/directives.js:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import Vue from 'vue';
+import { getLocalStorage } from '@/utils/auth'
+
+// account permission check
+Vue.prototype.$_has = function({rights}) {
+//debugger
+    let operatorInfo = getLocalStorage('operatorInfo');
+    let permission = operatorInfo.rights ? operatorInfo.rights.split(',') : [];
+    let resources = [];
+    let result = false;
+
+    // get current acccount role
+    if(Array.isArray(rights)){
+        rights.forEach((e) => {
+        resources = resources.concat([e]);
+      })
+    }else{
+      resources = resources.concat([rights.split(',')]);
+    }
+    // auth check
+    resources.map((p) => {
+      if(typeof p != 'string'){
+        p = p.toString();
+      }
+      if(permission.includes(p)){
+        return result = true;

Review Comment:
   ## Assignments should not be made from within sub-expressions
   
   <!--SONAR_ISSUE_KEY:AZgRXGgWIGTjcNxZo45d-->Extract the assignment of 
"result" from this expression. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgWIGTjcNxZo45d&open=AZgRXGgWIGTjcNxZo45d&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/253)



##########
admin/web/src/utils/cofetch.js:
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import axios from 'axios'
+import {Message} from 'element-ui'
+import {getToken, getLocalStorage, setLocalStorage} from '@/utils/auth'
+import store from '@/store/store.js'
+import * as dlgUtils from './dialogUtils'
+import Vue from 'vue'
+import ElementUI from 'element-ui'
+const SUCCESS_CODE = 200;
+import wsConsts from '@/utils/wsConsts'
+
+// 创建axios实例
+const service = axios.create({
+    baseURL: "/login", // api的base_url
+    dataType:"json",
+    headers: {"Content-Type": "multipart/form-data; 
boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" },
+    timeout: 5000 // 请求超时时间
+})
+
+
+// request拦截器
+service.interceptors.request.use(config => {
+    // console.log(store.getters)
+    // if (store.getters.token) {
+    //     config.headers.token = getToken();
+    // }
+
+
+    // if (config.method.toLowerCase() !== 'get' && 
Object.keys(config.data).length > 0) {
+    //     let body = {};
+    //     let data = {};
+
+    //     for (let key in config.data) {
+    //         if (key != 'method') {
+    //             body[key] = config.data[key];
+    //         }
+    //     }
+    //     data = body
+    //     // if (getToken()) {
+    //     //     data.ticket = getToken() || '';
+    //     // }
+
+    //     config.data = JSON.stringify(data)
+    // }
+
+    return config
+}, error => {
+    console.log(error) // for debug
+    Promise.reject(error)
+})
+Vue.prototype.$http = service
+
+Vue.prototype.$post = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.post(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$put = function (url, data) {
+  return new Promise((resolve, reject) => {
+    service.put(url, data).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+Vue.prototype.$delete = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.delete(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+    })
+  })
+}
+
+Vue.prototype.$get = function (url, params = {}) {
+  return new Promise((resolve, reject) => {
+    service.get(url, {
+      params
+    }).then(res => {
+      if (res.code == 10001) {
+        resolve(res)
+      } else {
+        resolve(res)
+      }
+    }).catch(err => {
+      // ElementUI.Message.error('网络错误,请重试!')
+      console.log(err)
+      reject(err)
+
+    })
+  })
+}
+// respone拦截器
+service.interceptors.response.use(response => {
+    if (!response.data) {
+        return Promise.reject({code: "", message: '网络异常'});
+    }
+    const res = response.data;
+    console.log(res)
+    if (!res.hasOwnProperty('code')) {
+        return res;
+    }
+
+    let expireTime = getLocalStorage('expireTime');
+    if(res.code == 503){
+        console.log(res)
+        dlgUtils.loginTimeout()
+        return Promise.reject({code: res.code, message: res.data})
+    }else{
+        setLocalStorage('expireTime', new Date().getTime() + 1000*60*60*24*7)
+        return res;
+    }
+
+    return Promise.reject({code: res.code, message: res.msg})

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgBIGTjcNxZo442-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgBIGTjcNxZo442&open=AZgRXGgBIGTjcNxZo442&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/239)



##########
admin/web/src/utils/utils.js:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 一些工具类的集合
+ */
+
+//dataURL to blob,
+export function dataUrlToBlob(dataURI){
+  let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // mime类型
+  let byteString = atob(dataURI.split(',')[1]); //base64 解码
+
+  let arrayBuffer = new ArrayBuffer(byteString.length); //创建缓冲数组
+  let intArray = new Uint8Array(arrayBuffer); //创建视图
+
+  for (let i = 0; i < byteString.length; i++) {
+    intArray[i] = byteString.charCodeAt(i);
+  }
+  return new Blob([intArray], {type: mimeString});
+}
+
+export  function format(time, format){
+  var t = new Date(time);
+  var tf = function(i){return (i < 10 ? '0' : '') + i};
+  return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
+    switch(a){
+      case 'yyyy':
+        return tf(t.getFullYear());
+        break;
+      case 'MM':
+        return tf(t.getMonth() + 1);
+        break;
+      case 'mm':
+        return tf(t.getMinutes());
+        break;
+      case 'dd':
+        return tf(t.getDate());
+        break;

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgEIGTjcNxZo448-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgEIGTjcNxZo448&open=AZgRXGgEIGTjcNxZo448&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/244)



##########
admin/web/src/utils/utils.js:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 一些工具类的集合
+ */
+
+//dataURL to blob,
+export function dataUrlToBlob(dataURI){
+  let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // mime类型
+  let byteString = atob(dataURI.split(',')[1]); //base64 解码
+
+  let arrayBuffer = new ArrayBuffer(byteString.length); //创建缓冲数组
+  let intArray = new Uint8Array(arrayBuffer); //创建视图
+
+  for (let i = 0; i < byteString.length; i++) {
+    intArray[i] = byteString.charCodeAt(i);
+  }
+  return new Blob([intArray], {type: mimeString});
+}
+
+export  function format(time, format){
+  var t = new Date(time);
+  var tf = function(i){return (i < 10 ? '0' : '') + i};
+  return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
+    switch(a){
+      case 'yyyy':
+        return tf(t.getFullYear());
+        break;
+      case 'MM':
+        return tf(t.getMonth() + 1);
+        break;

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgEIGTjcNxZo446-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgEIGTjcNxZo446&open=AZgRXGgEIGTjcNxZo446&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/242)



##########
admin/web/src/utils/socket.js:
##########
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* jshint esversion:6 */
+class socket {
+    constructor(params) {
+        this._params = params
+        this.init()
+    }
+
+    /* 初始化 */
+    init() {
+        // 重中之重,不然重连的时候会越来越快
+        clearInterval(this._reconnect_timer)
+        clearInterval(this._heart_timer)
+
+        // 取出所有参数
+        const params = this._params
+            // 设置连接路径
+        const {
+            url,
+            port
+        } = params
+        const global_params = ['heartBeat', 'heartMsg', 'reconnect', 
'reconnectTime', 'reconnectTimes']
+
+        // 定义全局变量
+        Object.keys(params).forEach(key => {
+            if (global_params.indexOf(key) !== -1) {
+                this[key] = params[key]
+            }
+        })
+
+        const ws_url = port ? url + ':' + port : url
+
+        this._ws = new WebSocket(ws_url)
+
+        // 默认绑定事件
+        this._ws.onopen = () => {
+            // 设置状态为开启
+            this._alive = true
+            clearInterval(this._reconnect_timer)
+                // 连接后进入心跳状态
+                //this.onheartbeat()
+        }
+
+        this._ws.onclose = () => {
+            // 设置状态为断开
+            this._alive = false
+
+            clearInterval(this._heart_timer)
+
+            // 自动重连开启  +  不在重连状态下
+            if (this.reconnect === true) {
+                /* 断开后立刻重连 */
+                this.onreconnect()
+            }
+        }
+    }
+
+    /* 心跳事件 */
+    onheartbeat(func) {
+        // 在连接状态下
+        setTimeout(() => {
+            if (this._alive === true) {
+                if (!this.first === true) {
+                    this.first = true
+                        /* 心跳计时器 */
+                    this._heart_timer = setInterval(() => {
+                        // 发送心跳信息
+                        
this.send('{"bissnessType":"doSale","chargeWay":"03","data":"{amount:1}"}')
+                        func ? func(this) : false
+                    }, this.heartBeat)
+                }
+            }
+        }, 500)
+    }
+
+    /* 重连事件 */
+    onreconnect(func) {
+        /* 重连间隔计时器 */
+        this._reconnect_timer = setInterval(() => {
+            // 限制重连次数
+            if (this.reconnectTimes <= 0) {
+                // 关闭定时器
+                // this._isReconnect = false
+                clearInterval(this._reconnect_timer)
+                    // 跳出函数之间的循环
+                return
+            } else {
+                // 重连一次-1
+                this.reconnectTimes--
+            }
+            // 进入初始状态
+            this.init()
+            func ? func(this) : false
+        }, this.reconnectTime)
+    }
+
+    // 发送消息
+    send(text) {
+        if (text === 'undefined') return
+        if (this._alive === true) {
+            text = typeof text === 'string' ? text : JSON.stringify(text)
+            this._ws.send(text)
+        }
+    }
+
+    /**断开连接 */
+    close() {
+        if (this._alive === true) {
+            // 关闭自动连接
+            this.reconnect = false
+            this._ws.close()
+        }
+    }
+
+    /**接受消息 */
+    onmessage(func, all = false) {
+        this._ws.onmessage = data => func(!all ? data.data : data)
+    }
+
+    /**websocket连接成功事件 */
+    onopen(func) {
+            this._ws.onopen = event => {
+                this._alive = true
+                func ? func(event) : false

Review Comment:
   ## Non-empty statements should change control flow or have at least one 
side-effect
   
   <!--SONAR_ISSUE_KEY:AZgRXGgHIGTjcNxZo45E-->Expected an assignment or 
function call and instead saw an expression. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgHIGTjcNxZo45E&open=AZgRXGgHIGTjcNxZo45E&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/248)



##########
admin/web/src/utils/utils.js:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 一些工具类的集合
+ */
+
+//dataURL to blob,
+export function dataUrlToBlob(dataURI){
+  let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // mime类型
+  let byteString = atob(dataURI.split(',')[1]); //base64 解码
+
+  let arrayBuffer = new ArrayBuffer(byteString.length); //创建缓冲数组
+  let intArray = new Uint8Array(arrayBuffer); //创建视图
+
+  for (let i = 0; i < byteString.length; i++) {
+    intArray[i] = byteString.charCodeAt(i);
+  }
+  return new Blob([intArray], {type: mimeString});
+}
+
+export  function format(time, format){
+  var t = new Date(time);
+  var tf = function(i){return (i < 10 ? '0' : '') + i};
+  return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
+    switch(a){
+      case 'yyyy':
+        return tf(t.getFullYear());
+        break;
+      case 'MM':
+        return tf(t.getMonth() + 1);
+        break;
+      case 'mm':
+        return tf(t.getMinutes());
+        break;
+      case 'dd':
+        return tf(t.getDate());
+        break;
+      case 'HH':
+        return tf(t.getHours());
+        break;
+      case 'ss':
+        return tf(t.getSeconds());
+        break;

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgEIGTjcNxZo44--->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgEIGTjcNxZo44-&open=AZgRXGgEIGTjcNxZo44-&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/240)



##########
admin/web/src/utils/utils.js:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 一些工具类的集合
+ */
+
+//dataURL to blob,
+export function dataUrlToBlob(dataURI){
+  let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // mime类型
+  let byteString = atob(dataURI.split(',')[1]); //base64 解码
+
+  let arrayBuffer = new ArrayBuffer(byteString.length); //创建缓冲数组
+  let intArray = new Uint8Array(arrayBuffer); //创建视图
+
+  for (let i = 0; i < byteString.length; i++) {
+    intArray[i] = byteString.charCodeAt(i);
+  }
+  return new Blob([intArray], {type: mimeString});
+}
+
+export  function format(time, format){
+  var t = new Date(time);
+  var tf = function(i){return (i < 10 ? '0' : '') + i};
+  return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
+    switch(a){
+      case 'yyyy':
+        return tf(t.getFullYear());
+        break;

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgEIGTjcNxZo445-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgEIGTjcNxZo445&open=AZgRXGgEIGTjcNxZo445&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/241)



##########
admin/web/src/utils/utils.js:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 一些工具类的集合
+ */
+
+//dataURL to blob,
+export function dataUrlToBlob(dataURI){
+  let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // mime类型
+  let byteString = atob(dataURI.split(',')[1]); //base64 解码
+
+  let arrayBuffer = new ArrayBuffer(byteString.length); //创建缓冲数组
+  let intArray = new Uint8Array(arrayBuffer); //创建视图
+
+  for (let i = 0; i < byteString.length; i++) {
+    intArray[i] = byteString.charCodeAt(i);
+  }
+  return new Blob([intArray], {type: mimeString});
+}
+
+export  function format(time, format){
+  var t = new Date(time);
+  var tf = function(i){return (i < 10 ? '0' : '') + i};
+  return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
+    switch(a){
+      case 'yyyy':
+        return tf(t.getFullYear());
+        break;
+      case 'MM':
+        return tf(t.getMonth() + 1);
+        break;
+      case 'mm':
+        return tf(t.getMinutes());
+        break;
+      case 'dd':
+        return tf(t.getDate());
+        break;
+      case 'HH':
+        return tf(t.getHours());
+        break;

Review Comment:
   ## All code should be reachable
   
   <!--SONAR_ISSUE_KEY:AZgRXGgEIGTjcNxZo449-->Unreachable code. <p>See more on 
<a 
href="https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&issues=AZgRXGgEIGTjcNxZo449&open=AZgRXGgEIGTjcNxZo449&pullRequest=697";>SonarQube
 Cloud</a></p>
   
   [Show more 
details](https://github.com/apache/dubbo-go-pixiu/security/code-scanning/245)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to