@@ -15,6 +15,9 @@ urlpatterns = [ |
||
15 | 15 |
|
16 | 16 |
urlpatterns += [ |
17 | 17 |
url(r'^intro/list$', intro_views.intro_list_api, name='intro_list_api'), # 说明书列表 |
18 |
+ |
|
19 |
+ url(r'^intro/name/info$', intro_views.intro_name_info_api, name='intro_name_info_api'), # 说明书名称详情 |
|
20 |
+ |
|
18 | 21 |
url(r'^intro/query$', intro_views.intro_query_api, name='intro_query_api'), # 说明书搜索 |
19 | 22 |
|
20 | 23 |
url(r'^intro/fav$', fav_views.intro_fav_api, name='intro_fav_api'), # 说明书收藏 |
@@ -3,7 +3,8 @@ from __future__ import unicode_literals |
||
3 | 3 |
|
4 | 4 |
from logit import logit |
5 | 5 |
|
6 |
-from intro.models import IntroCategoryInfo, IntroContentInfo |
|
6 |
+from intro.models import IntroCategoryInfo, IntroContentInfo, IntroNameInfo |
|
7 |
+from utils.error.errno_utils import IntroStatusCode |
|
7 | 8 |
from utils.error.response_utils import response |
8 | 9 |
|
9 | 10 |
|
@@ -18,6 +19,20 @@ def intro_list_api(request): |
||
18 | 19 |
|
19 | 20 |
|
20 | 21 |
@logit |
22 |
+def intro_name_info_api(request): |
|
23 |
+ pk = int(request.POST.get('pk', 0)) |
|
24 |
+ |
|
25 |
+ try: |
|
26 |
+ name = IntroNameInfo.objects.get(pk=pk) |
|
27 |
+ except IntroNameInfo.DoesNotExist: |
|
28 |
+ return response(IntroStatusCode.INTRO_NAME_NOT_FOUND) |
|
29 |
+ |
|
30 |
+ return response(200, 'Get Intro Name Info Success', u'获取说明书信息成功', { |
|
31 |
+ 'name': name.data, |
|
32 |
+ }) |
|
33 |
+ |
|
34 |
+ |
|
35 |
+@logit |
|
21 | 36 |
def intro_query_api(request): |
22 | 37 |
query = request.POST.get('query', '') |
23 | 38 |
|
@@ -155,6 +155,10 @@ class IntroFavoriteInfo(CreateUpdateMixin): |
||
155 | 155 |
verbose_name = _(u'introfavoriteinfo') |
156 | 156 |
verbose_name_plural = _(u'introfavoriteinfo') |
157 | 157 |
|
158 |
+ unique_together = ( |
|
159 |
+ ('user_id', 'content'), |
|
160 |
+ ) |
|
161 |
+ |
|
158 | 162 |
def __unicode__(self): |
159 | 163 |
return unicode(self.pk) |
160 | 164 |
|
@@ -1,4 +1,3 @@ |
||
1 |
--e git+https://github.com/andymccurdy/redis-py.git#egg=redis-py |
|
2 | 1 |
Django==1.11.3 |
3 | 2 |
MySQL-python==1.2.5 |
4 | 3 |
StatusCode==1.0.0 |
@@ -10,6 +9,7 @@ django-logit==1.0.6 |
||
10 | 9 |
django-paginator2==1.0.3 |
11 | 10 |
django-shortuuidfield==0.1.3 |
12 | 11 |
django-uniapi==1.0.0 |
13 |
-django-we==1.0.8 |
|
12 |
+django-we==1.0.10 |
|
14 | 13 |
hiredis==0.2.0 |
14 |
+redis==2.10.6 |
|
15 | 15 |
redis-extensions==1.1.1 |
@@ -16,6 +16,11 @@ class MachineStatusCode(BaseStatusCode): |
||
16 | 16 |
MACHINE_BACK_NOT_FOUND = StatusCodeField(402102, 'Machine Back Not Found', description=u'机背不存在') |
17 | 17 |
|
18 | 18 |
|
19 |
+class IntroStatusCode(BaseStatusCode): |
|
20 |
+ """ 说明书相关错误码 4031xx """ |
|
21 |
+ INTRO_NAME_NOT_FOUND = StatusCodeField(403111, 'Intro Name Not Found', description=u'说明书不存在') |
|
22 |
+ |
|
23 |
+ |
|
19 | 24 |
class OrderStatusCode(BaseStatusCode): |
20 | 25 |
""" 订单/支付相关错误码 4040xx """ |
21 | 26 |
UNIFIED_ORDER_FAIL = StatusCodeField(404000, 'Unified Order Fail', description=u'统一下单失败') |