+
+ remark = models.CharField(_(u'remark'), max_length=255, blank=True, null=True, help_text=u'备注')
+
+ class Meta:
+ verbose_name = _(u'userincomeexpensesinfo')
+ verbose_name_plural = _(u'userincomeexpensesinfo')
+
+ def __unicode__(self):
+ return unicode(self.pk)
@@ -1,6 +1,7 @@ |
||
| 1 | 1 |
# -*- coding: utf-8 -*- |
| 2 | 2 |
|
| 3 | 3 |
from curtail_uuid import CurtailUUID |
| 4 |
+from django.conf import settings |
|
| 4 | 5 |
from django.contrib.auth.hashers import check_password, make_password |
| 5 | 6 |
from django.contrib.auth.models import Group, User |
| 6 | 7 |
from django.http import JsonResponse |
@@ -207,6 +208,19 @@ def wx_authorize_api(request): |
||
| 207 | 208 |
}) |
| 208 | 209 |
|
| 209 | 210 |
|
| 211 |
+def guest_login_api(request): |
|
| 212 |
+ try: |
|
| 213 |
+ user = UserInfo.objects.get(user_id=settings.GUEST_USER_ID) |
|
| 214 |
+ except UserInfo.DoesNotExist: |
|
| 215 |
+ return response(UserStatusCode.GUEST_NOT_FOUND) |
|
| 216 |
+ |
|
| 217 |
+ return JsonResponse({
|
|
| 218 |
+ 'status': 200, |
|
| 219 |
+ 'message': u'Guest 登录成功', |
|
| 220 |
+ 'data': user.data, |
|
| 221 |
+ }) |
|
| 222 |
+ |
|
| 223 |
+ |
|
| 210 | 224 |
class UserViewSet(viewsets.ModelViewSet): |
| 211 | 225 |
""" |
| 212 | 226 |
API endpoint that allows users to be viewed or edited. |
@@ -18,6 +18,8 @@ urlpatterns = [ |
||
| 18 | 18 |
url(r'^u/login$', account_views.user_login_api, name='user_login_api'), # 用户登录 |
| 19 | 19 |
|
| 20 | 20 |
url(r'^u/wx/authorize$', account_views.wx_authorize_api, name='wx_authorize_api'), # 微信用户授权 |
| 21 |
+ |
|
| 22 |
+ url(r'^u/guest$', account_views.guest_login_api, name='guest_login_api'), # 游客登录 |
|
| 21 | 23 |
] |
| 22 | 24 |
|
| 23 | 25 |
# 群组相关 |
@@ -225,6 +225,7 @@ WECHAT_GET_OAUTH2_ACCESS_TOKEN = 'https://api.weixin.qq.com/sns/oauth2/access_to |
||
| 225 | 225 |
|
| 226 | 226 |
WECHAT_GET_USERINFO = 'https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s' |
| 227 | 227 |
|
| 228 |
+# 微信支付设置 |
|
| 228 | 229 |
WXPAY_NOTIFY_SUCCESS = '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>' |
| 229 | 230 |
WXPAY_NOTIFY_FAIL = '<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[XML PARSE FAIL]]></return_msg></xml>' |
| 230 | 231 |
|
@@ -250,6 +251,9 @@ PAI2_HOME_MAX_ROWS = 400 # 首页照片最大数量, PAI2_HOME_PER_PAGE * PAI2_ |
||
| 250 | 251 |
# 群组设置 |
| 251 | 252 |
GROUP_PER_PAGE = 20 # 群组每页数量 |
| 252 | 253 |
|
| 254 |
+# 游客设置 |
|
| 255 |
+GUEST_USER_ID = 'guest' |
|
| 256 |
+ |
|
| 253 | 257 |
# 价格设置 |
| 254 | 258 |
LENSMAN_PHOTO_HAGGLE_MAX_TIMES = 3 # 摄影师照片最大砍价次数 |
| 255 | 259 |
|
@@ -26,6 +26,8 @@ class UserStatusCode(BaseStatusCode): |
||
| 26 | 26 |
USER_PASSWORD_ERROR = StatusCodeField(400102, u'User Password Error', description=u'用户密码错误') |
| 27 | 27 |
USERNAME_HAS_REGISTERED = StatusCodeField(400103, u'Username Has Registered', description=u'用户名已注册') |
| 28 | 28 |
|
| 29 |
+ GUEST_NOT_FOUND = StatusCodeField(400111, u'Guest Not Found', description=u'游客不存在') |
|
| 30 |
+ |
|
| 29 | 31 |
|
| 30 | 32 |
class PhotoStatusCode(BaseStatusCode): |
| 31 | 33 |
""" 照片相关错误码 4010xx """ |