12345678910111213141516171819 |
- # coding=utf-8
- from apps.WechatApplet.models import WechatApplet
- from apps.WechatTp.models import WechatTp
- from utils.exceptions import CustomError
- class TenantBiz():
- @staticmethod
- def bindWechatApplet(tenant, auth_code):
- tp = WechatTp.getDefault()
- if tenant.delete:
- raise CustomError(u'该企业已被删除!')
- if tenant.is_bind_app:
- raise CustomError(u'该企业已绑定小程序!')
- app = WechatApplet.addAuthorizer(tp, auth_code, tenant)
- tenant.is_bind_app = True
- tenant.save()
- return app
|