正在显示
19 个修改的文件
包含
36 行增加
和
36 行删除
| ... | ... | @@ -23,7 +23,7 @@ class Api(ApiTemplate): |
| 23 | 23 | |
| 24 | 24 | database = db.session.query(Database).filter_by(guid=self.para.get("guid")).one_or_none() |
| 25 | 25 | #验证权限 |
| 26 | - UserCheck.verify(database.creator,current_token.user.username) | |
| 26 | + UserCheck.verify(database.creator) | |
| 27 | 27 | if configure.VACUATE_DB_URI: |
| 28 | 28 | va_ds: DataSource = PGUtil.open_pg_data_source(1, configure.VACUATE_DB_URI) |
| 29 | 29 | else: | ... | ... |
| ... | ... | @@ -28,7 +28,6 @@ class EntryDataVacuate: |
| 28 | 28 | try: |
| 29 | 29 | metas: list = parameter.get("meta") |
| 30 | 30 | |
| 31 | - vacuate = int(parameter.get("vacuate",1)) | |
| 32 | 31 | |
| 33 | 32 | # 总的入库是否成功 |
| 34 | 33 | is_success=True |
| ... | ... | @@ -165,7 +164,7 @@ class EntryDataVacuate: |
| 165 | 164 | |
| 166 | 165 | new_layer_name = None |
| 167 | 166 | vacuate_process= None |
| 168 | - vacuate = int(this_task.parameter.get("vacuate", 1)) | |
| 167 | + vacuate = int(this_task.parameter.get("vacuate", 0)) | |
| 169 | 168 | success = True |
| 170 | 169 | table_guid = uuid.uuid1().__str__() |
| 171 | 170 | try: |
| ... | ... | @@ -244,7 +243,10 @@ class EntryDataVacuate: |
| 244 | 243 | |
| 245 | 244 | # 注册图层信息 |
| 246 | 245 | # 是否抽吸过 |
| 247 | - is_vacuate = 1 if vacuate_process.max_level>0 else 0 | |
| 246 | + if vacuate: | |
| 247 | + is_vacuate = 1 if vacuate_process.max_level>0 else 0 | |
| 248 | + else: | |
| 249 | + is_vacuate = 0 | |
| 248 | 250 | |
| 249 | 251 | this_task.register_table(pg_layer,new_layer_name,overwrite,parameter.get("creator"),is_vacuate,table_guid) |
| 250 | 252 | ... | ... |
| ... | ... | @@ -24,7 +24,7 @@ class Api(ApiTemplate): |
| 24 | 24 | raise Exception("数据不存在!") |
| 25 | 25 | |
| 26 | 26 | #验证权限 |
| 27 | - UserCheck.verify(column.relate_table.relate_database.creator,current_token.user.username) | |
| 27 | + UserCheck.verify(column.relate_table.relate_database.creator) | |
| 28 | 28 | |
| 29 | 29 | try: |
| 30 | 30 | if self.para.get("column_alias"): | ... | ... |
| ... | ... | @@ -36,17 +36,13 @@ class Api(ApiTemplate): |
| 36 | 36 | database = Database.query.filter_by(guid=table.database_guid).one_or_none() |
| 37 | 37 | |
| 38 | 38 | #验证权限 |
| 39 | - UserCheck.verify(database.creator,current_token.user.username) | |
| 39 | + UserCheck.verify(database.creator) | |
| 40 | 40 | |
| 41 | 41 | if not database: |
| 42 | 42 | res["result"]=False |
| 43 | 43 | res["msg"]= "数据库不存在!" |
| 44 | 44 | return res |
| 45 | 45 | |
| 46 | - if database.creator != "": | |
| 47 | - raise Exception("缺乏权限!") | |
| 48 | - | |
| 49 | - | |
| 50 | 46 | pg_ds: DataSource = PGUtil.open_pg_data_source(1, DES.decode(database.sqlalchemy_uri)) |
| 51 | 47 | |
| 52 | 48 | if configure.VACUATE_DB_URI: | ... | ... |
| ... | ... | @@ -33,7 +33,7 @@ class Api(ApiTemplate): |
| 33 | 33 | return res |
| 34 | 34 | |
| 35 | 35 | #验证权限 |
| 36 | - UserCheck.verify(table.relate_database.creator,current_token.user.username) | |
| 36 | + UserCheck.verify(table.one_or_none().relate_database.creator) | |
| 37 | 37 | |
| 38 | 38 | if self.para.__contains__("catalog_guid"): |
| 39 | 39 | if catalog_guid is None: | ... | ... |
| ... | ... | @@ -29,10 +29,7 @@ class Api(ApiTemplate): |
| 29 | 29 | database = Database.query.filter_by(guid=database_guid).one_or_none() |
| 30 | 30 | |
| 31 | 31 | #验证权限 |
| 32 | - UserCheck.verify(database.creator,current_token.user.username) | |
| 33 | - | |
| 34 | - if database.creator != "": | |
| 35 | - raise Exception("缺乏权限!") | |
| 32 | + UserCheck.verify(database.creator) | |
| 36 | 33 | |
| 37 | 34 | if not database: |
| 38 | 35 | raise Exception("数据库不存在!") | ... | ... |
| ... | ... | @@ -43,7 +43,7 @@ class Api(ApiTemplate): |
| 43 | 43 | raise Exception("数据不存在!") |
| 44 | 44 | |
| 45 | 45 | #验证权限 |
| 46 | - UserCheck.verify(table.relate_database.creator,current_token.user.username) | |
| 46 | + UserCheck.verify(table.relate_database.creator) | |
| 47 | 47 | |
| 48 | 48 | pg_ds :DataSource= PGUtil.open_pg_data_source(0,DES.decode(table.relate_database.sqlalchemy_uri)) |
| 49 | 49 | layer = pg_ds.GetLayerByName(table.name) | ... | ... |
| ... | ... | @@ -9,6 +9,7 @@ from sqlalchemy.engine import ResultProxy |
| 9 | 9 | from app.util.component.ApiTemplate import ApiTemplate |
| 10 | 10 | from app.util.component.PGUtil import PGUtil |
| 11 | 11 | import json |
| 12 | +import decimal | |
| 12 | 13 | class Api(ApiTemplate): |
| 13 | 14 | api_name = "数据浏览" |
| 14 | 15 | def process(self): |
| ... | ... | @@ -53,6 +54,8 @@ class Api(ApiTemplate): |
| 53 | 54 | #格式化时间列 |
| 54 | 55 | if isinstance(value, datetime.datetime): |
| 55 | 56 | d[column] = value.strftime('%Y-%m-%d %H:%M:%S') |
| 57 | + elif isinstance(value, decimal.Decimal): | |
| 58 | + d[column] = float(value) | |
| 56 | 59 | else: |
| 57 | 60 | d[column]=value |
| 58 | 61 | pkey_dict.update(d) | ... | ... |
| ... | ... | @@ -23,7 +23,7 @@ class Api(ApiTemplate): |
| 23 | 23 | if not user_req.json().get("result"): |
| 24 | 24 | raise Exception("服务不存在!") |
| 25 | 25 | # 验证权限 |
| 26 | - UserCheck.verify(user_req.json().get("data").get("service").get("creator"), current_token.user.username) | |
| 26 | + UserCheck.verify(user_req.json().get("data").get("service").get("creator")) | |
| 27 | 27 | |
| 28 | 28 | url = "{}/API/Service/Delete".format(self.para.get("url")) |
| 29 | 29 | response:requests.Response = requests.post(url,data=self.para) | ... | ... |
| ... | ... | @@ -23,7 +23,7 @@ class Api(ApiTemplate): |
| 23 | 23 | if not user_req.json().get("result"): |
| 24 | 24 | raise Exception("服务不存在!") |
| 25 | 25 | # 验证权限 |
| 26 | - UserCheck.verify(user_req.json().get("data").get("service").get("creator"), current_token.user.username) | |
| 26 | + UserCheck.verify(user_req.json().get("data").get("service").get("creator")) | |
| 27 | 27 | |
| 28 | 28 | url = "{}/API/Service/Edit".format(self.para.get("url")) |
| 29 | 29 | response:requests.Response = requests.post(url,data=self.para) | ... | ... |
| ... | ... | @@ -26,14 +26,14 @@ class Api(ApiTemplate): |
| 26 | 26 | try: |
| 27 | 27 | guid = self.para.get("guid") |
| 28 | 28 | functions = self.para.get("functions") |
| 29 | - service :Service = Service.query.filter_by(guid=guid) | |
| 29 | + service :Service = Service.query.filter_by(guid=guid).one_or_none() | |
| 30 | 30 | this_time = datetime.datetime.now() |
| 31 | 31 | |
| 32 | 32 | if not service: |
| 33 | 33 | raise Exception("服务不存在!") |
| 34 | 34 | |
| 35 | 35 | #验证权限 |
| 36 | - UserCheck.verify(service.creator,current_token.user.username) | |
| 36 | + UserCheck.verify(service.creator) | |
| 37 | 37 | |
| 38 | 38 | service_update = {"update_time":this_time} |
| 39 | 39 | map_service_update = {} |
| ... | ... | @@ -59,6 +59,8 @@ class Api(ApiTemplate): |
| 59 | 59 | if not resp_json["status"]=="1": |
| 60 | 60 | raise Exception("调用矢量服务的修改服务接口失败!") |
| 61 | 61 | |
| 62 | + service_update["overview"] = resp_json["url"] | |
| 63 | + | |
| 62 | 64 | # 修改功能 |
| 63 | 65 | if functions: |
| 64 | 66 | new_types = functions.split(",") |
| ... | ... | @@ -75,7 +77,7 @@ class Api(ApiTemplate): |
| 75 | 77 | map_service = MapService.query.filter_by(service_guid=guid) |
| 76 | 78 | |
| 77 | 79 | if service_update: |
| 78 | - service.update(service_update) | |
| 80 | + Service.query.filter_by(guid=guid).update(service_update) | |
| 79 | 81 | if map_service_update: |
| 80 | 82 | map_service.update(map_service_update) |
| 81 | 83 | ... | ... |
| ... | ... | @@ -2,12 +2,13 @@ |
| 2 | 2 | #author: 4N |
| 3 | 3 | #createtime: 2022/1/14 |
| 4 | 4 | #email: nheweijun@sina.com |
| 5 | - | |
| 5 | +from authlib.integrations.flask_oauth2 import current_token | |
| 6 | 6 | import configure |
| 7 | 7 | class UserCheck: |
| 8 | 8 | |
| 9 | 9 | @classmethod |
| 10 | - def verify(cls,owner,operator): | |
| 10 | + def verify(cls,owner): | |
| 11 | 11 | if configure.PermissionActive: |
| 12 | + operator = current_token.user.username | |
| 12 | 13 | if configure.PermissionActive and operator != "admin" and owner !=operator: |
| 13 | 14 | raise Exception("缺乏权限!") | ... | ... |
| 1 | -<VirtualHost *:80> | |
| 2 | - ServerName 172.26.60.101 | |
| 1 | +Listen 81 | |
| 2 | +<VirtualHost *:81> | |
| 3 | + ServerName 172.26.60.100 | |
| 3 | 4 | WSGIDaemonProcess yourapplication processes=4 threads=16 |
| 4 | 5 | WSGIScriptAlias / /usr/src/app/run.wsgi |
| 5 | 6 | WSGIPassAuthorization On |
| ... | ... | @@ -11,11 +12,9 @@ |
| 11 | 12 | Require all granted |
| 12 | 13 | </Directory> |
| 13 | 14 | </VirtualHost> |
| 14 | - | |
| 15 | -Listen 81 | |
| 16 | - | |
| 17 | -<VirtualHost *:81> | |
| 18 | - ServerName 172.26.60.101 | |
| 15 | +Listen 82 | |
| 16 | +<VirtualHost *:82> | |
| 17 | + ServerName 172.26.60.100 | |
| 19 | 18 | WSGIDaemonProcess monitormanager processes=1 threads=8 |
| 20 | 19 | WSGIScriptAlias / /usr/src/app/monitor.wsgi |
| 21 | 20 | WSGIPassAuthorization On | ... | ... |
请
注册
或
登录
后发表评论