@name 绑定外网 @author hwliang<2021-08-09> @param get { name: string<项目名称> } @return dict
(self, get)
| 2578 | return True |
| 2579 | |
| 2580 | def BindExtranet(self, get): |
| 2581 | ''' |
| 2582 | @name 绑定外网 |
| 2583 | @author hwliang<2021-08-09> |
| 2584 | @param get<dict_obj>{ |
| 2585 | name: string<项目名称> |
| 2586 | } |
| 2587 | @return dict |
| 2588 | ''' |
| 2589 | res_msg = self._check_webserver() |
| 2590 | if res_msg: |
| 2591 | return public.return_error(res_msg) |
| 2592 | project_name = get.name.strip() |
| 2593 | project_find = self.get_project_find(project_name) |
| 2594 | if self.prep_status(project_find["project_config"]) == "running": |
| 2595 | return public.return_error("项目环境安装制作中.....<br>请勿操作") |
| 2596 | if not project_find: return public.return_error('项目不存在') |
| 2597 | if not project_find['project_config']['domains']: return public.return_error( |
| 2598 | '请先到【域名管理】选项中至少添加一个域名') |
| 2599 | project_find['project_config']['bind_extranet'] = 1 |
| 2600 | public.M('sites').where("id=?", (project_find['id'],)).setField('project_config', |
| 2601 | json.dumps(project_find['project_config'])) |
| 2602 | self.set_config(project_name) |
| 2603 | public.WriteLog(self._log_name, 'Python项目{}, 开启外网映射'.format(project_name)) |
| 2604 | return public.returnMsg(True, '开启外网映射成功') |
| 2605 | |
| 2606 | def unBindExtranet(self, get): |
| 2607 | ''' |
nothing calls this directly
no test coverage detected