@@ -30,7 +30,8 @@ from member.models import (GoodsInfo, GoodsOrderInfo, MemberActivityContribution |
||
| 30 | 30 |
from pre.custom_message import sendtemplatemessage, sendwxasubscribemessage |
| 31 | 31 |
from statistic.models import ConsumeModelSaleStatisticInfo, ConsumeSaleStatisticInfo, ConsumeUserStatisticInfo |
| 32 | 32 |
from utils.error.errno_utils import (AdministratorStatusCode, ComplementCodeStatusCode, |
| 33 |
- MemberActivityContributionStatusCode, ProductBrandStatusCode, |
|
| 33 |
+ MemberActivityContributionStatusCode, MemberActivityContributionWelfareStatusCode, |
|
| 34 |
+ MemberActivityContributionWelfareUnblockingStatusCode, ProductBrandStatusCode, |
|
| 34 | 35 |
ProductCouponStatusCode, ProductMachineStatusCode, UserStatusCode) |
| 35 | 36 |
|
| 36 | 37 |
|
@@ -1038,7 +1039,7 @@ def member_activity_contribute_welfare_update(request, administrator): |
||
| 1038 | 1039 |
try: |
| 1039 | 1040 |
welfare = MemberActivityContributionWelfareInfo.objects.get(welfare_id=welfare_id, status=True) |
| 1040 | 1041 |
except MemberActivityContributionWelfareInfo.DoesNotExist: |
| 1041 |
- return response() |
|
| 1042 |
+ return response(MemberActivityContributionWelfareStatusCode.ACTIVITY_CONTRIBUTION_WELFARE_NOT_FOUND) |
|
| 1042 | 1043 |
|
| 1043 | 1044 |
welfare.activity_id = activity_id |
| 1044 | 1045 |
welfare.welfare_type = welfare_type |
@@ -1096,6 +1097,63 @@ def member_activity_contribute_welfare_unlock(request, administrator): |
||
| 1096 | 1097 |
return response(200, 'Unlock Member Activity Contribute Welfare Success', u'解锁会员活动投稿福利成功') |
| 1097 | 1098 |
|
| 1098 | 1099 |
|
| 1100 |
+@logit |
|
| 1101 |
+@check_admin |
|
| 1102 |
+def member_activity_contribute_welfare_unlocking_list(request, administrator): |
|
| 1103 |
+ user_id = request.POST.get('user_id', '')
|
|
| 1104 |
+ activity_id = request.POST.get('activity_id', '')
|
|
| 1105 |
+ contribution_id = request.POST.get('contribution_id', '')
|
|
| 1106 |
+ welfare_id = request.POST.get('welfare_id', '')
|
|
| 1107 |
+ page = request.POST.get('page', 1)
|
|
| 1108 |
+ num = request.POST.get('num', 20)
|
|
| 1109 |
+ |
|
| 1110 |
+ unlockings = MemberActivityContributionWelfareUnlockingInfo.objects.filter(status=True) |
|
| 1111 |
+ if user_id: |
|
| 1112 |
+ unlockings = unlockings.filter(user_id=user_id) |
|
| 1113 |
+ if activity_id: |
|
| 1114 |
+ unlockings = unlockings.filter(activity_id=activity_id) |
|
| 1115 |
+ if contribution_id: |
|
| 1116 |
+ unlockings = unlockings.filter(contribution_id=contribution_id) |
|
| 1117 |
+ if welfare_id: |
|
| 1118 |
+ unlockings = unlockings.filter(welfare_id=welfare_id) |
|
| 1119 |
+ unlockings = unlockings.order_by('-pk')
|
|
| 1120 |
+ unlockings, left = pagination(unlockings, page, num) |
|
| 1121 |
+ unlockings = [unlocking.data for unlocking in unlockings] |
|
| 1122 |
+ |
|
| 1123 |
+ return response(data={
|
|
| 1124 |
+ 'unlockings': unlockings, |
|
| 1125 |
+ 'left': left, |
|
| 1126 |
+ }) |
|
| 1127 |
+ |
|
| 1128 |
+ |
|
| 1129 |
+@logit |
|
| 1130 |
+@check_admin |
|
| 1131 |
+@transaction.atomic |
|
| 1132 |
+def member_activity_contribute_welfare_unlocking_update(request, administrator): |
|
| 1133 |
+ unlocking_id = request.POST.get('unlocking_id', '')
|
|
| 1134 |
+ name = request.POST.get('name', '')
|
|
| 1135 |
+ phone = request.POST.get('phone', '')
|
|
| 1136 |
+ address = request.POST.get('address', '')
|
|
| 1137 |
+ tracking_number = request.POST.get('tracking_number', '')
|
|
| 1138 |
+ |
|
| 1139 |
+ try: |
|
| 1140 |
+ unlocking = MemberActivityContributionWelfareUnlockingInfo.objects.select_for_update().get(unlocking_id=unlocking_id, status=True) |
|
| 1141 |
+ except MemberActivityContributionWelfareUnlockingInfo.DoesNotExist: |
|
| 1142 |
+ return response(MemberActivityContributionWelfareUnblockingStatusCode.ACTIVITY_CONTRIBUTION_WELFARE_UNBLOCKING_NOT_FOUND) |
|
| 1143 |
+ |
|
| 1144 |
+ if name: |
|
| 1145 |
+ unlocking.name = name |
|
| 1146 |
+ if phone: |
|
| 1147 |
+ unlocking.phone = phone |
|
| 1148 |
+ if address: |
|
| 1149 |
+ unlocking.address = address |
|
| 1150 |
+ if tracking_number: |
|
| 1151 |
+ unlocking.tracking_number = tracking_number |
|
| 1152 |
+ unlocking.save() |
|
| 1153 |
+ |
|
| 1154 |
+ return response(200, 'Update Member Activity Contribute Welfare Unblocking Success', u'更新会员活动投稿福利解锁成功') |
|
| 1155 |
+ |
|
| 1156 |
+ |
|
| 1099 | 1157 |
@check_admin |
| 1100 | 1158 |
def coupon_list(request, administrator): |
| 1101 | 1159 |
title = request.POST.get('title', '')
|
@@ -15,11 +15,13 @@ from TimeConvert import TimeConvert as tc |
||
| 15 | 15 |
|
| 16 | 16 |
from account.models import UserInfo |
| 17 | 17 |
from coupon.models import UserCouponInfo |
| 18 |
-from member.models import (GoodsInfo, GoodsOrderInfo, MemberActivityContributionInfo, MemberActivityGroupShareInfo, |
|
| 18 |
+from member.models import (GoodsInfo, GoodsOrderInfo, MemberActivityContributionInfo, |
|
| 19 |
+ MemberActivityContributionWelfareUnlockingInfo, MemberActivityGroupShareInfo, |
|
| 19 | 20 |
MemberActivityInfo, MemberActivitySigninInfo, MemberActivitySignupInfo, RightInfo) |
| 20 |
-from utils.error.errno_utils import (MemberActivityContributionStatusCode, MemberActivityStatusCode, |
|
| 21 |
+from utils.error.errno_utils import (MemberActivityContributionStatusCode, |
|
| 22 |
+ MemberActivityContributionWelfareUnblockingStatusCode, MemberActivityStatusCode, |
|
| 21 | 23 |
MemberCouponStatusCode, MemberGoodStatusCode, MemberRightStatusCode, |
| 22 |
- UserStatusCode) |
|
| 24 |
+ PermissionStatusCode, UserStatusCode) |
|
| 23 | 25 |
from utils.redis.connect import r |
| 24 | 26 |
from utils.redis.rkeys import MEMBER_SEND_COUPON_LIST, MEMBER_UPGRADE_INFO |
| 25 | 27 |
from utils.redis.rshot import get_member_shot_data |
@@ -595,3 +597,70 @@ def activity_contribute_detail(request): |
||
| 595 | 597 |
return response(MemberActivityContributionStatusCode.ACTIVITY_CONTRIBUTION_NOT_FOUND) |
| 596 | 598 |
|
| 597 | 599 |
return response(data=contribution.data) |
| 600 |
+ |
|
| 601 |
+ |
|
| 602 |
+@logit |
|
| 603 |
+def activity_contribute_welfare_unlocking_list(request): |
|
| 604 |
+ brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
|
| 605 |
+ user_id = request.POST.get('user_id', '')
|
|
| 606 |
+ page = request.POST.get('page', 1)
|
|
| 607 |
+ num = request.POST.get('num', 20)
|
|
| 608 |
+ |
|
| 609 |
+ unlockings = MemberActivityContributionWelfareUnlockingInfo.objects.filter(user_id=user_id, is_handled=False, status=True).order_by('-pk')
|
|
| 610 |
+ unlockings, left = pagination(unlockings, page, num) |
|
| 611 |
+ unlockings = [unlocking.data for unlocking in unlockings] |
|
| 612 |
+ |
|
| 613 |
+ return response(data={
|
|
| 614 |
+ 'unlockings': unlockings, |
|
| 615 |
+ 'left': left, |
|
| 616 |
+ }) |
|
| 617 |
+ |
|
| 618 |
+ |
|
| 619 |
+@logit |
|
| 620 |
+@transaction.atomic |
|
| 621 |
+def activity_contribute_welfare_unlocking_update(request): |
|
| 622 |
+ brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
|
| 623 |
+ unlocking_id = request.POST.get('unlocking_id', '')
|
|
| 624 |
+ user_id = request.POST.get('user_id', '')
|
|
| 625 |
+ name = request.POST.get('name', '')
|
|
| 626 |
+ phone = request.POST.get('phone', '')
|
|
| 627 |
+ address = request.POST.get('address', '')
|
|
| 628 |
+ |
|
| 629 |
+ try: |
|
| 630 |
+ unlocking = MemberActivityContributionWelfareUnlockingInfo.objects.select_for_update().get(unlocking_id=unlocking_id, status=True) |
|
| 631 |
+ except MemberActivityContributionWelfareUnlockingInfo.DoesNotExist: |
|
| 632 |
+ return response(MemberActivityContributionWelfareUnblockingStatusCode.ACTIVITY_CONTRIBUTION_WELFARE_UNBLOCKING_NOT_FOUND) |
|
| 633 |
+ |
|
| 634 |
+ if user_id != unlocking.user_id: |
|
| 635 |
+ return response(PermissionStatusCode.PERMISSION_DENIED) |
|
| 636 |
+ |
|
| 637 |
+ if name: |
|
| 638 |
+ unlocking.name = name |
|
| 639 |
+ if phone: |
|
| 640 |
+ unlocking.phone = phone |
|
| 641 |
+ if address: |
|
| 642 |
+ unlocking.address = address |
|
| 643 |
+ unlocking.save() |
|
| 644 |
+ |
|
| 645 |
+ return response(200, 'Update Member Activity Contribute Welfare Unblocking Success', u'更新会员活动投稿福利解锁成功') |
|
| 646 |
+ |
|
| 647 |
+ |
|
| 648 |
+@logit |
|
| 649 |
+@transaction.atomic |
|
| 650 |
+def activity_contribute_welfare_unlocking_handled(request): |
|
| 651 |
+ brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
|
| 652 |
+ unlocking_id = request.POST.get('unlocking_id', '')
|
|
| 653 |
+ user_id = request.POST.get('user_id', '')
|
|
| 654 |
+ |
|
| 655 |
+ try: |
|
| 656 |
+ unlocking = MemberActivityContributionWelfareUnlockingInfo.objects.select_for_update().get(unlocking_id=unlocking_id, status=True) |
|
| 657 |
+ except MemberActivityContributionWelfareUnlockingInfo.DoesNotExist: |
|
| 658 |
+ return response(MemberActivityContributionWelfareUnblockingStatusCode.ACTIVITY_CONTRIBUTION_WELFARE_UNBLOCKING_NOT_FOUND) |
|
| 659 |
+ |
|
| 660 |
+ if user_id != unlocking.user_id: |
|
| 661 |
+ return response(PermissionStatusCode.PERMISSION_DENIED) |
|
| 662 |
+ |
|
| 663 |
+ unlocking.is_handled = True |
|
| 664 |
+ unlocking.save() |
|
| 665 |
+ |
|
| 666 |
+ return response(200, 'Update Member Activity Contribute Welfare Unblocking Success', u'处理会员活动投稿福利解锁成功') |
@@ -175,11 +175,13 @@ urlpatterns += [ |
||
| 175 | 175 |
url(r'^admin/member/activity/contribute/audit$', admin_views.member_activity_contribute_audit, name='admin_member_activity_contribute_audit'), |
| 176 | 176 |
url(r'^admin/member/activity/contribute/selected$', admin_views.member_activity_contribute_selected, name='admin_member_activity_contribute_selected'), |
| 177 | 177 |
|
| 178 |
- url(r'^admin/member/activity/contribute/welfare/list$', admin_views.member_activity_contribute_welfare_list, name='member_activity_contribute_welfare_list'), |
|
| 179 |
- url(r'^admin/member/activity/contribute/welfare/detail$', admin_views.member_activity_contribute_welfare_detail, name='member_activity_contribute_welfare_detail'), |
|
| 180 |
- url(r'^admin/member/activity/contribute/welfare/update$', admin_views.member_activity_contribute_welfare_update, name='member_activity_contribute_welfare_update'), |
|
| 181 |
- url(r'^admin/member/activity/contribute/welfare/create$', admin_views.member_activity_contribute_welfare_create, name='member_activity_contribute_welfare_create'), |
|
| 182 |
- url(r'^admin/member/activity/contribute/welfare/unlock$', admin_views.member_activity_contribute_welfare_unlock, name='member_activity_contribute_welfare_unlock'), |
|
| 178 |
+ url(r'^admin/member/activity/contribute/welfare/list$', admin_views.member_activity_contribute_welfare_list, name='admin_member_activity_contribute_welfare_list'), |
|
| 179 |
+ url(r'^admin/member/activity/contribute/welfare/detail$', admin_views.member_activity_contribute_welfare_detail, name='admin_member_activity_contribute_welfare_detail'), |
|
| 180 |
+ url(r'^admin/member/activity/contribute/welfare/update$', admin_views.member_activity_contribute_welfare_update, name='admin_member_activity_contribute_welfare_update'), |
|
| 181 |
+ url(r'^admin/member/activity/contribute/welfare/create$', admin_views.member_activity_contribute_welfare_create, name='admin_member_activity_contribute_welfare_create'), |
|
| 182 |
+ url(r'^admin/member/activity/contribute/welfare/unlock$', admin_views.member_activity_contribute_welfare_unlock, name='admin_member_activity_contribute_welfare_unlock'), |
|
| 183 |
+ url(r'^admin/member/activity/contribute/welfare/unlocking/list$', admin_views.member_activity_contribute_welfare_unlocking_list, name='admin_member_activity_contribute_welfare_unlocking_list'), |
|
| 184 |
+ url(r'^admin/member/activity/contribute/welfare/unlocking/update$', admin_views.member_activity_contribute_welfare_unlocking_update, name='admin_member_activity_contribute_welfare_unlocking_update'), |
|
| 183 | 185 |
|
| 184 | 186 |
url(r'^admin/coupon/list$', admin_views.coupon_list, name='coupon_list'), |
| 185 | 187 |
url(r'^admin/coupon/details$', admin_views.coupon_detail, name='coupon_detail'), |
@@ -242,6 +244,10 @@ urlpatterns += [ |
||
| 242 | 244 |
url(r'^member/activity/contribute/list$', member_views.activity_contribute_list, name='member_activity_contribute_list'), |
| 243 | 245 |
url(r'^member/activity/contribute/detail$', member_views.activity_contribute_detail, name='member_activity_contribute_detail'), |
| 244 | 246 |
|
| 247 |
+ url(r'^member/activity/contribute/welfare/unlocking/list$', member_views.activity_contribute_welfare_unlocking_list, name='member_activity_contribute_welfare_unlocking_list'), |
|
| 248 |
+ url(r'^member/activity/contribute/welfare/unlocking/update$', member_views.activity_contribute_welfare_unlocking_update, name='member_activity_contribute_welfare_unlocking_update'), |
|
| 249 |
+ url(r'^member/activity/contribute/welfare/unlocking/handled$', member_views.activity_contribute_welfare_unlocking_handled, name='member_activity_contribute_welfare_unlocking_handled'), |
|
| 250 |
+ |
|
| 245 | 251 |
url(r'^rights$', member_views.rights, name='rights'), |
| 246 | 252 |
url(r'^right/detail$', member_views.right_detail, name='right_detail'), |
| 247 | 253 |
url(r'^goods$', member_views.goods, name='goods'), |
@@ -792,6 +792,10 @@ class MemberActivityContributionWelfareUnlockingInfo(BaseModelMixin, BrandInfoMi |
||
| 792 | 792 |
|
| 793 | 793 |
@property |
| 794 | 794 |
def data(self): |
| 795 |
+ try: |
|
| 796 |
+ welfare = MemberActivityContributionWelfareInfo.objects.get(welfare_id=self.welfare_id) |
|
| 797 |
+ except MemberActivityContributionWelfareInfo.DoesNotExist: |
|
| 798 |
+ welfare = None |
|
| 795 | 799 |
return {
|
| 796 | 800 |
'unlocking_id': self.unlocking_id, |
| 797 | 801 |
'brand_id': self.brand_id, |
@@ -801,6 +805,7 @@ class MemberActivityContributionWelfareUnlockingInfo(BaseModelMixin, BrandInfoMi |
||
| 801 | 805 |
'activity_id': self.activity_id, |
| 802 | 806 |
'contribution_id': self.contribution_id, |
| 803 | 807 |
'welfare_id': self.welfare_id, |
| 808 |
+ 'welfare': welfare.data if welfare else {},
|
|
| 804 | 809 |
'name': self.name, |
| 805 | 810 |
'phone': self.phone, |
| 806 | 811 |
'address': self.address, |
@@ -100,6 +100,16 @@ class MemberActivityContributionStatusCode(BaseStatusCode): |
||
| 100 | 100 |
ACTIVITY_CONTRIBUTION_NOT_FOUND = StatusCodeField(503801, 'Activity Contribution Not Found', description=u'活动投稿不存在') |
| 101 | 101 |
|
| 102 | 102 |
|
| 103 |
+class MemberActivityContributionWelfareStatusCode(BaseStatusCode): |
|
| 104 |
+ """ 会员活动投稿福利相关错误码 5039xx """ |
|
| 105 |
+ ACTIVITY_CONTRIBUTION_WELFARE_NOT_FOUND = StatusCodeField(503901, 'Activity Contribution Welfare Not Found', description=u'活动投稿福利不存在') |
|
| 106 |
+ |
|
| 107 |
+ |
|
| 108 |
+class MemberActivityContributionWelfareUnblockingStatusCode(BaseStatusCode): |
|
| 109 |
+ """ 会员活动投稿福利相关错误码 5039xx """ |
|
| 110 |
+ ACTIVITY_CONTRIBUTION_WELFARE_UNBLOCKING_NOT_FOUND = StatusCodeField(503999, 'Activity Contribution Welfare Unblocking Not Found', description=u'活动投稿福利解锁不存在') |
|
| 111 |
+ |
|
| 112 |
+ |
|
| 103 | 113 |
class MemberCouponStatusCode(BaseStatusCode): |
| 104 | 114 |
""" 会员优惠券相关错误码 5040xx """ |
| 105 | 115 |
USER_COUPON_NOT_FOUND = StatusCodeField(504001, 'User Coupon Not Found', description=u'用户优惠券不存在') |