|
|
@@ -771,10 +771,13 @@ def add_model(cls,**kwargs):
|
|
|
raise ce.TipException(u"数据错误,今日净资产不能超过9999万元,不能低于0万元,请仔细核对数据!")
|
|
|
|
|
|
#有资金出入
|
|
|
- if cm.FundInOut.objects.filter(user_id=user_id,stock_date=stock_date).exists() and flag:
|
|
|
+ if cm.FundInOut.objects.filter(user_id=user_id,stock_date=stock_date).exists():
|
|
|
fundinout = cm.FundInOut.objects.filter(user_id=user_id,stock_date=stock_date).first()
|
|
|
fundin = fundinout.fundin
|
|
|
fundout = fundinout.fundout
|
|
|
+ today_income = 0.0
|
|
|
+ total_income = 0.0
|
|
|
+
|
|
|
#入资金
|
|
|
if fundin > fundout:
|
|
|
fundin = fundin - fundout
|
|
|
@@ -783,10 +786,15 @@ def add_model(cls,**kwargs):
|
|
|
obj.yesterday_fund = obj.yesterday_fund + fundin
|
|
|
else:
|
|
|
today_income = 0.0
|
|
|
+
|
|
|
+
|
|
|
total_income = (today_fund-init_fund-fundin)/(init_fund+fundin)
|
|
|
-
|
|
|
- cm.Player.objects.filter(user_id=user_id,match_id=match_id).update(fund=init_fund+fundin)
|
|
|
- obj.init_fund = init_fund + fundin
|
|
|
+ obj.today_income = round(today_income,4)
|
|
|
+ obj.total_income = round(total_income,4)
|
|
|
+
|
|
|
+ if flag:
|
|
|
+ cm.Player.objects.filter(user_id=user_id,match_id=match_id).update(fund=init_fund+fundin)
|
|
|
+ obj.init_fund = init_fund + fundin
|
|
|
#出资金
|
|
|
else:
|
|
|
fundout = fundout - fundin
|
|
|
@@ -795,20 +803,23 @@ def add_model(cls,**kwargs):
|
|
|
obj.yesterday_fund = round(today_fund/(1+today_income),4)
|
|
|
else:
|
|
|
today_income = 0.0
|
|
|
- total_income = (today_fund+fundout-init_fund)/init_fund
|
|
|
-
|
|
|
- cm.Player.objects.filter(user_id=user_id,match_id=match_id).update(fund=round(today_fund/(1+total_income),4))
|
|
|
- obj.init_fund = round(today_fund/(1+total_income),4)
|
|
|
-
|
|
|
- if float(today_income)>0.6:
|
|
|
- raise ce.TipException(u"今日盈利已超过60%,请仔细核对数据或直接联系顽主!")
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ total_income = (today_fund+fundout-init_fund)/init_fund if init_fund else 0.0
|
|
|
+
|
|
|
+ obj.today_income = round(today_income,4)
|
|
|
+ obj.total_income = round(total_income,4)
|
|
|
+
|
|
|
+ if flag:
|
|
|
+ cm.Player.objects.filter(user_id=user_id,match_id=match_id).update(fund=round(today_fund/(1+total_income),4))
|
|
|
+ obj.init_fund = round(today_fund/(1+total_income),4)
|
|
|
+
|
|
|
+ if float(today_income)>0.4:
|
|
|
+ raise ce.TipException(u"今日盈利已超过40%,请仔细核对数据或直接联系顽主!")
|
|
|
+
|
|
|
if float(total_income)>8:
|
|
|
raise ce.TipException(u"请仔细核对数据或直接联系顽主!")
|
|
|
-
|
|
|
- obj.today_income = round(today_income,4)
|
|
|
- obj.total_income = round(total_income,4)
|
|
|
-
|
|
|
+
|
|
|
else:
|
|
|
today_income = (today_fund - yesterday_fund)/float(yesterday_fund) if yesterday_fund else 0.0
|
|
|
total_income = (today_fund - init_fund)/float(init_fund) if init_fund else 0.0
|