调整活动分享逻辑:不管活动是否下线都记录到数据库,如果下线就不给积分。

FFIB 4 lat temu
rodzic
commit
944aa5ed8b
1 zmienionych plików z 9 dodań i 9 usunięć
  1. 9 9
      api/member_views.py

+ 9 - 9
api/member_views.py

@@ -466,7 +466,7 @@ def activity_group_share(request):
466 466
         return response()
467 467
     
468 468
     try:
469
-        user = UserInfo.objects.get(user_id=click_user_id, status=True)
469
+        user = UserInfo.objects.get(user_id=share_user_id, status=True)
470 470
     except:
471 471
         return response(UserStatusCode.USER_NOT_FOUND)
472 472
 
@@ -478,13 +478,9 @@ def activity_group_share(request):
478 478
     isOffline = act.activity_state != 0 or act.final_state == '已结束'
479 479
 
480 480
     # 判断是否给积分 & 给多少积分
481
-    if isOffline:
482
-        is_integral = False
483
-        integral = 0
484
-    else:
485
-        is_integral, integral = get_group_share_info_integral(act.activity_id, share_user_id, open_gid, act.group_share_integral, act.group_share_max_integral)
486
-        user.integral += integral
487
-        user.save()
481
+    is_integral, integral = get_group_share_info_integral(act.activity_id, share_user_id, open_gid, act.group_share_integral, act.group_share_max_integral)
482
+
483
+    # 活动未结束,则给用户加积分
488 484
         
489 485
     if is_integral:
490 486
         MemberActivityGroupShareInfo.objects.create(**{
@@ -496,9 +492,13 @@ def activity_group_share(request):
496 492
             'activity_id': activity_id,
497 493
             'title': act.title,
498 494
             'is_integral': is_integral,
499
-            'integral': integral,
495
+            'integral': 0 if isOffline else integral,
500 496
         })
501 497
 
498
+        if not isOffline:
499
+            user.integral += integral
500
+            user.save()
501
+
502 502
     if isOffline:
503 503
         return response(400002, 'Activity has been offline', '会员活动已下线')
504 504