Browse Source

userstock 去重

xjc 5 months ago
parent
commit
62829a9b30
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/weixin/controls.py

+ 4 - 0
src/weixin/controls.py

@@ -795,6 +795,10 @@ def add_model(cls,**kwargs):
                             name = ts["name"] 
                             name = ts["name"] 
                         )
                         )
                         stock_id = stock.id
                         stock_id = stock.id
+                        try:
+                            cm.UserStock.objects.filter(stock_id=stock_id,player_id=player.id,stock_date=stock_date).delete()
+                        except Exception as e:
+                            print(e)
                         usobj,flag = cm.UserStock.objects.get_or_create(
                         usobj,flag = cm.UserStock.objects.get_or_create(
                             stock_id = stock_id,
                             stock_id = stock_id,
                             player_id = player.id,
                             player_id = player.id,