@@ -26,6 +26,7 @@ from utils.page_utils import pagination |
||
26 | 26 |
from utils.redis.rgroup import get_group_info, get_group_users_info, set_group_info, set_group_users_info |
27 | 27 |
from utils.redis.rkeys import GROUP_LAST_PHOTO_PK, TODAY_INCOME, TODAY_UPLOAD_PHOTO_AMOUNT, WEEK_INCOME, WEEK_SOLD |
28 | 28 |
from utils.redis.rorder import set_lensman_order_record |
29 |
+from utils.redis.rprice import set_lensman_price_fixed |
|
29 | 30 |
from utils.thumbnail_utils import make_thumbnail |
30 | 31 |
from utils.watermark_utils import watermark_wrap |
31 | 32 |
|
@@ -144,6 +145,8 @@ def lensman_price_fix_api(request): |
||
144 | 145 |
lensman.origin = origin |
145 | 146 |
lensman.save() |
146 | 147 |
|
148 |
+ set_lensman_price_fixed(lensman_id) |
|
149 |
+ |
|
147 | 150 |
return response(200, 'Lensman Price Fix Success', u'摄影师定价修改成功') |
148 | 151 |
|
149 | 152 |
|
@@ -32,6 +32,7 @@ from utils.redis.rkeys import (GROUP_LAST_PHOTO_PK, GROUP_PHOTO_WATCHER_SET, GRO |
||
32 | 32 |
GROUP_USERS_DELETED_SET, GROUP_USERS_PASSED_SET, GROUP_USERS_QUIT_SET, |
33 | 33 |
GROUP_USERS_REFUSED_SET, LENSMAN_PHOTO_HAGGLE_TIMES, LENSMAN_PHOTO_PRICE) |
34 | 34 |
from utils.redis.rorder import get_lensman_order_record |
35 |
+from utils.redis.rprice import get_lensman_price_fixed |
|
35 | 36 |
from utils.sql.raw import PAI2_HOME_API |
36 | 37 |
from utils.thumbnail_utils import make_thumbnail |
37 | 38 |
from utils.time_utils import origin_expired_stamps |
@@ -963,9 +964,13 @@ def lensman_photo_price(request): |
||
963 | 964 |
price -= random.choice([50, 100]) |
964 | 965 |
r.incr(lensman_photo_haggle_times_key) |
965 | 966 |
else: |
967 |
+ try: |
|
968 |
+ group_photo = GroupPhotoInfo.objects.get(pk=photo_id) |
|
969 |
+ except GroupPhotoInfo.DoesNotExist: |
|
970 |
+ return response(GroupPhotoStatusCode.GROUP_PHOTO_NOT_FOUND) |
|
966 | 971 |
# 获取摄影师定价 |
967 |
- # TODO, 此处需要完整的摄影师定价 |
|
968 |
- price = 999 if photo_type == 'origin' else 299 |
|
972 |
+ price_fixed = get_lensman_price_fixed(group_photo.user_id) |
|
973 |
+ price = price_fixed.get(photo_type, 999) |
|
969 | 974 |
|
970 | 975 |
r.set(lensman_photo_price_key, price) |
971 | 976 |
|
@@ -40,6 +40,9 @@ TODAY_UPLOAD_PHOTO_AMOUNT = 'today:upload:photo:amount:%s:%s' # STRING,日上 |
||
40 | 40 |
# 售出 |
41 | 41 |
WEEK_SOLD = 'week:sold:%s:%s:%s' # STRING,周售出,photo_type、user_id、Week.thisweek().isoformat() |
42 | 42 |
|
43 |
+# 摄影师定价相关 |
|
44 |
+LENSMAN_PHOTO_PRICE_FIXED = 'lensman:photo:price:fixed:%s' # STRING,摄影师照片定价(单位:分),user_id |
|
45 |
+ |
|
43 | 46 |
# 系统消息相关 |
44 | 47 |
SYSTEM_MESSAGE_READ_INFO = 'system:message:read:info:%s' # STRING,系统消息读取信息,user_id |
45 | 48 |
SYSTEM_MESSAGE_DELETED_INFO = 'system:message:deleted:info:%s' # STRING,系统消息删除信息,user_id |
@@ -0,0 +1,36 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+ |
|
3 |
+import json |
|
4 |
+ |
|
5 |
+from django.conf import settings |
|
6 |
+ |
|
7 |
+from account.models import LensmanInfo |
|
8 |
+from utils.redis.rkeys import LENSMAN_PHOTO_PRICE_FIXED |
|
9 |
+ |
|
10 |
+ |
|
11 |
+r = settings.REDIS_CACHE |
|
12 |
+ |
|
13 |
+ |
|
14 |
+# 最新 APP 相关 |
|
15 |
+ |
|
16 |
+ |
|
17 |
+def set_lensman_price_fixed(user_id): |
|
18 |
+ """ 设置摄影师价格设定 """ |
|
19 |
+ try: |
|
20 |
+ lensman = LensmanInfo.objects.get(lensman_id=user_id) |
|
21 |
+ except LensmanInfo.DoesNotExist: |
|
22 |
+ lensman = None |
|
23 |
+ |
|
24 |
+ price_fixed = { |
|
25 |
+ 'nomark': (lensman and lensman.nomark) or 299, |
|
26 |
+ 'origin': (lensman and lensman.origin) or 999, |
|
27 |
+ } |
|
28 |
+ |
|
29 |
+ r.set(LENSMAN_PHOTO_PRICE_FIXED % user_id, json.dumps(price_fixed)) |
|
30 |
+ |
|
31 |
+ return price_fixed |
|
32 |
+ |
|
33 |
+ |
|
34 |
+def get_lensman_price_fixed(user_id): |
|
35 |
+ """ 获取摄影师价格设定 """ |
|
36 |
+ return json.loads(r.get(LENSMAN_PHOTO_PRICE_FIXED % user_id) or '{}') or set_lensman_price_fixed(user_id) |