import json from utils.base import APIView, get_offset_count class LaboratoryListView(APIView): def get(self, request): offset, count = get_offset_count(request) data = self.rpc['venus/sun/laboratory/list'](offset=offset, count=count).unwrap() return data class LaboratoryView(APIView): def post(self, request): laboratory_id = request.POST.get('id', None) title = request.POST.get("title", "") order = request.POST.get("order", "") image_url = request.POST.get("image_url", "") agreement_url = request.POST.get("agreement_url", "") description_fomula = request.POST.get("description_fomula", "") data = self.rpc["venus/sun/laboratory/create"]( title=title, order=order, description_fomula=description_fomula, image_url=image_url, agreement_url=agreement_url, laboratory_id=laboratory_id ).unwrap() return data class LaboratoryDeleteView(APIView): def post(self, request): laboratory_id = request.POST.get('id', None) data = self.rpc['venus/sun/laboratory/delete']( laboratory_id=laboratory_id ).unwrap() return { "status": 1 }