xingzai 2 lat temu
rodzic
commit
d0180d10c9
1 zmienionych plików z 21 dodań i 20 usunięć
  1. 21 20
      controllers/activity.go

+ 21 - 20
controllers/activity.go

@@ -3,6 +3,7 @@ package controllers
 import (
 	"encoding/json"
 	"fmt"
+	"github.com/medivhzhan/weapp/v2"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/services"
@@ -1367,26 +1368,26 @@ func (this *ActivityController) AskAdd() {
 		return
 	}
 	content := req.Content
-	//itemToken, err := services.WxGetToken()
-	//if err != nil {
-	//	br.Msg = "GetWxAccessToken Err:" + err.Error()
-	//	return
-	//}
-	//if itemToken.AccessToken == "" {
-	//	br.Msg = "accessToken is empty"
-	//	return
-	//}
-	//commerr, err := weapp.MSGSecCheck(itemToken.AccessToken, content)
-	//if err != nil {
-	//	br.Msg = "内容校验失败!"
-	//	br.ErrMsg = "内容校验失败,Err:" + err.Error()
-	//	return
-	//}
-	//if commerr.ErrCode != 0 {
-	//	br.Msg = "内容违规,请重新提交!"
-	//	br.ErrMsg = "颜文字内容违规,Err:" + commerr.ErrMSG
-	//	return
-	//}
+	itemToken, err := services.WxGetToken()
+	if err != nil {
+		br.Msg = "GetWxAccessToken Err:" + err.Error()
+		return
+	}
+	if itemToken.AccessToken == "" {
+		br.Msg = "accessToken is empty"
+		return
+	}
+	commerr, err := weapp.MSGSecCheck(itemToken.AccessToken, content)
+	if err != nil {
+		br.Msg = "内容校验失败!"
+		br.ErrMsg = "内容校验失败,Err:" + err.Error()
+		return
+	}
+	if commerr.ErrCode != 0 {
+		br.Msg = "内容违规,请重新提交!"
+		br.ErrMsg = "颜文字内容违规,Err:" + commerr.ErrMSG
+		return
+	}
 	activityId := req.ActivityId
 	activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
 	if activityInfo == nil {