|
|
@ -17,6 +17,7 @@ from api.utils.mp.wechat import check_signature, WxMsgCrypt, get_userinfo_from_o |
|
|
|
from api.utils.response import BaseResponse |
|
|
|
from api.utils.response import BaseResponse |
|
|
|
from api.utils.serializer import ThirdWxSerializer |
|
|
|
from api.utils.serializer import ThirdWxSerializer |
|
|
|
from api.utils.storage.caches import set_wx_ticket_login_info_cache |
|
|
|
from api.utils.storage.caches import set_wx_ticket_login_info_cache |
|
|
|
|
|
|
|
from api.views.login import get_login_type |
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
@ -155,6 +156,8 @@ class ThirdWxAccount(APIView): |
|
|
|
|
|
|
|
|
|
|
|
def get(self, request): |
|
|
|
def get(self, request): |
|
|
|
res = BaseResponse() |
|
|
|
res = BaseResponse() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if get_login_type().get('third', '').get('wxp'): |
|
|
|
# wx_open_id = request.query_params.get("openid", None) |
|
|
|
# wx_open_id = request.query_params.get("openid", None) |
|
|
|
wx_obj_lists = ThirdWeChatUserInfo.objects.filter(user_id=request.user) |
|
|
|
wx_obj_lists = ThirdWeChatUserInfo.objects.filter(user_id=request.user) |
|
|
|
# if wx_open_id: |
|
|
|
# if wx_open_id: |
|
|
@ -172,6 +175,6 @@ class ThirdWxAccount(APIView): |
|
|
|
def delete(self, request): |
|
|
|
def delete(self, request): |
|
|
|
openid = request.query_params.get("openid") |
|
|
|
openid = request.query_params.get("openid") |
|
|
|
user_id = request.query_params.get("user_id") |
|
|
|
user_id = request.query_params.get("user_id") |
|
|
|
if openid and user_id: |
|
|
|
if get_login_type().get('third', '').get('wxp') and openid and user_id: |
|
|
|
ThirdWeChatUserInfo.objects.filter(user_id_id=user_id, openid=openid).delete() |
|
|
|
ThirdWeChatUserInfo.objects.filter(user_id_id=user_id, openid=openid).delete() |
|
|
|
return self.get(request) |
|
|
|
return self.get(request) |
|
|
|