|
@@ -45,6 +45,8 @@ from utils.wxpay.pay import WechatPayDAL
|
|
#log = logging.getLogger("myerror")
|
|
#log = logging.getLogger("myerror")
|
|
from utils.upload_to_oss import get_signature
|
|
from utils.upload_to_oss import get_signature
|
|
|
|
|
|
|
|
+from weixin.wzhifuSDK_V3 import refund_order
|
|
|
|
+
|
|
def async(f):
|
|
def async(f):
|
|
def wrapper(*args, **kwargs):
|
|
def wrapper(*args, **kwargs):
|
|
thr = Thread(target=f, args=args, kwargs=kwargs)
|
|
thr = Thread(target=f, args=args, kwargs=kwargs)
|
|
@@ -3786,3 +3788,89 @@ def get_user_markscore_week_avg(request):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def refund_out_trade_order(**kwargs):
|
|
|
|
+ """
|
|
|
|
+ """
|
|
|
|
+ _id = kwargs.get("id")
|
|
|
|
+ signup_order = cm.SignupOrder.objects.filter(id=_id).first()
|
|
|
|
+ if signup_order:
|
|
|
|
+ out_trade_no = signup_order.out_trade_no
|
|
|
|
+ transaction_id = signup_order.transaction_id
|
|
|
|
+ total_fee = signup_order.total_fee
|
|
|
|
+ amount = str(int(total_fee*100))
|
|
|
|
+ print(amount)
|
|
|
|
+ result = refund_order(transaction_id,out_trade_no,out_trade_no,amount)
|
|
|
|
+ if result.get("result_code") == "SUCCESS":
|
|
|
|
+ signup_order.order_status = -1
|
|
|
|
+ signup_order.save()
|
|
|
|
+ return "success"
|
|
|
|
+ else:
|
|
|
|
+ raise ce.TipException(result.get("err_code_des"))
|
|
|
|
+ else:
|
|
|
|
+ raise ce.TipException(u"该订单不存在退款失败!")
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def signup_old_user(**kwargs):
|
|
|
|
+ """
|
|
|
|
+ """
|
|
|
|
+ order_id = kwargs.get("id")
|
|
|
|
+ signup_type = kwargs.get("signup_type")
|
|
|
|
+ match_group = kwargs.get("match_group")
|
|
|
|
+ player_type = kwargs.get("player_type")
|
|
|
|
+ role_type = kwargs.get("role_type")
|
|
|
|
+
|
|
|
|
+ order = cm.SignupOrder.objects.filter(id=order_id).first()
|
|
|
|
+ if order:
|
|
|
|
+ user_id = order.user_id
|
|
|
|
+ match_id = order.match_id
|
|
|
|
+ signup_name = order.signup_name
|
|
|
|
+
|
|
|
|
+ user = cm.UserInfo.objects.filter(id=user_id).first()
|
|
|
|
+ match_group_name = cm.MatchGroup.objects.filter(id=match_group).first().name
|
|
|
|
+ match = cm.Match.objects.filter(id=match_id).first()
|
|
|
|
+
|
|
|
|
+ user.player_type = player_type
|
|
|
|
+ user.phone = order.phone
|
|
|
|
+ user.username = signup_name
|
|
|
|
+ user.save()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ order.signup_type = signup_type
|
|
|
|
+ order.match_group = match_group
|
|
|
|
+ order.match_group_name = match_group_name
|
|
|
|
+ order.order_status = 1
|
|
|
|
+ order.save()
|
|
|
|
+
|
|
|
|
+ #生产选手信息
|
|
|
|
+ player,flag = cm.Player.objects.get_or_create(
|
|
|
|
+ user_id = user_id,
|
|
|
|
+ match_id = match_id
|
|
|
|
+ )
|
|
|
|
+ player.match_name = match.name
|
|
|
|
+ player.match_group = match_group
|
|
|
|
+ player.match_group_name = match_group_name
|
|
|
|
+ player.username = signup_name
|
|
|
|
+ player.usercode = user.usercode
|
|
|
|
+ player.role = role_type
|
|
|
|
+ player.match_status = 1
|
|
|
|
+ player.save()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def get_user_signup_order(request):
|
|
|
|
+ """#获取用户订单号
|
|
|
|
+ """
|
|
|
|
+ try:
|
|
|
|
+ user_id = request.user.get("id",0)
|
|
|
|
+ except:
|
|
|
|
+ user_id = 0
|
|
|
|
+ qdata = request.json
|
|
|
|
+ pay_status = qdata.get("pay_status")
|
|
|
|
+ if not user_id:
|
|
|
|
+ user_id = qdata.get("user_id")
|
|
|
|
+ match_id = ccc.get_cur_match().id
|
|
|
|
+
|
|
|
|
+ qset = cm.SignupOrder.objects.filter(user_id=user_id,match_id=match_id,pay_status=pay_status)
|
|
|
|
+ qdata = qset.values().first()
|
|
|
|
+
|
|
|
|
+ return qdata
|
|
|
|
+
|