|
@@ -45,12 +45,22 @@ class OperationHelpViewSet(CustomModelViewSet):
|
|
|
if file:
|
|
|
operation_help_img._add_img(file, user)
|
|
|
image = operation_help_img.image
|
|
|
- return response_ok(image)
|
|
|
-
|
|
|
- # @action(methods=['post'], detail=False)
|
|
|
- # def upload_radio(self, request):
|
|
|
- # file = self.request.FILES.get('file')
|
|
|
- # radio_path = OperationHelpRadio.objects._add_(file, request.user)
|
|
|
- # if radio_path:
|
|
|
- # return response_ok(radio_path)
|
|
|
- # return response_error('上传失败,请重新上传!')
|
|
|
+ data={
|
|
|
+ "src": image
|
|
|
+ }
|
|
|
+ return response_ok(data)
|
|
|
+ return response_error('上传失败,请重新上传!')
|
|
|
+
|
|
|
+ @action(methods=['post'], detail=False)
|
|
|
+ def upload_radio(self, request):
|
|
|
+ file = self.request.FILES.get('file')
|
|
|
+ user = self.request.user
|
|
|
+ operation_help_radio = OperationHelpRadio.objects.create(tenant=user.employee.tenant)
|
|
|
+ if file:
|
|
|
+ operation_help_radio._add_radio(file, user)
|
|
|
+ radio_path = operation_help_radio.radio_path
|
|
|
+ data = {
|
|
|
+ "src": radio_path
|
|
|
+ }
|
|
|
+ return response_ok(data)
|
|
|
+ return response_error('上传失败,请重新上传!')
|