|
8 | 8 |
|
9 | 9 | from tornado.concurrent import run_on_executor |
10 | 10 |
|
11 | | - |
12 | 11 | from libs.base_handler import BaseHandler |
13 | 12 | from services.area_service import ( |
14 | | - get_big_area_list, |
15 | | - get_area_list, |
16 | | - create_or_update_big_area, |
17 | 13 | create_area, |
18 | | - delete_big_area, |
| 14 | + create_or_update_big_area, |
19 | 15 | delete_area, |
| 16 | + delete_big_area, |
| 17 | + get_area_list, |
20 | 18 | get_big_area_detail, |
| 19 | + get_big_area_detail_for_gmt, |
| 20 | + get_big_area_list, |
| 21 | + get_big_area_list_for_gmt, |
21 | 22 | update_area, |
22 | 23 | ) |
23 | 24 | from services.env_service import env_checker |
@@ -171,11 +172,76 @@ def prepare(self): |
171 | 172 | return super().prepare() |
172 | 173 |
|
173 | 174 |
|
| 175 | +class CBBBigAreaForGMTHandler(CBBBigAreaHandler): |
| 176 | + _thread_pool = ThreadPoolExecutor(3) |
| 177 | + |
| 178 | + @run_on_executor(executor="_thread_pool") |
| 179 | + def async_get_big_area_list(self): |
| 180 | + if not self.request_tenantid: |
| 181 | + biz_id = self.params.get("biz_id") |
| 182 | + else: |
| 183 | + biz_id = self.request_tenantid |
| 184 | + self.params.update(biz_id=biz_id) |
| 185 | + return get_big_area_list_for_gmt(**self.params) |
| 186 | + |
| 187 | + async def get(self): |
| 188 | + res = await self.async_get_big_area_list() |
| 189 | + return self.write(res) |
| 190 | + |
| 191 | + |
| 192 | +class CBBBigAreaDetailForGMTHandler(BaseHandler, ABC): |
| 193 | + _thread_pool = ThreadPoolExecutor(3) |
| 194 | + |
| 195 | + @run_on_executor(executor="_thread_pool") |
| 196 | + def async_get_big_area_detail(self): |
| 197 | + if not self.request_tenantid: |
| 198 | + biz_id = self.params.get("biz_id") |
| 199 | + else: |
| 200 | + biz_id = self.request_tenantid |
| 201 | + |
| 202 | + self.params.update(biz_id=biz_id) |
| 203 | + return get_big_area_detail_for_gmt(**self.params) |
| 204 | + |
| 205 | + async def get(self): |
| 206 | + res = await self.async_get_big_area_detail() |
| 207 | + return self.write(res) |
| 208 | + |
| 209 | + |
| 210 | +class CBBAreaForGMTHandler(CBBAreaHandler): ... |
| 211 | + |
| 212 | + |
174 | 213 | area_urls = [ |
175 | 214 | (r"/cbb_area/area/", CBBAreaHandler, {"handle_name": "配置平台-区服管理", "method": ["ALL"]}), |
176 | 215 | (r"/cbb_area/big_area/", CBBBigAreaHandler, {"handle_name": "配置平台-大区管理", "method": ["ALL"]}), |
177 | 216 | (r"/cbb_area/big_area/detail/", CBBBigAreaDetailHandler, {"handle_name": "配置平台-大区详情", "method": ["GET"]}), |
178 | | - (r"/cbb_area/without_prd/area/", CBBAreaWithoutPrdHandler, {"handle_name": "配置平台-区服管理-非生产环境", "method": ["ALL"]}), |
179 | | - (r"/cbb_area/without_prd/big_area/",CBBBigAreaWithoutPrdHandler, {"handle_name": "配置平台-大区管理-非生产环境", "method": ["ALL"]}), |
180 | | - (r"/cbb_area/without_prd/big_area/detail/",CBBBigAreaDetailWithoutPrdHandler, {"handle_name": "配置平台-大区详情-非生产环境", "method": ["GET"]}), |
| 217 | + ( |
| 218 | + r"/cbb_area/without_prd/area/", |
| 219 | + CBBAreaWithoutPrdHandler, |
| 220 | + {"handle_name": "配置平台-区服管理-非生产环境", "method": ["ALL"]}, |
| 221 | + ), |
| 222 | + ( |
| 223 | + r"/cbb_area/without_prd/big_area/", |
| 224 | + CBBBigAreaWithoutPrdHandler, |
| 225 | + {"handle_name": "配置平台-大区管理-非生产环境", "method": ["ALL"]}, |
| 226 | + ), |
| 227 | + ( |
| 228 | + r"/cbb_area/without_prd/big_area/detail/", |
| 229 | + CBBBigAreaDetailWithoutPrdHandler, |
| 230 | + {"handle_name": "配置平台-大区详情-非生产环境", "method": ["GET"]}, |
| 231 | + ), |
| 232 | + ( |
| 233 | + r"/cbb_area/gmt/big_area/", |
| 234 | + CBBBigAreaForGMTHandler, |
| 235 | + {"handle_name": "配置平台-大区管理-GMT专用", "method": ["ALL"]}, |
| 236 | + ), |
| 237 | + ( |
| 238 | + r"/cbb_area/gmt/big_area/detail/", |
| 239 | + CBBBigAreaDetailForGMTHandler, |
| 240 | + {"handle_name": "配置平台-大区详情-GMT专用", "method": ["GET"]}, |
| 241 | + ), |
| 242 | + ( |
| 243 | + r"/cbb_area/gmt/area/", |
| 244 | + CBBAreaForGMTHandler, |
| 245 | + {"handle_name": "配置平台-区服管理-GMT专用", "method": ["ALL"]}, |
| 246 | + ), |
181 | 247 | ] |
0 commit comments