main #2
@ -149,30 +149,27 @@ def create_local_app(app_data):
|
||||
import json
|
||||
app_data = json.loads(app_data)
|
||||
|
||||
# 检查应用是否已存在
|
||||
if jingrow.db.exists("Local App", app_data["name"]):
|
||||
jingrow.throw("Local App already exists")
|
||||
# 检查应用名称是否已存在
|
||||
existing_app = jingrow.db.exists("Local App", {"app_name": app_data["app_name"]})
|
||||
if existing_app:
|
||||
return {"error": "应用名称已存在,请使用其他名称"}
|
||||
|
||||
# 创建应用
|
||||
app = jingrow.get_pg({
|
||||
"pagetype": "Local App",
|
||||
"name": app_data["name"],
|
||||
"app_name": app_data["app_name"],
|
||||
"title": app_data["title"],
|
||||
"subtitle": app_data.get("subtitle", ""),
|
||||
"description": app_data.get("description", ""),
|
||||
"category": app_data.get("category"),
|
||||
"team": team.name,
|
||||
"enabled": app_data.get("enabled", 1),
|
||||
"public": app_data.get("public", 1),
|
||||
"status": app_data.get("status", "Draft"),
|
||||
"team": team,
|
||||
"repository_url": app_data.get("repository_url"),
|
||||
"file_url": app_data.get("file_url"),
|
||||
"app_image": app_data.get("app_image")
|
||||
})
|
||||
|
||||
app.insert()
|
||||
return app.name
|
||||
return {"success": True, "name": app.name, "message": "应用创建成功"}
|
||||
|
||||
|
||||
@dashboard_whitelist()
|
||||
@ -210,6 +207,14 @@ def delete_local_app(name):
|
||||
return "Local App deleted successfully"
|
||||
|
||||
|
||||
@jingrow.whitelist(allow_guest=True)
|
||||
def get_local_app_meta():
|
||||
"""获取 Local App 元数据信息"""
|
||||
|
||||
meta = jingrow.get_meta("Local App")
|
||||
return meta.as_dict()
|
||||
|
||||
|
||||
@jingrow.whitelist(allow_guest=True)
|
||||
def get_local_app_categories():
|
||||
"""获取本地应用分类列表"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user