MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / StopProject

Method StopProject

class/projectModel/pythonModel.py:1408–1431  ·  view source on GitHub ↗
(self, get)

Source from the content-addressed store, hash-verified

1406 return public.return_data(True, '进程已全部结束')
1407
1408 def StopProject(self, get):
1409 project_name = None
1410 if hasattr(get, "name"):
1411 project_name = get.name.strip()
1412 if hasattr(get, "project_name"):
1413 project_name = get.project_name.strip()
1414 if not project_name:
1415 return public.returnMsg(False, "请选择要停止的项目")
1416 project_find = self.get_project_find(project_name)
1417 if not project_find:
1418 return public.returnMsg(False, "没有该项目,请尝试刷新页面后重试")
1419 # 2024.4.3 修复项目过期时间判断不对
1420 mEdate = time.strftime('%Y-%m-%d', time.localtime())
1421 if project_find['edate'] != "0000-00-00" and project_find['edate'] < mEdate:
1422 return public.return_error('当前项目已过期,请重新设置项目到期时间')
1423
1424 from mod.project.python.serviceMod import ServiceManager
1425
1426 s_mgr = ServiceManager.new_mgr(project_name)
1427 if isinstance(s_mgr, str):
1428 return public.returnMsg(False, s_mgr)
1429
1430 s_mgr.stop_project()
1431 return public.returnMsg(True, "停止指令已执行,请注意查看日志")
1432
1433 def only_stop_main_project(self, project_name):
1434 """停止项目的api接口

Callers 4

stop_projectMethod · 0.95
RemoveProjectMethod · 0.95
stop_websiteFunction · 0.80
site_task.pyFile · 0.80

Calls 4

get_project_findMethod · 0.95
returnMsgMethod · 0.80
new_mgrMethod · 0.80
stop_projectMethod · 0.45

Tested by

no test coverage detected