|
@@ -21,7 +21,7 @@ from utils.jgpush import send_notification_by_registration_ids
|
|
|
import wzhifuSDK as wxpay
|
|
|
from utils.exceltool import ExcelTool
|
|
|
from utils.qrcodetool import gen_general_qrcode
|
|
|
-from django.db.models import Q,Sum,Count,F
|
|
|
+from django.db.models import Q,Sum,Count,F,Avg
|
|
|
from PIL import Image
|
|
|
from PIL import Image,ImageDraw,ImageFont
|
|
|
from django.db import transaction
|
|
@@ -279,6 +279,11 @@ def get_player_match_detail(request):
|
|
|
user_info = get_user_info(cur_user_id)
|
|
|
if user_info.get("phone"):
|
|
|
del user_info["phone"]
|
|
|
+ #查询出入资金
|
|
|
+ fund_inout_list = []
|
|
|
+ if cm.FundInOut.objects.filter(user_id = cur_user_id,stock_date=today_record["stock_date"]).exists():
|
|
|
+ fund_inout_list = list(cm.FundInOut.objects.filter(user_id=cur_user_id,stock_date=today_record["stock_date"]).values())
|
|
|
+
|
|
|
ret = {
|
|
|
"match":match,
|
|
|
"today_record":today_record,
|
|
@@ -289,7 +294,8 @@ def get_player_match_detail(request):
|
|
|
"fans":cm.UserFollows.objects.filter(follow_id=cur_user_id).count(),
|
|
|
"followers":cm.UserFollows.objects.filter(user_id=cur_user_id).count(),
|
|
|
"stock_age":datetime.datetime.now().year - int(userinfo.get("join_time")) if userinfo.get("join_time") else 0,
|
|
|
- "stock_follow":list(cm.UserChoice.objects.filter(user_id=cur_user_id).values_list("stock_name",flat=True))
|
|
|
+ "stock_follow":list(cm.UserChoice.objects.filter(user_id=cur_user_id).values_list("stock_name",flat=True)),
|
|
|
+ "fund_inout":fund_inout_list[0] if len(fund_inout_list) > 0 else {}
|
|
|
}
|
|
|
|
|
|
return ret
|
|
@@ -790,16 +796,18 @@ def add_model(cls,**kwargs):
|
|
|
)
|
|
|
stock_id = stock.id
|
|
|
usobj,flag = cm.UserStock.objects.get_or_create(
|
|
|
- user_id = user_id,
|
|
|
stock_id = stock_id,
|
|
|
- stock_name = ts["name"],
|
|
|
player_id = player.id,
|
|
|
- stock_date = stock_date,
|
|
|
- match_group = match_group,
|
|
|
- opmode_group = opmode_group
|
|
|
+ stock_date = stock_date
|
|
|
)
|
|
|
if ts.get("fund"):
|
|
|
usobj.fund = ts["fund"]
|
|
|
+ if ts.get("name"):
|
|
|
+ usobj.stock_name = ts.get("name")
|
|
|
+ if match_group:
|
|
|
+ usobj.match_group = match_group
|
|
|
+ if opmode_group:
|
|
|
+ usobj.opmode_group = opmode_group
|
|
|
usobj.save()
|
|
|
ts["stock_id"] = stock_id
|
|
|
new_stock_list.append(ts)
|
|
@@ -1408,10 +1416,16 @@ def get_hot_stock_buy(**kwargs):
|
|
|
"""
|
|
|
"""
|
|
|
stock_date = kwargs.get("stock_date")
|
|
|
+
|
|
|
qset = cm.UserStock.objects.filter(stock_date=stock_date,fund__gt=0)
|
|
|
if kwargs.get("name"):
|
|
|
qset = cm.UserStock.objects.filter(stock_name__icontains=kwargs.get("name"),stock_date=stock_date)
|
|
|
- qset = qset.values("stock_id","stock_name").annotate(count=Count("stock_id"),total_fund=Sum("fund")).order_by("-count")
|
|
|
+
|
|
|
+ if int(kwargs.get("fund_rank",0)) == 1:
|
|
|
+ qset = qset.values("stock_id","stock_name").annotate(count=Count("stock_id"),total_fund=Sum("fund")).order_by("-total_fund")
|
|
|
+ else:
|
|
|
+ qset = qset.values("stock_id","stock_name").annotate(count=Count("stock_id"),total_fund=Sum("fund")).order_by("-count")
|
|
|
+
|
|
|
data = []
|
|
|
for q in qset:
|
|
|
stock_id = q["stock_id"]
|
|
@@ -3706,4 +3720,31 @@ def get_oss2_policy_sign(request):
|
|
|
rst = get_signature(policy)
|
|
|
return rst
|
|
|
|
|
|
+def get_match_group_list(**kwargs):
|
|
|
+ """
|
|
|
+ """
|
|
|
+ match_id = kwargs.get("match_id")
|
|
|
+ match,groups = get_match_groups(match_id)
|
|
|
+ return groups
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+def get_user_markscore_week_avg(request):
|
|
|
+ """
|
|
|
+ """
|
|
|
+ pass
|
|
|
+ now = datetime.datetime.now().date()
|
|
|
+ data = []
|
|
|
+ for i in range(1,5):
|
|
|
+ item_list = []
|
|
|
+ for j in range(1,8):
|
|
|
+ now = now + datetime.timedelta(days=-1)
|
|
|
+ now_str = ccf.datetime_to_str(now,"%Y-%m-%d")
|
|
|
+ qset = cm.UserMarkScore.objects.filter(stock_date=now_str).aggregate(avg_score=Avg("score"))
|
|
|
+ item_list.append({"stock_date":now_str,"avg_score":qset.get("avg_score",0)})
|
|
|
+ data.append(item_list)
|
|
|
+
|
|
|
+ return data
|
|
|
+
|
|
|
+
|
|
|
|