Эх сурвалжийг харах

feat: 新增infoId字段存储

zhangxinlei1996 1 жил өмнө
parent
commit
d13e7dc326

+ 16 - 3
jyservice/src/usermanager/getdata.go

@@ -9,6 +9,7 @@ import (
 	. "config"
 	"encoding/json"
 	"fmt"
+	"net/url"
 
 	"crypto/md5"
 	"encoding/hex"
@@ -943,8 +944,8 @@ func PushLtData(w http.ResponseWriter, r *http.Request) {
 	//
 	rData, errMsg := func() (interface{}, error) {
 
-		// fmt.Println(MD5("jyMi1XQgMABQNcSkBMIhBq" + fmt.Sprint(time.Now().Unix()) + "6PzV0CUa"))
-		// fmt.Println(time.Now().Unix())
+		//fmt.Println(MD5("jyMi1XQgMABQNcSkBMIhBq" + fmt.Sprint(time.Now().Unix()) + "6PzV0CUa"))
+		//fmt.Println(time.Now().Unix())
 
 		//
 		if r.Header.Get("Content-Type") != "application/x-www-form-urlencoded" {
@@ -966,11 +967,12 @@ func PushLtData(w http.ResponseWriter, r *http.Request) {
 		zhongBiaoUnit := r.FormValue("zhongBiaoUnit")     //中标单位
 		amount := r.FormValue("amount")                   //中标金额
 		batchNumber := r.FormValue("batchNumber")         //批次号
+		infoId := r.FormValue("infoId")                   //加密的数据id
 		//选填
 		fieldName := r.FormValue("fieldName") //有问题的字段名,多个用逗号拼接
 		xmNumber := r.FormValue("xmNumber")   //项目编号
 		//必选校验
-		for _, v := range []string{"dataType", "href", "infoTypeSegment", "infoTitle", "zhaoBiaoUnit", "zhongBiaoUnit", "amount", "batchNumber"} {
+		for _, v := range []string{"infoId", "dataType", "href", "infoTypeSegment", "infoTitle", "zhaoBiaoUnit", "zhongBiaoUnit", "amount", "batchNumber"} {
 			if len(r.Form[v]) <= 0 {
 				return -1, fmt.Errorf(fmt.Sprintf("%s字段缺失", v))
 			}
@@ -979,6 +981,15 @@ func PushLtData(w http.ResponseWriter, r *http.Request) {
 		if util.IntAll(dataType) != 1 && util.IntAll(dataType) != 2 {
 			return -1, fmt.Errorf("dataType参数错误")
 		}
+
+		//infoId解密
+		escapeInfoId, _ := url.QueryUnescape(infoId)
+		infoid := SE.DecodeString(escapeInfoId)
+
+		if infoid == "" {
+			return -1, fmt.Errorf("infoId错误")
+		}
+
 		if Mgo.Save("ltPushData", map[string]interface{}{
 			"dataType":        util.IntAll(dataType),
 			"href":            href,
@@ -992,6 +1003,8 @@ func PushLtData(w http.ResponseWriter, r *http.Request) {
 			"xmNumber":        xmNumber,
 			"createTime":      time.Now().Unix(),
 			"appid":           appid,
+			"encryptInfoId":   infoId, //加密的
+			"infoId":          infoid,
 		}) != "" {
 			return 1, nil
 		}