3R155">155
+                    var no = $('#no').val();
156
+                    if (!no) {
157
+                        show_error_dialog('编号', '导游证编号错误,请检查重新输入');
158
+                        return false;
159
+                    }
160
+
161
+                    return {
162
+                        unionid: unionid,
163
+                        openid: getURLParameter('openid'),
164
+                        name: name,
165
+                        sex: $('#sex option:checked').val(),
166
+                        phone: $('#phone').val(),
167
+{#                        location: location,#}
168
+                        no: no,
169
+                    }
170
+                }
171
+
172
+                $('#submit').click(function () {
173
+                    var check_result = data_check();
174
+                    if (check_result){
175
+                        $.ajax({
176
+                            type: 'POST',
177
+                            url: 't/submit',
178
+                            data: check_result,
179
+                            success: function(data) {
180
+                                if (data.status == 200) {
181
+                                    $('#toast').show();
182
+                                    setTimeout(function () {
183
+                                        $('#toast').hide();
184
+                                    }, 1000);
185
+                                    window.location.reload();
186
+                                } else {
187
+                                    show_error_dialog('错误', data.description);
188
+                                }
189
+                            }
190
+                        })
191
+                    }
192
+                });
193
+
194
+                $('#dialog .weui_btn_dialog').click(function () {
195
+                    $('#dialog').hide();
196
+                })
197
+            });
198
+            {% endif %}
199
+        </script>
200
+        <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
201
+        <script type="text/javascript" src="{% static 'pai2/js/jswe.js' %}?v=1"></script>
202
+        <script>
203
+            V.initWxData({
204
+                imgUrl: "http://pai.ai/static/pai2/img/paiai_96_96.png",
205
+                link: 'http://api.pai.ai/wx_oauth2?redirect_url=http://pai.ai/page/tourguide&scope=snsapi_base',
206
+                desc: "导游授权",
207
+                title: "导游授权",
208
+                timeLine: ""
209
+            }, true);
210
+            V.hideOptionMenu();
211
+        </script>
212
+    </body>
213
+</html>

+ 15 - 1
page/views.py

@@ -2,7 +2,7 @@
2 2
 
3 3
 from django.shortcuts import render
4 4
 
5
-from account.models import LensmanInfo
5
+from account.models import LensmanInfo, TourGuideInfo
6 6
 
7 7
 
8 8
 def user_agreement(request):
@@ -29,3 +29,17 @@ def lensman_oauth(request):
29 29
 
30 30
 def lensman_price(request):
31 31
     return render(request, 'page/lensman_price.html', {})
32
+
33
+
34
+def tourguide_oauth(request):
35
+    unionid = request.GET.get('unionid', '')
36
+
37
+    try:
38
+        tourguide = TourGuideInfo.objects.get(unionid=unionid)
39
+    except TourGuideInfo.DoesNotExist:
40
+        tourguide = None
41
+
42
+    return render(request, 'page/tourguide_oauth.html', {
43
+        'tourguide_info': tourguide and tourguide.data,
44
+        'modified': bool((not tourguide) or (tourguide and tourguide.user_status in [TourGuideInfo.UNVERIFIED, TourGuideInfo.REFUSED])),  # 是否可以更改信息
45
+    })

+ 8 - 0
pai2/urls.py

@@ -22,6 +22,7 @@ from django.contrib import admin
22 22
 from rest_framework import routers
23 23
 
24 24
 from account import views as account_views
25
+from account import tourguide_views
25 26
 from group import views as group_views
26 27
 from group import lensman_views
27 28
 from page import views as page_views
@@ -69,6 +70,8 @@ urlpatterns += [
69 70
 
70 71
     url(r'^page/lensman$', page_views.lensman_oauth, name='lensman_oauth'),  # 摄影师授权页面
71 72
     url(r'^page/price$', page_views.lensman_price, name='lensman_price'),  # 摄影师照片价格和分成规则
73
+
74
+    url(r'^page/tourguide$', page_views.tourguide_oauth, name='tourguide_oauth'),  # 导游授权页面
72 75
 ]
73 76
 
74 77
 urlpatterns += [
@@ -84,6 +87,11 @@ urlpatterns += [
84 87
     url(r'^page/l/submit$', lensman_views.lensman_submit_api, name='lensman_submit_api'),  # 摄影师信息提交
85 88
 ]
86 89
 
90
+# 导游相关
91
+urlpatterns += [
92
+    url(r'^page/t/submit$', tourguide_views.tourguide_submit_api, name='tourguide_submit_api'),  # 导游信息提交
93
+]
94
+
87 95
 # Wire up our API using automatic URL routing.
88 96
 # Additionally, we include login URLs for the browsable API.
89 97
 urlpatterns += [

+ 23 - 11
utils/error/errno_utils.py

@@ -15,25 +15,37 @@ class LensmanStatusCode(BaseStatusCode):
15 15
     LENSMAN_NOT_ACTIVATED = StatusCodeField(400015, u'Lensman Not Activated', description=u'摄影师帐号未激活')
16 16
 
17 17
 
18
+class TourGuideStatusCode(BaseStatusCode):
19
+    """ 导游相关错误码 4001xx """
20
+    TOURGUIDE_NOT_FOUND = StatusCodeField(400101, u'Tour Guide Not Found', description=u'导游不存在')
21
+    TOURGUIDE_PASSWORD_ERROR = StatusCodeField(400102, u'Tour Guide Password Error', description=u'导游密码错误')
22
+
23
+    TOURGUIDE_PHONE_ALREADY_EXISTS = StatusCodeField(400105, u'Tour Guide Phone Already Exists', description=u'手机号已经存在')
24
+
25
+    TOURGUIDE_ALREADY_NOT_UNVERIFIED = StatusCodeField(400110, u'Tour Guide Already Not Unverified', description=u'导游帐号已激活')
26
+
27
+    TOURGUIDE_NOT_ACTIVATED = StatusCodeField(400115, u'Tour Guide Not Activated', description=u'导游帐号未激活')
28
+
29
+
18 30
 class UserStatusCode(BaseStatusCode):
19
-    """ 用户相关错误码  4001xx """
20
-    USER_NOT_FOUND = StatusCodeField(400101, u'User Not Found', description=u'用户不存在')
21
-    USER_PASSWORD_ERROR = StatusCodeField(400102, u'User Password Error', description=u'用户密码错误')
22
-    USERNAME_HAS_REGISTERED = StatusCodeField(400103, u'Username Has Registered', description=u'用户名已注册')
31
+    """ 用户相关错误码  4005xx """
32
+    USER_NOT_FOUND = StatusCodeField(400501, u'User Not Found', description=u'用户不存在')
33
+    USER_PASSWORD_ERROR = StatusCodeField(400502, u'User Password Error', description=u'用户密码错误')
34
+    USERNAME_HAS_REGISTERED = StatusCodeField(400503, u'Username Has Registered', description=u'用户名已注册')
23 35
 
24
-    GUEST_NOT_ALLOWED = StatusCodeField(400111, u'Guest Not ALLOWED', description=u'游客登录未开启')
36
+    GUEST_NOT_ALLOWED = StatusCodeField(400511, u'Guest Not ALLOWED', description=u'游客登录未开启')
25 37
 
26 38
 
27 39
 class PhoneStatusCode(BaseStatusCode):
28
-    """ 手机相关错误码  4002xx """
29
-    PHONE_NOT_FOUND = StatusCodeField(400201, u'Phone Not Found', description=u'手机不存在')
40
+    """ 手机相关错误码  4006xx """
41
+    PHONE_NOT_FOUND = StatusCodeField(400601, u'Phone Not Found', description=u'手机不存在')
30 42
 
31 43
 
32 44
 class WechatStatusCode(BaseStatusCode):
33
-    """ 微信相关错误码  4003xx """
34
-    WECHAT_NOT_FOUND = StatusCodeField(400301, u'Wechat Not Found', description=u'微信不存在')
35
-    UNIONID_NOT_FOUND = StatusCodeField(400302, u'Unionid Not Found', description=u'微信 UNIONID 不存在')
36
-    OPENID_NOT_FOUND = StatusCodeField(400303, u'OPENID Not Found', description=u'微信 OPENID 不存在')
45
+    """ 微信相关错误码  4007xx """
46
+    WECHAT_NOT_FOUND = StatusCodeField(400701, u'Wechat Not Found', description=u'微信不存在')
47
+    UNIONID_NOT_FOUND = StatusCodeField(400702, u'Unionid Not Found', description=u'微信 UNIONID 不存在')
48
+    OPENID_NOT_FOUND = StatusCodeField(400703, u'OPENID Not Found', description=u'微信 OPENID 不存在')
37 49
 
38 50
 
39 51
 class PhotoStatusCode(BaseStatusCode):

Kodo/kodo - Gogs: Go Git Service

1 Commits (38ef14de915c94230e5d5db0852e2b713ada86bc)

Autor SHA1 Mensagem Data
  Brightcells 246a9ff4b8 Change to 'from utils.redis.connect import r' 9 anos atrás