|
|
@@ -2,7 +2,7 @@
|
|
|
'''
|
|
|
'''
|
|
|
import os
|
|
|
-import json,time
|
|
|
+import json,time,datetime
|
|
|
from django.db import transaction
|
|
|
from django.db.models import Q
|
|
|
import common.models as cm
|
|
|
@@ -240,7 +240,18 @@ def update_signup(request):
|
|
|
vals["cid"] = uid
|
|
|
if vals.get("idnoimg_face") and vals.get("idnoimg_back") and vals.get("halfbody_img"):
|
|
|
vals["order_status"] = 0
|
|
|
+ vals["update_time"] = datetime.datetime.now()
|
|
|
+ subject_id = vals.get("subject_id")
|
|
|
+ train_type = vals.get("train_type")
|
|
|
+ subject_obj = cm.Subject.objects.filter(id=subject_id).first()
|
|
|
+ if train_type == u"新办":
|
|
|
+ vals["price"] = subject_obj.price_new
|
|
|
+ if train_type == u"复审":
|
|
|
+ vals["price"] = subject_obj.price_re
|
|
|
+ if train_type == u"换证":
|
|
|
+ vals["price"] = subject_obj.price_change
|
|
|
obj = cm.SignupOrders.objects.filter(id=id).update(**vals)
|
|
|
+ vals.pop("update_time")
|
|
|
#更新用户信息
|
|
|
userinfo = cm.UserInfo.objects.filter(id=uid).first().userinfo
|
|
|
userinfo = json.loads(userinfo) if userinfo else {}
|
|
|
@@ -413,19 +424,21 @@ def do_wxpay_notify(request):
|
|
|
out_trade_no = res.get("out_trade_no")
|
|
|
transaction_id = res.get("transaction_id")
|
|
|
pay_time = res.get("time_end")
|
|
|
- cm.SignupOrders.objects.filter(out_trade_no=out_trade_no)\
|
|
|
- .update(order_status=2,pay_status=1,pay_time=pay_time,transaction_id=transaction_id)
|
|
|
- #发送支付成功通知
|
|
|
- from utils.aliyun_sms import send_pay_notice
|
|
|
- import common.common_notice as cn
|
|
|
sorder = cm.SignupOrders.objects.filter(out_trade_no=out_trade_no).first()
|
|
|
- phone = sorder.phone if sorder else None
|
|
|
- transaction_id = sorder.transaction_id
|
|
|
- user_id = sorder.user_id
|
|
|
- if phone and user_id and not transaction_id:
|
|
|
- send_pay_notice(phone)
|
|
|
- cn.send_pay_notice(user_id)
|
|
|
- return True
|
|
|
+ if sorder and not sorder.transaction_id:
|
|
|
+ now = datetime.datetime.now()
|
|
|
+ cm.SignupOrders.objects.filter(out_trade_no=out_trade_no)\
|
|
|
+ .update(order_status=2,update_time=now,pay_status=1,pay_time=pay_time,transaction_id=transaction_id)
|
|
|
+ #发送支付成功通知
|
|
|
+ from utils.aliyun_sms import send_pay_notice
|
|
|
+ import common.common_notice as cn
|
|
|
+ phone = sorder.phone if sorder else None
|
|
|
+ transaction_id = sorder.transaction_id
|
|
|
+ user_id = sorder.user_id
|
|
|
+ if phone and user_id and not transaction_id:
|
|
|
+ send_pay_notice(phone)
|
|
|
+ cn.send_pay_notice(user_id)
|
|
|
+ return True
|
|
|
return False
|
|
|
|
|
|
def addText(img,orgpath,string,path,point=(100,100),size=32):
|