完成基本审核功能
Change-Id: Ib93823f864d5340b034a37af4e4cb3fb2cd5491a
diff --git a/TRM/back/app/routes.py b/TRM/back/app/routes.py
index 90c9c5c..19ff870 100644
--- a/TRM/back/app/routes.py
+++ b/TRM/back/app/routes.py
@@ -11,6 +11,7 @@
@main.route('/apostlist',methods=['POST','GET'])
def postlist():
data=request.get_json()
+ print(data)
engine=create_engine(Config.SQLURL)
SessionLocal = sessionmaker(bind=engine)
session = SessionLocal()
@@ -61,3 +62,19 @@
+@main.route('/nginxauth',methods=['POST','GET'])
+def nginxauth():
+ data=request.get_json()
+ engine=create_engine(Config.SQLURL)
+ SessionLocal = sessionmaker(bind=engine)
+ session = SessionLocal()
+ f=Fpost(session)
+ checres=f.checkid(data['userid'])
+ if(not checres):
+ return jsonify({'status': 'error', 'message': 'Unauthorized'})
+
+ res=f.nginxauth(data['postid'],data['status'])
+ if not res:
+ return jsonify({'status': 'error', 'message': 'Post not found'})
+
+ return jsonify({'status': 'success', 'message': 'Nginx auth updated successfully'})
\ No newline at end of file