35dc3f45 by 冯轩

MOD:api

1 parent 33a3d92e
...@@ -1940,16 +1940,18 @@ class SearchGBHistoryFileView(GenericView): ...@@ -1940,16 +1940,18 @@ class SearchGBHistoryFileView(GenericView):
1940 return response.ok(data=True) 1940 return response.ok(data=True)
1941 1941
1942 class DownloadGBHistoryFileView(GenericView): 1942 class DownloadGBHistoryFileView(GenericView):
1943 permission_classes = [IsAuthenticated] 1943 # permission_classes = [IsAuthenticated]
1944 authentication_classes = [OAuth2AuthenticationWithUser] 1944 # authentication_classes = [OAuth2AuthenticationWithUser]
1945 1945
1946 @use_args(d_gb_file_args, location='data') 1946 @use_args(d_gb_file_args, location='data')
1947 def post(self, request, args): 1947 def post(self, request, args):
1948
1949 business_type = args.get('business_type')
1950 object_id = args.get('object_id')
1951 save_path = args.get('save_path')
1952 ecm = ECM()
1953 ecm.download(save_path, object_id, 'green_book', business_type)
1954 self.running_log.info('[DownloadGBHistoryFileView] [args={0}] '.format(args))
1955 return response.ok(data=False)
...\ No newline at end of file ...\ No newline at end of file
1948 try:
1949 business_type = args.get('business_type')
1950 object_id = args.get('object_id')
1951 save_path = args.get('save_path')
1952 ecm = ECM()
1953 ecm.download(save_path, object_id, 'green_book', business_type)
1954 self.running_log.info('[DownloadGBHistoryFileView] [args={0}] '.format(args))
1955 return response.ok(data=True)
1956 except Exception as e:
1957 return response.ok(data=False)
...\ No newline at end of file ...\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!