Browse Source

修复流量过期预警生成重复系统消息

zhangdongming 1 year ago
parent
commit
903edf2fbe
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Controller/ComboCron/ComboCronPushController.py

+ 4 - 1
Controller/ComboCron/ComboCronPushController.py

@@ -90,6 +90,7 @@ class ComboCronPushView(View):
                 values('user_id', 'app_bundle_id', 'app_type', 'push_type', 'token_val', 'm_code', 'lang', 'tz')
             if not push_qs.exists():
                 continue
+            user_list = []
             for push_vo in push_qs:
                 kwargs = {
                     'n_time': now_time,
@@ -114,7 +115,9 @@ class ComboCronPushView(View):
                 kwargs['token_val'] = token_val
                 kwargs['msg_title'] = msg_title
                 kwargs['msg_text'] = sys_msg_text
-                cls.sys_msg_save(user_id, nickname, now_time, sys_msg_text)
+                if user_id not in user_list:
+                    cls.sys_msg_save(user_id, nickname, now_time, sys_msg_text)
+                    user_list.append(user_id)
                 if not cls.msg_push(push_type, **kwargs):
                     continue
         return True