scheme_edit.py
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# coding=utf-8
#author: 4N
#createtime: 2021/9/16
#email: nheweijun@sina.com
import uuid
from app.models import TileScheme,db
from app.util.component.ApiTemplate import ApiTemplate
import datetime
class Api(ApiTemplate):
api_name = "修改方案"
def process(self):
# 返回结果
res = {}
res["result"] = False
try:
# 业务逻辑
data = self.para
guid = data.get("guid")
tile_scheme:TileScheme = TileScheme.query.filter_by(guid=guid).one_or_none()
if tile_scheme is None:
raise Exception("不存在该切片方案!")
update_dict = data
update_dict["update_time"] = datetime.datetime.now()
del update_dict["guid"]
tile_scheme.update(update_dict)
db.session.commit()
res["data"] = guid
res["result"] = True
except Exception as e:
db.session.rollback()
raise Exception("参数填写错误!")
return res
api_doc = {
"tags": ["方案接口"],
"parameters": [
{"name": "guid",
"in": "formData",
"type": "string"},
{"name": "name",
"in": "formData",
"type": "string"},
{"name": "alias",
"in": "formData",
"type": "string"},
{"name": "crs",
"in": "formData",
"type": "string"},
{"name": "crs_wkt",
"in": "formData",
"type": "string"},
{"name": "extent",
"in": "formData",
"type": "string"},
{"name": "top_left",
"in": "formData",
"type": "string"},
{"name": "rows",
"in": "formData",
"type": "string"},
{"name": "cols",
"in": "formData",
"type": "string"},
{"name": "dpi",
"in": "formData",
"type": "string"},
{"name": "levels",
"in": "formData",
"type": "string"},
],
"responses": {
200: {
"schema": {
"properties": {
}
}
}
}
}