|
|
@ -24,11 +24,14 @@ from api.base_views import app_delete |
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_release_apps(res, app_serializer, apps_obj, storage): |
|
|
|
def get_release_apps(request, res, app_serializer, apps_obj, storage): |
|
|
|
res.data["currentapp"] = app_serializer.data |
|
|
|
page_obj = AppsPageNumber() |
|
|
|
app_release_obj = AppReleaseInfo.objects.filter(app_id=apps_obj).all().order_by("-created_time") |
|
|
|
app_release_obj = AppReleaseInfo.objects.filter(app_id=apps_obj).all().order_by("-created_time") |
|
|
|
app_release_serializer = AppReleaseSerializer(app_release_obj, many=True, |
|
|
|
app_release_page_serializer = page_obj.paginate_queryset(queryset=app_release_obj, request=request) |
|
|
|
|
|
|
|
app_release_serializer = AppReleaseSerializer(app_release_page_serializer, many=True, |
|
|
|
context={"storage": storage}) |
|
|
|
context={"storage": storage}) |
|
|
|
|
|
|
|
res.data['has_next'] = page_obj.page.has_next() |
|
|
|
|
|
|
|
res.data["currentapp"] = app_serializer.data |
|
|
|
res.data["release_apps"] = app_release_serializer.data |
|
|
|
res.data["release_apps"] = app_release_serializer.data |
|
|
|
return res |
|
|
|
return res |
|
|
|
|
|
|
|
|
|
|
@ -273,7 +276,7 @@ class AppReleaseinfoView(APIView): |
|
|
|
if apps_obj: |
|
|
|
if apps_obj: |
|
|
|
storage = Storage(request.user) |
|
|
|
storage = Storage(request.user) |
|
|
|
app_serializer = AppsSerializer(apps_obj, context={"storage": storage}) |
|
|
|
app_serializer = AppsSerializer(apps_obj, context={"storage": storage}) |
|
|
|
res = get_release_apps(res, app_serializer, apps_obj, storage) |
|
|
|
res = get_release_apps(request, res, app_serializer, apps_obj, storage) |
|
|
|
else: |
|
|
|
else: |
|
|
|
res.msg = "未找到该应用" |
|
|
|
res.msg = "未找到该应用" |
|
|
|
res.code = 1003 |
|
|
|
res.code = 1003 |
|
|
@ -297,6 +300,7 @@ class AppReleaseinfoView(APIView): |
|
|
|
|
|
|
|
|
|
|
|
apprelease_count = AppReleaseInfo.objects.filter(app_id=apps_obj).values("release_id").count() |
|
|
|
apprelease_count = AppReleaseInfo.objects.filter(app_id=apps_obj).values("release_id").count() |
|
|
|
appreleaseobj = AppReleaseInfo.objects.filter(app_id=apps_obj, release_id=act).first() |
|
|
|
appreleaseobj = AppReleaseInfo.objects.filter(app_id=apps_obj, release_id=act).first() |
|
|
|
|
|
|
|
if appreleaseobj: |
|
|
|
if not appreleaseobj.is_master: |
|
|
|
if not appreleaseobj.is_master: |
|
|
|
logger.info("delete app release %s" % (appreleaseobj)) |
|
|
|
logger.info("delete app release %s" % (appreleaseobj)) |
|
|
|
storage.delete_file(appreleaseobj.release_id, appreleaseobj.release_type) |
|
|
|
storage.delete_file(appreleaseobj.release_id, appreleaseobj.release_type) |
|
|
@ -362,6 +366,6 @@ class AppReleaseinfoView(APIView): |
|
|
|
|
|
|
|
|
|
|
|
del_cache_response_by_short(apps_obj.app_id) |
|
|
|
del_cache_response_by_short(apps_obj.app_id) |
|
|
|
app_serializer = AppsSerializer(apps_obj) |
|
|
|
app_serializer = AppsSerializer(apps_obj) |
|
|
|
res = get_release_apps(res, app_serializer, apps_obj, Storage(request.user)) |
|
|
|
res = get_release_apps(request, res, app_serializer, apps_obj, Storage(request.user)) |
|
|
|
|
|
|
|
|
|
|
|
return Response(res.dict) |
|
|
|
return Response(res.dict) |
|
|
|