切换微信绑定
This commit is contained in:
parent
e540b15b73
commit
eada0465d9
|
@ -34,12 +34,12 @@ const store = new Vuex.Store({
|
|||
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {},
|
||||
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
|
||||
// vuex_host: 'http://127.0.0.1:8000',
|
||||
// vuex_api: 'http://127.0.0.1:8000/api',
|
||||
// vuex_apifile: 'http://127.0.0.1:8000/api/file/',
|
||||
vuex_api: 'http://127.0.0.1:8000/api',
|
||||
vuex_apifile: 'http://127.0.0.1:8000/api/file/',
|
||||
|
||||
vuex_host: 'https://testsearch.ctc.ac.cn',
|
||||
vuex_api: 'https://testsearch.ctc.ac.cn/api',
|
||||
vuex_apifile: 'https://testsearch.ctc.ac.cn/api/file/',
|
||||
// vuex_api: 'https://testsearch.ctc.ac.cn/api',
|
||||
// vuex_apifile: 'https://testsearch.ctc.ac.cn/api/file/',
|
||||
|
||||
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
|
||||
// vuex_version: '1.0.1',
|
||||
|
|
|
@ -343,9 +343,10 @@ class UserViewSet(PageOrNot, ModelViewSet):
|
|||
code+'&grant_type=authorization_code').content.decode('utf-8')
|
||||
info = json.loads(info)
|
||||
openid = info['openid']
|
||||
if UserThird.objects.filter(openid=openid).exists():
|
||||
instance = UserThird.objects.get(openid=openid)
|
||||
instance.openid = openid
|
||||
instances = UserThird.objects.filter(openid=openid)
|
||||
if instances.exists():
|
||||
instance = instances[0]
|
||||
instance.user = request.user
|
||||
instance.save()
|
||||
else:
|
||||
UserThird.objects.get_or_create(openid=openid, type='wx_mp', user=request.user, defaults={'openid':openid, 'user':request.user, 'type':'wx_mp'})
|
||||
|
|
Loading…
Reference in New Issue