瀏覽代碼

fix:芝麻报告邮件发送

duxin 3 天之前
父節點
當前提交
edd374dd5e

+ 1 - 1
src/jfw/modules/subscribepay/src/config.yaml

@@ -51,7 +51,7 @@ pdfPackPrice:
   投标企业信用报告下载包:
   投标企业信用报告下载包:
     - num: 1
     - num: 1
       price: 9900
       price: 9900
-  芝麻信用共建分析报告下载包:
+  招投标综合分析下载包:
     - num: 1
     - num: 1
       price: 99900
       price: 99900
     - num: 20
     - num: 20

+ 359 - 359
src/jfw/modules/subscribepay/src/entity/basePack.go

@@ -1,416 +1,416 @@
 package entity
 package entity
 
 
 import (
 import (
-    "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-    "app.yhyue.com/moapp/jybase/redis"
-    "encoding/json"
-    "fmt"
-    "github.com/gogf/gf/v2/util/gconv"
-    "jy/src/jfw/modules/subscribepay/src/config"
-    "jy/src/jfw/modules/subscribepay/src/consts"
-    "jy/src/jfw/modules/subscribepay/src/util"
-    "log"
-    "math"
-    "strconv"
-    "time"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jybase/redis"
+	"encoding/json"
+	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
+	"jy/src/jfw/modules/subscribepay/src/config"
+	"jy/src/jfw/modules/subscribepay/src/consts"
+	"jy/src/jfw/modules/subscribepay/src/util"
+	"log"
+	"math"
+	"strconv"
+	"time"
 
 
-    qutil "app.yhyue.com/moapp/jybase/common"
-    . "app.yhyue.com/moapp/jybase/date"
-    "app.yhyue.com/moapp/jybase/encrypt"
-    . "app.yhyue.com/moapp/jybase/mongodb"
-    "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	. "app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 )
 
 
 // 默认消费
 // 默认消费
 func (this *UseBalanceStruct) defaultConsume() (r map[string]interface{}, m string, c int) {
 func (this *UseBalanceStruct) defaultConsume() (r map[string]interface{}, m string, c int) {
-    r, rerr := this.UseBalance()
-    if rerr != nil {
-        m = fmt.Sprintf("消费异常:%s", rerr.Error())
-    }
-    return
+	r, rerr := this.UseBalance()
+	if rerr != nil {
+		m = fmt.Sprintf("消费异常:%s", rerr.Error())
+	}
+	return
 }
 }
 
 
 // KeyAccountConsume 大客户平台  || 资源中台  无权限限制
 // KeyAccountConsume 大客户平台  || 资源中台  无权限限制
 func (this *UseBalanceStruct) KeyAccountConsume() (r map[string]interface{}, m string, c int) {
 func (this *UseBalanceStruct) KeyAccountConsume() (r map[string]interface{}, m string, c int) {
-    log.Println(this.Name, "-------附件下载记录------", this.Remarks)
-    _fileName := this.Remarks["fileName"].(string)
-    _id := this.Remarks["id"].(string)
-    if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
-        r = SupplyInfoFile(_fileName, _id)
-    } else {
-        r = fileAttachRpc(_fileName, _id)
-    }
-    return
+	log.Println(this.Name, "-------附件下载记录------", this.Remarks)
+	_fileName := this.Remarks["fileName"].(string)
+	_id := this.Remarks["id"].(string)
+	if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
+		r = SupplyInfoFile(_fileName, _id)
+	} else {
+		r = fileAttachRpc(_fileName, _id)
+	}
+	return
 }
 }
 
 
 // 附件下载消费 fui:免费赠送已使用次数;pui:付费权限已使用次数
 // 附件下载消费 fui:免费赠送已使用次数;pui:付费权限已使用次数
 func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string, c int) {
 func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string, c int) {
-    _fileName := this.Remarks["fileName"].(string)
-    _id := this.Remarks["id"].(string)
-    log.Println("附件下载包。。。。。")
-    BaseMsg := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
-    log.Println("---:", this.Remarks)
-    //P450 v4.8.85
-    var freeFileCacheUpdate = func() {
-        //免费用户 更新留资附件缓存
-        if BaseMsg.Status <= 0 && BaseMsg.VipStatus <= 0 && BaseMsg.EntnicheStatus <= 0 {
-            sess := this.Session.GetMultiple()
-            userId := this.UserId
-            if qutil.IntAll(sess["positionId"]) == 1 {
-                userId = strconv.Itoa(qutil.IntAll(sess["positionId"]))
-            }
-            //已留资
-            if c := qutil.Int64All(redis.GetInt("other", fmt.Sprintf("free_article_attach_%s", userId))); c > 0 {
-                if ok := redis.PutKV(fmt.Sprintf("free_article_attach_%s", userId), -1); !ok {
-                    log.Println("free user update file  download power  false:", userId)
-                }
-            }
-        }
-    }
-    //获取余额数量
-    dbs := &FindBalanceStruct{
-        AccountId:    this.UserId,
-        ResourceType: "附件下载包",
-        VipState:     BaseMsg.VipStatus,
-    }
-    this.VipState = BaseMsg.VipStatus
-    data, err := dbs.FindBalance()
-    if data == nil || err != nil {
-        c = -1
-        m = "余额不足"
-        go freeFileCacheUpdate()
-        return
-    }
-    number := 0
-    if data != nil {
-        dataArr := gconv.SliceAny(data["data"])
-        if len(dataArr) > 0 {
-            dataMap := gconv.MapStrStr(dataArr[0])
-            number = gconv.Int(dataMap["number"])
-        }
-    }
-    isExists := false
-    id := this.FindJyConsumePackRecord()
-    if id != "" && this.Remarks["downUrl"] != nil {
-        if util.MQFW.UpdateById(jyCC, id, map[string]interface{}{
-            "$set": map[string]interface{}{
-                "l_updateDate": time.Now().Unix(),
-            },
-        }) {
-            delete(this.Remarks, "id")
-            delete(this.Remarks, "title")
-            r = this.Remarks
-            r["isExists"] = true
-            isExists = true
-        }
-    }
-    go freeFileCacheUpdate()
-    if BaseMsg.Status > 0 && BaseMsg.PowerMap[3] {
-        if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
-            r = SupplyInfoFile(_fileName, _id)
-        } else {
-            r = fileAttachRpc(_fileName, _id)
-        }
-        /*go func(this *UseBalanceStruct, r map[string]interface{}) {
-        	data := make(map[string]interface{})
-        	data["p_type"] = "大会员用户附件下载"
-        	data["p_userid"] = this.UserId
-        	data["p_infoId"] = this.Remarks["id"].(string)
-        	data["s_platform"] = this.Platform
-        	data["p_create_time"] = time.Now().Unix()
-        	data["p_rep"] = r
-        	//存库记录
-        	if util.MQFW.Save("filehistroy", data) == "" {
-        		log.Println("大会员附件下载-历史记录异常:" + this.UserId)
-        	}
-        }(this, r)*/
-        if r["downUrl"] != nil {
-            this.Remarks["downUrl"] = r["downUrl"]
-            this.Remarks["size"] = r["size"]
-        }
-        if !isExists {
-            this.saveJyConsumePackList()
-        }
-    } else {
-        //查询当月附件下载历史记录-如是已下载过的附件不再扣除次数
-        // log.Println(this.Remarks, "++++++", this.AccountId, id, "-------------", isExists)
-        //当月未有消费记录
-        if !isExists {
-            //免费赠送已使用次数
-            if number > 0 {
-                if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
-                    r = SupplyInfoFile(_fileName, _id)
-                } else {
-                    r = fileAttachRpc(_fileName, _id)
-                }
-                if r["downUrl"] != nil {
-                    this.Remarks["downUrl"] = r["downUrl"]
-                    this.Remarks["size"] = r["size"]
-                    if this.saveJyConsumePackList() {
-                        //中台消费记录
-                        rb, err := this.UseBalance()
-                        if err != nil || (rb != nil && qutil.IntAll(rb["code"]) == 0) {
-                            m = fmt.Sprintf("消费记录保存异常:%s", qutil.ObjToString(rb["message"]))
-                        }
-                    }
-                } else {
-                    m = "获取附件异常"
-                }
-            } else {
-                c = -1
-                m = "该用户下载权限已用完"
-            }
-        }
-    }
-    return
+	_fileName := this.Remarks["fileName"].(string)
+	_id := this.Remarks["id"].(string)
+	log.Println("附件下载包。。。。。")
+	BaseMsg := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
+	log.Println("---:", this.Remarks)
+	//P450 v4.8.85
+	var freeFileCacheUpdate = func() {
+		//免费用户 更新留资附件缓存
+		if BaseMsg.Status <= 0 && BaseMsg.VipStatus <= 0 && BaseMsg.EntnicheStatus <= 0 {
+			sess := this.Session.GetMultiple()
+			userId := this.UserId
+			if qutil.IntAll(sess["positionId"]) == 1 {
+				userId = strconv.Itoa(qutil.IntAll(sess["positionId"]))
+			}
+			//已留资
+			if c := qutil.Int64All(redis.GetInt("other", fmt.Sprintf("free_article_attach_%s", userId))); c > 0 {
+				if ok := redis.PutKV(fmt.Sprintf("free_article_attach_%s", userId), -1); !ok {
+					log.Println("free user update file  download power  false:", userId)
+				}
+			}
+		}
+	}
+	//获取余额数量
+	dbs := &FindBalanceStruct{
+		AccountId:    this.UserId,
+		ResourceType: "附件下载包",
+		VipState:     BaseMsg.VipStatus,
+	}
+	this.VipState = BaseMsg.VipStatus
+	data, err := dbs.FindBalance()
+	if data == nil || err != nil {
+		c = -1
+		m = "余额不足"
+		go freeFileCacheUpdate()
+		return
+	}
+	number := 0
+	if data != nil {
+		dataArr := gconv.SliceAny(data["data"])
+		if len(dataArr) > 0 {
+			dataMap := gconv.MapStrStr(dataArr[0])
+			number = gconv.Int(dataMap["number"])
+		}
+	}
+	isExists := false
+	id := this.FindJyConsumePackRecord()
+	if id != "" && this.Remarks["downUrl"] != nil {
+		if util.MQFW.UpdateById(jyCC, id, map[string]interface{}{
+			"$set": map[string]interface{}{
+				"l_updateDate": time.Now().Unix(),
+			},
+		}) {
+			delete(this.Remarks, "id")
+			delete(this.Remarks, "title")
+			r = this.Remarks
+			r["isExists"] = true
+			isExists = true
+		}
+	}
+	go freeFileCacheUpdate()
+	if BaseMsg.Status > 0 && BaseMsg.PowerMap[3] {
+		if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
+			r = SupplyInfoFile(_fileName, _id)
+		} else {
+			r = fileAttachRpc(_fileName, _id)
+		}
+		/*go func(this *UseBalanceStruct, r map[string]interface{}) {
+			data := make(map[string]interface{})
+			data["p_type"] = "大会员用户附件下载"
+			data["p_userid"] = this.UserId
+			data["p_infoId"] = this.Remarks["id"].(string)
+			data["s_platform"] = this.Platform
+			data["p_create_time"] = time.Now().Unix()
+			data["p_rep"] = r
+			//存库记录
+			if util.MQFW.Save("filehistroy", data) == "" {
+				log.Println("大会员附件下载-历史记录异常:" + this.UserId)
+			}
+		}(this, r)*/
+		if r["downUrl"] != nil {
+			this.Remarks["downUrl"] = r["downUrl"]
+			this.Remarks["size"] = r["size"]
+		}
+		if !isExists {
+			this.saveJyConsumePackList()
+		}
+	} else {
+		//查询当月附件下载历史记录-如是已下载过的附件不再扣除次数
+		// log.Println(this.Remarks, "++++++", this.AccountId, id, "-------------", isExists)
+		//当月未有消费记录
+		if !isExists {
+			//免费赠送已使用次数
+			if number > 0 {
+				if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
+					r = SupplyInfoFile(_fileName, _id)
+				} else {
+					r = fileAttachRpc(_fileName, _id)
+				}
+				if r["downUrl"] != nil {
+					this.Remarks["downUrl"] = r["downUrl"]
+					this.Remarks["size"] = r["size"]
+					if this.saveJyConsumePackList() {
+						//中台消费记录
+						rb, err := this.UseBalance()
+						if err != nil || (rb != nil && qutil.IntAll(rb["code"]) == 0) {
+							m = fmt.Sprintf("消费记录保存异常:%s", qutil.ObjToString(rb["message"]))
+						}
+					}
+				} else {
+					m = "获取附件异常"
+				}
+			} else {
+				c = -1
+				m = "该用户下载权限已用完"
+			}
+		}
+	}
+	return
 }
 }
 
 
 var jyCC = "jy_consumepack"
 var jyCC = "jy_consumepack"
 
 
 // 查询jy 消费日志记录
 // 查询jy 消费日志记录
 func (this *UseBalanceStruct) FindJyConsumePackRecord() string {
 func (this *UseBalanceStruct) FindJyConsumePackRecord() string {
-    query := map[string]interface{}{
-        "s_id":       this.Remarks["id"].(string),
-        "s_userId":   this.UserId,
-        "s_product":  this.Name,
-        "s_month":    time.Now().Format("2006-01"),
-        "s_fileName": this.Remarks["fileName"].(string),
-    }
-    res, ok := util.MQFW.FindOne(jyCC, query)
-    if ok && res != nil {
-        if (*res)["s_downUrl"] != nil {
-            this.Remarks["downUrl"] = (*res)["s_downUrl"]
-            this.Remarks["size"] = (*res)["s_fileSize"]
-        }
-    } else {
-        log.Println("查询附件下载日志异常:", this.UserId)
-    }
-    return BsonIdToSId((*res)["_id"])
+	query := map[string]interface{}{
+		"s_id":       this.Remarks["id"].(string),
+		"s_userId":   this.UserId,
+		"s_product":  this.Name,
+		"s_month":    time.Now().Format("2006-01"),
+		"s_fileName": this.Remarks["fileName"].(string),
+	}
+	res, ok := util.MQFW.FindOne(jyCC, query)
+	if ok && res != nil {
+		if (*res)["s_downUrl"] != nil {
+			this.Remarks["downUrl"] = (*res)["s_downUrl"]
+			this.Remarks["size"] = (*res)["s_fileSize"]
+		}
+	} else {
+		log.Println("查询附件下载日志异常:", this.UserId)
+	}
+	return BsonIdToSId((*res)["_id"])
 }
 }
 
 
 // 保存日志
 // 保存日志
 func (this *UseBalanceStruct) saveJyConsumePackList() (b bool) {
 func (this *UseBalanceStruct) saveJyConsumePackList() (b bool) {
-    saveMap := map[string]interface{}{
-        "s_id":         this.Remarks["id"],
-        "s_userId":     this.UserId,
-        "s_product":    this.Name,
-        "l_date":       time.Now().Unix(),
-        "l_updateDate": time.Now().Unix(), //更新时间
-        "s_month":      time.Now().Format("2006-01"),
-        "s_fileName":   this.Remarks["fileName"],
-        "s_downUrl":    this.Remarks["downUrl"],
-        "s_fileSize":   this.Remarks["size"],
-        "s_title":      this.Remarks["title"],
-        "b_isPay":      b,
-        "s_platform":   this.Platform,
-    }
-    b = util.MQFW.Save(jyCC, saveMap) != ""
-    if !b {
-        log.Println("保存附件下载日志异常:", this.UserId)
-    }
-    return
+	saveMap := map[string]interface{}{
+		"s_id":         this.Remarks["id"],
+		"s_userId":     this.UserId,
+		"s_product":    this.Name,
+		"l_date":       time.Now().Unix(),
+		"l_updateDate": time.Now().Unix(), //更新时间
+		"s_month":      time.Now().Format("2006-01"),
+		"s_fileName":   this.Remarks["fileName"],
+		"s_downUrl":    this.Remarks["downUrl"],
+		"s_fileSize":   this.Remarks["size"],
+		"s_title":      this.Remarks["title"],
+		"b_isPay":      b,
+		"s_platform":   this.Platform,
+	}
+	b = util.MQFW.Save(jyCC, saveMap) != ""
+	if !b {
+		log.Println("保存附件下载日志异常:", this.UserId)
+	}
+	return
 }
 }
 
 
 // 调rpc 获取附件信息
 // 调rpc 获取附件信息
 func fileAttachRpc(fileName, id string) (r map[string]interface{}) {
 func fileAttachRpc(fileName, id string) (r map[string]interface{}) {
-    r = make(map[string]interface{})
-    // 调用rpc 获取附件信息
-    req := util.JyFileRequest{id}
-    rep, err := util.Attachment(&req)
-    if err != nil {
-        log.Println("attachment  rpc调用失败")
-    } else {
-        if rep.Rep != nil && len(rep.Rep) > 0 {
-            //获取当前附件下载地址
-            for _, v := range rep.Rep {
-                if qutil.ObjToString(v["filename"]) == fileName {
-                    r = map[string]interface{}{
-                        "downUrl":  qutil.ObjToString(v["downurl"]),
-                        "fileName": qutil.ObjToString(v["filename"]),
-                        "size":     qutil.ObjToString(v["size"]),
-                    }
-                    break
-                }
-            }
-        }
-    }
-    return
+	r = make(map[string]interface{})
+	// 调用rpc 获取附件信息
+	req := util.JyFileRequest{id}
+	rep, err := util.Attachment(&req)
+	if err != nil {
+		log.Println("attachment  rpc调用失败")
+	} else {
+		if rep.Rep != nil && len(rep.Rep) > 0 {
+			//获取当前附件下载地址
+			for _, v := range rep.Rep {
+				if qutil.ObjToString(v["filename"]) == fileName {
+					r = map[string]interface{}{
+						"downUrl":  qutil.ObjToString(v["downurl"]),
+						"fileName": qutil.ObjToString(v["filename"]),
+						"size":     qutil.ObjToString(v["size"]),
+					}
+					break
+				}
+			}
+		}
+	}
+	return
 }
 }
 
 
 // 供应信息附件
 // 供应信息附件
 func SupplyInfoFile(fileName, msgId string) (r map[string]interface{}) {
 func SupplyInfoFile(fileName, msgId string) (r map[string]interface{}) {
-    //查数据
-    data := util.InfoMysql.FindOne("supply_info", map[string]interface{}{"id": msgId}, "", "")
-    if *data != nil && (*data)["attach"] != nil {
-        attach_str := qutil.ObjToString((*data)["attach"])
-        var attachMap map[string]interface{}
-        err := json.Unmarshal([]byte(attach_str), &attachMap)
-        if err != nil {
-            log.Println("err:", err)
-        }
-        for _, v := range attachMap {
-            fileMap := qutil.ObjToMap(v)
-            if fileName == qutil.ObjToString((*fileMap)["filename"]) {
-                r = map[string]interface{}{
-                    "downUrl":  fmt.Sprintf("%s/%s", qutil.ObjToString((*fileMap)["ossurl"]), qutil.ObjToString((*fileMap)["fid"])),
-                    "fileName": qutil.ObjToString((*fileMap)["filename"]),
-                    "size":     qutil.ObjToString((*fileMap)["size"]),
-                }
-                break
-            }
-        }
-    }
-    return
+	//查数据
+	data := util.InfoMysql.FindOne("supply_info", map[string]interface{}{"id": msgId}, "", "")
+	if *data != nil && (*data)["attach"] != nil {
+		attach_str := qutil.ObjToString((*data)["attach"])
+		var attachMap map[string]interface{}
+		err := json.Unmarshal([]byte(attach_str), &attachMap)
+		if err != nil {
+			log.Println("err:", err)
+		}
+		for _, v := range attachMap {
+			fileMap := qutil.ObjToMap(v)
+			if fileName == qutil.ObjToString((*fileMap)["filename"]) {
+				r = map[string]interface{}{
+					"downUrl":  fmt.Sprintf("%s/%s", qutil.ObjToString((*fileMap)["ossurl"]), qutil.ObjToString((*fileMap)["fid"])),
+					"fileName": qutil.ObjToString((*fileMap)["filename"]),
+					"size":     qutil.ObjToString((*fileMap)["size"]),
+				}
+				break
+			}
+		}
+	}
+	return
 }
 }
 
 
 // 兑换作废
 // 兑换作废
 func JyexchangeCance(userId, product, platform, queryTime string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
 func JyexchangeCance(userId, product, platform, queryTime string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
-    RStruct := InitFindRecord(userId, userId, product, queryTime, platform, pageSize, pageNum, 2)
-    list, total = RStruct.DefaultData()
-    return list, total, nil
+	RStruct := InitFindRecord(userId, userId, product, queryTime, platform, pageSize, pageNum, 2)
+	list, total = RStruct.DefaultData()
+	return list, total, nil
 }
 }
 
 
 // 消费
 // 消费
 func JyConsumePack(userId, product, platform string, remarks map[string]interface{}, session *httpsession.Session) (r map[string]interface{}, m string, c int) {
 func JyConsumePack(userId, product, platform string, remarks map[string]interface{}, session *httpsession.Session) (r map[string]interface{}, m string, c int) {
-    CStruct := InitUseBalance(userId, product, product, "", "", nil, remarks, 1, platform, session)
-    switch product {
-    case "附件下载包":
-        r, m, c = CStruct.fileConsume()
-    case "大客户平台":
-        r, m, c = CStruct.KeyAccountConsume()
-    case "资源平台":
-        r, m, c = CStruct.KeyAccountConsume()
-    default:
-        r, m, c = CStruct.defaultConsume()
-    }
-    return
+	CStruct := InitUseBalance(userId, product, product, "", "", nil, remarks, 1, platform, session)
+	switch product {
+	case "附件下载包":
+		r, m, c = CStruct.fileConsume()
+	case "大客户平台":
+		r, m, c = CStruct.KeyAccountConsume()
+	case "资源平台":
+		r, m, c = CStruct.KeyAccountConsume()
+	default:
+		r, m, c = CStruct.defaultConsume()
+	}
+	return
 }
 }
 
 
 // 流水
 // 流水
 func JyFindRecordPack(userId, productName, queryTime, platform string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
 func JyFindRecordPack(userId, productName, queryTime, platform string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
-    RStruct := InitFindRecord(userId, userId, productName, queryTime, platform, pageSize, pageNum, 0)
-    switch productName {
-    case "附件下载包":
-        list, total = RStruct.FindJyConsumePackAllRecord()
-    default:
-        list, total = RStruct.DefaultData()
-    }
-    return list, total, nil
+	RStruct := InitFindRecord(userId, userId, productName, queryTime, platform, pageSize, pageNum, 0)
+	switch productName {
+	case "附件下载包":
+		list, total = RStruct.FindJyConsumePackAllRecord()
+	default:
+		list, total = RStruct.DefaultData()
+	}
+	return list, total, nil
 }
 }
 
 
 // 数据处理-附件下载包
 // 数据处理-附件下载包
 func (this *FindRecordStruct) FindJyConsumePackAllRecord() ([]map[string]interface{}, int) {
 func (this *FindRecordStruct) FindJyConsumePackAllRecord() ([]map[string]interface{}, int) {
-    var articleAddMap = map[string]string{
-        "PC":  "/article/content/%s.html",
-        "WX":  "/article/content/%s.html",
-        "APP": "/jyapp/article/content/%s.html",
-    }
-    query := map[string]interface{}{
-        "s_userId":  this.UserId,
-        "s_product": this.Name,
-        "s_month":   this.QueryTime,
-    }
-    // log.Println("query:", query, "---", this.Page, this.PageSize)
-    //当月
-    total := util.MQFW.Count(jyCC, query)
-    // query["s_month"] = this.QueryTime
-    list, ok := util.MQFW.Find(jyCC, query, `{"l_updateDate":-1,"l_date":-1}`, `{"s_id":1,"s_fileName":1,"s_downUrl":1,"l_date":1,"s_title":1,"l_updateDate":1}`, false, (this.Page-1)*this.PageSize, this.PageSize)
-    if ok && list != nil {
-        if len(*list) >= 1 {
-            for _, item := range *list {
-                itemData := qutil.ObjToMap(item)
-                if itemData == nil || len(*itemData) == 0 {
-                    continue
-                }
-                l_date := qutil.If((*itemData)["l_updateDate"] != nil, (*itemData)["l_updateDate"], (*itemData)["l_date"])
-                (*itemData)["l_date"] = FormatDateWithObj(&l_date, "2006/01/02")
-                (*itemData)["articleUrl"] = fmt.Sprintf(articleAddMap[this.Platform], encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string)))
-                (*itemData)["s_id"] = encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string))
-                delete((*itemData), "s_downUrl")
-                delete((*itemData), "_id")
-            }
-        } else {
-            log.Println("暂无附件下载记录:", this.UserId)
-        }
-    } else {
-        log.Println("查询附件下载记录异常:", this.UserId)
-    }
+	var articleAddMap = map[string]string{
+		"PC":  "/article/content/%s.html",
+		"WX":  "/article/content/%s.html",
+		"APP": "/jyapp/article/content/%s.html",
+	}
+	query := map[string]interface{}{
+		"s_userId":  this.UserId,
+		"s_product": this.Name,
+		"s_month":   this.QueryTime,
+	}
+	// log.Println("query:", query, "---", this.Page, this.PageSize)
+	//当月
+	total := util.MQFW.Count(jyCC, query)
+	// query["s_month"] = this.QueryTime
+	list, ok := util.MQFW.Find(jyCC, query, `{"l_updateDate":-1,"l_date":-1}`, `{"s_id":1,"s_fileName":1,"s_downUrl":1,"l_date":1,"s_title":1,"l_updateDate":1}`, false, (this.Page-1)*this.PageSize, this.PageSize)
+	if ok && list != nil {
+		if len(*list) >= 1 {
+			for _, item := range *list {
+				itemData := qutil.ObjToMap(item)
+				if itemData == nil || len(*itemData) == 0 {
+					continue
+				}
+				l_date := qutil.If((*itemData)["l_updateDate"] != nil, (*itemData)["l_updateDate"], (*itemData)["l_date"])
+				(*itemData)["l_date"] = FormatDateWithObj(&l_date, "2006/01/02")
+				(*itemData)["articleUrl"] = fmt.Sprintf(articleAddMap[this.Platform], encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string)))
+				(*itemData)["s_id"] = encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string))
+				delete((*itemData), "s_downUrl")
+				delete((*itemData), "_id")
+			}
+		} else {
+			log.Println("暂无附件下载记录:", this.UserId)
+		}
+	} else {
+		log.Println("查询附件下载记录异常:", this.UserId)
+	}
 
 
-    return *list, total
+	return *list, total
 }
 }
 
 
 // 数据处理-default
 // 数据处理-default
 func (this *FindRecordStruct) DefaultData() ([]map[string]interface{}, int) {
 func (this *FindRecordStruct) DefaultData() ([]map[string]interface{}, int) {
-    var (
-        returnList []interface{}
-        total      int
-        err        error
-    )
-    if this.ResourceType == "芝麻信用共建分析报告下载包" { //芝麻信用流水
-        total = gconv.Int(util.Mysql.Count("bid_credit_balance_details", map[string]interface{}{"user_id": this.UserId}))
-        balanceDetails := util.Mysql.SelectBySql("SELECT *  FROM bid_credit_balance_details where user_id =? order by create_time desc, id desc limit ?,?", this.UserId, (this.Page-1)*this.PageSize, this.PageSize)
-        if balanceDetails != nil && len(*balanceDetails) > 0 {
-            for _, m := range *balanceDetails {
-                var (
-                    userType    int
-                    combo, mold string
-                )
-                remarks := make(map[string]interface{})
-                switch gconv.Int(m["pack_type"]) {
-                case 1:
-                    combo = "月"
-                case 2:
-                    combo = "季"
-                case 3:
-                    combo = "年"
-                }
-                switch gconv.Int(m["operation"]) {
-                case 1: //新增
-                    userType = 1
-                    if gconv.Int(m["pack_type"]) > 0 {
-                        remarks["source"] = fmt.Sprintf("开通%s卡,%s卡每月余额权益", combo, combo)
-                    } else {
-                        remarks["source"] = "购买“芝麻共建分析报告”-单份"
-                    }
-                case 2: //消费
-                    remarks["source"] = "下载报告"
-                case 3: //回收
-                    remarks["describe"] = "未使用权益失效"
-                    userType = 5
-                case 4: //重新分配
-                    userType = 1
-                    remarks["source"] = fmt.Sprintf("%s卡每月余额权益", combo)
-                }
-                switch gconv.Int(m["mold"]) {
-                case consts.ZmReportMoldProject:
-                    mold = "项目分析报告"
-                case consts.ZmReportMoldEnt:
-                    mold = "竞争对手分析报告"
-                case consts.ZmReportMoldBuyer:
-                    mold = "采购单位分析报告"
-                }
-                now, _ := time.ParseInLocation("2006-01-02 15:04:05", gconv.String(m["create_time"]), time.Local)
-                returnList = append(returnList, map[string]interface{}{
-                    "createTime":    now.Unix(),
-                    "number":        math.Abs(gconv.Float64(m["number"])),
-                    "deductionNumb": m["residue_number"],
-                    "pack_type":     m["pack_type"],
-                    "userType":      userType,
-                    "remarks":       gconv.String(remarks),
-                    "resourceType":  mold,
-                })
-            }
-        }
-    } else {
-        returnList, total, err = this.FindRecord()
-    }
+	var (
+		returnList []interface{}
+		total      int
+		err        error
+	)
+	if this.ResourceType == "招投标综合分析下载包" { //芝麻信用流水
+		total = gconv.Int(util.Mysql.Count("bid_credit_balance_details", map[string]interface{}{"user_id": this.UserId}))
+		balanceDetails := util.Mysql.SelectBySql("SELECT *  FROM bid_credit_balance_details where user_id =? order by create_time desc, id desc limit ?,?", this.UserId, (this.Page-1)*this.PageSize, this.PageSize)
+		if balanceDetails != nil && len(*balanceDetails) > 0 {
+			for _, m := range *balanceDetails {
+				var (
+					userType    int
+					combo, mold string
+				)
+				remarks := make(map[string]interface{})
+				switch gconv.Int(m["pack_type"]) {
+				case 1:
+					combo = "月"
+				case 2:
+					combo = "季"
+				case 3:
+					combo = "年"
+				}
+				switch gconv.Int(m["operation"]) {
+				case 1: //新增
+					userType = 1
+					if gconv.Int(m["pack_type"]) > 0 {
+						remarks["source"] = fmt.Sprintf("开通%s卡,%s卡每月余额权益", combo, combo)
+					} else {
+						remarks["source"] = "购买“芝麻共建分析报告”-单份"
+					}
+				case 2: //消费
+					remarks["source"] = "下载报告"
+				case 3: //回收
+					remarks["describe"] = "未使用权益失效"
+					userType = 5
+				case 4: //重新分配
+					userType = 1
+					remarks["source"] = fmt.Sprintf("%s卡每月余额权益", combo)
+				}
+				switch gconv.Int(m["mold"]) {
+				case consts.ZmReportMoldProject:
+					mold = "项目分析报告"
+				case consts.ZmReportMoldEnt:
+					mold = "竞争对手分析报告"
+				case consts.ZmReportMoldBuyer:
+					mold = "采购单位分析报告"
+				}
+				now, _ := time.ParseInLocation("2006-01-02 15:04:05", gconv.String(m["create_time"]), time.Local)
+				returnList = append(returnList, map[string]interface{}{
+					"createTime":    now.Unix(),
+					"number":        math.Abs(gconv.Float64(m["number"])),
+					"deductionNumb": m["residue_number"],
+					"pack_type":     m["pack_type"],
+					"userType":      userType,
+					"remarks":       gconv.String(remarks),
+					"resourceType":  mold,
+				})
+			}
+		}
+	} else {
+		returnList, total, err = this.FindRecord()
+	}
 
 
-    if err != nil {
-        log.Println("默认资源包流水异常:", err)
-        return nil, 0
-    }
-    if total == 0 {
-        log.Println(fmt.Sprintf("暂无%s资源包流水", this.Name))
-    }
-    return qutil.ObjArrToMapArr(returnList), total
+	if err != nil {
+		log.Println("默认资源包流水异常:", err)
+		return nil, 0
+	}
+	if total == 0 {
+		log.Println(fmt.Sprintf("暂无%s资源包流水", this.Name))
+	}
+	return qutil.ObjArrToMapArr(returnList), total
 }
 }

+ 1 - 1
src/jfw/modules/subscribepay/src/entity/pdfExportPack.go

@@ -38,7 +38,7 @@ const (
 	PDFPACK_BUYER            = "业主采购分析报告下载包"
 	PDFPACK_BUYER            = "业主采购分析报告下载包"
 	PDFPACK_MARKET           = "市场分析定制报告下载包"
 	PDFPACK_MARKET           = "市场分析定制报告下载包"
 	PDFPACK_BIDREPORT        = "投标企业信用报告下载包"
 	PDFPACK_BIDREPORT        = "投标企业信用报告下载包"
-	PDFPACK_ZMANALYSISREPORT = "芝麻信用共建分析报告下载包"
+	PDFPACK_ZMANALYSISREPORT = "招投标综合分析下载包"
 
 
 	ParentResourceIdPrefix = "p_share_"
 	ParentResourceIdPrefix = "p_share_"
 )
 )