|
@@ -195,10 +195,12 @@ class AppInfo(View):
|
|
bundleVersion = request_dict.get('bundleVersion', None)
|
|
bundleVersion = request_dict.get('bundleVersion', None)
|
|
minAppversion = request_dict.get('minAppversion', None)
|
|
minAppversion = request_dict.get('minAppversion', None)
|
|
downloadLink = request_dict.get('downloadLink', None)
|
|
downloadLink = request_dict.get('downloadLink', None)
|
|
|
|
+ f = self.request.FILES.get('file', None)
|
|
if not all(
|
|
if not all(
|
|
[appBundleId, appName, systemLanguage, newAppversion, content, app_type, bundleVersion]):
|
|
[appBundleId, appName, systemLanguage, newAppversion, content, app_type, bundleVersion]):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
try:
|
|
try:
|
|
|
|
+
|
|
app_info = App_Info.objects.get(id=id)
|
|
app_info = App_Info.objects.get(id=id)
|
|
app_info.appBundleId = appBundleId
|
|
app_info.appBundleId = appBundleId
|
|
app_info.appName = appName
|
|
app_info.appName = appName
|
|
@@ -209,6 +211,20 @@ class AppInfo(View):
|
|
app_info.minAppversion = minAppversion
|
|
app_info.minAppversion = minAppversion
|
|
app_info.bundleVersion = bundleVersion
|
|
app_info.bundleVersion = bundleVersion
|
|
app_info.downloadLink = downloadLink
|
|
app_info.downloadLink = downloadLink
|
|
|
|
+ if f:
|
|
|
|
+ try:
|
|
|
|
+ rv_path = 'static/app/image/' + appBundleId + '.png'
|
|
|
|
+ as_path = os.path.join(BASE_DIR, rv_path)
|
|
|
|
+ if os.path.exists(as_path):
|
|
|
|
+ os.remove(as_path)
|
|
|
|
+ with open(as_path, 'wb+') as destination:
|
|
|
|
+ for chunk in f.chunks():
|
|
|
|
+ destination.write(chunk)
|
|
|
|
+ except Exception as e:
|
|
|
|
+ print(repr(e))
|
|
|
|
+ pass
|
|
|
|
+ else:
|
|
|
|
+ app_info.img = rv_path
|
|
app_info.save()
|
|
app_info.save()
|
|
except Exception as e:
|
|
except Exception as e:
|
|
return response.json(404, repr(e))
|
|
return response.json(404, repr(e))
|