|
|
@@ -2054,7 +2054,10 @@ def do_wx_pay(request):
|
|
|
if not match_group:
|
|
|
match_group = cm.MatchGroup.objects.filter(match_id=match_id,charge=0).first().id
|
|
|
|
|
|
- out_trade_no = datetime.datetime.now().strftime("%Y%m%d%H%M%S") + str(int(time.time()*1000))
|
|
|
+ if pay_type == "wxapppay":
|
|
|
+ out_trade_no = "WXAPP"+datetime.datetime.now().strftime("%Y%m%d%H%M%S") + str(int(time.time()*1000))
|
|
|
+ else:
|
|
|
+ out_trade_no = datetime.datetime.now().strftime("%Y%m%d%H%M%S") + str(int(time.time()*1000))
|
|
|
|
|
|
#游客和普通选手付费报名
|
|
|
#gt_time = datetime.timedelta(days=-365)+datetime.datetime.now()
|
|
|
@@ -2077,8 +2080,9 @@ def do_wx_pay(request):
|
|
|
#支付
|
|
|
if pay_type == "wxapppay":
|
|
|
total_fee = str(int(float(order.total_fee)*100))
|
|
|
- notify_url = "https://api.hunanwanzhu.com/api/wx/v3/signup/notify"
|
|
|
- data = {"subject":u"%s报名费" % match_name,"price":total_fee}
|
|
|
+ notify_url = "https://test.hunanwanzhu.com/api/wx/v3/signup/notify"
|
|
|
+ #notify_url = "https://test.hunanwanzhu.com"
|
|
|
+ data = {"subject":u"%s报名费" % match_name,"price":total_fee,"out_trade_no":out_trade_no}
|
|
|
wxapppay = WechatPayDAL()
|
|
|
prepayinfo = wxapppay.create_order_info(data,notify_url)
|
|
|
return prepayinfo
|
|
|
@@ -2140,7 +2144,13 @@ def do_wx_pay(request):
|
|
|
|
|
|
def do_wxpay_notify(request):
|
|
|
qdata = request.json
|
|
|
- flag,res = wxpay.check_notify_valid(request.body)
|
|
|
+ if qdata.get("resource_type") == "encrypt-resource":
|
|
|
+ wxapppay = WechatPayDAL()
|
|
|
+ res = wxapppay.decrypt_nofify_v3(qdata)
|
|
|
+ res = json.loads(res)
|
|
|
+ flag = True
|
|
|
+ else:
|
|
|
+ flag,res = wxpay.check_notify_valid(request.body)
|
|
|
if flag:
|
|
|
out_trade_no = res.get("out_trade_no")
|
|
|
transaction_id = res.get("transaction_id")
|
|
|
@@ -3093,11 +3103,14 @@ def get_match_winlost_top5(**kwargs):
|
|
|
"""
|
|
|
"""
|
|
|
data = []
|
|
|
- matchs = cm.Match.objects.filter(id__gte=8).order_by("id")
|
|
|
+ cur_match_id = ccc.get_cur_match().id
|
|
|
+ matchs = cm.Match.objects.filter(id__gte=8).order_by("-id")
|
|
|
for match in matchs:
|
|
|
match_id = match.id
|
|
|
match_name = match.name
|
|
|
end_time = match.end_time
|
|
|
+ if cur_match_id == match_id:
|
|
|
+ end_time = get_today_date()
|
|
|
records = cm.PlayerRecord.get_db_model(match_id).objects.filter(stock_date=end_time)
|
|
|
total_income_up = copy.copy(records)
|
|
|
total_income_up = total_income_up.order_by("-total_income")
|