|  |  | @@ -21,21 +21,26 @@ def lensman_list(request, administrator): | 
            
            
              | 21 | 21 |      query = request.POST.get('query', '') | 
            
            
              | 22 | 22 |      lensman_status = request.POST.get('lensman_status', '') | 
            
            
              | 23 | 23 |      end_date = tc.to_date(request.POST.get('end_date', '')) | 
            
            
              | 24 |  | -    integral_end_date = tc.to_date(request.POST.get('integral_end_date', '')) | 
            
            
              |  | 24 | +    integral_end_date_start = tc.to_date( | 
            
            
              |  | 25 | +        request.POST.get('integral_end_date_start', '')) | 
            
            
              |  | 26 | +    integral_end_date_end = tc.to_date( | 
            
            
              |  | 27 | +        request.POST.get('integral_end_date_end', '')) | 
            
            
              | 25 | 28 |   | 
            
            
              | 26 | 29 |      logs = LensmanInfo.objects.filter(status=True).order_by('-pk') | 
            
            
              | 27 | 30 |   | 
            
            
              | 28 | 31 |      if query: | 
            
            
              | 29 |  | -      logs = logs.filter(Q(name__icontains=query) | Q(phone__icontains=query)) | 
            
            
              | 30 |  | -     | 
            
            
              |  | 32 | +        logs = logs.filter(Q(name__icontains=query) | | 
            
            
              |  | 33 | +                           Q(phone__icontains=query)) | 
            
            
              |  | 34 | + | 
            
            
              | 31 | 35 |      if lensman_status: | 
            
            
              | 32 |  | -       logs = logs.filter(lensman_status=lensman_status) | 
            
            
              | 33 |  | -       | 
            
            
              |  | 36 | +        logs = logs.filter(lensman_status=lensman_status) | 
            
            
              |  | 37 | + | 
            
            
              | 34 | 38 |      if end_date: | 
            
            
              | 35 |  | -       logs = logs.filter(end_date__lte=end_date) | 
            
            
              | 36 |  | -     | 
            
            
              | 37 |  | -    if integral_end_date: | 
            
            
              | 38 |  | -       logs = logs.filter(integral_end_date__lte=integral_end_date) | 
            
            
              |  | 39 | +        logs = logs.filter(end_date__lte=end_date) | 
            
            
              |  | 40 | + | 
            
            
              |  | 41 | +    if integral_end_date_start and integral_end_date_end: | 
            
            
              |  | 42 | +        logs = logs.filter(integral_end_date__lte=integral_end_date_end, | 
            
            
              |  | 43 | +                           integral_end_date__gte=integral_end_date_start) | 
            
            
              | 39 | 44 |   | 
            
            
              | 40 | 45 |      count = logs.count() | 
            
            
              | 41 | 46 |      logs, left = pagination(logs, page, num) | 
            
            
            
            
              |  |  | @@ -56,10 +61,10 @@ def lensman_audit(request, administrator): | 
            
            
              | 56 | 61 |      end_date = tc.to_date(request.POST.get('end_date', '')) | 
            
            
              | 57 | 62 |   | 
            
            
              | 58 | 63 |      try: | 
            
            
              | 59 |  | -      lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True) | 
            
            
              |  | 64 | +        lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True) | 
            
            
              | 60 | 65 |      except LensmanInfo.DoesNotExist: | 
            
            
              | 61 |  | -      return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              | 62 |  | -     | 
            
            
              |  | 66 | +        return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              |  | 67 | + | 
            
            
              | 63 | 68 |      lensman.lensman_status = LensmanInfo.ACTIVATED | 
            
            
              | 64 | 69 |      lensman.start_date = start_date | 
            
            
              | 65 | 70 |      lensman.end_date = end_date | 
            
            
            
            
              |  |  | @@ -75,17 +80,18 @@ def lensman_update(request, administrator): | 
            
            
              | 75 | 80 |      lensman_id = request.POST.get('lensman_id', '') | 
            
            
              | 76 | 81 |      start_date = tc.to_date(request.POST.get('start_date', '')) | 
            
            
              | 77 | 82 |      end_date = tc.to_date(request.POST.get('end_date', '')) | 
            
            
              | 78 |  | -    integral_start_date = tc.to_date(request.POST.get('integral_start_date', '')) | 
            
            
              |  | 83 | +    integral_start_date = tc.to_date( | 
            
            
              |  | 84 | +        request.POST.get('integral_start_date', '')) | 
            
            
              | 79 | 85 |      integral_end_date = tc.to_date(request.POST.get('integral_end_date', '')) | 
            
            
              | 80 | 86 |      name = request.POST.get('name', '') | 
            
            
              | 81 | 87 |      phone = request.POST.get('phone', '') | 
            
            
              | 82 | 88 |      remark = request.POST.get('remark', '') | 
            
            
              | 83 |  | -         | 
            
            
              |  | 89 | + | 
            
            
              | 84 | 90 |      try: | 
            
            
              | 85 |  | -      lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True) | 
            
            
              |  | 91 | +        lensman = LensmanInfo.objects.get(lensman_id=lensman_id, status=True) | 
            
            
              | 86 | 92 |      except LensmanInfo.DoesNotExist: | 
            
            
              | 87 |  | -      return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              | 88 |  | -     | 
            
            
              |  | 93 | +        return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              |  | 94 | + | 
            
            
              | 89 | 95 |      lensman.start_date = start_date | 
            
            
              | 90 | 96 |      lensman.end_date = end_date | 
            
            
              | 91 | 97 |      lensman.integral_start_date = integral_start_date | 
            
            
            
            
              |  |  | @@ -102,19 +108,19 @@ def lensman_update(request, administrator): | 
            
            
              | 102 | 108 |  @logit | 
            
            
              | 103 | 109 |  @check_admin | 
            
            
              | 104 | 110 |  def lensman_integral_list(request, administrator): | 
            
            
              | 105 |  | -  user_id = request.POST.get('user_id', '') | 
            
            
              |  | 111 | +    user_id = request.POST.get('user_id', '') | 
            
            
              |  | 112 | + | 
            
            
              |  | 113 | +    try: | 
            
            
              |  | 114 | +        lensman = LensmanInfo.objects.get(user_id=user_id, status=True) | 
            
            
              |  | 115 | +    except LensmanInfo.DoesNotExist: | 
            
            
              |  | 116 | +        return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              | 106 | 117 |   | 
            
            
              | 107 |  | -  try: | 
            
            
              | 108 |  | -    lensman = LensmanInfo.objects.get(user_id=user_id, status=True) | 
            
            
              | 109 |  | -  except LensmanInfo.DoesNotExist: | 
            
            
              | 110 |  | -    return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              | 111 |  | -   | 
            
            
              | 112 |  | -  integrals = LensmanIntegralIncomeExpensesInfo.objects.filter(user_id=user_id, status=True) | 
            
            
              |  | 118 | +    integrals = LensmanIntegralIncomeExpensesInfo.objects.filter( | 
            
            
              |  | 119 | +        user_id=user_id, status=True) | 
            
            
              | 113 | 120 |   | 
            
            
              | 114 |  | -  integrals = [integral.admindata for integral in integrals] | 
            
            
              | 115 |  | -   | 
            
            
              |  | 121 | +    integrals = [integral.admindata for integral in integrals] | 
            
            
              | 116 | 122 |   | 
            
            
              | 117 |  | -  return response(200, 'Get Lensman Integral List Success', u'获取摄影师积分列表成功', data=integrals) | 
            
            
              |  | 123 | +    return response(200, 'Get Lensman Integral List Success', u'获取摄影师积分列表成功', data=integrals) | 
            
            
              | 118 | 124 |   | 
            
            
              | 119 | 125 |   | 
            
            
              | 120 | 126 |  @logit | 
            
            
            
            
              |  |  | @@ -125,20 +131,19 @@ def lensman_integral_update(request): | 
            
            
              | 125 | 131 |      brand_id = request.POST.get('brand_id') or settings.KODO_DEFAULT_BRAND_ID | 
            
            
              | 126 | 132 |   | 
            
            
              | 127 | 133 |      try: | 
            
            
              | 128 |  | -      lensman = LensmanInfo.objects.get(user_id=user_id, status=True) | 
            
            
              |  | 134 | +        lensman = LensmanInfo.objects.get(user_id=user_id, status=True) | 
            
            
              | 129 | 135 |      except LensmanInfo.DoesNotExist: | 
            
            
              | 130 |  | -      return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              | 131 |  | -     | 
            
            
              |  | 136 | +        return response(200, 'Lensman Not Found', u'摄影师不存在') | 
            
            
              |  | 137 | + | 
            
            
              | 132 | 138 |      lensman.integral += integral | 
            
            
              | 133 | 139 |      lensman.save() | 
            
            
              | 134 |  | -   | 
            
            
              |  | 140 | + | 
            
            
              | 135 | 141 |      LensmanIntegralIncomeExpensesInfo.objects.create( | 
            
            
              | 136 |  | -      brand_id=brand_id, | 
            
            
              | 137 |  | -      user_id=user_id, | 
            
            
              | 138 |  | -      integral=integral, | 
            
            
              | 139 |  | -      remark=remark, | 
            
            
              | 140 |  | -      expired_at=lensman.integral_end_date, | 
            
            
              |  | 142 | +        brand_id=brand_id, | 
            
            
              |  | 143 | +        user_id=user_id, | 
            
            
              |  | 144 | +        integral=integral, | 
            
            
              |  | 145 | +        remark=remark, | 
            
            
              |  | 146 | +        expired_at=lensman.integral_end_date, | 
            
            
              | 141 | 147 |      ) | 
            
            
              | 142 | 148 |   | 
            
            
              | 143 | 149 |      return response(200, 'Lensman Integral Update Success', u'摄影师积分更新成功') | 
            
            
              | 144 |  | - |