1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import json
- from django.shortcuts import render
- from account.models import LensmanInfo, TourGuideInfo
- from utils.redis.connect import r
- def lensman_oauth(request):
- unionid = request.GET.get('unionid', '')
- try:
- lensman = LensmanInfo.objects.get(unionid=unionid)
- except LensmanInfo.DoesNotExist:
- lensman = None
- return render(request, 'page/lensman_oauth.html', {
- 'lensman_info': lensman and lensman.data,
- 'modified': bool((not lensman) or (lensman and lensman.user_status in [LensmanInfo.UNVERIFIED, LensmanInfo.REFUSED])),
- })
- def tourguide_oauth(request):
- unionid = request.GET.get('unionid', '')
- try:
- tourguide = TourGuideInfo.objects.get(unionid=unionid)
- except TourGuideInfo.DoesNotExist:
- tourguide = None
- return render(request, 'page/tourguide_oauth.html', {
- 'tourguide_info': tourguide and tourguide.data,
- 'modified': bool((not tourguide) or (tourguide and tourguide.user_status in [TourGuideInfo.UNVERIFIED, TourGuideInfo.REFUSED])),
- })
- def login_qrcode(request):
- unionid = request.GET.get('unionid', '')
- data = {
- 'unionid': unionid,
- 'token': r.token(unionid)
- }
- return render(request, 'page/login_qrcode.html', {
- 'data': json.dumps(data)
- })
|