service_engine_edit.py
1.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
# coding=utf-8
#author: 4N
#createtime: 2021/9/14
#email: nheweijun@sina.com
from app.util.component.ApiTemplate import ApiTemplate
import requests
from app.modules.service.models import ServiceEngine,db
class Api(ApiTemplate):
api_name = "修改服务引擎"
def process(self):
res = {}
try:
udpate = {}
guid = self.para.get("guid")
for key in self.para.keys():
if key in ["name","url","out_url"]:
udpate[key] = self.para.get(key)
ServiceEngine.query.filter_by(guid=guid).update(udpate)
db.session.commit()
res["result"] = True
except Exception as e:
raise e
return res
api_doc = {
"tags": ["引擎接口"],
"parameters": [
{"name": "guid",
"in": "formData",
"type": "string",
"description": "guid"},
{"name": "name",
"in": "formData",
"type": "string"},
{"name": "url",
"in": "formData",
"type": "string"},
{"name": "out_url",
"in": "formData",
"type": "string"},
],
"responses": {
200: {
"schema": {
"properties": {
}
}
}
}
}