Skip to content

Commit

Permalink
Merge pull request #65 from hhyo/github
Browse files Browse the repository at this point in the history
bug修复
  • Loading branch information
Mr.July authored Apr 17, 2018
2 parents f087f63 + 966eb87 commit 5d92d34
Show file tree
Hide file tree
Showing 33 changed files with 338 additions and 505 deletions.
2 changes: 2 additions & 0 deletions archer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

ALLOWED_HOSTS = ['*']

# 解决nginx部署跳转404
USE_X_FORWARDED_HOST = True

# Application definition

Expand Down
Binary file removed docs/mysql_db_design_guide.docx
Binary file not shown.
Binary file removed screenshots/adminsql.png
Binary file not shown.
Binary file removed screenshots/adminsqlusers.png
Binary file not shown.
Binary file removed screenshots/allworkflow.png
Binary file not shown.
Binary file removed screenshots/autoreview.png
Binary file not shown.
Binary file removed screenshots/bugs/bug1.png
Binary file not shown.
Binary file removed screenshots/bugs/bug2.png
Binary file not shown.
Binary file removed screenshots/bugs/bug3.png
Binary file not shown.
Binary file removed screenshots/charts.png
Binary file not shown.
Binary file removed screenshots/finish.png
Binary file not shown.
Binary file removed screenshots/login.png
Binary file not shown.
Binary file removed screenshots/nginx.png
Binary file not shown.
Binary file removed screenshots/osc_progress.png
Binary file not shown.
Binary file removed screenshots/pymysql.png
Binary file not shown.
Binary file removed screenshots/rollback.png
Binary file not shown.
Binary file removed screenshots/startup.png
Binary file not shown.
Binary file removed screenshots/submitsql.png
Binary file not shown.
Binary file removed screenshots/waitingforme.png
Binary file not shown.
60 changes: 47 additions & 13 deletions sql/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def getdbNameList(request):
if is_master:
try:
master_info = master_config.objects.get(cluster_name=clusterName)
# 取出该集群的连接方式,为了后面连进去获取所有databases
# 取出该集群主库的连接方式,为了后面连进去获取所有databases
listDb = dao.getAlldbByCluster(master_info.master_host, master_info.master_port, master_info.master_user,
prpCryptor.decrypt(master_info.master_password))
# 要把result转成JSON存进数据库里,方便SQL单子详细信息展示
Expand Down Expand Up @@ -226,14 +226,31 @@ def getdbNameList(request):
def getTableNameList(request):
clusterName = request.POST.get('cluster_name')
db_name = request.POST.get('db_name')
is_master = request.POST.get('is_master')
result = {'status': 0, 'msg': 'ok', 'data': []}

slave_info = slave_config.objects.get(cluster_name=clusterName)
# 取出该集群的连接方式,为了后面连进去获取所有的表
listTb = dao.getAllTableByDb(slave_info.slave_host, slave_info.slave_port, slave_info.slave_user,
prpCryptor.decrypt(slave_info.slave_password), db_name)
# 要把result转成JSON存进数据库里,方便SQL单子详细信息展示
result['data'] = listTb
if is_master:
try:
master_info = master_config.objects.get(cluster_name=clusterName)
# 取出该集群主库的连接方式,为了后面连进去获取所有的表
listTb = dao.getAllTableByDb(master_info.master_host, master_info.master_port, master_info.master_user,
prpCryptor.decrypt(master_info.master_password), db_name)
# 要把result转成JSON存进数据库里,方便SQL单子详细信息展示
result['data'] = listTb
except Exception:
result['status'] = 1
result['msg'] = '找不到对应的主库配置信息,请配置'
else:
try:
slave_info = slave_config.objects.get(cluster_name=clusterName)
# 取出该集群从库的连接方式,为了后面连进去获取所有的表
listTb = dao.getAllTableByDb(slave_info.slave_host, slave_info.slave_port, slave_info.slave_user,
prpCryptor.decrypt(slave_info.slave_password), db_name)
# 要把result转成JSON存进数据库里,方便SQL单子详细信息展示
result['data'] = listTb
except Exception:
result['status'] = 1
result['msg'] = '找不到对应的从库配置信息,请配置'
return HttpResponse(json.dumps(result), content_type='application/json')


Expand All @@ -243,14 +260,31 @@ def getColumnNameList(request):
clusterName = request.POST.get('cluster_name')
db_name = request.POST.get('db_name')
tb_name = request.POST.get('tb_name')
is_master = request.POST.get('is_master')
result = {'status': 0, 'msg': 'ok', 'data': []}

slave_info = slave_config.objects.get(cluster_name=clusterName)
# 取出该集群的连接方式,为了后面连进去获取表的所有字段
listCol = dao.getAllColumnsByTb(slave_info.slave_host, slave_info.slave_port, slave_info.slave_user,
prpCryptor.decrypt(slave_info.slave_password), db_name, tb_name)
# 要把result转成JSON存进数据库里,方便SQL单子详细信息展示
result['data'] = listCol
if is_master:
try:
master_info = master_config.objects.get(cluster_name=clusterName)
# 取出该集群主库的连接方式,为了后面连进去获取所有字段
listCol = dao.getAllColumnsByTb(master_info.master_host, master_info.master_port, master_info.master_user,
prpCryptor.decrypt(master_info.master_password), db_name, tb_name)
# 要把result转成JSON存进数据库里,方便SQL单子详细信息展示
result['data'] = listCol
except Exception:
result['status'] = 1
result['msg'] = '找不到对应的主库配置信息,请配置'
else:
try:
slave_info = slave_config.objects.get(cluster_name=clusterName)
# 取出该集群的连接方式,为了后面连进去获取表的所有字段
listCol = dao.getAllColumnsByTb(slave_info.slave_host, slave_info.slave_port, slave_info.slave_user,
prpCryptor.decrypt(slave_info.slave_password), db_name, tb_name)
# 要把result转成JSON存进数据库里,方便SQL单子详细信息展示
result['data'] = listCol
except Exception:
result['status'] = 1
result['msg'] = '找不到对应的从库配置信息,请配置'
return HttpResponse(json.dumps(result), content_type='application/json')


Expand Down
Loading

0 comments on commit 5d92d34

Please sign in to comment.