浏览代码

Merge branch 'dev4.6.11' of http://192.168.3.207:8080/qmx/jy into dev4.6.11

yangfeng 3 年之前
父节点
当前提交
8a9e939c59

+ 3 - 0
src/jfw/modules/publicapply/src/dataexport/dataexport.json

@@ -0,0 +1,3 @@
+{
+    "msgMaxCount":20000
+}

+ 15 - 0
src/jfw/modules/publicapply/src/dataexport/dexport/dataexport.go

@@ -0,0 +1,15 @@
+package dataexport
+
+import (
+	"qfw/util"
+)
+
+type dataExport struct {
+	MsgMaxCount int `json:"msgMaxCount"` //数据导出最大数
+}
+
+var DataExport *dataExport
+
+func init() {
+	util.ReadConfig("./dataexport/dataexport.json", &DataExport)
+}

+ 1 - 0
src/jfw/modules/publicapply/src/dataexport/init.go

@@ -1,6 +1,7 @@
 package dataexport
 
 import (
+	_ "dataexport/dexport"
 	"dataexport/service"
 
 	"github.com/go-xweb/xweb"

+ 70 - 0
src/jfw/modules/publicapply/src/dataexport/service/action.go

@@ -2,13 +2,16 @@ package service
 
 import (
 	. "api"
+	de "dataexport/dexport"
 	"dataexport/entity"
 	"db"
+	"errors"
 	"fmt"
 	"log"
 	"qfw/util"
 	"qfw/util/dataexport"
 	"qfw/util/jy"
+	"qfw/util/redis"
 	"strings"
 	"time"
 	u "util"
@@ -21,8 +24,75 @@ type DataExportStruct struct {
 	bySelects     xweb.Mapper `xweb:"/dataexpoet/bySelects"`     //数据导出_选择导出
 	byCollection  xweb.Mapper `xweb:"/dataexpoet/bycollection"`  //数据导出_收藏导出
 	byPushHistory xweb.Mapper `xweb:"/dataexpoet/byPushHistory"` //数据导出_推送记录
+	payPageParams xweb.Mapper `xweb:"/dataexport/payPageParams"` //数据导出_支付页面参数信息
 }
 
+//
+func (des *DataExportStruct) PayPageParams() {
+	userId, _ := des.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		defer util.Catch()
+		if userId == "" {
+			return nil, errors.New("未登录")
+		}
+		var res = map[string]interface{}{}
+		id := util.SE.Decode4Hex(des.GetString("id"))
+		//最大导出数据量
+		msgCount := dataexport.GetDataExportSearchCountByScdId(db.Mgo, db.Mgo_Bidding, db.DbConf.Mongodb.Bidding.DbName, db.DbConf.Elasticsearch.Main.Address, id)
+		if msgCount > de.DataExport.MsgMaxCount || msgCount == -1 {
+			msgCount = de.DataExport.MsgMaxCount
+		}
+		if msgCount < 1 {
+			msgCount = 20000
+		}
+		//邮箱
+
+		resEmail, _ := des.GetSession("DataExportVerifyEmail_val").(string)
+		resPhone, _ := des.GetSession("DataExportVerifyPhone_val").(string)
+		if resEmail != "" {
+			lastSendDEVerify := util.Int64All(des.GetSession("CreatEVerifyTime"))
+			res["timeSpaceing"] = lastSendDEVerify - time.Now().Unix() + 60*5
+			res["resEmail"] = resEmail
+		}
+		if resPhone != "" {
+			res["resPhone"] = resPhone
+		}
+
+		if resEmail == "" || resPhone == "" {
+			lastEmail, lastPhone := "", ""
+			if lastPhone, lastEmail = dataexport.GetLastExportPhoneAndMail(db.Mysql, userId, util.ObjToString(des.GetSession("entUserId"))); lastPhone == "" || lastEmail == "" {
+				userData, _ := db.Mgo.FindById("user", userId, `{"s_myemail":1,"s_phone":1,"s_m_phone":1}`)
+				if userData != nil && len(*userData) > 0 {
+					if lastEmail == "" {
+						lastEmail, _ = (*userData)["s_myemail"].(string)
+					}
+					if lastPhone == "" {
+						lastPhone, _ = util.If((*userData)["s_phone"] != nil, (*userData)["s_phone"], (*userData)["s_m_phone"]).(string)
+					}
+				}
+			}
+			if resEmail == "" && lastEmail != "" {
+				res["resEmail"] = lastEmail
+				des.SetSession("EMVerifySucess", true)
+				des.SetSession("DataExportVerifyEmail_val", lastEmail)
+			}
+
+			if resPhone == "" && lastPhone != "" {
+				des.SetSession("DataExportVerifyPhone_val", lastPhone)
+				res["resPhone"] = lastPhone
+			}
+		}
+		incurKey := fmt.Sprintf("PreviewData_%s_%d", des.GetSession("userId"), time.Now().Day()) //每日限制预览次数
+		res["previewData"] = util.IntAll(redis.Get("other", incurKey))
+		return res, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportStruct ByCollection:%s\n", userId, errMsg.Error())
+	}
+	des.ServeJson(NewResult(rData, errMsg))
+}
+
+//
 func (des *DataExportStruct) BySelects() {
 	userId, _ := des.GetSession("userId").(string)
 	rData, errMsg := func() (interface{}, error) {