|
@@ -95,46 +95,40 @@ class AppInfo(View):
|
|
|
data=[appBundleId, appName, systemLanguage, newAppversion, content, app_type, bundleVersion])
|
|
|
if param_flag is not True:
|
|
|
return response.json(444)
|
|
|
-
|
|
|
- try:
|
|
|
- has_app_info = App_Info.objects.filter(appBundleId=appBundleId)
|
|
|
- except Exception:
|
|
|
- errorInfo = traceback.format_exc()
|
|
|
- print(errorInfo)
|
|
|
- return response.json(424, {'details': errorInfo})
|
|
|
+ has_app_info = App_Info.objects.filter(appBundleId=appBundleId)
|
|
|
+ if has_app_info.exists():
|
|
|
+ return response.json(174)
|
|
|
else:
|
|
|
- if has_app_info.exists():
|
|
|
- return response.json(174)
|
|
|
+ try:
|
|
|
+ app_Info = App_Info(
|
|
|
+ appBundleId=appBundleId,
|
|
|
+ appName=appName,
|
|
|
+ newAppversion=newAppversion,
|
|
|
+ systemLanguage=systemLanguage,
|
|
|
+ content=content,
|
|
|
+ app_type=app_type,
|
|
|
+ bundleVersion=bundleVersion,
|
|
|
+ downloadLink=downloadLink)
|
|
|
+ app_Info.save()
|
|
|
+ except Exception:
|
|
|
+ errorInfo = traceback.format_exc()
|
|
|
+ print(errorInfo)
|
|
|
+ return response.json(500, {'details': errorInfo})
|
|
|
else:
|
|
|
- try:
|
|
|
- app_Info = App_Info(
|
|
|
- appBundleId=appBundleId,
|
|
|
- appName=appName,
|
|
|
- newAppversion=newAppversion,
|
|
|
- systemLanguage=systemLanguage,
|
|
|
- content=content,
|
|
|
- app_type=app_type,
|
|
|
- bundleVersion=bundleVersion,
|
|
|
- downloadLink=downloadLink)
|
|
|
- app_Info.save()
|
|
|
- except Exception:
|
|
|
- errorInfo = traceback.format_exc()
|
|
|
- print(errorInfo)
|
|
|
- return response.json(500, {'details': errorInfo})
|
|
|
+ if app_Info.id:
|
|
|
+ res = {'appBundleId': app_Info.appBundleId,
|
|
|
+ 'appName': app_Info.appName,
|
|
|
+ 'newAppversion': app_Info.newAppversion,
|
|
|
+ 'systemLanguage': app_Info.systemLanguage,
|
|
|
+ 'content': app_Info.content,
|
|
|
+ 'app_type': app_Info.app_type,
|
|
|
+ 'id': app_Info.id,
|
|
|
+ 'downloadLink': downloadLink,
|
|
|
+ 'bundleVersion': app_Info.bundleVersion}
|
|
|
+ return response.json(0, res)
|
|
|
else:
|
|
|
- if app_Info.id:
|
|
|
- res = {'appBundleId': app_Info.appBundleId,
|
|
|
- 'appName': app_Info.appName,
|
|
|
- 'newAppversion': app_Info.newAppversion,
|
|
|
- 'systemLanguage': app_Info.systemLanguage,
|
|
|
- 'content': app_Info.content,
|
|
|
- 'app_type': app_Info.app_type,
|
|
|
- 'id': app_Info.id,
|
|
|
- 'downloadLink': downloadLink,
|
|
|
- 'bundleVersion': app_Info.bundleVersion}
|
|
|
- return response.json(0, res)
|
|
|
- else:
|
|
|
- return response.json(500)
|
|
|
+ return response.json(500)
|
|
|
+
|
|
|
|
|
|
def query(self, request_dict, userID, response):
|
|
|
own_perm = ModelService.check_perm(userID=userID, permID=30)
|
|
@@ -166,13 +160,10 @@ class AppInfo(View):
|
|
|
app_type = request_dict.get('app_type', None)
|
|
|
bundleVersion = request_dict.get('bundleVersion', None)
|
|
|
downloadLink = request_dict.get('downloadLink', None)
|
|
|
- param_flag = CommonService.get_param_flag(
|
|
|
- data=[appBundleId, appName, systemLanguage, newAppversion, content, app_type, bundleVersion,
|
|
|
- downloadLink])
|
|
|
- if param_flag is not True:
|
|
|
+ if not all([appBundleId, appName, systemLanguage, newAppversion, content, app_type, bundleVersion, downloadLink]):
|
|
|
return response.json(444)
|
|
|
- app_info = App_Info.objects.get(id=id)
|
|
|
- if app_info.id:
|
|
|
+ try:
|
|
|
+ app_info = App_Info.objects.get(id=id)
|
|
|
app_info.appBundleId = appBundleId
|
|
|
app_info.appName = appName
|
|
|
app_info.systemLanguage = systemLanguage
|
|
@@ -182,6 +173,9 @@ class AppInfo(View):
|
|
|
app_info.bundleVersion = bundleVersion
|
|
|
app_info.downloadLink = downloadLink
|
|
|
app_info.save()
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(404,repr(e))
|
|
|
+ else:
|
|
|
return response.json(0, {'update_id': app_info.id, 'update_time': str(app_info.update_time)})
|
|
|
|
|
|
def delete(self, request_dict, userID, response):
|