|
@@ -1,378 +1,332 @@
|
|
|
package front
|
|
|
|
|
|
import (
|
|
|
- "encoding/json"
|
|
|
- "errors"
|
|
|
- "fmt"
|
|
|
- "jy/src/jfw/modules/app/src/jfw/config"
|
|
|
- "log"
|
|
|
- "regexp"
|
|
|
- "strconv"
|
|
|
- "strings"
|
|
|
- "time"
|
|
|
+ "encoding/json"
|
|
|
+ "errors"
|
|
|
+ "fmt"
|
|
|
+ "jy/src/jfw/modules/app/src/jfw/config"
|
|
|
+ "log"
|
|
|
+ "regexp"
|
|
|
+ "strconv"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
|
|
|
- util "app.yhyue.com/moapp/jybase/common"
|
|
|
- . "app.yhyue.com/moapp/jybase/date"
|
|
|
- "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
- "app.yhyue.com/moapp/jybase/redis"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/dataexport"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
- "app.yhyue.com/moapp/jypkg/public"
|
|
|
- "go.mongodb.org/mongo-driver/bson"
|
|
|
+ util "app.yhyue.com/moapp/jybase/common"
|
|
|
+ . "app.yhyue.com/moapp/jybase/date"
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/dataexport"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
+ "app.yhyue.com/moapp/jypkg/public"
|
|
|
+ "go.mongodb.org/mongo-driver/bson"
|
|
|
)
|
|
|
|
|
|
type WsDataExport struct {
|
|
|
- *xweb.Action
|
|
|
- searchExport xweb.Mapper `xweb:"/jyapp/front/dataExport/searchExport"` //app数据导出
|
|
|
- toCreateOrderPage xweb.Mapper `xweb:"/jyapp/front/dataExport/toCreateOrderPage"` //app数据导出-订单支付
|
|
|
- sendMailVerify xweb.Mapper `xweb:"/jyapp/front/dataExport/sendMailVerify"` //发送邮箱验证码
|
|
|
- checkMailVerify xweb.Mapper `xweb:"/jyapp/front/dataExport/checkMailVerify"` //验证邮箱验证码
|
|
|
- checkPhoneVerify xweb.Mapper `xweb:"/jyapp/front/dataExport/checkPhoneVerify"` //验证手机号
|
|
|
- previewData xweb.Mapper `xweb:"/jyapp/front/dataExport/previewData/(.*)"` //app数据导出-数据预览页面
|
|
|
- getPreview xweb.Mapper `xweb:"/jyapp/front/dataExport/getPreview"` //app数据导出-预览数据
|
|
|
- toOrderDetail xweb.Mapper `xweb:"/jyapp/front/dataExport/toOrderDetail"` //订单详情
|
|
|
+ *xweb.Action
|
|
|
+ searchExport xweb.Mapper `xweb:"/jyapp/front/dataExport/searchExport"` //app数据导出
|
|
|
+ toCreateOrderPage xweb.Mapper `xweb:"/jyapp/front/dataExport/toCreateOrderPage"` //app数据导出-订单支付
|
|
|
+ sendMailVerify xweb.Mapper `xweb:"/jyapp/front/dataExport/sendMailVerify"` //发送邮箱验证码
|
|
|
+ checkMailVerify xweb.Mapper `xweb:"/jyapp/front/dataExport/checkMailVerify"` //验证邮箱验证码
|
|
|
+ checkPhoneVerify xweb.Mapper `xweb:"/jyapp/front/dataExport/checkPhoneVerify"` //验证手机号
|
|
|
+ previewData xweb.Mapper `xweb:"/jyapp/front/dataExport/previewData/(.*)"` //app数据导出-数据预览页面
|
|
|
+ getPreview xweb.Mapper `xweb:"/jyapp/front/dataExport/getPreview"` //app数据导出-预览数据
|
|
|
+ toOrderDetail xweb.Mapper `xweb:"/jyapp/front/dataExport/toOrderDetail"` //订单详情
|
|
|
|
|
|
}
|
|
|
|
|
|
func init() {
|
|
|
- xweb.AddAction(&WsDataExport{})
|
|
|
+ xweb.AddAction(&WsDataExport{})
|
|
|
}
|
|
|
|
|
|
func (w *WsDataExport) GetPreview() error {
|
|
|
- userId := util.ObjToString(w.GetSession("userId"))
|
|
|
- if userId == "" {
|
|
|
- return errors.New("未登录")
|
|
|
- }
|
|
|
- _res := make(map[string]interface{})
|
|
|
- //数据预览每天限制50次
|
|
|
- incurKey := fmt.Sprintf("PreviewData_%s_%d", w.GetSession("userId"), time.Now().Day())
|
|
|
- times := util.IntAll(redis.Get("other", incurKey))
|
|
|
- if times >= 50 {
|
|
|
- _res["msg"] = "超出预览次数"
|
|
|
- w.ServeJson(map[string]interface{}{
|
|
|
- "res": _res,
|
|
|
- })
|
|
|
- return nil
|
|
|
- }
|
|
|
- if times == 0 {
|
|
|
- redis.Put("other", incurKey, 1, 24*60*60)
|
|
|
- } else {
|
|
|
- redis.Incr("other", incurKey)
|
|
|
- }
|
|
|
- _id := encrypt.SE.Decode4Hex(w.GetString("_id"))
|
|
|
- dataType := w.GetString("dataType")
|
|
|
- //从500条数据中筛选字段最全五条
|
|
|
- scd := dataexport.GetSqlObjFromId(public.MQFW, _id)
|
|
|
- kws := scd.Keyword
|
|
|
- res, err := dataexport.GetDataExportSearchResult(public.Mgo_Bidding, public.DbConf.Mongodb.Bidding.DbName, public.DbConf.Elasticsearch.Main.Address, scd, dataType, -1)
|
|
|
- if res == nil || err != nil {
|
|
|
- return w.Render("/pc/dataExport_noDataErr.html", &w.T)
|
|
|
- }
|
|
|
- msgCount := dataexport.GetDataExportSearchCountByScdId(public.MQFW, public.Mgo_Bidding, public.DbConf.Mongodb.Bidding.DbName, public.DbConf.Elasticsearch.Main.Address, _id)
|
|
|
- //格式化字段
|
|
|
- res_screen := dataexport.ScreenData(res, dataType, 20, kws)
|
|
|
- var EntArr = []string{}
|
|
|
- if dataType == "2" {
|
|
|
- for _, v := range res_screen {
|
|
|
- //高级字段查询且winner不为空
|
|
|
- if v["s_winner"] != nil && v["s_winner"] != "" {
|
|
|
- EntArr = append(EntArr, v["s_winner"].(string))
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- list := dataexport.FormatExportData(public.Mgo_Ent, &res_screen, config.Sysconfig["webdomain"].(string), dataType, true)
|
|
|
- if msgCount > 20000 {
|
|
|
- msgCount = 20000
|
|
|
- }
|
|
|
- _res["data"] = subUrl(list, dataType)
|
|
|
- _res["dataType"] = dataType
|
|
|
- _res["total"] = msgCount
|
|
|
- w.ServeJson(map[string]interface{}{
|
|
|
- "res": _res,
|
|
|
- })
|
|
|
- return nil
|
|
|
+ userId := util.ObjToString(w.GetSession("userId"))
|
|
|
+ if userId == "" {
|
|
|
+ return errors.New("未登录")
|
|
|
+ }
|
|
|
+ _res := make(map[string]interface{})
|
|
|
+ //数据预览每天限制50次
|
|
|
+ incurKey := fmt.Sprintf("PreviewData_%s_%d", w.GetSession("userId"), time.Now().Day())
|
|
|
+ times := util.IntAll(redis.Get("other", incurKey))
|
|
|
+ if times >= 50 {
|
|
|
+ _res["msg"] = "超出预览次数"
|
|
|
+ w.ServeJson(map[string]interface{}{
|
|
|
+ "res": _res,
|
|
|
+ })
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ if times == 0 {
|
|
|
+ redis.Put("other", incurKey, 1, 24*60*60)
|
|
|
+ } else {
|
|
|
+ redis.Incr("other", incurKey)
|
|
|
+ }
|
|
|
+ _id := encrypt.SE.Decode4Hex(w.GetString("_id"))
|
|
|
+ dataType := w.GetString("dataType")
|
|
|
+ //从500条数据中筛选字段最全五条
|
|
|
+ scd := dataexport.GetSqlObjFromId(public.MQFW, _id)
|
|
|
+ kws := scd.Keyword
|
|
|
+ res, err := dataexport.GetDataExportSearchResult(public.Mgo_Bidding, public.DbConf.Mongodb.Bidding.DbName, public.DbConf.Elasticsearch.Main.Address, scd, dataType, -1)
|
|
|
+ if res == nil || err != nil {
|
|
|
+ return w.Render("/pc/dataExport_noDataErr.html", &w.T)
|
|
|
+ }
|
|
|
+ msgCount := dataexport.GetDataExportSearchCountByScdId(public.MQFW, public.Mgo_Bidding, public.DbConf.Mongodb.Bidding.DbName, public.DbConf.Elasticsearch.Main.Address, _id)
|
|
|
+ //格式化字段
|
|
|
+ res_screen := dataexport.ScreenData(res, dataType, 20, kws)
|
|
|
+ var EntArr = []string{}
|
|
|
+ if dataType == "2" {
|
|
|
+ for _, v := range res_screen {
|
|
|
+ //高级字段查询且winner不为空
|
|
|
+ if v["s_winner"] != nil && v["s_winner"] != "" {
|
|
|
+ EntArr = append(EntArr, v["s_winner"].(string))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list := dataexport.FormatExportData(public.Mgo_Ent, &res_screen, config.Sysconfig["webdomain"].(string), dataType, true)
|
|
|
+ if msgCount > 20000 {
|
|
|
+ msgCount = 20000
|
|
|
+ }
|
|
|
+ _res["data"] = subUrl(list, dataType)
|
|
|
+ _res["dataType"] = dataType
|
|
|
+ _res["total"] = msgCount
|
|
|
+ w.ServeJson(map[string]interface{}{
|
|
|
+ "res": _res,
|
|
|
+ })
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
// 发送邮件
|
|
|
func (w *WsDataExport) SendMailVerify() {
|
|
|
- email := w.GetString("email")
|
|
|
- if isEmail(email) {
|
|
|
- var email_used = true
|
|
|
- if email != w.GetSession("DataExportVerifyEmail") {
|
|
|
- w.DelSession("CreatEVerifyTime")
|
|
|
- // openid := util.ObjToString(w.GetSession("s_m_openid"))
|
|
|
- userId := util.ObjToString(w.GetSession("userId"))
|
|
|
- emails := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
- "user_mail": email,
|
|
|
- "user_id": userId,
|
|
|
- }, "user_mail", "")
|
|
|
- if emails != nil && util.ObjToString((*emails)["user_mail"]) != "" {
|
|
|
- email_used = false
|
|
|
- w.T["success"] = true
|
|
|
- w.T["errCode"] = 4
|
|
|
- w.T["errMsg"] = "此邮箱已被验证"
|
|
|
- w.SetSession("DataExportVerifyEmail_val", email)
|
|
|
- w.SetSession("EMVerifySucess", true)
|
|
|
- }
|
|
|
- }
|
|
|
- if email_used {
|
|
|
- lastSendDEVerify := util.Int64All(w.GetSession("CreatEVerifyTime"))
|
|
|
- timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
|
|
|
- incurKey := fmt.Sprintf("SendEmail_%s_%d", w.GetSession("userId"), time.Now().Day())
|
|
|
- if lastSendDEVerify == 0 || timeSpaceing < 0 {
|
|
|
- //每日限制10次
|
|
|
- times := util.IntAll(redis.Get("other", incurKey))
|
|
|
- if times < 10 {
|
|
|
- if times == 0 {
|
|
|
- redis.Put("other", incurKey, 1, 24*60*60)
|
|
|
- } else {
|
|
|
- redis.Incr("other", incurKey)
|
|
|
- }
|
|
|
- //生成随机数
|
|
|
- verifyStr := strings.ToUpper(util.GetComplexRandom(6, 3, 3))
|
|
|
- w.SetSession("EMVerifySucess", false)
|
|
|
- w.SetSession("DataExportVerifyEmail", email)
|
|
|
- w.SetSession("DataExportVerify", verifyStr)
|
|
|
- w.SetSession("CreatEVerifyTime", time.Now().Unix())
|
|
|
- log.Println("====================", verifyStr, "====================", w.GetSession("DataExportVerify"))
|
|
|
- //发送邮箱验证码
|
|
|
- go public.SendMailIdentCode(email, verifyStr, config.GmailAuth)
|
|
|
- w.T["success"] = true
|
|
|
- } else {
|
|
|
- w.T["success"] = false
|
|
|
- w.T["errCode"] = 3
|
|
|
- w.T["time"] = timeSpaceing
|
|
|
- w.T["errMsg"] = "验证码发送次数已达到今日上限"
|
|
|
- }
|
|
|
+ email := w.GetString("email")
|
|
|
+ if isEmail(email) {
|
|
|
+ var email_used = true
|
|
|
+ if email != w.GetSession("DataExportVerifyEmail") {
|
|
|
+ w.DelSession("CreatEVerifyTime")
|
|
|
+ // openid := util.ObjToString(w.GetSession("s_m_openid"))
|
|
|
+ userId := util.ObjToString(w.GetSession("userId"))
|
|
|
+ emails := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
+ "user_mail": email,
|
|
|
+ "user_id": userId,
|
|
|
+ }, "user_mail", "")
|
|
|
+ if emails != nil && util.ObjToString((*emails)["user_mail"]) != "" {
|
|
|
+ email_used = false
|
|
|
+ w.T["success"] = true
|
|
|
+ w.T["errCode"] = 4
|
|
|
+ w.T["errMsg"] = "此邮箱已被验证"
|
|
|
+ w.SetSession("DataExportVerifyEmail_val", email)
|
|
|
+ w.SetSession("EMVerifySucess", true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if email_used {
|
|
|
+ lastSendDEVerify := util.Int64All(w.GetSession("CreatEVerifyTime"))
|
|
|
+ timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
|
|
|
+ incurKey := fmt.Sprintf("SendEmail_%s_%d", w.GetSession("userId"), time.Now().Day())
|
|
|
+ if lastSendDEVerify == 0 || timeSpaceing < 0 {
|
|
|
+ //每日限制10次
|
|
|
+ times := util.IntAll(redis.Get("other", incurKey))
|
|
|
+ if times < 10 {
|
|
|
+ if times == 0 {
|
|
|
+ redis.Put("other", incurKey, 1, 24*60*60)
|
|
|
+ } else {
|
|
|
+ redis.Incr("other", incurKey)
|
|
|
+ }
|
|
|
+ //生成随机数
|
|
|
+ verifyStr := strings.ToUpper(util.GetComplexRandom(6, 3, 3))
|
|
|
+ w.SetSession("EMVerifySucess", false)
|
|
|
+ w.SetSession("DataExportVerifyEmail", email)
|
|
|
+ w.SetSession("DataExportVerify", verifyStr)
|
|
|
+ w.SetSession("CreatEVerifyTime", time.Now().Unix())
|
|
|
+ log.Println("====================", verifyStr, "====================", w.GetSession("DataExportVerify"))
|
|
|
+ //发送邮箱验证码
|
|
|
+ go public.SendMailIdentCode(email, verifyStr, config.GmailAuth)
|
|
|
+ w.T["success"] = true
|
|
|
+ } else {
|
|
|
+ w.T["success"] = false
|
|
|
+ w.T["errCode"] = 3
|
|
|
+ w.T["time"] = timeSpaceing
|
|
|
+ w.T["errMsg"] = "验证码发送次数已达到今日上限"
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
- w.T["success"] = false
|
|
|
- w.T["errCode"] = 2
|
|
|
- w.T["time"] = timeSpaceing
|
|
|
- w.T["errMsg"] = "已发送,5分钟后再尝试"
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- w.T["success"] = false
|
|
|
- w.T["errCode"] = 1
|
|
|
- w.T["errMsg"] = "邮箱格式不正确"
|
|
|
- }
|
|
|
- w.ServeJson(&w.T)
|
|
|
+ } else {
|
|
|
+ w.T["success"] = false
|
|
|
+ w.T["errCode"] = 2
|
|
|
+ w.T["time"] = timeSpaceing
|
|
|
+ w.T["errMsg"] = "已发送,5分钟后再尝试"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ w.T["success"] = false
|
|
|
+ w.T["errCode"] = 1
|
|
|
+ w.T["errMsg"] = "邮箱格式不正确"
|
|
|
+ }
|
|
|
+ w.ServeJson(&w.T)
|
|
|
}
|
|
|
|
|
|
// 验证手机号
|
|
|
func (w *WsDataExport) CheckPhoneVerify() {
|
|
|
- phone := w.GetString("phone")
|
|
|
- verityResult := false
|
|
|
- if isPhone(phone) {
|
|
|
- verityResult = true
|
|
|
- w.SetSession("DataExportVerifyPhone", phone)
|
|
|
- }
|
|
|
- w.T["success"] = verityResult
|
|
|
- w.ServeJson(&w.T)
|
|
|
+ phone := w.GetString("phone")
|
|
|
+ verityResult := false
|
|
|
+ if isPhone(phone) {
|
|
|
+ verityResult = true
|
|
|
+ w.SetSession("DataExportVerifyPhone", phone)
|
|
|
+ }
|
|
|
+ w.T["success"] = verityResult
|
|
|
+ w.ServeJson(&w.T)
|
|
|
}
|
|
|
|
|
|
// CheckMailVerify 验证邮箱
|
|
|
func (w *WsDataExport) CheckMailVerify() {
|
|
|
- email := w.GetString("email")
|
|
|
- emailVerity := w.GetString("emailVerity")
|
|
|
+ email := w.GetString("email")
|
|
|
+ emailVerity := w.GetString("emailVerity")
|
|
|
|
|
|
- DataExportEmail := w.GetSession("DataExportVerifyEmail")
|
|
|
- DataExportVerify := w.GetSession("DataExportVerify")
|
|
|
- log.Println(email, emailVerity, "---", DataExportEmail, DataExportVerify)
|
|
|
- verityResult := false
|
|
|
- if emailVerity != "" && emailVerity == DataExportVerify && email != "" && email == DataExportEmail {
|
|
|
- verityResult = true
|
|
|
- w.DelSession("DataExportVerify")
|
|
|
- w.DelSession("CreatEVerifyTime")
|
|
|
- w.SetSession("EMVerifySucess", true)
|
|
|
- w.SetSession("DataExportVerifyEmail_val", DataExportEmail)
|
|
|
- }
|
|
|
- w.T["success"] = verityResult
|
|
|
- w.ServeJson(&w.T)
|
|
|
+ DataExportEmail := w.GetSession("DataExportVerifyEmail")
|
|
|
+ DataExportVerify := w.GetSession("DataExportVerify")
|
|
|
+ log.Println(email, emailVerity, "---", DataExportEmail, DataExportVerify)
|
|
|
+ verityResult := false
|
|
|
+ if emailVerity != "" && emailVerity == DataExportVerify && email != "" && email == DataExportEmail {
|
|
|
+ verityResult = true
|
|
|
+ w.DelSession("DataExportVerify")
|
|
|
+ w.DelSession("CreatEVerifyTime")
|
|
|
+ w.SetSession("EMVerifySucess", true)
|
|
|
+ w.SetSession("DataExportVerifyEmail_val", DataExportEmail)
|
|
|
+ }
|
|
|
+ w.T["success"] = verityResult
|
|
|
+ w.ServeJson(&w.T)
|
|
|
}
|
|
|
|
|
|
func (w *WsDataExport) PreviewData(_id string) error {
|
|
|
- userId := util.ObjToString(w.GetSession("userId"))
|
|
|
- if userId == "" {
|
|
|
- return errors.New("未登录")
|
|
|
- }
|
|
|
- w.T["id"] = _id
|
|
|
- w.T["dataType"] = w.GetString("dataType")
|
|
|
- w.T["ttf"] = public.GetFontVersion() + "_" + public.PC
|
|
|
- return w.Render("/dataExport/dataExport_previewData.html", &w.T)
|
|
|
+ userId := util.ObjToString(w.GetSession("userId"))
|
|
|
+ if userId == "" {
|
|
|
+ return errors.New("未登录")
|
|
|
+ }
|
|
|
+ w.T["id"] = _id
|
|
|
+ w.T["dataType"] = w.GetString("dataType")
|
|
|
+ w.T["ttf"] = public.GetFontVersion() + "_" + public.PC
|
|
|
+ return w.Render("/dataExport/dataExport_previewData.html", &w.T)
|
|
|
}
|
|
|
|
|
|
func subUrl(list *[]map[string]interface{}, dataType string) *[]map[string]interface{} {
|
|
|
- for _, v := range *list {
|
|
|
- //加密截取url
|
|
|
- href := util.ObjToString(v["href"])
|
|
|
- url := util.ObjToString(v["url"])
|
|
|
- if len(url) > 40 { //截取剑鱼标讯地址
|
|
|
- v["url"] = url[:40] + "*****" + url[len(url)-10:]
|
|
|
- }
|
|
|
- if len(href) > 40 { //截取原文地址
|
|
|
- v["href"] = href[:40] + "*****" + href[len(href)-10:]
|
|
|
- } else if len(href) > 0 {
|
|
|
- v["href"] = href[:len(href)*8/10] + "*****"
|
|
|
- }
|
|
|
- }
|
|
|
- var result []map[string]interface{}
|
|
|
- bytes, marshalErr := json.Marshal(list)
|
|
|
- if marshalErr != nil {
|
|
|
- log.Println("数据导出字体混淆errMarshal", marshalErr)
|
|
|
- return list
|
|
|
- }
|
|
|
- //字体混淆
|
|
|
- hxb := public.GetFontConvertStr(public.ExConf.Font.ConvertVersionDefault, string(bytes), "pc")
|
|
|
- unmarshalErr := json.Unmarshal([]byte(hxb), &result)
|
|
|
- if unmarshalErr != nil {
|
|
|
- log.Println("数据导出字体混淆unmarshalErr", unmarshalErr)
|
|
|
- return list
|
|
|
- }
|
|
|
- return &result
|
|
|
+ for _, v := range *list {
|
|
|
+ //加密截取url
|
|
|
+ href := util.ObjToString(v["href"])
|
|
|
+ url := util.ObjToString(v["url"])
|
|
|
+ if len(url) > 40 { //截取剑鱼标讯地址
|
|
|
+ v["url"] = url[:40] + "*****" + url[len(url)-10:]
|
|
|
+ }
|
|
|
+ if len(href) > 40 { //截取原文地址
|
|
|
+ v["href"] = href[:40] + "*****" + href[len(href)-10:]
|
|
|
+ } else if len(href) > 0 {
|
|
|
+ v["href"] = href[:len(href)*8/10] + "*****"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var result []map[string]interface{}
|
|
|
+ bytes, marshalErr := json.Marshal(list)
|
|
|
+ if marshalErr != nil {
|
|
|
+ log.Println("数据导出字体混淆errMarshal", marshalErr)
|
|
|
+ return list
|
|
|
+ }
|
|
|
+ //字体混淆
|
|
|
+ hxb := public.GetFontConvertStr(public.ExConf.Font.ConvertVersionDefault, string(bytes), "pc")
|
|
|
+ unmarshalErr := json.Unmarshal([]byte(hxb), &result)
|
|
|
+ if unmarshalErr != nil {
|
|
|
+ log.Println("数据导出字体混淆unmarshalErr", unmarshalErr)
|
|
|
+ return list
|
|
|
+ }
|
|
|
+ return &result
|
|
|
}
|
|
|
|
|
|
func isEmail(value string) bool {
|
|
|
- var emailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
|
|
|
- return emailPattern.MatchString(value)
|
|
|
+ var emailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
|
|
|
+ return emailPattern.MatchString(value)
|
|
|
}
|
|
|
|
|
|
func (w *WsDataExport) PaySuccessPage() error {
|
|
|
- defer util.Catch()
|
|
|
- w.T["email"] = w.GetString("email")
|
|
|
- w.T["pay_way"] = w.GetString("pay_way")
|
|
|
- payTime, _ := strconv.ParseInt(w.GetString("payTime"), 10, 64)
|
|
|
- w.T["payTime"] = FormatDateByInt64(&payTime, Date_Short_Layout)
|
|
|
- w.T["orderCode"] = w.GetString("code")
|
|
|
- return w.Render("/dataExport/dataExport_paySuccess.html", &w.T)
|
|
|
+ defer util.Catch()
|
|
|
+ w.T["email"] = w.GetString("email")
|
|
|
+ w.T["pay_way"] = w.GetString("pay_way")
|
|
|
+ payTime, _ := strconv.ParseInt(w.GetString("payTime"), 10, 64)
|
|
|
+ w.T["payTime"] = FormatDateByInt64(&payTime, Date_Short_Layout)
|
|
|
+ w.T["orderCode"] = w.GetString("code")
|
|
|
+ return w.Render("/dataExport/dataExport_paySuccess.html", &w.T)
|
|
|
}
|
|
|
|
|
|
// 创建订单页面
|
|
|
func (w *WsDataExport) ToCreateOrderPage() error {
|
|
|
- defer util.Catch()
|
|
|
- id := encrypt.SE.Decode4Hex(w.GetString("id"))
|
|
|
- userId := util.ObjToString(w.GetSession("userId"))
|
|
|
- if userId == "" {
|
|
|
- return errors.New("未登录")
|
|
|
- }
|
|
|
- msgCount := dataexport.GetDataExportSearchCountByScdId(public.MQFW, public.Mgo_Bidding, public.DbConf.Mongodb.Bidding.DbName, public.DbConf.Elasticsearch.Main.Address, id)
|
|
|
- if msgCount > public.ExConf.MsgMaxCount || msgCount == -1 {
|
|
|
- msgCount = public.ExConf.MsgMaxCount
|
|
|
- }
|
|
|
- if msgCount < 1 {
|
|
|
- return w.Render("/dataExport/404.html", &w.T)
|
|
|
- }
|
|
|
+ defer util.Catch()
|
|
|
+ id := encrypt.SE.Decode4Hex(w.GetString("id"))
|
|
|
+ userId := util.ObjToString(w.GetSession("userId"))
|
|
|
+ if userId == "" {
|
|
|
+ return errors.New("未登录")
|
|
|
+ }
|
|
|
+ msgCount := dataexport.GetDataExportSearchCountByScdId(public.MQFW, public.Mgo_Bidding, public.DbConf.Mongodb.Bidding.DbName, public.DbConf.Elasticsearch.Main.Address, id)
|
|
|
+ if msgCount > public.ExConf.MsgMaxCount || msgCount == -1 {
|
|
|
+ msgCount = public.ExConf.MsgMaxCount
|
|
|
+ }
|
|
|
+ if msgCount < 1 {
|
|
|
+ return w.Render("/dataExport/404.html", &w.T)
|
|
|
+ }
|
|
|
|
|
|
- resEmail, _ := w.GetSession("DataExportVerifyEmail_val").(string)
|
|
|
- resPhone, _ := w.GetSession("DataExportVerifyPhone_val").(string)
|
|
|
- if resEmail != "" {
|
|
|
- lastSendDEVerify := util.Int64All(w.GetSession("CreatEVerifyTime"))
|
|
|
- timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
|
|
|
- w.T["email"] = resEmail
|
|
|
- w.T["timeSpaceing"] = timeSpaceing
|
|
|
- }
|
|
|
- if resPhone != "" {
|
|
|
- w.T["phone"] = resPhone
|
|
|
- }
|
|
|
+ resEmail, _ := w.GetSession("DataExportVerifyEmail_val").(string)
|
|
|
+ resPhone, _ := w.GetSession("DataExportVerifyPhone_val").(string)
|
|
|
+ if resEmail != "" {
|
|
|
+ lastSendDEVerify := util.Int64All(w.GetSession("CreatEVerifyTime"))
|
|
|
+ timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
|
|
|
+ w.T["email"] = resEmail
|
|
|
+ w.T["timeSpaceing"] = timeSpaceing
|
|
|
+ }
|
|
|
+ if resPhone != "" {
|
|
|
+ w.T["phone"] = resPhone
|
|
|
+ }
|
|
|
|
|
|
- if resEmail == "" || resPhone == "" {
|
|
|
- lastEmail, lastPhone := "", ""
|
|
|
- if lastPhone, lastEmail = dataexport.GetLastExportPhoneAndMail(public.Mysql, userId, util.ObjToString(w.GetSession("entUserId"))); lastPhone == "" || lastEmail == "" {
|
|
|
- userData, _ := mongodb.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 != "" {
|
|
|
- w.T["email"] = lastEmail
|
|
|
- w.SetSession("EMVerifySucess", true)
|
|
|
- w.SetSession("DataExportVerifyEmail_val", lastEmail)
|
|
|
- }
|
|
|
+ if resEmail == "" || resPhone == "" {
|
|
|
+ lastEmail, lastPhone := "", ""
|
|
|
+ if lastPhone, lastEmail = dataexport.GetLastExportPhoneAndMail(public.Mysql, userId, util.ObjToString(w.GetSession("entUserId"))); lastPhone == "" || lastEmail == "" {
|
|
|
+ userData, _ := mongodb.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 != "" {
|
|
|
+ w.T["email"] = lastEmail
|
|
|
+ w.SetSession("EMVerifySucess", true)
|
|
|
+ w.SetSession("DataExportVerifyEmail_val", lastEmail)
|
|
|
+ }
|
|
|
|
|
|
- if resPhone == "" && lastPhone != "" {
|
|
|
- w.SetSession("DataExportVerifyPhone_val", lastPhone)
|
|
|
- w.T["phone"] = lastPhone
|
|
|
- }
|
|
|
- }
|
|
|
- //支付方式
|
|
|
- payway := w.GetString("payway")
|
|
|
- if payway != "" {
|
|
|
- w.T["payway"] = payway
|
|
|
- }
|
|
|
- //字段包
|
|
|
- spec := w.GetString("dataspec")
|
|
|
- if spec != "" {
|
|
|
- w.T["dataspec"] = spec
|
|
|
- }
|
|
|
- w.T["_id"] = w.GetString("id")
|
|
|
- w.T["msgCount"] = msgCount //信息总量
|
|
|
- incurKey := fmt.Sprintf("PreviewData_%s_%d", w.GetSession("userId"), time.Now().Day()) //每日限制预览次数
|
|
|
- w.T["PreviewData"] = util.IntAll(redis.Get("other", incurKey))
|
|
|
+ if resPhone == "" && lastPhone != "" {
|
|
|
+ w.SetSession("DataExportVerifyPhone_val", lastPhone)
|
|
|
+ w.T["phone"] = lastPhone
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //支付方式
|
|
|
+ payway := w.GetString("payway")
|
|
|
+ if payway != "" {
|
|
|
+ w.T["payway"] = payway
|
|
|
+ }
|
|
|
+ //字段包
|
|
|
+ spec := w.GetString("dataspec")
|
|
|
+ if spec != "" {
|
|
|
+ w.T["dataspec"] = spec
|
|
|
+ }
|
|
|
+ w.T["_id"] = w.GetString("id")
|
|
|
+ w.T["msgCount"] = msgCount //信息总量
|
|
|
+ incurKey := fmt.Sprintf("PreviewData_%s_%d", w.GetSession("userId"), time.Now().Day()) //每日限制预览次数
|
|
|
+ w.T["PreviewData"] = util.IntAll(redis.Get("other", incurKey))
|
|
|
|
|
|
- w.Render("/dataExport/dataExport_payOrder.html", &w.T)
|
|
|
- return nil
|
|
|
+ w.Render("/dataExport/dataExport_payOrder.html", &w.T)
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
func isPhone(value string) bool {
|
|
|
- var phonePattern = regexp.MustCompile("^[1][3-9][0-9]{9}$")
|
|
|
- return phonePattern.MatchString(value)
|
|
|
+ var phonePattern = regexp.MustCompile("^[1][3-9][0-9]{9}$")
|
|
|
+ return phonePattern.MatchString(value)
|
|
|
}
|
|
|
|
|
|
// 微信数据导出
|
|
|
func (wd *WsDataExport) SearchExport() error {
|
|
|
-<<<<<<< HEAD
|
|
|
- openid := util.ObjToString(wd.GetSession("s_m_openid"))
|
|
|
- userId := util.ObjToString(wd.GetSession("userId"))
|
|
|
- if userId == "" {
|
|
|
- return errors.New("未登录")
|
|
|
- }
|
|
|
- //接收超级搜索页面参数
|
|
|
- reqData := public.BidSearchExport{
|
|
|
- Keywords: wd.GetString("searchvalue"), //搜索词
|
|
|
- Publishtime: wd.GetString("publishtime"), //发布时间
|
|
|
- Area: wd.GetString("scope"), //地区
|
|
|
- Subtype: wd.GetString("subtype"), //信息类型
|
|
|
- Minprice: wd.GetString("minprice"), //最低价格
|
|
|
- Maxprice: wd.GetString("maxprice"), //最高价格
|
|
|
- Industry: strings.TrimSpace(wd.GetString("industry")), //选中的行业
|
|
|
- SelectType: wd.GetString("selectType"), //标题 or 全文
|
|
|
- Buyerclass: wd.GetString("buyerclass"), //采购单位行业
|
|
|
- Winner: wd.GetString("winner"), //中标单位
|
|
|
- Hasbuyertel: wd.GetString("buyertel"), //是否有采购电话
|
|
|
- Haswinnertel: wd.GetString("winnertel"), //是否有中标电话
|
|
|
- SelectIds: strings.TrimSpace(wd.GetString("selectIds")), //选择信息id
|
|
|
- Notkey: wd.GetString("notkey"), //排除词
|
|
|
- City: wd.GetString("city"), //城市
|
|
|
- FileExists: wd.GetString("fileExists"), //有无附件
|
|
|
- }
|
|
|
- saveData := reqData.PassBidSearchExport(config.Sysconfig)
|
|
|
- saveData["selectType"] = strings.Join(jy.GetVipState(wd.Session(), *config.Middleground, userId).
|
|
|
- GetQueryItems(wd.GetString("selectType"), util.Int64All(config.Sysconfig["bidSearchOldUserLimit"])), ",")
|
|
|
- saveData["s_openid"] = openid
|
|
|
- saveData["s_userid"] = userId
|
|
|
- saveData["comeinfrom"] = "supersearchPage"
|
|
|
- region := util.If(reqData.Area == "全国", "", reqData.Area).(string)
|
|
|
- if region != "" && reqData.City != "" {
|
|
|
- region += "," + reqData.City
|
|
|
- } else {
|
|
|
- region = reqData.City
|
|
|
- }
|
|
|
- saveData["region"] = strings.Split(region, ",")
|
|
|
- //是否开启 正文 标题同时搜索只搜正文的开关
|
|
|
- saveData["searchTypeSwitch"], _ = config.Sysconfig["searchTypeSwitch"].(bool)
|
|
|
- //存入数据库
|
|
|
- _id := mongodb.Save(dataexport.ExportTable, saveData)
|
|
|
-
|
|
|
- wd.ServeJson(bson.M{"_id": encrypt.SE.Encode2Hex(_id)})
|
|
|
- return nil
|
|
|
-=======
|
|
|
openid := util.ObjToString(wd.GetSession("s_m_openid"))
|
|
|
userId := util.ObjToString(wd.GetSession("userId"))
|
|
|
if userId == "" {
|
|
@@ -404,9 +358,8 @@ func (wd *WsDataExport) SearchExport() error {
|
|
|
WordsMode: wordsMode, //搜索关键词模式;默认0:包含所有,1:包含任意
|
|
|
AdditionalWords: wd.GetString("additionalWords"), //关键词:附加关键词(副:五组,每组最多15个字符)
|
|
|
}
|
|
|
- entId := util.IntAll(wd.GetSession("entId"))
|
|
|
- saveData := reqData.PassBidSearchExport()
|
|
|
- saveData["selectType"] = strings.Join(jy.GetVipState(public.Mysql, public.MQFW, userId, entId).
|
|
|
+ saveData := reqData.PassBidSearchExport(config.Sysconfig)
|
|
|
+ saveData["selectType"] = strings.Join(jy.GetVipState(wd.Session(), *config.Middleground, userId).
|
|
|
GetQueryItems(wd.GetString("selectType"), util.Int64All(config.Sysconfig["bidSearchOldUserLimit"])), ",")
|
|
|
saveData["s_openid"] = openid
|
|
|
saveData["s_userid"] = userId
|
|
@@ -422,113 +375,111 @@ func (wd *WsDataExport) SearchExport() error {
|
|
|
saveData["searchTypeSwitch"], _ = config.Sysconfig["searchTypeSwitch"].(bool)
|
|
|
//存入数据库
|
|
|
_id := mongodb.Save(dataexport.ExportTable, saveData)
|
|
|
-
|
|
|
- wd.ServeJson(bson.M{"_id": util.SE.Encode2Hex(_id)})
|
|
|
+ wd.ServeJson(bson.M{"_id": encrypt.SE.Encode2Hex(_id)})
|
|
|
return nil
|
|
|
->>>>>>> master
|
|
|
}
|
|
|
|
|
|
func (m *WsDataExport) ToOrderDetail() error {
|
|
|
- userId := m.Session().Get("userId")
|
|
|
- if userId == nil || userId == "" {
|
|
|
- return m.Redirect("/jyapp/free/login")
|
|
|
- }
|
|
|
- orderCode := m.GetString("orderCode")
|
|
|
- orderDetail := map[string]interface{}{}
|
|
|
- filter := dataexport.SieveCondition{}
|
|
|
- queryMap := map[string]interface{}{
|
|
|
- "order_code": orderCode,
|
|
|
- "user_id": userId,
|
|
|
- }
|
|
|
- if orderCode != "" {
|
|
|
- orderDetail = *public.Mysql.FindOne(tableName_order, queryMap, "", "")
|
|
|
- }
|
|
|
- orderDetail["order_code"] = orderCode
|
|
|
- if orderDetail["pay_money"] != nil {
|
|
|
- orderDetail["pay_money"] = float64(orderDetail["pay_money"].(int64)) / 100
|
|
|
- }
|
|
|
- if orderDetail["order_money"] != nil {
|
|
|
- orderDetail["order_money"] = float64(orderDetail["order_money"].(int64)) / 100
|
|
|
- }
|
|
|
- if orderDetail["pay_time"] != nil {
|
|
|
- pay_time := strings.Replace(orderDetail["pay_time"].(string), "-", ".", -1)
|
|
|
- orderDetail["pay_time"] = pay_time
|
|
|
- }
|
|
|
- if orderDetail["create_time"] != nil {
|
|
|
- create_time := strings.Replace(orderDetail["create_time"].(string), "-", ".", -1)
|
|
|
- orderDetail["create_time"] = create_time
|
|
|
- }
|
|
|
- if orderDetail["filter"] != nil {
|
|
|
- err := json.Unmarshal([]byte(orderDetail["filter"].(string)), &filter)
|
|
|
- if err == nil {
|
|
|
- publishtime := filter.PublishTime
|
|
|
- if publishtime != "" {
|
|
|
- timeArr := strings.Split(publishtime, "_")
|
|
|
- if len(timeArr) == 2 {
|
|
|
- start, err := strconv.ParseInt(timeArr[0], 10, 64)
|
|
|
- end, erro := strconv.ParseInt(timeArr[1], 10, 64)
|
|
|
- //可能出现只选择一个时间
|
|
|
- if err == nil && erro == nil {
|
|
|
- filter.PublishTime = FormatDateByInt64(&start, layout_date) + "-" + FormatDateByInt64(&end, layout_date)
|
|
|
- } else if err != nil && erro == nil {
|
|
|
- filter.PublishTime = "-" + FormatDateByInt64(&end, layout_date)
|
|
|
- } else if err == nil && erro != nil {
|
|
|
- filter.PublishTime = FormatDateByInt64(&start, layout_date) + "-"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- filter.MinPrice = public.GetPriceDes_SieveCondition(filter.MinPrice, filter.MaxPrice)
|
|
|
- orderDetail["filter"] = filter
|
|
|
- } else {
|
|
|
- log.Println("筛选条件-关键词-结构体反序列化-错误", err)
|
|
|
- }
|
|
|
- }
|
|
|
- if orderDetail["applybill_type"] != nil && orderDetail["applybill_type"].(int64) == 0 {
|
|
|
- orderDetail["applybill_type"] = "个人"
|
|
|
- } else if orderDetail["applybill_type"] != nil && orderDetail["applybill_type"].(int64) == 1 {
|
|
|
- orderDetail["applybill_type"] = "单位"
|
|
|
- } else {
|
|
|
- orderDetail["applybill_type"] = "-"
|
|
|
- }
|
|
|
- if orderDetail["applybill_status"] != nil && orderDetail["applybill_status"].(int64) == 1 {
|
|
|
- orderDetail["applybill_status"] = "T" //已申请
|
|
|
- } else {
|
|
|
- orderDetail["applybill_status"] = "F" //未申请
|
|
|
- }
|
|
|
- //加密
|
|
|
- if orderDetail["filter_id"] != nil {
|
|
|
- orderDetail["filter_id"] = encrypt.SE.Encode2Hex(orderDetail["filter_id"].(string))
|
|
|
- }
|
|
|
- //卡卷id加密
|
|
|
- if orderDetail["d_relation_id"] != "" {
|
|
|
- orderDetail["userLotteryId"] = encrypt.SE.Encode2Hex(util.ObjToString(orderDetail["d_relation_id"]))
|
|
|
- }
|
|
|
- delete(orderDetail, "d_relation_id")
|
|
|
- orderStatus := util.IntAll((orderDetail)["order_status"])
|
|
|
- orderDetail["order_status"] = orderStatus
|
|
|
- log.Println((orderDetail)["order_status"], "---", orderStatus, "---", orderDetail["order_status"])
|
|
|
- if orderStatus == 1 {
|
|
|
- orderDetail["transaction_id"] = func() string {
|
|
|
- table := ""
|
|
|
- // 0微信支付 1支付宝支付
|
|
|
- if util.ObjToString(orderDetail["pay_way"]) == "wx_pc" || util.ObjToString(orderDetail["pay_way"]) == "wx_js" || util.ObjToString(orderDetail["pay_way"]) == "wx_app" {
|
|
|
- table = "weixin_pay"
|
|
|
- orderDetail["pay_way"] = "wx"
|
|
|
- } else if util.ObjToString(orderDetail["pay_way"]) == "ali_pc" || util.ObjToString(orderDetail["pay_way"]) == "ali_app" {
|
|
|
- orderDetail["pay_way"] = "ali"
|
|
|
- table = "ali_pay"
|
|
|
- } else {
|
|
|
- return ""
|
|
|
- }
|
|
|
- wxPayMap := map[string]interface{}{}
|
|
|
- wxPayMap["out_trade_no"] = orderDetail["out_trade_no"]
|
|
|
- wxpay := public.Mysql.FindOne(table, wxPayMap, "", "")
|
|
|
- if wxpay == nil {
|
|
|
- return ""
|
|
|
- }
|
|
|
- return util.ObjToString((*wxpay)["transaction_id"])
|
|
|
- }()
|
|
|
- }
|
|
|
- m.T["o"] = orderDetail
|
|
|
- return m.Render("/dataExport/dataExport_toOrderDetail.html", &m.T)
|
|
|
+ userId := m.Session().Get("userId")
|
|
|
+ if userId == nil || userId == "" {
|
|
|
+ return m.Redirect("/jyapp/free/login")
|
|
|
+ }
|
|
|
+ orderCode := m.GetString("orderCode")
|
|
|
+ orderDetail := map[string]interface{}{}
|
|
|
+ filter := dataexport.SieveCondition{}
|
|
|
+ queryMap := map[string]interface{}{
|
|
|
+ "order_code": orderCode,
|
|
|
+ "user_id": userId,
|
|
|
+ }
|
|
|
+ if orderCode != "" {
|
|
|
+ orderDetail = *public.Mysql.FindOne(tableName_order, queryMap, "", "")
|
|
|
+ }
|
|
|
+ orderDetail["order_code"] = orderCode
|
|
|
+ if orderDetail["pay_money"] != nil {
|
|
|
+ orderDetail["pay_money"] = float64(orderDetail["pay_money"].(int64)) / 100
|
|
|
+ }
|
|
|
+ if orderDetail["order_money"] != nil {
|
|
|
+ orderDetail["order_money"] = float64(orderDetail["order_money"].(int64)) / 100
|
|
|
+ }
|
|
|
+ if orderDetail["pay_time"] != nil {
|
|
|
+ pay_time := strings.Replace(orderDetail["pay_time"].(string), "-", ".", -1)
|
|
|
+ orderDetail["pay_time"] = pay_time
|
|
|
+ }
|
|
|
+ if orderDetail["create_time"] != nil {
|
|
|
+ create_time := strings.Replace(orderDetail["create_time"].(string), "-", ".", -1)
|
|
|
+ orderDetail["create_time"] = create_time
|
|
|
+ }
|
|
|
+ if orderDetail["filter"] != nil {
|
|
|
+ err := json.Unmarshal([]byte(orderDetail["filter"].(string)), &filter)
|
|
|
+ if err == nil {
|
|
|
+ publishtime := filter.PublishTime
|
|
|
+ if publishtime != "" {
|
|
|
+ timeArr := strings.Split(publishtime, "_")
|
|
|
+ if len(timeArr) == 2 {
|
|
|
+ start, err := strconv.ParseInt(timeArr[0], 10, 64)
|
|
|
+ end, erro := strconv.ParseInt(timeArr[1], 10, 64)
|
|
|
+ //可能出现只选择一个时间
|
|
|
+ if err == nil && erro == nil {
|
|
|
+ filter.PublishTime = FormatDateByInt64(&start, layout_date) + "-" + FormatDateByInt64(&end, layout_date)
|
|
|
+ } else if err != nil && erro == nil {
|
|
|
+ filter.PublishTime = "-" + FormatDateByInt64(&end, layout_date)
|
|
|
+ } else if err == nil && erro != nil {
|
|
|
+ filter.PublishTime = FormatDateByInt64(&start, layout_date) + "-"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ filter.MinPrice = public.GetPriceDes_SieveCondition(filter.MinPrice, filter.MaxPrice)
|
|
|
+ orderDetail["filter"] = filter
|
|
|
+ } else {
|
|
|
+ log.Println("筛选条件-关键词-结构体反序列化-错误", err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if orderDetail["applybill_type"] != nil && orderDetail["applybill_type"].(int64) == 0 {
|
|
|
+ orderDetail["applybill_type"] = "个人"
|
|
|
+ } else if orderDetail["applybill_type"] != nil && orderDetail["applybill_type"].(int64) == 1 {
|
|
|
+ orderDetail["applybill_type"] = "单位"
|
|
|
+ } else {
|
|
|
+ orderDetail["applybill_type"] = "-"
|
|
|
+ }
|
|
|
+ if orderDetail["applybill_status"] != nil && orderDetail["applybill_status"].(int64) == 1 {
|
|
|
+ orderDetail["applybill_status"] = "T" //已申请
|
|
|
+ } else {
|
|
|
+ orderDetail["applybill_status"] = "F" //未申请
|
|
|
+ }
|
|
|
+ //加密
|
|
|
+ if orderDetail["filter_id"] != nil {
|
|
|
+ orderDetail["filter_id"] = encrypt.SE.Encode2Hex(orderDetail["filter_id"].(string))
|
|
|
+ }
|
|
|
+ //卡卷id加密
|
|
|
+ if orderDetail["d_relation_id"] != "" {
|
|
|
+ orderDetail["userLotteryId"] = encrypt.SE.Encode2Hex(util.ObjToString(orderDetail["d_relation_id"]))
|
|
|
+ }
|
|
|
+ delete(orderDetail, "d_relation_id")
|
|
|
+ orderStatus := util.IntAll((orderDetail)["order_status"])
|
|
|
+ orderDetail["order_status"] = orderStatus
|
|
|
+ log.Println((orderDetail)["order_status"], "---", orderStatus, "---", orderDetail["order_status"])
|
|
|
+ if orderStatus == 1 {
|
|
|
+ orderDetail["transaction_id"] = func() string {
|
|
|
+ table := ""
|
|
|
+ // 0微信支付 1支付宝支付
|
|
|
+ if util.ObjToString(orderDetail["pay_way"]) == "wx_pc" || util.ObjToString(orderDetail["pay_way"]) == "wx_js" || util.ObjToString(orderDetail["pay_way"]) == "wx_app" {
|
|
|
+ table = "weixin_pay"
|
|
|
+ orderDetail["pay_way"] = "wx"
|
|
|
+ } else if util.ObjToString(orderDetail["pay_way"]) == "ali_pc" || util.ObjToString(orderDetail["pay_way"]) == "ali_app" {
|
|
|
+ orderDetail["pay_way"] = "ali"
|
|
|
+ table = "ali_pay"
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ wxPayMap := map[string]interface{}{}
|
|
|
+ wxPayMap["out_trade_no"] = orderDetail["out_trade_no"]
|
|
|
+ wxpay := public.Mysql.FindOne(table, wxPayMap, "", "")
|
|
|
+ if wxpay == nil {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ return util.ObjToString((*wxpay)["transaction_id"])
|
|
|
+ }()
|
|
|
+ }
|
|
|
+ m.T["o"] = orderDetail
|
|
|
+ return m.Render("/dataExport/dataExport_toOrderDetail.html", &m.T)
|
|
|
}
|