| Author | SHA1 | Message | Date | 
|---|---|---|---|
|  | 6924caea46 | 7 months ago | 
| @@ -11,7 +11,7 @@ from TimeConvert import TimeConvert as tc | ||
| 11 | 11 |  | 
| 12 | 12 | from account.models import UserInfo | 
| 13 | 13 | from kodo.decorators import check_admin | 
| 14 | -from mch.models import AdministratorInfo, ConsumeShotUnbindingInfo | |
| 14 | +from mch.models import AdministratorInfo, ConsumeShotUnbindingInfo, ConsumeInfoSubmitLogInfo, ModelInfo | |
| 15 | 15 |  | 
| 16 | 16 |  | 
| 17 | 17 | @logit | 
| @@ -52,3 +52,36 @@ def consumer_shot_unbinding_list(request, administrator): | ||
| 52 | 52 | 'count': count, | 
| 53 | 53 | 'left': left | 
| 54 | 54 | }) | 
| 55 | + | |
| 56 | + | |
| 57 | +@logit | |
| 58 | +@check_admin | |
| 59 | +def consumer_shot_unbinding_delete(request, administrator): | |
| 60 | +    unbinding_id = request.POST.get('unbinding_id', '') | |
| 61 | + | |
| 62 | + unbinding_info = ConsumeShotUnbindingInfo.objects.get(unbinding_id=unbinding_id) | |
| 63 | + | |
| 64 | + unbinding_info.status = False | |
| 65 | + unbinding_info.delete() | |
| 66 | + | |
| 67 | + log_info = ConsumeInfoSubmitLogInfo.objects.get(pk=unbinding_info.submit_pk) | |
| 68 | + log_info.status = True | |
| 69 | + log_info.delete_type = ConsumeInfoSubmitLogInfo.UNDELETE | |
| 70 | + log_info.save() | |
| 71 | + | |
| 72 | + if log_info.unbound: | |
| 73 | + try: | |
| 74 | + user = UserInfo.objects.get(user_id=log_info.user_id) | |
| 75 | + user.shots_num += 1 | |
| 76 | + user.integral += log_info.shot_member_integral | |
| 77 | + model = ModelInfo.objects.get(model_id=log_info.model_id) | |
| 78 | + | |
| 79 | + if user.level < UserInfo.MEMBER_BLACK_GOLD and model.shot_type_id != 'V6PkivthL4sdADp4GNpQ4C': | |
| 80 | + user.level += 1 | |
| 81 | + user.save() | |
| 82 | + | |
| 83 | + except UserInfo.DoesNotExist: | |
| 84 | + pass | |
| 85 | + | |
| 86 | + | |
| 87 | + return response(200, 'Get Cosumer Shot Unbinding Delete Success', u'消费者镜头解绑记录删除成功') | 
| @@ -162,6 +162,7 @@ urlpatterns += [ | ||
| 162 | 162 | url(r'^admin/record/sale/batch$', admin_views.record_sale_batch, name='record_sale_batch'), | 
| 163 | 163 | url(r'^admin/record/warehouse$', admin_views.record_warehouse, name='record_warehouse'), | 
| 164 | 164 | url(r'^admin/consumer/shot/unbinding/list$', consumer_admin_view.consumer_shot_unbinding_list, name='consumer_shot_unbinding_list'), | 
| 165 | + url(r'^admin/consumer/shot/unbinding/delete$', consumer_admin_view.consumer_shot_unbinding_delete, name='consumer_shot_unbinding_delete'), | |
| 165 | 166 |  | 
| 166 | 167 | url(r'^admin/list/model$', admin_views.model_list, name='model_list'), | 
| 167 | 168 | url(r'^admin/list/distributor$', admin_views.distributor_list, name='distributor_list'), |