def post(self, request): entity_ids = request.data.get('commodity_ids', []) is_off_shelve = to_bool(request.data.get('is_off_shelve', '')) entity_ids = map(lambda c:int(c), entity_ids) FacadeFactory(request.user).get_obj(facades.CommodityFacade).batch_shelve(entity_ids, is_off_shelve) return self.ajax_result(None, message=u'批量下架成功')
def get(self, request): params = CommodityQueryModel(request.query_params) params.is_off_shelve = to_bool(params.is_off_shelve[0]) commodities = FacadeFactory(request.user).get_obj(facades.CommodityFacade).list(params) serializer = serializers.CommoditySerializer(commodities, many=True) return self.ajax_result(serializer.data)