pull/109/head
midoks 3 years ago
parent e1d8225c93
commit ce5aa5ff86
  1. 2
      plugins/gogs/class/mysqlDb.py
  2. 16
      plugins/gogs/index.py

@ -83,7 +83,7 @@ class mysqlDb:
self.__Close() self.__Close()
return result return result
except Exception as ex: except Exception as ex:
return ex return "error: " + str(ex)
# 关闭连接 # 关闭连接
def __Close(self): def __Close(self):

@ -628,19 +628,23 @@ def getRsaPublic():
def getTotalStatistics(): def getTotalStatistics():
st = status() st = status()
data = {} data = {}
if st == 'start': if st.strip() == 'start':
pm = pMysqlDb() pm = pMysqlDb()
list_count = pm.query('select count(id) as num from repository') list_count = pm.query('select count(id) as num from repository')
count = list_count[0][0]
if list_count.find("error") > -1:
data['status'] = False
data['count'] = 0
return mw.returnJson(False, 'fail', data)
data['status'] = True data['status'] = True
data['count'] = count data['count'] = count
data['ver'] = mw.readFile(getServerDir() + '/version.pl').strip() data['ver'] = mw.readFile(getServerDir() + '/version.pl').strip()
return mw.returnJson(True, 'ok', data) return mw.returnJson(True, 'ok', data)
else:
data['status'] = False data['status'] = False
data['count'] = 0 data['count'] = 0
return mw.returnJson(False, 'fail', data) return mw.returnJson(False, 'fail', data)
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save