+ lensman_photo_id = models.CharField(_(u'lensman_photo_id'), max_length=255, blank=True, null=True, help_text=u'摄影师照片唯一标识,同 PhotosInfo 表', db_index=True)
- m_photo_path = models.CharField(_(u'm_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,控制器上传,无水印')
+ m_photo_path = models.CharField(_(u'm_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,Box上传,无水印')
l_photo_path = models.CharField(_(u'l_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,美化大图')
r_photo_path = models.CharField(_(u'r_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,高清大图')
@@ -6,8 +6,8 @@ from pay.models import OrderInfo |
||
6 | 6 |
|
7 | 7 |
|
8 | 8 |
class OrderInfoAdmin(admin.ModelAdmin): |
9 |
- list_display = ('order_id', 'from_uid', 'to_uid', 'pay_status', 'paid_at', 'status', 'created_at', 'updated_at') |
|
10 |
- list_filter = ('pay_status', 'status') |
|
9 |
+ list_display = ('order_id', 'photo_type', 'photo_status', 'from_uid', 'to_uid', 'pay_status', 'paid_at', 'reback_status', 'reback_at', 'status', 'created_at', 'updated_at') |
|
10 |
+ list_filter = ('photo_type', 'photo_status', 'pay_status', 'reback_status', 'status') |
|
11 | 11 |
|
12 | 12 |
|
13 | 13 |
admin.site.register(OrderInfo, OrderInfoAdmin) |
@@ -0,0 +1,39 @@ |
||
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 |
+ ('pay', '0005_remove_orderinfo_to_lid'), |
|
11 |
+ ] |
|
12 |
+ |
|
13 |
+ operations = [ |
|
14 |
+ migrations.AddField( |
|
15 |
+ model_name='orderinfo', |
|
16 |
+ name='photo_status', |
|
17 |
+ field=models.IntegerField(default=0, help_text='\u8d2d\u4e70\u7167\u7247\u72b6\u6001, \u6807\u8bc6\u7528\u6237\u662f\u5426\u5df2\u7ecf\u83b7\u5f97\u7167\u7247', db_index=True, verbose_name='photo_status', choices=[(0, '\u5f85\u4e0a\u4f20'), (1, '\u5df2\u4e0a\u4f20'), (2, '\u5df2\u5220\u9664')]), |
|
18 |
+ ), |
|
19 |
+ migrations.AddField( |
|
20 |
+ model_name='orderinfo', |
|
21 |
+ name='reback_at', |
|
22 |
+ field=models.DateTimeField(help_text='\u9000\u6b3e\u65f6\u95f4', null=True, verbose_name='reback_at', blank=True), |
|
23 |
+ ), |
|
24 |
+ migrations.AddField( |
|
25 |
+ model_name='orderinfo', |
|
26 |
+ name='reback_status', |
|
27 |
+ field=models.BooleanField(default=False, help_text='\u9000\u6b3e\u72b6\u6001', db_index=True, verbose_name='reback_status'), |
|
28 |
+ ), |
|
29 |
+ migrations.AddField( |
|
30 |
+ model_name='orderinfo', |
|
31 |
+ name='session_id', |
|
32 |
+ field=models.CharField(max_length=255, blank=True, help_text='\u7167\u7247\u7ec4\u552f\u4e00\u6807\u8bc6\uff0c\u540c PhotosInfo \u8868', null=True, verbose_name='session_id', db_index=True), |
|
33 |
+ ), |
|
34 |
+ migrations.AlterField( |
|
35 |
+ model_name='orderinfo', |
|
36 |
+ name='photo_type', |
|
37 |
+ field=models.IntegerField(default=0, help_text='\u8d2d\u4e70\u7167\u7247\u7c7b\u578b', db_index=True, verbose_name='photo_type', choices=[(0, '\u53bb\u9664\u6c34\u5370'), (1, '\u83b7\u53d6\u9ad8\u6e05\u56fe')]), |
|
38 |
+ ), |
|
39 |
+ ] |
@@ -1,6 +1,5 @@ |
||
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
-from django.conf import settings |
|
4 | 3 |
from django.db import models |
5 | 4 |
from django.utils.translation import ugettext_lazy as _ |
6 | 5 |
from shortuuidfield import ShortUUIDField |
@@ -18,6 +17,16 @@ class OrderInfo(CreateUpdateMixin): |
||
18 | 17 |
(ORIGIN, u'获取高清图'), |
19 | 18 |
) |
20 | 19 |
|
20 |
+ WANTED = 0 |
|
21 |
+ FETCHED = 1 |
|
22 |
+ DELETED = 2 |
|
23 |
+ |
|
24 |
+ PHOTO_STATUS = ( |
|
25 |
+ (WANTED, u'待上传'), |
|
26 |
+ (FETCHED, u'已上传'), |
|
27 |
+ (DELETED, u'已删除'), |
|
28 |
+ ) |
|
29 |
+ |
|
21 | 30 |
""" |
22 | 31 |
# Trade State of Wechat Query |
23 | 32 |
SUCCESS ——— 支付成功 |
@@ -44,10 +53,12 @@ class OrderInfo(CreateUpdateMixin): |
||
44 | 53 |
order_id = ShortUUIDField(_(u'order_id'), max_length=255, help_text=u'订单唯一标识', db_index=True) |
45 | 54 |
|
46 | 55 |
group_id = models.CharField(_(u'group_id'), max_length=255, blank=True, null=True, help_text=u'群组唯一标识', db_index=True) |
56 |
+ session_id = models.CharField(_(u'session_id'), max_length=255, blank=True, null=True, help_text=u'照片组唯一标识,同 PhotosInfo 表', db_index=True) |
|
47 | 57 |
photo_id = models.CharField(_(u'photo_id'), max_length=255, blank=True, null=True, help_text=u'飞图唯一标识', db_index=True) |
48 | 58 |
lensman_photo_id = models.CharField(_(u'lensman_photo_id'), max_length=255, blank=True, null=True, help_text=u'摄影师照片唯一标识,同 PhotosInfo 表', db_index=True) |
49 | 59 |
|
50 |
- photo_type = models.IntegerField(_('photo_type'), choices=PHOTO_TYPE, default=NOMARK, help_text=u'购买照片类型') |
|
60 |
+ photo_type = models.IntegerField(_('photo_type'), choices=PHOTO_TYPE, default=NOMARK, help_text=u'购买照片类型', db_index=True) |
|
61 |
+ photo_status = models.IntegerField(_(u'photo_status'), choices=PHOTO_STATUS, default=WANTED, help_text=_(u'购买照片状态, 标识用户是否已经获得照片'), db_index=True) |
|
51 | 62 |
|
52 | 63 |
from_uid = models.CharField(_(u'from_uid'), max_length=255, help_text=u'付款用户唯一标识', db_index=True) |
53 | 64 |
to_uid = models.CharField(_(u'to_uid'), max_length=255, blank=True, null=True, help_text=u'收款用户唯一标识', db_index=True) |
@@ -60,6 +71,9 @@ class OrderInfo(CreateUpdateMixin): |
||
60 | 71 |
pay_status = models.IntegerField(_(u'pay_status'), choices=PAY_STATUS, default=WAITING_PAY, help_text=u'支付状态', db_index=True) |
61 | 72 |
paid_at = models.DateTimeField(_(u'paid_at'), blank=True, null=True, help_text=_(u'支付时间')) |
62 | 73 |
|
74 |
+ reback_status = models.BooleanField(_(u'reback_status'), default=False, help_text=u'退款状态', db_index=True) |
|
75 |
+ reback_at = models.DateTimeField(_(u'reback_at'), blank=True, null=True, help_text=_(u'退款时间')) |
|
76 |
+ |
|
63 | 77 |
class Meta: |
64 | 78 |
verbose_name = _('orderinfo') |
65 | 79 |
verbose_name_plural = _('orderinfo') |
@@ -85,3 +99,10 @@ class OrderInfo(CreateUpdateMixin): |
||
85 | 99 |
'paid_at': self.paid_at and self.paid_at.replace(microsecond=0), |
86 | 100 |
'created_at': self.created_at.replace(microsecond=0), |
87 | 101 |
} |
102 |
+ |
|
103 |
+ @property |
|
104 |
+ def lensdata(self): |
|
105 |
+ return { |
|
106 |
+ 'session_id': self.session_id, |
|
107 |
+ 'photo_id': self.lensman_photo_id |
|
108 |
+ } |
@@ -70,6 +70,7 @@ def wx_order_create_api(request): |
||
70 | 70 |
photo_type=1 if photo_type == 'origin' else 0, |
71 | 71 |
from_uid=from_uid, |
72 | 72 |
to_uid=to_uid, |
73 |
+ session_id=group_photo.session_id, |
|
73 | 74 |
total_fee=total_fee, |
74 | 75 |
trade_type=trade_type, |
75 | 76 |
) |
@@ -103,14 +104,18 @@ def order_paid_success(order): |
||
103 | 104 |
if order.pay_status == OrderInfo.PAID: |
104 | 105 |
return |
105 | 106 |
|
107 |
+ if order.photo_type == OrderInfo.NOMARK: |
|
108 |
+ order.photo_status = OrderInfo.FETCHED |
|
106 | 109 |
order.pay_status = OrderInfo.PAID |
107 | 110 |
order.paid_at = tc.utc_datetime() |
108 | 111 |
order.save() |
109 | 112 |
|
110 | 113 |
porder, created = GroupPhotoOrderInfo.objects.get_or_create( |
111 | 114 |
group_id=order.group_id, |
115 |
+ session_id=order.session_id, |
|
112 | 116 |
user_id=order.from_uid, |
113 | 117 |
photo_id=order.photo_id, |
118 |
+ lensman_photo_id=order.lensman_photo_id, |
|
114 | 119 |
) |
115 | 120 |
photo = PhotosInfo.objects.get( |
116 | 121 |
photo_id=order.lensman_photo_id, |
@@ -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 |
+ ('photo', '0007_auto_20160422_1322'), |
|
11 |
+ ] |
|
12 |
+ |
|
13 |
+ operations = [ |
|
14 |
+ migrations.AlterField( |
|
15 |
+ model_name='photosinfo', |
|
16 |
+ name='m_photo_path', |
|
17 |
+ field=models.CharField(help_text='\u7167\u7247\u5b58\u653e\u8def\u5f84\uff0cBox\u4e0a\u4f20\uff0c\u65e0\u6c34\u5370', max_length=255, null=True, verbose_name='m_photo_path', blank=True), |
|
18 |
+ ), |
|
19 |
+ migrations.AlterField( |
|
20 |
+ model_name='photosinfo', |
|
21 |
+ name='p_photo_path', |
|
22 |
+ field=models.CharField(help_text='\u7167\u7247\u5b58\u653e\u8def\u5f84\uff0cBox\u4e0a\u4f20\uff0c\u6709\u6c34\u5370\uff0c\u670d\u52a1\u5668\u6dfb\u52a0', max_length=255, null=True, verbose_name='p_photo_path', blank=True), |
|
23 |
+ ), |
|
24 |
+ ] |
@@ -33,8 +33,8 @@ class PhotosInfo(CreateUpdateMixin): |
||
33 | 33 |
lensman_id = models.CharField(_(u'lensman_id'), max_length=255, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True) |
34 | 34 |
session_id = models.CharField(_(u'session_id'), max_length=255, blank=True, null=True, help_text=u'照片组唯一标识', db_index=True) |
35 | 35 |
photo_id = models.CharField(_(u'photo_id'), max_length=255, blank=True, null=True, help_text=u'照片唯一标识', db_index=True, unique=True) |
36 |
- p_photo_path = models.CharField(_(u'p_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,控制器上传,有水印,服务器添加') |
|
37 |
- m_photo_path = models.CharField(_(u'm_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,控制器上传,无水印') |
|
36 |
+ p_photo_path = models.CharField(_(u'p_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,Box上传,有水印,服务器添加') |
|
37 |
+ m_photo_path = models.CharField(_(u'm_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,Box上传,无水印') |
|
38 | 38 |
l_photo_path = models.CharField(_(u'l_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,美化大图') |
39 | 39 |
r_photo_path = models.CharField(_(u'r_photo_path'), max_length=255, blank=True, null=True, help_text=u'照片存放路径,高清大图') |
40 | 40 |
|