From eada0465d919d1de5328b605c028e21173fbac1c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 30 Apr 2021 12:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=BE=AE=E4=BF=A1=E7=BB=91?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client_mp/store/index.js | 8 ++++---- server/apps/system/views.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client_mp/store/index.js b/client_mp/store/index.js index 5860176..6ece716 100644 --- a/client_mp/store/index.js +++ b/client_mp/store/index.js @@ -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', diff --git a/server/apps/system/views.py b/server/apps/system/views.py index b3a5bba..85f2e5c 100644 --- a/server/apps/system/views.py +++ b/server/apps/system/views.py @@ -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'})