| @@ -8,8 +8,8 @@ from mch.models import ConsumeInfoSubmitLogInfo | ||
| 8 | 8 |  | 
| 9 | 9 |  | 
| 10 | 10 | class UserInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin): | 
| 11 | -    list_display = ('user_id', 'nickname', 'phone', 'unionid', 'openid', 'openid_miniapp', 'location', 'balance', 'integral', 'freeze_integral', 'user_status', 'test_user', 'status', 'created_at', 'updated_at') | |
| 12 | -    list_filter = ('subscribe', 'has_membercard', 'test_user', 'sex', 'user_status', 'status') | |
| 11 | +    list_display = ('user_id', 'nickname', 'phone', 'appid', 'unionid', 'openid', 'openid_miniapp', 'location', 'balance', 'integral', 'freeze_integral', 'user_status', 'test_user', 'status', 'created_at', 'updated_at') | |
| 12 | +    list_filter = ('appid', 'subscribe', 'has_membercard', 'test_user', 'sex', 'user_status', 'status') | |
| 13 | 13 |      readonly_fields = ('user_id', ) | 
| 14 | 14 |      search_fields = ('user_id', 'username', 'unionid', 'openid', 'openid_miniapp', 'name', 'phone', 'location') | 
| 15 | 15 |  | 
| @@ -0,0 +1,20 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.11.28 on 2020-03-15 14:40 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | +        ('account', '0042_userinfo_province_name'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AddField( | |
| 16 | + model_name='userinfo', | |
| 17 | + name='appid', | |
| 18 | + field=models.CharField(blank=True, db_index=True, help_text='appId', max_length=32, null=True, verbose_name='appid'), | |
| 19 | + ), | |
| 20 | + ] | 
| @@ -315,6 +315,7 @@ class UserInfo(BaseModelMixin, LensmanTypeBoolMixin): | ||
| 315 | 315 | username = models.CharField(_(u'username'), max_length=255, blank=True, null=True, help_text=u'用户用户名', db_index=True, unique=True) | 
| 316 | 316 | password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'用户密码') | 
| 317 | 317 | # 微信授权用户 | 
| 318 | + appid = models.CharField(_(u'appid'), max_length=32, blank=True, null=True, help_text=u'appId', db_index=True) | |
| 318 | 319 | unionid = models.CharField(_(u'unionid'), max_length=32, blank=True, null=True, help_text=u'微信 Unionid', db_index=True, unique=True) | 
| 319 | 320 | openid = models.CharField(_(u'openid'), max_length=32, blank=True, null=True, help_text=u'微信 Openid,拍爱用户端', db_index=True, unique=True) | 
| 320 | 321 | openid_lensman = models.CharField(_(u'openid_lensman'), max_length=32, blank=True, null=True, help_text=u'微信 Openid,拍爱摄影师端', db_index=True, unique=True) | 
| @@ -72,6 +72,7 @@ def get_userinfo_api(request): | ||
| 72 | 72 |  | 
| 73 | 73 | # Set User Key's Value | 
| 74 | 74 | user.user_from = UserInfo.MINIAPP_USER | 
| 75 | + user.appid = appId | |
| 75 | 76 |      user.unionid = userinfo.get('unionId', '') | 
| 76 | 77 |      user.openid_miniapp = userinfo.get('openId', '') | 
| 77 | 78 |      user.sex = userinfo.get('gender', '') | 
| @@ -151,6 +152,7 @@ def mini_login_api(request): | ||
| 151 | 152 |  | 
| 152 | 153 | # Set User Key's Value | 
| 153 | 154 | user.user_from = UserInfo.MINIAPP_USER | 
| 155 | + user.appid = appId | |
| 154 | 156 | if unionid: | 
| 155 | 157 | user.unionid = unionid | 
| 156 | 158 | user.user_status = UserInfo.ACTIVATED | 
| @@ -207,6 +209,7 @@ def get_userinfo_api2(request): | ||
| 207 | 209 | userinfo = get_userinfo(appid=appid, secret=secret, session_key=session_key, encryptedData=encryptedData, iv=iv) | 
| 208 | 210 |  | 
| 209 | 211 | # Set User Key's Value | 
| 212 | + user.appid = appId | |
| 210 | 213 |      user.unionid = userinfo.get('unionId', '') | 
| 211 | 214 |      user.openid_miniapp = userinfo.get('openId', '') | 
| 212 | 215 |      user.sex = userinfo.get('gender', '') |