@@ -35,6 +35,7 @@ def update_course_field(request): |
||
35 | 35 |
|
36 | 36 |
|
37 | 37 |
def get_course_field(request): |
38 |
+ admin_id = request.POST.get('admin_id', '') |
|
38 | 39 |
field_id = request.POST.get('field_id', '') |
39 | 40 |
|
40 | 41 |
try: |
@@ -43,18 +44,19 @@ def get_course_field(request): |
||
43 | 44 |
return response() |
44 | 45 |
|
45 | 46 |
return response(data={ |
46 |
- 'field': field.data, |
|
47 |
+ 'field': field.qrcodedata(admin_id), |
|
47 | 48 |
}) |
48 | 49 |
|
49 | 50 |
|
50 | 51 |
def get_course_field_list(request): |
52 |
+ admin_id = request.POST.get('admin_id', '') |
|
51 | 53 |
page = request.POST.get('page', 1) |
52 | 54 |
num = request.POST.get('num', 20) |
53 | 55 |
|
54 | 56 |
fields = CourseRegisterFieldInfo.objects.filter(status=True) |
55 | 57 |
count = fields.count() |
56 | 58 |
fields, left = pagination(fields, page, num) |
57 |
- fields = [f.data for f in fields] |
|
59 |
+ fields = [f.qrcodedata(admin_id) for f in fields] |
|
58 | 60 |
|
59 | 61 |
return response(data={ |
60 | 62 |
'fields': fields, |
@@ -6,6 +6,8 @@ from django_models_ext import BaseModelMixin |
||
6 | 6 |
from jsonfield import JSONField |
7 | 7 |
from shortuuidfield import ShortUUIDField |
8 | 8 |
|
9 |
+from api.wx_views import get_course_field_limit_scene_qrcode_url |
|
10 |
+ |
|
9 | 11 |
|
10 | 12 |
class BranchCampusInfo(BaseModelMixin): |
11 | 13 |
campus_id = ShortUUIDField(_('campus_id'), max_length=32, blank=True, null=True, help_text='分院唯一标识', db_index=True, unique=True) |
@@ -121,6 +123,16 @@ class CourseRegisterFieldInfo(BaseModelMixin): |
||
121 | 123 |
'fields': self.fields, |
122 | 124 |
} |
123 | 125 |
|
126 |
+ def qrcodedata(self, admin_id): |
|
127 |
+ qrcode_url = get_course_field_limit_scene_qrcode_url('{}:{}'.format(self.field_id, admin_id)) |
|
128 |
+ return { |
|
129 |
+ 'field_id': self.field_id, |
|
130 |
+ 'course_id': self.course_id, |
|
131 |
+ 'course_name': self.course_name, |
|
132 |
+ 'fields': self.fields, |
|
133 |
+ 'qrcode_url': qrcode_url, |
|
134 |
+ } |
|
135 |
+ |
|
124 | 136 |
|
125 | 137 |
class CourseRegisterInfo(BaseModelMixin): |
126 | 138 |
user_id = models.CharField(_('user_id'), max_length=32, blank=True, null=True, help_text='用户唯一标识', db_index=True) |