|
@@ -0,0 +1,43 @@
|
|
|
|
+package service
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ . "api"
|
|
|
|
+ "db"
|
|
|
|
+ "fmt"
|
|
|
|
+ "github.com/go-xweb/xweb"
|
|
|
|
+ "jfw/public"
|
|
|
|
+ "log"
|
|
|
|
+ "qfw/util"
|
|
|
|
+ "qfw/util/dataexport"
|
|
|
|
+ "strings"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+type DataExportStruct struct {
|
|
|
|
+ *xweb.Action
|
|
|
|
+ byCollection xweb.Mapper `xweb:"/dataexpoet/bycollection"` //数据导出_收藏导出
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (des *DataExportStruct) ByCollection() {
|
|
|
|
+ userId, _ := des.GetSession("userId").(string)
|
|
|
|
+ rData, errMsg := func() (interface{}, error) {
|
|
|
|
+ reqData := public.BidSearchExport{
|
|
|
|
+ SelectIds: strings.TrimSpace(des.GetString("selectIds")), //选择信息id
|
|
|
|
+ }
|
|
|
|
+ saveData := reqData.PassBidSearchExport()
|
|
|
|
+ saveData["s_openid"] = util.ObjToString(des.GetSession("s_m_openid"))
|
|
|
|
+ saveData["s_userid"] = userId
|
|
|
|
+ saveData["comeinfrom"] = "collectionPage"
|
|
|
|
+
|
|
|
|
+ _id := db.Mgo.Save(dataexport.ExportTable, saveData)
|
|
|
|
+ if _id == "" {
|
|
|
|
+ return nil, fmt.Errorf("选择导出异常")
|
|
|
|
+ }
|
|
|
|
+ return map[string]interface{}{
|
|
|
|
+ "_id": util.SE.Encode2Hex(_id),
|
|
|
|
+ }, nil
|
|
|
|
+ }()
|
|
|
|
+ if errMsg != nil {
|
|
|
|
+ log.Printf("%s DataExportStruct ByCollection:%s\n", userId, errMsg.Error())
|
|
|
|
+ }
|
|
|
|
+ des.ServeJson(NewResult(rData, errMsg))
|
|
|
|
+}
|