|  |  | @@ -291,36 +291,8 @@ def consumer_info_api(request): | 
            
            
              | 291 | 291 |          act = None | 
            
            
              | 292 | 292 |          during_activity = False | 
            
            
              | 293 | 293 |      else: | 
            
            
              | 294 |  | -        for act in activities: | 
            
            
              | 295 |  | -            try: | 
            
            
              | 296 |  | -                coupon = CouponInfo.objects.get(coupon_id=act['coupon_id']) | 
            
            
              | 297 |  | -            except CouponInfo.DoesNotExist: | 
            
            
              | 298 |  | -                continue | 
            
            
              | 299 |  | - | 
            
            
              | 300 |  | -            try: | 
            
            
              | 301 |  | -                activity = ActivityInfo.objects.get(activity_id=act['activity_id']) | 
            
            
              | 302 |  | -            except ActivityInfo.DoesNotExist: | 
            
            
              | 303 |  | -                continue | 
            
            
              | 304 |  | - | 
            
            
              | 305 |  | -            UserCouponInfo.objects.create( | 
            
            
              | 306 |  | -                brand_id=coupon.brand_id, | 
            
            
              | 307 |  | -                brand_name=coupon.brand_name, | 
            
            
              | 308 |  | -                coupon_id=coupon.coupon_id, | 
            
            
              | 309 |  | -                user_id=user_id, | 
            
            
              | 310 |  | -                coupon_title=coupon.coupon_title, | 
            
            
              | 311 |  | -                coupon_detail=coupon.coupon_detail, | 
            
            
              | 312 |  | -                coupon_value=coupon.coupon_value, | 
            
            
              | 313 |  | -                coupon_image=coupon.coupon_image, | 
            
            
              | 314 |  | -                active_at=tc.utc_datetime(), | 
            
            
              | 315 |  | -                expire_at=coupon.final_expire_at, | 
            
            
              | 316 |  | -                is_coupon_admin_writeoff=coupon.is_coupon_admin_writeoff, | 
            
            
              | 317 |  | -                coupon_valid_period=coupon.coupon_valid_period, | 
            
            
              | 318 |  | -                coupon_limit_model_ids=coupon.coupon_limit_model_ids, | 
            
            
              | 319 |  | -                coupon_from='PROMOTION', | 
            
            
              | 320 |  | -                activity_id=activity.activity_id, | 
            
            
              | 321 |  | -                activity_name=activity.activity_name, | 
            
            
              | 322 |  | -            ) | 
            
            
              | 323 |  | - | 
            
            
              |  | 294 | +        during_activity = True if activities else False | 
            
            
              |  | 295 | +         | 
            
            
              | 324 | 296 |          # 更新销售员提交的表 | 
            
            
              | 325 | 297 |          SaleclerkSubmitLogInfo.objects.filter(code=serialNo, model_pk=model.pk, status=True).update(has_scan=True) | 
            
            
              | 326 | 298 |   | 
            
            
            
            
              |  |  | @@ -349,8 +321,41 @@ def consumer_info_api(request): | 
            
            
              | 349 | 321 |          ym=ymd[:6], | 
            
            
              | 350 | 322 |          ymd=ymd, | 
            
            
              | 351 | 323 |          province=user.province_name if lat == 0.0 and lon == 0.0 else '', | 
            
            
              |  | 324 | +        submit_during_activity=during_activity | 
            
            
              | 352 | 325 |      ) | 
            
            
              | 353 | 326 |   | 
            
            
              |  | 327 | +    for act in activities: | 
            
            
              |  | 328 | +        try: | 
            
            
              |  | 329 | +            coupon = CouponInfo.objects.get(coupon_id=act['coupon_id']) | 
            
            
              |  | 330 | +        except CouponInfo.DoesNotExist: | 
            
            
              |  | 331 | +            continue | 
            
            
              |  | 332 | + | 
            
            
              |  | 333 | +        try: | 
            
            
              |  | 334 | +            activity = ActivityInfo.objects.get(activity_id=act['activity_id']) | 
            
            
              |  | 335 | +        except ActivityInfo.DoesNotExist: | 
            
            
              |  | 336 | +            continue | 
            
            
              |  | 337 | + | 
            
            
              |  | 338 | +        UserCouponInfo.objects.create( | 
            
            
              |  | 339 | +            brand_id=coupon.brand_id, | 
            
            
              |  | 340 | +            brand_name=coupon.brand_name, | 
            
            
              |  | 341 | +            coupon_id=coupon.coupon_id, | 
            
            
              |  | 342 | +            user_id=user_id, | 
            
            
              |  | 343 | +            coupon_title=coupon.coupon_title, | 
            
            
              |  | 344 | +            coupon_detail=coupon.coupon_detail, | 
            
            
              |  | 345 | +            coupon_value=coupon.coupon_value, | 
            
            
              |  | 346 | +            coupon_image=coupon.coupon_image, | 
            
            
              |  | 347 | +            active_at=tc.utc_datetime(), | 
            
            
              |  | 348 | +            expire_at=coupon.final_expire_at, | 
            
            
              |  | 349 | +            is_coupon_admin_writeoff=coupon.is_coupon_admin_writeoff, | 
            
            
              |  | 350 | +            coupon_valid_period=coupon.coupon_valid_period, | 
            
            
              |  | 351 | +            coupon_limit_model_ids=coupon.coupon_limit_model_ids, | 
            
            
              |  | 352 | +            coupon_from='PROMOTION', | 
            
            
              |  | 353 | +            activity_id=activity.activity_id, | 
            
            
              |  | 354 | +            activity_name=activity.activity_name, | 
            
            
              |  | 355 | +            submit_pk=log.pk, | 
            
            
              |  | 356 | +        ) | 
            
            
              |  | 357 | + | 
            
            
              |  | 358 | + | 
            
            
              | 354 | 359 |      if not user.test_user and not dupload: | 
            
            
              | 355 | 360 |          # TODO: Make statistic async | 
            
            
              | 356 | 361 |   |