wushaodong 4 lat temu
rodzic
commit
cc9704b975
1 zmienionych plików z 5 dodań i 12 usunięć
  1. 5 12
      apps/admin/tenant/views.py

+ 5 - 12
apps/admin/tenant/views.py

@@ -114,21 +114,14 @@ class TenantViewSet(CustomModelViewSet):
 
                 instance.status = status
                 instance.reject_reason = reject_reason
+
+                if not instance.wxapp_img:
+                    applet = WechatApplet.objects.filter(authorizer_appid=settings.WEAPP['appid']).first()
+                    filename = applet.getWXAppCode(instance.company_no)
+                    instance.wxapp_img = "{0}{1}".format(settings.MEDIA_URL, filename)
                 instance.save()
                 BizLog.objects.addnew(None, request.user, BizLog.INSERT, u'审核企业[%s]状态为[%s],id=%d' % (instance.company_name, status, instance.id))
 
-            tenant = Tenant.objects.filter(id=pk).first()
-            if tenant:
-                company_no = tenant.company_no
-            else:
-                raise CustomError('获取企业信息失败,请刷新重试!')
-            if not tenant.wxapp_img:
-                applet = WechatApplet.objects.filter(authorizer_appid=settings.WEAPP['appid']).first()
-                filename = applet.getWXAppCode(company_no)
-                tenant.wxapp_img = "{0}{1}".format(settings.MEDIA_URL, filename)
-                tenant.save()
-
-            return response_ok(tenant.wxapp_img)
         except CustomError as e:
             return response_error(e.get_error_msg())
         except Exception as e: