xjconline 1 month ago
parent
commit
48709e24e6
4 changed files with 49 additions and 4 deletions
  1. 27 2
      src/weixin/controls.py
  2. 1 0
      src/weixin/urls_backstage.py
  3. 20 1
      src/weixin/views.py
  4. 1 1
      templates/topic/xsSignup.html

+ 27 - 2
src/weixin/controls.py

@@ -5,7 +5,7 @@ import os,re,random
 import json,time,datetime
 import shutil
 import tempfile
-import zipfile
+import zipfile,requests
 from docxtpl import DocxTemplate,InlineImage
 from docx.shared import Mm
 from django.db import transaction
@@ -3874,10 +3874,35 @@ def get_user_signup_order(request):
     pay_status = qdata.get("pay_status")
     if not user_id:
         user_id = qdata.get("user_id")
-    match_id = ccc.get_cur_match().id
+    match_id = ccc.get_signup_match().id
 
     qset = cm.SignupOrder.objects.filter(user_id=user_id,match_id=match_id,pay_status=pay_status,order_status=pay_status)
     qdata = qset.values().first()
 
     return qdata
 
+
+def check_msg_content(request):
+    """
+    """
+    qdata = request.json
+    APPID = "wxb299e10e65157301"
+    APPSECRET = "20e278a60d52ad63822a07e49931435c"
+    token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s" % (APPID,APPSECRET)
+    res = requests.get(token_url,verify=False)
+    access_token = res.json().get("access_token")
+    #check msg content
+    check_url = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=%s" % access_token
+	
+    openid = qdata.get('openid')
+    if openid:
+        params = {
+                "content":qdata.get("content"), 
+                "version":2, 
+                "scene":2, 
+                "openid":openid
+
+            }
+        rest = requests.post(check_url,json=params)
+        return rest.json()
+    return {}

+ 1 - 0
src/weixin/urls_backstage.py

@@ -127,5 +127,6 @@ urlpatterns = [
     url(r'^v3/wxpay/refund$', views.WXPayRefundView.as_view()),
     url(r'^v3/signup/olduser$', views.SignupOldUserView.as_view()),
     url(r'^v3/user/signup/order$', views.UserSignupOrder.as_view()),
+    url(r'^v3/msg/content/check$', views.MsgContentCheck.as_view()),
 ]
 

+ 20 - 1
src/weixin/views.py

@@ -834,7 +834,7 @@ class V3PhoneBindView(cv.AuthView):
             return cv.to_fail(e)
 
 
-class V3SignupInfoView(cv.BaseView):
+class V3SignupInfoView(cv.AuthView):
     def get(self, request):
         """#报名信息v3(3.0小程序)
         """
@@ -1847,3 +1847,22 @@ class UserSignupOrder(cv.BaseView):
             cv.tracefail()
             return cv.to_fail(e)
 
+
+class MsgContentCheck(cv.BaseView):
+    def post(self,request):
+        """#微信退款(平台管理后台)
+        @id:"订单id"
+        """
+        qdata = request.json
+        need_params = ["content"]
+        mse = ccf.check_params(*need_params,**qdata)
+        if mse:
+            raise ce.TipException(mse)
+        try:
+            vals = ccf.get_need_params(*need_params,**qdata)
+            rst = ctl.check_msg_content(request)
+            return cv.to_suc(rst)
+        except Exception as e:
+            cv.tracefail()
+            return cv.to_fail(e)
+

+ 1 - 1
templates/topic/xsSignup.html

@@ -66,8 +66,8 @@
         </div>
         
         <div class="data">
-	      冠军组:历届小组前三,十万以上<br/>
           千万组:300W以上<br/>
+          
           百万组:50W到300W<br/>
           十万组:10W到50W<br/>
           菜鸟组:10W以下<br/>