9937dda3027dc290afca56146cdf71d4733d0e5bR406">406
+            'phone': self.phone,
407
+            'lensman_status': self.lensman_status,
408
+        }
409
+
410
+    @property
411
+    def admindata(self):
412
+        return {
413
+            'lensman_id': self.lensman_id,
414
+            'name': self.name,
415
+            'phone': self.phone,
416
+            'lensman_status': self.lensman_status,
417
+            'start_date': self.start_date,
418
+            'end_date': self.end_date,
419
+            'created_at': tc.local_string(utc_dt=self.created_at),
420
+        }
421
+
352 422
 class UserIntegralIncomeExpensesInfo(BaseModelMixin):
353 423
     PRODUCT = 0
354 424
     SHARE = 1

+ 81 - 0
api/lensman_admin_views.py

@@ -0,0 +1,81 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from __future__ import division
4
+
5
+from django_logit import logit
6
+from django_response import response
7
+from django.db.models import Q
8
+from paginator import pagination
9
+from TimeConvert import TimeConvert as tc
10
+
11
+from account.models import LensmanInfo
12
+from kodo.decorators import check_admin
13
+
14
+
15
+@logit
16
+@check_admin
17
+def lensman_list(request, administrator):
18
+    page = request.POST.get('page', 1)
19
+    num = request.POST.get('num', 20)
20
+    query = request.POST.get('query', '')
21
+
22
+    logs = LensmanInfo.objects.filter(status=True).order_by('-pk')
23
+
24
+    if query:
25
+      logs = logs.filter(Q(name__icontains=query) | Q(phone__icontains=query))
26
+
27
+    count = logs.count()
28
+    logs, left = pagination(logs, page, num)
29
+    logs = [log.admindata for log in logs]
30
+
31
+    return response(data={
32
+        'logs': logs,
33
+        'left': left,
34
+        'count': count,
35
+    })
36
+
37
+
38
+@logit
39
+@check_admin
40
+def lensman_audit(request, administrator):
41
+    lensman_id = request.POST.get('lensman_id', '')
42
+    start_date = tc.to_date(request.POST.get('start_date', ''))
43
+    end_date = tc.to_date(request.POST.get('end_date', ''))
44
+
45
+    try:
46
+      lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True)
47
+    except LensmanInfo.DoesNotExist:
48
+      return response(200, 'Lensman Not Found', u'摄影师不存在')
49
+    
50
+    lensman.lensman_status = LensmanInfo.ACTIVATED
51
+    lensman.start_date = start_date
52
+    lensman.end_date = end_date
53
+
54
+    lensman.save()
55
+
56
+    return response(200, 'Lensman Audit Pass Suceess', u'摄影师审核通过')
57
+
58
+
59
+@logit
60
+@check_admin
61
+def lensman_update(request, administrator):
62
+    lensman_id = request.POST.get('lensman_id', '')
63
+    start_date = tc.to_date(request.POST.get('start_date', ''))
64
+    end_date = tc.to_date(request.POST.get('end_date', ''))
65
+    name = request.POST.get('name', '')
66
+    phone = request.POST.get('phone', '')
67
+        
68
+    try:
69
+      lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True)
70
+    except LensmanInfo.DoesNotExist:
71
+      return response(200, 'Lensman Not Found', u'摄影师不存在')
72
+    
73
+    lensman.start_date = start_date
74
+    lensman.end_date = end_date
75
+    lensman.name = name
76
+    lensman.phone = phone
77
+
78
+    lensman.save()
79
+
80
+    return response(200, 'Lensman Info Update Suceess', u'摄影师信息更新成功')
81
+

+ 36 - 0
api/lensman_mp_views.py

@@ -0,0 +1,36 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from __future__ import division
4
+
5
+from django_logit import logit
6
+from django_response import response
7
+
8
+from account.models import LensmanInfo
9
+
10
+@logit
11
+def lensman_register(request):
12
+    user_id = request.POST.get('user_id', '')
13
+    name = request.POST.get('name', '')
14
+    phone = request.POST.get('phone', '')
15
+
16
+    fields = {
17
+        'user_id': user_id,
18
+        'name': name,
19
+        'phone': phone,
20
+    }
21
+
22
+    lensman, _ = LensmanInfo.objects.update_or_create(user_id=user_id, defaults=fields)
23
+
24
+    return response(200, 'Submit Success', u'提交成功', data=lensman.data)
25
+
26
+
27
+@logit
28
+def lensman_detail(request):
29
+  user_id = request.POST.get('user_id', '')
30
+
31
+  try:
32
+    lensman = LensmanInfo.objects.get(user_id=user_id, status=True)
33
+  except LensmanInfo.DoesNotExist:
34
+    return response(200, 'Lensman Not Found', u'摄影师不存在')
35
+
36
+  return response(200, 'Get Lensman Detail Success', u'获取摄影师信息成功', data=lensman.data)

+ 13 - 1
api/urls.py

@@ -6,7 +6,7 @@ from django_file_upload import views as file_views
6 6
 from api import (admin_views, clerk_views, complement_views, distributor_views, encrypt_views, express_views, log_views,
7 7
                  maintenance_point_views, maintenance_views, mch_views, member_views, model_views, operator_views,
8 8
                  refresh_views, sr_views, staff_views, tenancy_admin_views, tenancy_views, tencentcloud_views, wx_views,
9
-                 wxa_views, consumer_admin_view, salesman_mp_views)
9
+                 wxa_views, consumer_admin_view, salesman_mp_views, lensman_mp_views, lensman_admin_views)
10 10
 from miniapp import qy_views
11 11
 from miniapp import views as mini_views
12 12
 from page import oauth_views, sale_views, screen_views
@@ -369,3 +369,15 @@ urlpatterns += [
369 369
 urlpatterns += [
370 370
     url(r'', include(('member.urls', 'member'), namespace='member')),
371 371
 ]
372
+
373
+#摄影师模块
374
+urlpatterns += [
375
+    #小程序
376
+    url(r'^mp/lensman/detail$', lensman_mp_views.lensman_detail, name='mp_lensman_detail'),
377
+    url(r'^mp/lensman/register$', lensman_mp_views.lensman_register, name='mp_lensman_register'),
378
+
379
+    #管理后台
380
+    url(r'^admin/lensman/list$', lensman_admin_views.lensman_list, name='admin_lensman_list'),
381
+    url(r'^admin/lensman/audit$', lensman_admin_views.lensman_audit, name='admin_lensman_audit'),
382
+    url(r'^admin/lensman/update$', lensman_admin_views.lensman_update, name='admin_lensman_update'),
383
+]

+ 6 - 0
member/activity_mp_views.py

@@ -85,6 +85,9 @@ def activity_detail(request):
85 85
 def activity_signup(request):
86 86
     brand_id = request.POST.get('brand_id') or settings.KODO_DEFAULT_BRAND_ID
87 87
     user_id = request.POST.get('user_id', '')
88
+    lensman_id = request.POST.get('lensman_id', '')
89
+    name = request.POST.get('name', '')
90
+    phone = request.POST.get('phone', '')
88 91
     activity_id = request.POST.get('activity_id', '')
89 92
     fields = request.POST.get('fields', '[]')
90 93
 
@@ -95,6 +98,9 @@ def activity_signup(request):
95 98
 
96 99
     MemberActivitySignupInfo.objects.update_or_create(user_id=user_id, activity_id=activity_id, defaults={
97 100
         'title': act.title,
101
+        'lensman_id': lensman_id,
102
+        'name': name,
103
+        'phone': phone,
98 104
         'fields': fields,
99 105
     })
100 106
 

+ 1 - 0
src/mysqlclient

@@ -0,0 +1 @@
1
+Subproject commit ee1882e02e3c73910b1d6df86bbdce784edbb881

:art: Pycodestyle · cdd3367b88 - Gogs: Go Git Service

:art: Pycodestyle

huangqimin001 4 年之前
父節點
當前提交
cdd3367b88
共有 2 個文件被更改,包括 10 次插入8 次删除
  1. 5 5
      api/maintenance_views.py
  2. 5 3
      miniapp/views.py

+ 5 - 5
api/maintenance_views.py

@@ -12,8 +12,8 @@ from paginator import pagination
12 12
 from TimeConvert import TimeConvert as tc
13 13
 
14 14
 from account.models import UserInfo
15
-from mch.models import ModelInfo
16 15
 from maintenance.models import ExpressCompanyInfo, MaintenaceInfo
16
+from mch.models import ModelInfo
17 17
 from pre.custom_message import sendtemplatemessage
18 18
 from utils.admin_utils import is_admin, is_maintenanceman
19 19
 from utils.error.errno_utils import MaintenanceStatusCode
@@ -203,7 +203,7 @@ def maintenance_list(request):
203 203
         start_time = tc.string_to_utc_datetime(start_time, format='%Y%m%d')
204 204
         end_time = tc.string_to_utc_datetime(end_time + ' 23:59:59', format='%Y%m%d %H:%M:%S')
205 205
         maintenances = maintenances.filter(created_at__range=(start_time, end_time))
206
-    
206
+
207 207
     if point_id:
208 208
         maintenances = maintenances.filter(point_id=point_id)
209 209
 
@@ -264,10 +264,10 @@ def maintenance_status_update_sendtemplatemessage(maintenance):
264 264
             "color": "#173177"
265 265
         }
266 266
     }
267
-    
267
+
268 268
     wxcfg = WECHAT.get('MINIAPP', {})
269 269
     appid = wxcfg.get('appID')
270
-    
270
+
271 271
     sendtemplatemessage(openid=user.openid, template_id=settings.TEMPLATE_ID_MAINTENANCE, data=data, miniappid=appid, minipagepath='/pages/index/index')
272 272
 
273 273
 
@@ -297,7 +297,7 @@ def maintenance_tracking_info_update(maintenance, type_, tracking_info):
297 297
         maintenance.back_tracking_signed = is_tracking_signed
298 298
         if is_tracking_signed and old_maintenance_status == MaintenaceInfo.TRACKING_FIXED_BACK:
299 299
             maintenance_status = MaintenaceInfo.TRACKING_BACK_SIGNED
300
-    
300
+
301 301
     if maintenance_status:
302 302
         maintenance.maintenance_status = maintenance_status
303 303
         maintenance_status_at = maintenance.maintenance_status_at

+ 5 - 3
miniapp/views.py

@@ -262,28 +262,30 @@ def get_userinfo_api2(request):
262 262
 
263 263
     return response(200, 'Mini App Get Userinfo Success', u'微信小程序获取用户信息成功', user.brandata(brand_id=brand_id))
264 264
 
265
+
265 266
 @logit(res=True)
266 267
 @transaction.atomic
267 268
 def update_userinfo_api(request):
268 269
     brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
269 270
     user_id = request.POST.get('user_id', '')
270 271
     nickname = request.POST.get('nickname', '')
271
-    avatar = request.POST.get('avatar', '') 
272
+    avatar = request.POST.get('avatar', '')
272 273
 
273 274
     try:
274 275
         user = UserInfo.objects.select_for_update().get(user_id=user_id, status=True)
275 276
     except UserInfo.DoesNotExist:
276 277
         return response(UserStatusCode.USER_NOT_FOUND)
277
-    
278
+
278 279
     if nickname:
279 280
         user.nickname = nickname
280 281
     if avatar:
281 282
         user.avatar = avatar
282
-    
283
+
283 284
     user.save()
284 285
 
285 286
     return response(200, 'Mini App Get Userinfo Success', u'微信小程序获取用户信息成功', user.brandata(brand_id=brand_id))
286 287
 
288
+
287 289
 @logit(res=True)
288 290
 @transaction.atomic
289 291
 def membercard_extradata(request):