|
@@ -40,6 +40,7 @@ class WechatLoginSerializer(serializers.Serializer):
|
|
|
payload = jwt_payload_handler(user)
|
|
|
customer_log(customer_wechat.customer, BizLog.INSERT, u'用户微信登录,username=%s' % user.username)
|
|
|
tenant_id = customer_wechat.customer.tenant and customer_wechat.customer.tenant.id or ''
|
|
|
+ tenant_edition = customer_wechat.customer.tenant and customer_wechat.customer.tenant.edition or Tenant.EDITION_1
|
|
|
company_no = customer_wechat.customer.tenant and customer_wechat.customer.tenant.company_no or ''
|
|
|
nick_name = customer_wechat.customer.tenant and customer_wechat.customer.tenant.company_name or settings.WEAPP['nick_name']
|
|
|
is_validity = Tenant.check_validity(company_no)
|
|
@@ -49,6 +50,7 @@ class WechatLoginSerializer(serializers.Serializer):
|
|
|
'token': jwt_encode_handler(payload),
|
|
|
'openid': customer_wechat.openid,
|
|
|
'tenant_id': tenant_id,
|
|
|
+ 'tenant_edition': tenant_edition,
|
|
|
'is_validity': is_validity,
|
|
|
'nick_name': nick_name,
|
|
|
'name': customer_wechat.customer.name or '',
|
|
@@ -79,11 +81,13 @@ class WechatBindSerializer(serializers.Serializer):
|
|
|
payload = jwt_payload_handler(user)
|
|
|
customer_log(customer, BizLog.INSERT, u'用户微信登录,username=%s' % user.username)
|
|
|
tenant_id = ''
|
|
|
+ tenant_edition = Tenant.EDITION_1
|
|
|
nick_name = settings.WEAPP['nick_name']
|
|
|
if customer.tenant:
|
|
|
tenant_id = customer.tenant.id
|
|
|
company_no = customer.tenant.company_no
|
|
|
nick_name = customer.tenant.company_name
|
|
|
+ tenant_edition = customer.tenant.edition
|
|
|
elif company_no:
|
|
|
# 扫二维码,没有绑定企业的用户之间绑定企业
|
|
|
tenant = Tenant.objects.filter(company_no=company_no).first()
|
|
@@ -93,6 +97,7 @@ class WechatBindSerializer(serializers.Serializer):
|
|
|
tenant_id = tenant.id
|
|
|
company_no = tenant.company_no
|
|
|
nick_name = tenant.company_name
|
|
|
+ tenant_edition = tenant.edition
|
|
|
is_validity = Tenant.check_validity(company_no)
|
|
|
return {
|
|
|
'token': jwt_encode_handler(payload),
|
|
@@ -105,6 +110,7 @@ class WechatBindSerializer(serializers.Serializer):
|
|
|
'user_type': customer.type, # 用户类别,1为平台管理员,2为管理者,3检修人,4报修人
|
|
|
'forbid_baoxiu': 'true' and customer.status == Employee.DISABLE or 'false', # 是否禁用报修,
|
|
|
'tenant_id': tenant_id,
|
|
|
+ 'tenant_edition': tenant_edition,
|
|
|
'emplate_id': [settings.WEAPP['message_template_finish'],settings.WEAPP['message_template_wait_check'],
|
|
|
settings.WEAPP['message_template_dispatch'],],
|
|
|
}
|