|
@@ -1,98 +1,98 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
- "errors"
|
|
|
- "fmt"
|
|
|
- "jy/src/jfw/modules/publicapply/src/config"
|
|
|
- de "jy/src/jfw/modules/publicapply/src/dataexport/dexport"
|
|
|
- "jy/src/jfw/modules/publicapply/src/dataexport/entity"
|
|
|
- "jy/src/jfw/modules/publicapply/src/db"
|
|
|
- u "jy/src/jfw/modules/publicapply/src/util"
|
|
|
- "log"
|
|
|
- "strings"
|
|
|
- "time"
|
|
|
+ "errors"
|
|
|
+ "fmt"
|
|
|
+ "jy/src/jfw/modules/publicapply/src/config"
|
|
|
+ de "jy/src/jfw/modules/publicapply/src/dataexport/dexport"
|
|
|
+ "jy/src/jfw/modules/publicapply/src/dataexport/entity"
|
|
|
+ "jy/src/jfw/modules/publicapply/src/db"
|
|
|
+ u "jy/src/jfw/modules/publicapply/src/util"
|
|
|
+ "log"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
|
|
|
- . "app.yhyue.com/moapp/jybase/api"
|
|
|
- util "app.yhyue.com/moapp/jybase/common"
|
|
|
- "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
- "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/jybase/api"
|
|
|
+ util "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
+ "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/jybase/go-xweb/xweb"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
)
|
|
|
|
|
|
type DataExportStruct struct {
|
|
|
- *xweb.Action
|
|
|
- //bySelects xweb.Mapper `xweb:"/dataexpoet/bySelects"` //数据导出_选择导出
|
|
|
- byCollection xweb.Mapper `xweb:"/dataexpoet/bycollection"` //数据导出_收藏导出
|
|
|
- //byPushHistory xweb.Mapper `xweb:"/dataexpoet/byPushHistory"` //数据导出_推送记录
|
|
|
- payPageParams xweb.Mapper `xweb:"/dataexport/payPageParams"` //数据导出_支付页面参数信息
|
|
|
+ *xweb.Action
|
|
|
+ //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("mgoUserId").(string)
|
|
|
- rData, errMsg := func() (interface{}, error) {
|
|
|
- defer util.Catch()
|
|
|
- if userId == "" {
|
|
|
- return nil, errors.New("未登录")
|
|
|
- }
|
|
|
- var res = map[string]interface{}{}
|
|
|
- id := encrypt.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 = 0
|
|
|
- }
|
|
|
- res["msgCount"] = msgCount
|
|
|
- //邮箱
|
|
|
+ userId, _ := des.GetSession("mgoUserId").(string)
|
|
|
+ rData, errMsg := func() (interface{}, error) {
|
|
|
+ defer util.Catch()
|
|
|
+ if userId == "" {
|
|
|
+ return nil, errors.New("未登录")
|
|
|
+ }
|
|
|
+ var res = map[string]interface{}{}
|
|
|
+ id := encrypt.SE.Decode4Hex(des.GetString("id"))
|
|
|
+ //最大导出数据量
|
|
|
+ msgCount := dataexport.GetDataExportSearchCountByScdId(db.Mgo, db.DbConf.Elasticsearch.Main.Address, id)
|
|
|
+ if msgCount > de.DataExport.MsgMaxCount || msgCount == -1 {
|
|
|
+ msgCount = de.DataExport.MsgMaxCount
|
|
|
+ }
|
|
|
+ if msgCount < 1 {
|
|
|
+ msgCount = 0
|
|
|
+ }
|
|
|
+ res["msgCount"] = msgCount
|
|
|
+ //邮箱
|
|
|
|
|
|
- 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
|
|
|
- }
|
|
|
+ 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 := config.Compatible.Select( 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 resEmail == "" || resPhone == "" {
|
|
|
+ lastEmail, lastPhone := "", ""
|
|
|
+ if lastPhone, lastEmail = dataexport.GetLastExportPhoneAndMail(db.Mysql, userId, util.ObjToString(des.GetSession("entUserId"))); lastPhone == "" || lastEmail == "" {
|
|
|
+ userData := config.Compatible.Select(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))
|
|
|
+ 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))
|
|
|
}
|
|
|
|
|
|
//
|
|
@@ -134,149 +134,149 @@ func (des *DataExportStruct) PayPageParams() {
|
|
|
//}
|
|
|
|
|
|
func (des *DataExportStruct) ByCollection() {
|
|
|
- userId, _ := des.GetSession("userId").(string)
|
|
|
- rData, errMsg := func() (interface{}, error) {
|
|
|
- defer util.Catch()
|
|
|
- ids := []string{}
|
|
|
- selectIds := strings.TrimSpace(des.GetString("selectIds"))
|
|
|
- if selectIds != "" { //选中导出
|
|
|
- for _, encodeId := range strings.Split(selectIds, ",") {
|
|
|
- if tmp := encrypt.CommonDecodeArticle("content", encodeId); len(tmp) > 0 {
|
|
|
- if id := tmp[0]; id != "" {
|
|
|
- ids = append(ids, id)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- buyerPhone, _ := des.GetInteger("buyerPhone")
|
|
|
- winnerPhone, _ := des.GetInteger("winnerPhone")
|
|
|
- sql := u.CollListSql(&u.CollList{
|
|
|
- Label: des.GetString("label"),
|
|
|
- SelectTime: des.GetString("selectTime"),
|
|
|
- Buyerclass: des.GetString("buyerclass"),
|
|
|
- BuyerPhone: buyerPhone,
|
|
|
- WinnerPhone: winnerPhone,
|
|
|
- }, entity.IsPay(des.Session()), userId)
|
|
|
- data := db.Mysql.SelectBySql(sql)
|
|
|
- if data != nil && len(*data) > 0 {
|
|
|
- for _, v := range *data {
|
|
|
- ids = append(ids, util.ObjToString(v["bid"]))
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if len(ids) == 0 {
|
|
|
- return nil, fmt.Errorf("参数异常")
|
|
|
- }
|
|
|
+ userId, _ := des.GetSession("userId").(string)
|
|
|
+ rData, errMsg := func() (interface{}, error) {
|
|
|
+ defer util.Catch()
|
|
|
+ ids := []string{}
|
|
|
+ selectIds := strings.TrimSpace(des.GetString("selectIds"))
|
|
|
+ if selectIds != "" { //选中导出
|
|
|
+ for _, encodeId := range strings.Split(selectIds, ",") {
|
|
|
+ if tmp := encrypt.CommonDecodeArticle("content", encodeId); len(tmp) > 0 {
|
|
|
+ if id := tmp[0]; id != "" {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ buyerPhone, _ := des.GetInteger("buyerPhone")
|
|
|
+ winnerPhone, _ := des.GetInteger("winnerPhone")
|
|
|
+ sql := u.CollListSql(&u.CollList{
|
|
|
+ Label: des.GetString("label"),
|
|
|
+ SelectTime: des.GetString("selectTime"),
|
|
|
+ Buyerclass: des.GetString("buyerclass"),
|
|
|
+ BuyerPhone: buyerPhone,
|
|
|
+ WinnerPhone: winnerPhone,
|
|
|
+ }, entity.IsPay(des.Session()), userId)
|
|
|
+ data := db.Mysql.SelectBySql(sql)
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
+ ids = append(ids, util.ObjToString(v["bid"]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(ids) == 0 {
|
|
|
+ return nil, fmt.Errorf("参数异常")
|
|
|
+ }
|
|
|
|
|
|
- saveData := map[string]interface{}{
|
|
|
- "s_userid": userId,
|
|
|
- "comeinfrom": "collectionPage",
|
|
|
- "comeintime": time.Now().Unix(),
|
|
|
- "selectIds": ids,
|
|
|
- }
|
|
|
+ saveData := map[string]interface{}{
|
|
|
+ "s_userid": userId,
|
|
|
+ "comeinfrom": "collectionPage",
|
|
|
+ "comeintime": time.Now().Unix(),
|
|
|
+ "selectIds": ids,
|
|
|
+ }
|
|
|
|
|
|
- _id := db.Mgo.Save(dataexport.ExportTable, saveData)
|
|
|
- if _id == "" {
|
|
|
- return nil, fmt.Errorf("选择导出异常")
|
|
|
- }
|
|
|
- return map[string]interface{}{
|
|
|
- "_id": encrypt.SE.Encode2Hex(_id),
|
|
|
- }, nil
|
|
|
- }()
|
|
|
- if errMsg != nil {
|
|
|
- log.Printf("%s DataExportStruct ByCollection:%s\n", userId, errMsg.Error())
|
|
|
- }
|
|
|
- des.ServeJson(NewResult(rData, errMsg))
|
|
|
+ _id := db.Mgo.Save(dataexport.ExportTable, saveData)
|
|
|
+ if _id == "" {
|
|
|
+ return nil, fmt.Errorf("选择导出异常")
|
|
|
+ }
|
|
|
+ return map[string]interface{}{
|
|
|
+ "_id": encrypt.SE.Encode2Hex(_id),
|
|
|
+ }, nil
|
|
|
+ }()
|
|
|
+ if errMsg != nil {
|
|
|
+ log.Printf("%s DataExportStruct ByCollection:%s\n", userId, errMsg.Error())
|
|
|
+ }
|
|
|
+ des.ServeJson(NewResult(rData, errMsg))
|
|
|
}
|
|
|
|
|
|
// ByPushHistory 推送页面筛选导出
|
|
|
func (des *DataExportStruct) ByPushHistory() {
|
|
|
- userId, _ := des.GetSession("userId").(string)
|
|
|
- rData, errMsg := func() (interface{}, error) {
|
|
|
- defer util.Catch()
|
|
|
- vipType := des.GetString("vt")
|
|
|
- if vipType == "" { //默认取已切换的企业
|
|
|
- vipType = jy.SwitchService.GetEntniche(des.Session(), *config.Middleground)
|
|
|
- }
|
|
|
- if vipType == jy.SwitchService.Entniche {
|
|
|
- userId = fmt.Sprint(util.IntAll(des.GetSession("entUserId")))
|
|
|
- }
|
|
|
+ userId, _ := des.GetSession("userId").(string)
|
|
|
+ rData, errMsg := func() (interface{}, error) {
|
|
|
+ defer util.Catch()
|
|
|
+ vipType := des.GetString("vt")
|
|
|
+ if vipType == "" { //默认取已切换的企业
|
|
|
+ vipType = jy.SwitchService.GetEntniche(des.Session(), *config.Middleground)
|
|
|
+ }
|
|
|
+ if vipType == jy.SwitchService.Entniche {
|
|
|
+ userId = fmt.Sprint(util.IntAll(des.GetSession("entUserId")))
|
|
|
+ }
|
|
|
|
|
|
- //条件导出
|
|
|
- exportNum, _ := des.GetInteger("exportNum")
|
|
|
- spqp := &jy.SubPushQueryParam{
|
|
|
- Mgo_bidding: db.Mgo_Bidding,
|
|
|
- Bidding: db.DbConf.Mongodb.Bidding.Collection,
|
|
|
- Bidding_back: db.DbConf.Mongodb.Bidding.Collection_change,
|
|
|
- UserId: userId,
|
|
|
- PageSize: exportNum,
|
|
|
- Export: true,
|
|
|
- SelectTime: des.GetString("selectTime"),
|
|
|
- Area: des.GetString("area"),
|
|
|
- City: des.GetString("city"),
|
|
|
- Buyerclass: des.GetString("buyerclass"),
|
|
|
- Subtype: des.GetString("subtype"),
|
|
|
- Subscopeclass: des.GetString("subscopeclass"),
|
|
|
- Key: des.GetString("key"),
|
|
|
- Price: des.GetString("price"),
|
|
|
- FileExists: des.GetString("fileExists"),
|
|
|
- }
|
|
|
+ //条件导出
|
|
|
+ exportNum, _ := des.GetInteger("exportNum")
|
|
|
+ spqp := &jy.SubPushQueryParam{
|
|
|
+ Mgo_bidding: db.Mgo_Bidding,
|
|
|
+ Bidding: db.DbConf.Mongodb.Bidding.Collection,
|
|
|
+ Bidding_back: db.DbConf.Mongodb.Bidding.Collection_change,
|
|
|
+ UserId: userId,
|
|
|
+ PageSize: exportNum,
|
|
|
+ Export: true,
|
|
|
+ SelectTime: des.GetString("selectTime"),
|
|
|
+ Area: des.GetString("area"),
|
|
|
+ City: des.GetString("city"),
|
|
|
+ Buyerclass: des.GetString("buyerclass"),
|
|
|
+ Subtype: des.GetString("subtype"),
|
|
|
+ Subscopeclass: des.GetString("subscopeclass"),
|
|
|
+ Key: des.GetString("key"),
|
|
|
+ Price: des.GetString("price"),
|
|
|
+ FileExists: des.GetString("fileExists"),
|
|
|
+ }
|
|
|
|
|
|
- //选择导出
|
|
|
- if selectIds := strings.TrimSpace(des.GetString("selectIds")); selectIds != "" {
|
|
|
- encodeArr := strings.Split(selectIds, ",")
|
|
|
- idArr := make([]string, 0, len(encodeArr))
|
|
|
- for _, encodeId := range encodeArr {
|
|
|
- if tmp := encrypt.CommonDecodeArticle("content", encodeId); len(tmp) > 0 {
|
|
|
- if id := tmp[0]; id != "" {
|
|
|
- idArr = append(idArr, id)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- spqp.SelectInfoIds = idArr
|
|
|
- }
|
|
|
+ //选择导出
|
|
|
+ if selectIds := strings.TrimSpace(des.GetString("selectIds")); selectIds != "" {
|
|
|
+ encodeArr := strings.Split(selectIds, ",")
|
|
|
+ idArr := make([]string, 0, len(encodeArr))
|
|
|
+ for _, encodeId := range encodeArr {
|
|
|
+ if tmp := encrypt.CommonDecodeArticle("content", encodeId); len(tmp) > 0 {
|
|
|
+ if id := tmp[0]; id != "" {
|
|
|
+ idArr = append(idArr, id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ spqp.SelectInfoIds = idArr
|
|
|
+ }
|
|
|
|
|
|
- if vipType == jy.SwitchService.Member {
|
|
|
- spqp.PushMysql = db.MysqlMemberPush
|
|
|
- } else if vipType == jy.SwitchService.Entniche {
|
|
|
- spqp.PushMysql = db.MysqlEntnichePush
|
|
|
- } else {
|
|
|
- spqp.PushMysql = db.MysqlPush
|
|
|
- }
|
|
|
- _, _, list := jy.NewSubscribePush(vipType).Datas(spqp)
|
|
|
- if list == nil || len(list) == 0 {
|
|
|
- return nil, fmt.Errorf("未匹配到导出数据")
|
|
|
- }
|
|
|
- ids := make([]string, 0, len(list))
|
|
|
- keyWords := make([]string, 0, len(list))
|
|
|
- for _, pushData := range list {
|
|
|
- if pushData.Id != "" {
|
|
|
- if tmp := encrypt.CommonDecodeArticle("content", pushData.Id); len(tmp) > 0 {
|
|
|
- if id := tmp[0]; id != "" {
|
|
|
- ids = append(ids, id)
|
|
|
- keyWords = append(keyWords, strings.Join(pushData.MatchKeys, ","))
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if vipType == jy.SwitchService.Member {
|
|
|
+ spqp.PushMysql = db.MysqlMemberPush
|
|
|
+ } else if vipType == jy.SwitchService.Entniche {
|
|
|
+ spqp.PushMysql = db.MysqlEntnichePush
|
|
|
+ } else {
|
|
|
+ spqp.PushMysql = db.MysqlPush
|
|
|
+ }
|
|
|
+ _, _, list := jy.NewSubscribePush(vipType).Datas(spqp)
|
|
|
+ if list == nil || len(list) == 0 {
|
|
|
+ return nil, fmt.Errorf("未匹配到导出数据")
|
|
|
+ }
|
|
|
+ ids := make([]string, 0, len(list))
|
|
|
+ keyWords := make([]string, 0, len(list))
|
|
|
+ for _, pushData := range list {
|
|
|
+ if pushData.Id != "" {
|
|
|
+ if tmp := encrypt.CommonDecodeArticle("content", pushData.Id); len(tmp) > 0 {
|
|
|
+ if id := tmp[0]; id != "" {
|
|
|
+ ids = append(ids, id)
|
|
|
+ keyWords = append(keyWords, strings.Join(pushData.MatchKeys, ","))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- saveData := map[string]interface{}{
|
|
|
- "s_userid": userId,
|
|
|
- "comeinfrom": "pushHistory",
|
|
|
- "comeintime": time.Now().Unix(),
|
|
|
- "selectIds": ids,
|
|
|
- "pushKeyWords": keyWords,
|
|
|
- }
|
|
|
- _id := db.Mgo.Save(dataexport.ExportTable, saveData)
|
|
|
- if _id == "" {
|
|
|
- return nil, fmt.Errorf("创建导出异常")
|
|
|
- }
|
|
|
- return map[string]interface{}{
|
|
|
- "_id": encrypt.SE.Encode2Hex(_id),
|
|
|
- }, nil
|
|
|
- }()
|
|
|
- if errMsg != nil {
|
|
|
- log.Printf("%s DataExportStruct ByPushHistory:%s\n", userId, errMsg.Error())
|
|
|
- }
|
|
|
- des.ServeJson(NewResult(rData, errMsg))
|
|
|
+ saveData := map[string]interface{}{
|
|
|
+ "s_userid": userId,
|
|
|
+ "comeinfrom": "pushHistory",
|
|
|
+ "comeintime": time.Now().Unix(),
|
|
|
+ "selectIds": ids,
|
|
|
+ "pushKeyWords": keyWords,
|
|
|
+ }
|
|
|
+ _id := db.Mgo.Save(dataexport.ExportTable, saveData)
|
|
|
+ if _id == "" {
|
|
|
+ return nil, fmt.Errorf("创建导出异常")
|
|
|
+ }
|
|
|
+ return map[string]interface{}{
|
|
|
+ "_id": encrypt.SE.Encode2Hex(_id),
|
|
|
+ }, nil
|
|
|
+ }()
|
|
|
+ if errMsg != nil {
|
|
|
+ log.Printf("%s DataExportStruct ByPushHistory:%s\n", userId, errMsg.Error())
|
|
|
+ }
|
|
|
+ des.ServeJson(NewResult(rData, errMsg))
|
|
|
}
|