add api price_fix

Brightcells 8 年之前
父节点
当前提交
4fdd237863
共有 5 个文件被更改,包括 51 次插入1 次删除
  1. 1 1
      account/admin.py
  2. 24 0
      account/migrations/0017_auto_20160908_1053.py
  3. 3 0
      account/models.py
  4. 2 0
      api/urls.py
  5. 21 0
      group/lensman_views.py

+ 1 - 1
account/admin.py

@@ -10,7 +10,7 @@ from account.models import (LensmanIncomeExpensesInfo, LensmanInfo, LensmanLogin
10 10
 
11 11
 class LensmanInfoAdmin(admin.ModelAdmin):
12 12
     readonly_fields = ('lensman_id', 'encryption', )
13
-    list_display = ('lensman_id', 'unionid', 'username', 'name', 'sex', 'phone', 'location', 'proportion', 'balance', 'user_status', 'status', 'created_at', 'updated_at')
13
+    list_display = ('lensman_id', 'unionid', 'username', 'name', 'sex', 'phone', 'location', 'proportion', 'nomark', 'origin', 'balance', 'user_status', 'status', 'created_at', 'updated_at')
14 14
     search_fields = ('name', 'phone', 'location')
15 15
     list_filter = ('sex', 'user_status', 'status')
16 16
 

+ 24 - 0
account/migrations/0017_auto_20160908_1053.py

@@ -0,0 +1,24 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models, migrations
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    dependencies = [
10
+        ('account', '0016_auto_20160718_1258'),
11
+    ]
12
+
13
+    operations = [
14
+        migrations.AddField(
15
+            model_name='lensmaninfo',
16
+            name='nomark',
17
+            field=models.IntegerField(default=299, help_text='\u6444\u5f71\u5e08\u65e0\u6c34\u5370\u4ef7\u683c(\u5206)', verbose_name='nomark'),
18
+        ),
19
+        migrations.AddField(
20
+            model_name='lensmaninfo',
21
+            name='origin',
22
+            field=models.IntegerField(default=999, help_text='\u6444\u5f71\u5e08\u9ad8\u6e05\u56fe\u4ef7\u683c(\u5206)', verbose_name='origin'),
23
+        ),
24
+    ]

+ 3 - 0
account/models.py

@@ -47,6 +47,9 @@ class LensmanInfo(CreateUpdateMixin):
47 47
 
48 48
     proportion = models.FloatField(_(u'proportion'), default=1.0, help_text=u'摄影师分成比例(0.0 ~ 1.0)')
49 49
 
50
+    nomark = models.IntegerField(_(u'nomark'), default=299, help_text=u'摄影师无水印价格(分)')
51
+    origin = models.IntegerField(_(u'origin'), default=999, help_text=u'摄影师高清图价格(分)')
52
+
50 53
     balance = models.IntegerField(_(u'balance'), default=0, help_text=u'摄影师余额(分)')
51 54
 
52 55
     user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS, default=UNVERIFIED)

+ 2 - 0
api/urls.py

@@ -32,6 +32,8 @@ urlpatterns += [
32 32
 
33 33
     url(r'^l/wx/authorize$', lensman_views.lensman_wx_authorize_api, name='lensman_wx_authorize_api'),  # 微信用户授权
34 34
 
35
+    url(r'^l/price_fix$', lensman_views.lensman_price_fix_api, name='lensman_price_fix_api'),  # 摄影师定价
36
+
35 37
     url(r'^l/upload$', lensman_views.lensman_photo_upload_api, name='lensman_photo_upload_api'),  # 摄影师照片上传
36 38
     url(r'^l/origin_upload$', lensman_views.lensman_origin_photo_upload_api, name='lensman_origin_photo_upload_api'),  # 摄影师原图上传
37 39
 

+ 21 - 0
group/lensman_views.py

@@ -127,6 +127,27 @@ def lensman_wx_authorize_api(request):
127 127
 
128 128
 
129 129
 @logit
130
+def lensman_price_fix_api(request):
131
+    lensman_id = request.POST.get('user_id', '')
132
+    nomark = request.POST.get('nomark', 299)
133
+    origin = request.POST.get('origin', 999)
134
+
135
+    # 用户校验
136
+    try:
137
+        lensman = LensmanInfo.objects.get(lensman_id=lensman_id)
138
+    except LensmanInfo.DoesNotExist:
139
+        return response(UserStatusCode.USER_NOT_FOUND)
140
+
141
+    if 'nomark' in request.POST:
142
+        lensman.nomark = nomark
143
+    if 'origin' in request.POST:
144
+        lensman.origin = origin
145
+    lensman.save()
146
+
147
+    return response(200, 'Lensman Price Fix Success', u'摄影师定价修改成功')
148
+
149
+
150
+@logit
130 151
 def lensman_photo_upload_api(request):
131 152
     """
132 153
     摄影师照片上传