atar.com/avatar/44538b8d5c5dc4e3f585ce127d425556" alt=""/>  Brightcells b68c637678 update redis-extensions 9 年 前   Brightcells 561491e543 fix bug: AttributeError: 'module' object has no attribute 'ConnectionPool' 9 年 前   Brightcells ae502c940d fix bug: AttributeError: 'module' object has no attribute 'StrictRedis' 9 年 前   Brightcells 48995aae69 update redis_extensions —— class StrictRedisExtensions(StrictRedis) 9 年 前   Brightcells 05faf3c5db update lensman_brief_api 9 年 前   Brightcells 8c384ff52e remove to_lid 9 年 前   Brightcells 8468d9f9c5 remove to_lid 9 年 前   Brightcells f7b627af9b update lensman_brief_api 9 年 前   Brightcells 21b4a5403a add api lensman_brief_api 9 年 前   Brightcells ee7388cd15 add src for SystemMessageInfo 9 年 前   Brightcells 49f3749ebd remove param current_id and returns current_id/photos for lensman_photo_upload_api 9 年 前   Brightcells 2b26ecad19 update requirements.txt 9 年 前   Brightcells f93199e23c update requirements.txt 9 年 前   Brightcells 9ab6aee69e update requirements.txt 9 年 前   Brightcells 08be7a1f9f change to use RedisListHandler 9 年 前   Brightcells d73fdb7cd2 async/multi_pop uuids 9 年 前   Brightcells 744ff384c2 update wx share link 9 年 前   Brightcells 05e046c8ca fix bug: errcode=48001 when scope=snsapi_base 9 年 前   Brightcells 3b39460e59 update wechat relative 9 年 前   Brightcells 48c5514e05 update jswe.js 9 年 前   Brightcells c81acc73e4 update DATABASES comment 9 年 前   Brightcells 32b6dfd487 add redis_conf 9 年 前   Brightcells 3fe58578d8 update requirements.txt 9 年 前   Brightcells 7dee2f9449 update requirements.txt 9 年 前   Brightcells 2eb44593ee fix bug: logs lost using ConcurrentRotatingFileHandler 9 年 前   Brightcells c7071ae7f1 wx_uid to openid 9 年 前   Brightcells 9b0b9c0587 fix bug: int error 9 年 前   Brightcells a71f3c569b add src for feedback 9 年 前   Brightcells f07f4fc893 JsonResponse to response 9 年 前   Brightcells 72890dc75c user to user_id 9 年 前   Brightcells 7161824a44 session to session_id 9 年 前   Brightcells 57e79f38df fix bug: Duplicate entry 'xxx' for key 'user_id' 9 年 前   Brightcells 3af14d4a96 fix bug: Duplicate entry 'xxx' for key 'account_userinfo_unionid_3c1f5d4e4e1b84a9_uniq 9 年 前   Brightcells 6626af8a8d add api lensman_wx_authorize_api 9 年 前   Brightcells 30d24179d9 add refused relative 9 年 前   Brightcells 6fb6025912 hideOptionMenu in wx & display status & forbidden modify after Actived 9 年 前   Brightcells 08f87a7634 add wechat diy share for lensman_oauth 9 年 前   Brightcells 77023892d9 add wechat diy share for lensman_oauth 9 年 前   Brightcells 6faf4d4d8c fix bug: WECHAT_REDIRECT_URI not exists 9 年 前   Brightcells d0affd4b01 add lensman_oauth page 9 年 前   Brightcells 7bd5e500b8 add hiredis package & upgrade some package 9 年 前   Brightcells 40165198cd change to use redis.ConnectionPool 9 年 前   Brightcells 6102143d8e reduce balance 9 年 前   Brightcells 92da943e9e check wx_uid for api wx_balance_withdraw_api 9 年 前   Brightcells fa2729a4e1 add api wx_balance_withdraw_api 9 年 前   Brightcells d3fd6adf70 add api lensman_login_api/lensman_upload_photo_api 9 年 前   Brightcells 6d6c8485ce bind LensmanInfo and UserInfo 9 年 前   Brightcells b2cf473db5 optimize pagination 9 年 前   Brightcells 54dd8f095f update requirements 9 年 前   Brightcells fa36c26ce4 extend param to_uid for comment_submit_api 9 年 前   Brightcells abc5fdce05 fix bug multi message for photo owner 9 年 前   Brightcells 3c11ca7b16 fix bug multi message for photo owner 9 年 前   Brightcells 9618c6d3bd add var for jswe.js 9 年 前   Brightcells 09d7f479cb fix bug import GROUP_PHOTO_WATCHER_SET 9 年 前   Brightcells 2a7e6d170d sadd user_id into GROUP_PHOTO_WATCHER_SET 9 年 前   Brightcells 9ae03cd4df refresh GROUP_PHOTO_COMMENT_LIST/GROUP_PHOTO_THUMB_UP_LIST 9 年 前   Brightcells 86aa86bbba add GROUP_PHOTO_WATCHER_SET 9 年 前   Brightcells 47eb096687 fix bug add cls=DjangoJSONEncoder for json.dumps 9 年 前   Brightcells e920b279d1 send message for all watched users 9 年 前   Brightcells 1a0427282e change to auto_response of django-json-response 9 年 前   Brightcells 29185bf2d4 reback to use raw sql instead of records 9 年 前   Brightcells a02504cc21 Fix Bug: created_at format error 9 年 前   Brightcells 148da098dd add wexin diy share for session_detail 9 年 前   Brightcells 5a00022a72 close debug 9 年 前   Brightcells 4f1aa43391 nonceStr 9 年 前   Brightcells f3edf9f11f add wexin diy share 9 年 前   Brightcells 8f43551640 add api wx_jsapi_signature_api 9 年 前   Brightcells b5857bab0c dialect[+driver]://user:password@host/dbname[?key=value..] 9 年 前   Brightcells d50a6c1bae update django-detect in requirements.txt 9 年 前   Brightcells 3253541b10 change to exec raw sql from django.db.connection to records 9 年 前   Brightcells 8263625d9c new website 9 年 前   Brightcells 8d6858fb00 adjust website content 9 年 前   Brightcells 80a3496489 fix user join group by session after remove 9 年 前   Brightcells e4567ea2de fix call set_group_users_info after group user removed 9 年 前   Brightcells 1e620ebab6 *_download.html 9 年 前   Brightcells 2f29afecbd modify version in operation 9 年 前   Brightcells 65ab52f95a spell error 9 年 前   Brightcells 535ac34ee1 add api download_api 9 年 前   Brightcells af2b3f483f change download.html to be generated from download.tmpl.html 9 年 前   Brightcells 696c8d2e2b adjust download section of photo_detail/session_detail 9 年 前   Brightcells 9671c0e989 wrongly written or mispronounced characters 9 年 前   Brightcells 5a0b6447ca change RotatingFileHandler to TimedRotatingFileHandler to support rotation of disk log files at certain timed intervals. 9 年 前   Brightcells cce055cdf4 change FileHandler to RotatingFileHandler to to supports rotation of disk log files. 9 年 前   Brightcells 51959f199b remove overflow: hidden; 9 年 前   Brightcells 88294e7647 change title of photo detail 9 年 前   Brightcells 4b7cfa2426 adjust photo detail page 9 年 前   Brightcells f679be700a adjust title of user_agreement 9 年 前   Brightcells a80a911457 change time.time() to int(time.time()) in upload_path 9 年 前   Brightcells 771845b52e add param pfrom for statistic_thumbnail_size 9 年 前   Brightcells 5c9e21b29b add Only Once Function statistic_thumbnail_size to statistic thumbnail size 9 年 前   Brightcells 0339d3dce4 Fix Bug: set_group_photo_data should after group_photo.save() 9 年 前   Brightcells bbc43c96ec add photo_share_url 9 年 前   Brightcells 398957153c add pk in user's nickname 9 年 前   Brightcells 85eb6c6f2d Fix Bug: nickname for GroupPhotoInfo error 9 年 前   Brightcells afcdf74a49 add api group_data_api 9 年 前   Brightcells e1b319d9a4 'charset': 'utf8mb4' 9 年 前   Brightcells a8d890cb70 filter order by pay_status 9 年 前   Brightcells 03304ad48a add api guest_status_api & modify api guest_login_api 9 年 前   Brightcells c209e83d29 add delete_guest_entrance_control 9 年 前   Brightcells 63eaee0951 modify guest_login_api 9 年 前   Brightcells 70689e758c add lensman and user's balance 9 年 前   Brightcells 269576f8b9 add guest user 9 年 前   Brightcells 818e5ae2cd adjust page 9 年 前   Brightcells 10fdf9ba1f adjust page 9 年 前   Brightcells 805b221885 add content for contact_us.html 9 年 前   Brightcells 60b2bc0c09 add content for user_agreement.html 9 年 前   Brightcells 95c1d32792 put isort and pep8 in check.sh 9 年 前   Brightcells fabef63211 set line_length=200 for isort 9 年 前   Brightcells 084a5eece8 order ruler: date/self/7*thumbup_num+3*comment_num/id 9 年 前   Brightcells 81e5a71d7f GroupUserInfo order by id desc in group_list_api 9 年 前   Brightcells f72ccb1875 isort import 9 年 前   Brightcells de60d59c26 order ruler: date/self/thumbup_num/id 9 年 前   Brightcells f684a1d89c order ruler: date/self/thumbup_num 9 年 前   Brightcells 5bf645c33d change order ruler for paiai home, user_id self upload first 9 年 前   Brightcells 414e2cb1b0 change some {number} to {} 9 年 前   Brightcells d1ef8ec9e9 download page 9 年 前   Brightcells ee258aeb8b GroupPhotoOrderInfo value set error 9 年 前   Brightcells b7a21719c7 change message_list_api to return unread message num 9 年 前   Brightcells bc49c77a94 adjust settings of redis 9 年 前   Brightcells 6f4b4a7f5c unify fee(return and params) to fen 9 年 前   Brightcells 102152ca4a add api lensman_photo_bought & modify api wx_order_create_api and adjust return field 9 年 前   Brightcells cb9a21132f modify lesman_photo_price api 9 年 前   Brightcells 8aeca53563 record unionid for wx_authorize user 9 年 前   Brightcells 50ebe3bfcd add company name in website 9 年 前   Brightcells efaa518b96 add Only Once Function refresh_thumbnail 9 年 前   Brightcells d0f8b5ce5c larger image file 403 forbidden 9 年 前   Brightcells d64b3c216b add and return photo_thumbnail2 relative 9 年 前   Brightcells a0dfcb6f16 Alter field pay_status on orderinfo 9 年 前   Brightcells 98f968c53c add api lesman_photo_price/wx_order_list_api/wx_order_detail_api 9 年 前   Brightcells 0f425ae151 add api wx_order_query_api 9 年 前   Brightcells 097426009e Fix Bug: sign error when trade_type == 'APP' 9 年 前   Brightcells 0e1b1fb160 adjust WECHAT in settings.py & use django-logit 9 年 前   Brightcells fab8ef6c5e add term of service page 9 年 前   Brightcells 03c3611ad0 improve image clarity 9 年 前   Brightcells 3114315824 add pc official website 9 年 前   Brightcells 5695243a9a Fix Bug: creator of group not in GROUP_USERS_PASSED_SET 9 年 前   Brightcells ed5ee99a08 Fix Bug: get_group_info wrong use as get_group_users_info 9 年 前   Brightcells 5301e7237e unify join group logic 9 年 前   Brightcells 02373a6dff return complete group_photo_info for api message_list_api/message_type_list_api 9 年 前   Brightcells aa78f33cca Fix Bug: group admin request group_join_api 9 年 前   Brightcells 349e60836f Fix Bug: set() takes at least 3 arguments (2 given) & change r.set to r.setex 9 年 前   Brightcells 15772543dd add return field thumbup for api flyimg_upload_api/flyimg_list_api/session_detail_api/pai2_home_api 9 年 前   Brightcells f0113f2b5c Fix Bug: get group_info/group_users when not created 9 年 前   Brightcells a53a8a8312 modify session_detail_api to deal with group/group_user/group_photo 9 年 前   Brightcells ec142555be return group_from for pai2_home_api 9 年 前   Brightcells 25a5b5e8ae reconstruct retrieve_redis_data 9 年 前   Brightcells dbea356558 add photo_from field for GroupPhotoInfo and return photo_from for some api 9 年 前   Brightcells a1bd97d641 change all param to cmp to string true 9 年 前   Brightcells 165424743a modify message relative apis 9 年 前   Brightcells 3586c96fbb Fix Bug: duplicate thumbup should not increase thumbup_num 9 年 前   Brightcells 017d878faa Fix Bug: duplicate thumbup should not increase thumbup_num 9 年 前   Brightcells b3b9639df8 add comment_num/thumbup_num in message_list_api/message_type_list_api 9 年 前   Brightcells 904fabf2d0 modify join policy in api group_join_api 9 年 前   Brightcells ff0a63215f Fix Bug: redis .replace(microsecond=0) 9 年 前   Brightcells 8493e9949f add pagination for group_list_api 9 年 前   Brightcells 537bd9bd41 add api group_quit_api 9 年 前   Brightcells 61590ecb17 Fix Bug: admin remove itself from a group 9 年 前   Brightcells ebaa78d5ad add api feedback_api 9 年 前   Brightcells c8d93d6339 add api message_delete_api/message_type_delete_api 9 年 前   Brightcells 8b7c49ddb9 add app to add page user_agreement/contact_us 9 年 前   Brightcells f5a460140f Fix Bug: get flag of whether user has thumbup or not error 9 年 前   Brightcells 454f8cd8ec change some info store in redis & remove some unnecessary params check & add some return for some api 9 年 前   Brightcells 78e4e238a7 GroupUserInfo.user_status == GroupUserInfo.DELETED & error status code 9 年 前   Brightcells 90515dc878 update comment_num and thumbup_num in api comment_submit_api/thumbup_submit_api/thumbup_cancel_api 9 年 前   Brightcells 1bc6cf2a73 add update group_avatar 9 年 前   Brightcells f7d159714f Fix Bug: PAI2_HOME_API error 9 年 前   Brightcells 17a826bc1b add status filter for GroupPhotoInfo query 9 年 前   Brightcells deeabd58a2 change 'nickname=nickname or user.final_nickname' in api flyimg_upload_api 9 年 前   Brightcells 5a05032918 modify order ruler to by DATE(created_at) desc 9 年 前   Brightcells 88049b12db store/return more field for photo 9 年 前   Brightcells ca727b0362 store/return w/h for photo 9 年 前   Brightcells f6a88c632b add group_default_avatar field for GroupInfo 9 年 前   Brightcells e50a206d29 add pagination for pai2_home_api 9 年 前   Brightcells da2a81fff1 add api pai2_home 9 年 前   Brightcells 7d85bed0b0 move errno_utils.py/response_utils.py into error file 10 年 前   Brightcells 11c6982627 return user_id for some api 10 年 前   Brightcells 0110c29272 rename api name 10 年 前   Brightcells 7a17d0fb90 add api wxpay & add redis relative 10 年 前   Brightcells 62aff0cb2f move status code into errno_utils.py to unified management 10 年 前   Brightcells a121b75ff2 add db_index=True for status field 10 年 前   Brightcells b5be31c6cd Fix Bug: Field name photo_path is not valid for model PhotosInfo 10 年 前   Brightcells 0786f22bad order_by('-pk') replace of order_by('-created_at') 10 年 前   Brightcells 62ef679981 add ret photo_url and photo_thumbnail_url 10 年 前   Brightcells d3088e1fec add ret msg_type_desc 10 年 前   Brightcells 464c31b794 support POST method for message relative api 10 年 前   Brightcells 8f83bd22be add param user_id for msg relative api 10 年 前   Brightcells 928a51477c 'UserMessageInfo' object has no attribute 'title' 10 年 前   Brightcells 8f14561134 UserMessageInfo in admin.py 10 年 前   Brightcells 89094aa77b if user exists, update user info, in api wx_authorize_api 10 年 前   Brightcells ba7bc03f03 adjust sex value 10 年 前   Brightcells 30daca135b add api message_list_api/message_type_list_api/message_read_api 10 年 前   Brightcells 03561aaa5f modify api comment_submit_api/comment_list_api 10 年 前   Brightcells c72d89f6e5 add api comment_submit_api/comment_list_api/thumbup_submit_api/thumbup_list_api/thumbup_cancel_api 10 年 前   Brightcells df1df69fe3 add api upgrade/splash 10 年 前   Brightcells 3253626936 change DOMAIN and IMG_DOMAIN to pai.ai 10 年 前   Brightcells e5721d434c add URL_CONFIG for domain pai.ai 10 年 前   Brightcells 2b831a139f CONN_MAX_AGE & cached.Loader 10 年 前   Brightcells 2fb52216da Fix Bug: wx authorize doesn't store wx_uid 10 年 前   Brightcells 48d2e93b70 return nickname for userinfo data 10 年 前   Brightcells 814ed79bfc add api group_unlock_api 10 年 前   Brightcells 1c25788dbf add group_name for group_create_api 10 年 前   Brightcells 8b5ea74192 add location /fly 10 年 前   Brightcells 4afdb94e20 add avatar for GroupUserInfo 10 年 前   Brightcells 5ef425fee7 add api wx_authorize_api 10 年 前   Brightcells d3798a39f1 update session_detail_api 10 年 前   Brightcells ce10db91f9 thumbnail_utils make_thumb 10 年 前   Brightcells f587f0a48f user can just see photo after he joined the group & zh_Hans replace zh_CN in settings.py 10 年 前   Brightcells 42df840f43 return current_id for api flyimg_upload/flyimg_list 10 年 前   Brightcells 9077a53317 return next_id for api flyimg_upload/flyimg_list 10 年 前   Brightcells f58bde298b add api flyimg_upload/flyimg_list 10 年 前   Brightcells 7fd74ed1e4 add group_join_api direct pass 10 年 前   Brightcells 7467a3e68a add api group_update/group_remove 10 年 前   Brightcells 7e305483ab add api group_detail/group_lock/group_pass/group_refuse 10 年 前   Brightcells e184e7dd5b add api group_create/group_join 10 年 前   Brightcells 6e77deb909 https://pypi.python.org/pypi/django-curtail-uuid 10 年 前   Brightcells e7d461ade5 upload photo with photo_id 10 年 前   Brightcells ca16dc830e alias .img.xfoto.com.cn/photo 10 年 前   Brightcells 7ddb9f0b5e change to use img.xfoto.com.cn as photo domain 10 年 前   Brightcells 3454610bb7 add api of user signup/login 10 年 前   Brightcells 00e8234de9 add api photo_standard_api 10 年 前   Brightcells e0ba30f506 add api session_detail_api 10 年 前   Brightcells 4a8b4f8819 add watermark 10 年 前   Brightcells b9c2997666 change server name .api.xfoto.com.cn before .xfoto.com.cn 10 年 前   Brightcells ca8b65a77e nginx conf & requirements 10 年 前   Brightcells 434468279f add api of lesman login & update other api 10 年 前   Brightcells 52ce35cbfc add api uuid_init/uuid 10 年 前   Brightcells 4defb80fdc gogs first init 10 年 前

差分データは利用できません。

Merge branch 'tamron' of git.xfoto.com.cn:Kodo/kodo into tamron · 21cfb42807 - Gogs: Go Git Service

Merge branch 'tamron' of git.xfoto.com.cn:Kodo/kodo into tamron

huangqimin001 1 年間 前
コミット
21cfb42807
共有2 個のファイルを変更した139 個の追加85 個の削除を含む
  1. 45 37
      api/lensman_admin_views.py
  2. 94 48
      tenancy/models.py

+ 45 - 37
api/lensman_admin_views.py

@@ -2,6 +2,8 @@
2 2
 
3 3
 from __future__ import division
4 4
 
5
+from datetime import datetime
6
+
5 7
 from django.conf import settings
6 8
 from django_logit import logit
7 9
 from django_response import response
@@ -21,21 +23,27 @@ def lensman_list(request, administrator):
21 23
     query = request.POST.get('query', '')
22 24
     lensman_status = request.POST.get('lensman_status', '')
23 25
     end_date = tc.to_date(request.POST.get('end_date', ''))
24
-    integral_end_date = tc.to_date(request.POST.get('integral_end_date', ''))
26
+    integral_end_date_start = request.POST.get('integral_end_date_start', '')
27
+    integral_end_date_end = request.POST.get('integral_end_date_end', '')
25 28
 
26 29
     logs = LensmanInfo.objects.filter(status=True).order_by('-pk')
27 30
 
28 31
     if query:
29
-      logs = logs.filter(Q(name__icontains=query) | Q(phone__icontains=query))
30
-    
32
+        logs = logs.filter(Q(name__icontains=query) |
33
+                           Q(phone__icontains=query))
34
+
31 35
     if lensman_status:
32
-       logs = logs.filter(lensman_status=lensman_status)
33
-      
36
+        logs = logs.filter(lensman_status=lensman_status)
37
+
34 38
     if end_date:
35
-       logs = logs.filter(end_date__lte=end_date)
36
-    
37
-    if integral_end_date:
38
-       logs = logs.filter(integral_end_date__lte=integral_end_date)
39
+        logs = logs.filter(end_date__lte=end_date)
40
+
41
+    if integral_end_date_start and integral_end_date_end:
42
+        ftime = datetime.strptime(
43
+            integral_end_date_start + ' 00:00:00', '%Y%m%d %H:%M:%S')
44
+        ttime = datetime.strptime(
45
+            integral_end_date_end + ' 23:59:59', '%Y%m%d %H:%M:%S')
46
+        logs = logs.filter(integral_end_date__range=[ftime, ttime])
39 47
 
40 48
     count = logs.count()
41 49
     logs, left = pagination(logs, page, num)
@@ -56,10 +64,10 @@ def lensman_audit(request, administrator):
56 64
     end_date = tc.to_date(request.POST.get('end_date', ''))
57 65
 
58 66
     try:
59
-      lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True)
67
+        lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True)
60 68
     except LensmanInfo.DoesNotExist:
61
-      return response(200, 'Lensman Not Found', u'摄影师不存在')
62
-    
69
+        return response(200, 'Lensman Not Found', u'摄影师不存在')
70
+
63 71
     lensman.lensman_status = LensmanInfo.ACTIVATED
64 72
     lensman.start_date = start_date
65 73
     lensman.end_date = end_date
@@ -75,17 +83,18 @@ def lensman_update(request, administrator):
75 83
     lensman_id = request.POST.get('lensman_id', '')
76 84
     start_date = tc.to_date(request.POST.get('start_date', ''))
77 85
     end_date = tc.to_date(request.POST.get('end_date', ''))
78
-    integral_start_date = tc.to_date(request.POST.get('integral_start_date', ''))
86
+    integral_start_date = tc.to_date(
87
+        request.POST.get('integral_start_date', ''))
79 88
     integral_end_date = tc.to_date(request.POST.get('integral_end_date', ''))
80 89
     name = request.POST.get('name', '')
81 90
     phone = request.POST.get('phone', '')
82 91
     remark = request.POST.get('remark', '')
83
-        
92
+
84 93
     try:
85
-      lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True)
94
+        lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True)
86 95
     except LensmanInfo.DoesNotExist:
87
-      return response(200, 'Lensman Not Found', u'摄影师不存在')
88
-    
96
+        return response(200, 'Lensman Not Found', u'摄影师不存在')
97
+
89 98
     lensman.start_date = start_date
90 99
     lensman.end_date = end_date
91 100
     lensman.integral_start_date = integral_start_date
@@ -102,19 +111,19 @@ def lensman_update(request, administrator):
102 111
 @logit
103 112
 @check_admin
104 113
 def lensman_integral_list(request, administrator):
105
-  user_id = request.POST.get('user_id', '')
114
+    user_id = request.POST.get('user_id', '')
115
+
116
+    try:
117
+        lensman = LensmanInfo.objects.get(user_id=user_id, status=True)
118
+    except LensmanInfo.DoesNotExist:
119
+        return response(200, 'Lensman Not Found', u'摄影师不存在')
106 120
 
107
-  try:
108
-    lensman = LensmanInfo.objects.get(user_id=user_id, status=True)
109
-  except LensmanInfo.DoesNotExist:
110
-    return response(200, 'Lensman Not Found', u'摄影师不存在')
111
-  
112
-  integrals = LensmanIntegralIncomeExpensesInfo.objects.filter(user_id=user_id, status=True)
121
+    integrals = LensmanIntegralIncomeExpensesInfo.objects.filter(
122
+        user_id=user_id, status=True)
113 123
 
114
-  integrals = [integral.admindata for integral in integrals]
115
-  
124
+    integrals = [integral.admindata for integral in integrals]
116 125
 
117
-  return response(200, 'Get Lensman Integral List Success', u'获取摄影师积分列表成功', data=integrals)
126
+    return response(200, 'Get Lensman Integral List Success', u'获取摄影师积分列表成功', data=integrals)
118 127
 
119 128
 
120 129
 @logit
@@ -125,20 +134,19 @@ def lensman_integral_update(request):
125 134
     brand_id = request.POST.get('brand_id') or settings.KODO_DEFAULT_BRAND_ID
126 135
 
127 136
     try:
128
-      lensman = LensmanInfo.objects.get(user_id=user_id, status=True)
137
+        lensman = LensmanInfo.objects.get(user_id=user_id, status=True)
129 138
     except LensmanInfo.DoesNotExist:
130
-      return response(200, 'Lensman Not Found', u'摄影师不存在')
131
-    
139
+        return response(200, 'Lensman Not Found', u'摄影师不存在')
140
+
132 141
     lensman.integral += integral
133 142
     lensman.save()
134
-  
143
+
135 144
     LensmanIntegralIncomeExpensesInfo.objects.create(
136
-      brand_id=brand_id,
137
-      user_id=user_id,
138
-      integral=integral,
139
-      remark=remark,
140
-      expired_at=lensman.integral_end_date,
145
+        brand_id=brand_id,
146
+        user_id=user_id,
147
+        integral=integral,
148
+        remark=remark,
149
+        expired_at=lensman.integral_end_date,
141 150
     )
142 151
 
143 152
     return response(200, 'Lensman Integral Update Success', u'摄影师积分更新成功')
144
-

+ 94 - 48
tenancy/models.py

@@ -16,17 +16,28 @@ class TenancyShotInfo(BaseModelMixin):
16 16
         (1, u'已租'),
17 17
     )
18 18
 
19
-    admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'经手人唯一标识', db_index=True)
20
-    shot_id = ShortUUIDField(_(u'shot_id'), max_length=32, blank=True, null=True, help_text=u'镜头唯一标识', db_index=True, unique=True)
21
-    model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True)
22
-    model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称')
23
-    sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True)
24
-    front_cap_status = models.BooleanField(_(u'front_cap_status'), default=False, help_text=u'前盖状态')
25
-    rear_cap_status = models.BooleanField(_(u'rear_cap_status'), default=False, help_text=u'后盖状态')
26
-    lens_hood_status = models.BooleanField(_(u'lens_hood_status'), default=False, help_text=u'遮光罩状态')
27
-    tripod_ring_status = models.BooleanField(_(u'tripod_ring_status'), default=False, help_text=u'脚架环状态')
28
-    appearance_performance_status = models.BooleanField(_(u'appearance_performance_status'), default=False, help_text=u'外观性能状态')
29
-    tenancy_status = models.IntegerField(_(u'tenancy_status'), choices=TENANCY_STATUS, default=0, help_text=u'租借状态')
19
+    admin_id = models.CharField(_(u'admin_id'), max_length=32,
20
+                                blank=True, null=True, help_text=u'经手人唯一标识', db_index=True)
21
+    shot_id = ShortUUIDField(_(u'shot_id'), max_length=32, blank=True,
22
+                             null=True, help_text=u'镜头唯一标识', db_index=True, unique=True)
23
+    model_id = models.CharField(_(u'model_id'), max_length=32,
24
+                                blank=True, null=True, help_text=u'型号唯一标识', db_index=True)
25
+    model_name = models.CharField(
26
+        _(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称')
27
+    sn = models.CharField(_(u'sn'), max_length=32, blank=True,
28
+                          null=True, help_text=u'序列号', db_index=True)
29
+    front_cap_status = models.BooleanField(
30
+        _(u'front_cap_status'), default=False, help_text=u'前盖状态')
31
+    rear_cap_status = models.BooleanField(
32
+        _(u'rear_cap_status'), default=False, help_text=u'后盖状态')
33
+    lens_hood_status = models.BooleanField(
34
+        _(u'lens_hood_status'), default=False, help_text=u'遮光罩状态')
35
+    tripod_ring_status = models.BooleanField(
36
+        _(u'tripod_ring_status'), default=False, help_text=u'脚架环状态')
37
+    appearance_performance_status = models.BooleanField(
38
+        _(u'appearance_performance_status'), default=False, help_text=u'外观性能状态')
39
+    tenancy_status = models.IntegerField(
40
+        _(u'tenancy_status'), choices=TENANCY_STATUS, default=0, help_text=u'租借状态')
30 41
 
31 42
     class Meta:
32 43
         verbose_name = _(u'租赁镜头信息')
@@ -70,53 +81,84 @@ class TenancyShotRequestInfo(BaseModelMixin):
70 81
         (2, u'未通过'),
71 82
     )
72 83
 
73
-    request_id = ShortUUIDField(_(u'request_id'), max_length=32, blank=True, null=True, help_text=u'申请唯一标识', db_index=True, unique=True)
74
-    admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'经手人唯一标识', db_index=True)
84
+    request_id = ShortUUIDField(_(u'request_id'), max_length=32, blank=True,
85
+                                null=True, help_text=u'申请唯一标识', db_index=True, unique=True)
86
+    admin_id = models.CharField(_(u'admin_id'), max_length=32,
87
+                                blank=True, null=True, help_text=u'经手人唯一标识', db_index=True)
75 88
 
76
-    request_number = models.CharField(_(u'request_number'), max_length=32, blank=True, null=True, help_text=u'线下借单编号', db_index=True)
89
+    request_number = models.CharField(
90
+        _(u'request_number'), max_length=32, blank=True, null=True, help_text=u'线下借单编号', db_index=True)
77 91
 
78
-    shot_id = models.CharField(_(u'shot_id'), max_length=32, blank=True, null=True, help_text=u'镜头唯一标识', db_index=True)
79
-    model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'镜头型号唯一标识', db_index=True)
92
+    shot_id = models.CharField(_(u'shot_id'), max_length=32,
93
+                               blank=True, null=True, help_text=u'镜头唯一标识', db_index=True)
94
+    model_id = models.CharField(_(u'model_id'), max_length=32,
95
+                                blank=True, null=True, help_text=u'镜头型号唯一标识', db_index=True)
80 96
 
81
-    user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
97
+    user_id = models.CharField(_(u'user_id'), max_length=32,
98
+                               blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
82 99
 
83 100
     # 镜头配件信息
84
-    front_cap_status = models.BooleanField(_(u'front_cap_status'), default=False, help_text=u'前盖状态')
85
-    rear_cap_status = models.BooleanField(_(u'rear_cap_status'), default=False, help_text=u'后盖状态')
86
-    lens_hood_status = models.BooleanField(_(u'lens_hood_status'), default=False, help_text=u'遮光罩状态')
87
-    tripod_ring_status = models.BooleanField(_(u'tripod_ring_status'), default=False, help_text=u'脚架环状态')
88
-    appearance_performance_status = models.BooleanField(_(u'appearance_performance_status'), default=False, help_text=u'外观性能状态')
101
+    front_cap_status = models.BooleanField(
102
+        _(u'front_cap_status'), default=False, help_text=u'前盖状态')
103
+    rear_cap_status = models.BooleanField(
104
+        _(u'rear_cap_status'), default=False, help_text=u'后盖状态')
105
+    lens_hood_status = models.BooleanField(
106
+        _(u'lens_hood_status'), default=False, help_text=u'遮光罩状态')
107
+    tripod_ring_status = models.BooleanField(
108
+        _(u'tripod_ring_status'), default=False, help_text=u'脚架环状态')
109
+    appearance_performance_status = models.BooleanField(
110
+        _(u'appearance_performance_status'), default=False, help_text=u'外观性能状态')
89 111
 
90 112
     # 身份证信息
91
-    identity_card_number = models.CharField(_(u'identity_card_number'), max_length=32, blank=True, null=True, help_text=u'身份证号')
92
-    identity_card_name = models.CharField(_(u'identity_card_name'), max_length=32, blank=True, null=True, help_text=u'身份证姓名')
113
+    identity_card_number = models.CharField(
114
+        _(u'identity_card_number'), max_length=32, blank=True, null=True, help_text=u'身份证号')
115
+    identity_card_name = models.CharField(
116
+        _(u'identity_card_name'), max_length=32, blank=True, null=True, help_text=u'身份证姓名')
93 117
 
94 118
     # 邮寄信息
95
-    name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户姓名')
96
-    phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'用户电话')
97
-    location = models.CharField(_(u'location'), max_length=255, blank=True, null=True, help_text=u'用户地址')
98
-    postcode = models.CharField(_(u'postcode'), max_length=255, blank=True, null=True, help_text=u'用户邮政编码')
119
+    name = models.CharField(_(u'name'), max_length=255,
120
+                            blank=True, null=True, help_text=u'用户姓名')
121
+    phone = models.CharField(_(u'phone'), max_length=11,
122
+                             blank=True, null=True, help_text=u'用户电话')
123
+    location = models.CharField(
124
+        _(u'location'), max_length=255, blank=True, null=True, help_text=u'用户地址')
125
+    postcode = models.CharField(
126
+        _(u'postcode'), max_length=255, blank=True, null=True, help_text=u'用户邮政编码')
99 127
 
100 128
     # 租赁信息
101
-    purpose = models.CharField(_(u'purpose'), max_length=255, blank=True, null=True, help_text=u'用途')
102
-    return_date = models.DateField(_(u'return_date'), blank=True, null=True, help_text=u'预定归还日期')
129
+    purpose = models.CharField(
130
+        _(u'purpose'), max_length=255, blank=True, null=True, help_text=u'用途')
131
+    return_date = models.DateField(
132
+        _(u'return_date'), blank=True, null=True, help_text=u'预定归还日期')
103 133
 
104 134
     # 公司 =》 用户
105
-    express_name = models.CharField(_(u'express_name'), max_length=255, blank=True, null=True, help_text=u'快递公司')
106
-    express_com = models.CharField(_(u'express_com'), max_length=255, blank=True, null=True, help_text=u'快递编码')
107
-    tracking_number = models.CharField(_(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号')
108
-    tracking_info = JSONField(_(u'tracking_info'), blank=True, null=True, default={}, help_text=u'快递信息')
109
-    tracking_signed = models.BooleanField(_(u'tracking_signed'), default=False, help_text=u'快递是否已签收')
110
-    tracking_signed_images = JSONField(_(u'tracking_signed_images'), blank=True, null=True, default=[], help_text=u'快递签收图片列表')
135
+    express_name = models.CharField(
136
+        _(u'express_name'), max_length=255, blank=True, null=True, help_text=u'快递公司')
137
+    express_com = models.CharField(
138
+        _(u'express_com'), max_length=255, blank=True, null=True, help_text=u'快递编码')
139
+    tracking_number = models.CharField(
140
+        _(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号')
141
+    tracking_info = JSONField(
142
+        _(u'tracking_info'), blank=True, null=True, default={}, help_text=u'快递信息')
143
+    tracking_signed = models.BooleanField(
144
+        _(u'tracking_signed'), default=False, help_text=u'快递是否已签收')
145
+    tracking_signed_images = JSONField(
146
+        _(u'tracking_signed_images'), blank=True, null=True, default=[], help_text=u'快递签收图片列表')
111 147
 
112 148
     # 用户 =》 公司
113
-    back_express_name = models.CharField(_(u'back_express_name'), max_length=255, blank=True, null=True, help_text=u'寄回快递公司')
114
-    back_express_com = models.CharField(_(u'back_express_com'), max_length=255, blank=True, null=True, help_text=u'寄回快递编码')
115
-    back_tracking_number = models.CharField(_(u'back_tracking_number'), max_length=255, blank=True, null=True, help_text=u'寄回快递单号')
116
-    back_tracking_info = JSONField(_(u'back_tracking_info'), blank=True, null=True, default={}, help_text=u'寄回快递信息')
117
-    back_tracking_signed = models.BooleanField(_(u'back_tracking_signed'), default=False, help_text=u'寄回快递是否已签收')
118
-
119
-    audit_status = models.IntegerField(_(u'audit_status'), choices=AUDIT_STATUS, default=0, help_text=u'审批状态', db_index=True)
149
+    back_express_name = models.CharField(
150
+        _(u'back_express_name'), max_length=255, blank=True, null=True, help_text=u'寄回快递公司')
151
+    back_express_com = models.CharField(
152
+        _(u'back_express_com'), max_length=255, blank=True, null=True, help_text=u'寄回快递编码')
153
+    back_tracking_number = models.CharField(
154
+        _(u'back_tracking_number'), max_length=255, blank=True, null=True, help_text=u'寄回快递单号')
155
+    back_tracking_info = JSONField(
156
+        _(u'back_tracking_info'), blank=True, null=True, default={}, help_text=u'寄回快递信息')
157
+    back_tracking_signed = models.BooleanField(
158
+        _(u'back_tracking_signed'), default=False, help_text=u'寄回快递是否已签收')
159
+
160
+    audit_status = models.IntegerField(
161
+        _(u'audit_status'), choices=AUDIT_STATUS, default=0, help_text=u'审批状态', db_index=True)
120 162
     # REQUEST_STATUS = (
121 163
     #     (0, u'寄出'),
122 164
     #     (1, u'寄出已签收'),
@@ -124,10 +166,13 @@ class TenancyShotRequestInfo(BaseModelMixin):
124 166
     #     (3, u'寄回已签收并检查无损坏'),
125 167
     # )
126 168
     # request_status = models.IntegerField(_(u'request_status'), choices=REQUEST_STATUS, default=0, help_text=u'租借申请状态')
127
-    request_status = models.CharField(_(u'request_status'), max_length=16, default='', help_text=u'租借申请状态')
128
-    request_status_at = JSONField(_(u'request_status_at'), blank=True, null=True, default={}, help_text=u'租借申请状态变更时间')
169
+    request_status = models.CharField(
170
+        _(u'request_status'), max_length=16, default='', help_text=u'租借申请状态')
171
+    request_status_at = JSONField(
172
+        _(u'request_status_at'), blank=True, null=True, default={}, help_text=u'租借申请状态变更时间')
129 173
 
130
-    remark = models.CharField(_(u'remark'), max_length=256, default='', help_text=u'备注')
174
+    remark = models.CharField(
175
+        _(u'remark'), max_length=256, default='', help_text=u'备注')
131 176
 
132 177
     class Meta:
133 178
         verbose_name = _(u'租赁镜头申请信息')
@@ -185,7 +230,7 @@ class TenancyShotRequestInfo(BaseModelMixin):
185 230
             'back_tracking_signed': self.back_tracking_signed,
186 231
             'audit_status': self.audit_status,
187 232
             'request_status': self.request_status,
188
-            'request_status_at': {k: tc.local_date_string(utc_dt=tc.string_to_utc_datetime(v, format='%Y-%m-%dT%H:%M:%S.%fZ')) for k, v in self.request_status_at.items()},
233
+            'request_status_at': {k: tc.local_date_string(utc_dt=tc.string_to_utc_datetime(v, format='%Y-%m-%d %H:%M:%S')) for k, v in self.request_status_at.items()},
189 234
             'created_at': tc.local_date_string(utc_dt=self.created_at),
190 235
             'remark': self.remark,
191 236
         }
@@ -198,7 +243,8 @@ class TenancyShotRequestInfo(BaseModelMixin):
198 243
             admin = None
199 244
 
200 245
         try:
201
-            shot = TenancyShotInfo.objects.get(shot_id=self.shot_id, status=True)
246
+            shot = TenancyShotInfo.objects.get(
247
+                shot_id=self.shot_id, status=True)
202 248
         except TenancyShotInfo.DoesNotExist:
203 249
             shot = None
204 250