wangshan 3 주 전
부모
커밋
e897ebe719
2개의 변경된 파일274개의 추가작업 그리고 273개의 파일을 삭제
  1. 4 3
      src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go
  2. 270 270
      src/jfw/modules/subscribepay/src/service/bidCreditReport.go

+ 4 - 3
src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go

@@ -399,9 +399,10 @@ func (b *bidCreditReport) Create(id int64) error {
 	}
 	if orderNo == "" {
 		biz := map[string]interface{}{
-			"scene_code": "ZTB_REPORT_JY",
-			"out_biz_no": outBizNo,
-			"order_type": consts.ZMReportOrderType[mold], //报告类型
+			"scene_code":  "ZTB_REPORT_JY",
+			"out_biz_no":  outBizNo,
+			"order_type":  consts.ZMReportOrderType[mold], //报告类型
+			"customer_id": userId,                         //合作方客户id
 		}
 		if price > 0 {
 			biz["report_amount"] = b.YuanToWan(float64(price * 100))

+ 270 - 270
src/jfw/modules/subscribepay/src/service/bidCreditReport.go

@@ -1,303 +1,303 @@
 package service
 
 import (
-    "app.yhyue.com/moapp/jybase/api"
-    "app.yhyue.com/moapp/jybase/common"
-    "app.yhyue.com/moapp/jybase/encrypt"
-    "app.yhyue.com/moapp/jybase/go-xweb/xweb"
-    "context"
-    "encoding/json"
-    "fmt"
-    "github.com/gogf/gf/v2/frame/g"
-    "github.com/gogf/gf/v2/os/gctx"
-    "github.com/gogf/gf/v2/util/gconv"
-    "jy/src/jfw/modules/subscribepay/src/consts"
-    "jy/src/jfw/modules/subscribepay/src/entity"
-    "jy/src/jfw/modules/subscribepay/src/entity/bidCreditReport"
-    "jy/src/jfw/modules/subscribepay/src/util"
-    "strings"
-    "time"
+	"app.yhyue.com/moapp/jybase/api"
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"context"
+	"encoding/json"
+	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gctx"
+	"github.com/gogf/gf/v2/util/gconv"
+	"jy/src/jfw/modules/subscribepay/src/consts"
+	"jy/src/jfw/modules/subscribepay/src/entity"
+	"jy/src/jfw/modules/subscribepay/src/entity/bidCreditReport"
+	"jy/src/jfw/modules/subscribepay/src/util"
+	"strings"
+	"time"
 )
 
 type BidCreditReport struct {
-    *xweb.Action
-    entSearch    xweb.Mapper `xweb:"/bidCreditReport/entSearch"`      //企业模糊搜索
-    getReport    xweb.Mapper `xweb:"/bidCreditReport/report/get"`     //信用报告查询
-    updateReport xweb.Mapper `xweb:"/bidCreditReport/report/update"`  //信用报告修改
-    preview      xweb.Mapper `xweb:"/bidCreditReport/report/preview"` //信用报告预览
-    getButton    xweb.Mapper `xweb:"/bidCreditReport/getButton"`      // 报告按钮是否展示
-    reportTest   xweb.Mapper `xweb:"/bidCreditReport/report/test"`    //调试
-    example      xweb.Mapper `xweb:"/bidCreditReport/report/example"` //信用报告示例
+	*xweb.Action
+	entSearch    xweb.Mapper `xweb:"/bidCreditReport/entSearch"`      //企业模糊搜索
+	getReport    xweb.Mapper `xweb:"/bidCreditReport/report/get"`     //信用报告查询
+	updateReport xweb.Mapper `xweb:"/bidCreditReport/report/update"`  //信用报告修改
+	preview      xweb.Mapper `xweb:"/bidCreditReport/report/preview"` //信用报告预览
+	getButton    xweb.Mapper `xweb:"/bidCreditReport/getButton"`      // 报告按钮是否展示
+	reportTest   xweb.Mapper `xweb:"/bidCreditReport/report/test"`    //调试
+	example      xweb.Mapper `xweb:"/bidCreditReport/report/example"` //信用报告示例
 }
 
 func (this *BidCreditReport) Example() {
-    exampleUrlMap := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "ExampleUrl").Maps()
-    this.ServeJson(api.Result{Data: exampleUrlMap})
-    return
+	exampleUrlMap := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "ExampleUrl").Maps()
+	this.ServeJson(api.Result{Data: exampleUrlMap})
+	return
 }
 
 func (this *BidCreditReport) ReportTest() { //todo
-    phone := this.GetSession("phone")
-    id, _ := this.GetInt("id")
-    if phone == "" || id <= 0 {
-        this.ServeJson(api.Result{Error_code: -1, Error_msg: api.Error_msg_1003})
-        return
-    }
-    envSwitch := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "EnvSwitch").Bool() //芝麻预发环境
-    envPhone := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "EnvPhone").String()
-    if !envSwitch || phone != envPhone {
-        return
-    }
-    err := bidCreditReport.BidCreditReport.Create(id)
-    if err != nil {
-        this.ServeJson(api.Result{Error_code: -1, Error_msg: err.Error()})
-        return
-    }
-    this.ServeJson(api.Result{})
-    return
+	phone := this.GetSession("phone")
+	id, _ := this.GetInt("id")
+	if phone == "" || id <= 0 {
+		this.ServeJson(api.Result{Error_code: -1, Error_msg: api.Error_msg_1003})
+		return
+	}
+	envSwitch := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "EnvSwitch").Bool() //芝麻预发环境
+	envPhone := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "EnvPhone").String()
+	if !envSwitch || phone != envPhone {
+		return
+	}
+	err := bidCreditReport.BidCreditReport.Create(id)
+	if err != nil {
+		this.ServeJson(api.Result{Error_code: -1, Error_msg: err.Error()})
+		return
+	}
+	this.ServeJson(api.Result{})
+	return
 }
 
 // 预览
 func (this *BidCreditReport) Preview() {
-    data, err := func() (map[string]interface{}, error) {
-        userId, _ := this.GetSession("userId").(string)
-        if userId == "" {
-            return nil, fmt.Errorf(api.Error_msg_1001)
-        }
-        orderCode := this.GetString("order_code")
-        id := this.GetString("id")
-        decodeData := encrypt.DecodeArticleId(id)
-        var decodeId string
-        if len(decodeData) > 0 {
-            decodeId = decodeData[0]
-        }
-        if orderCode == "" && decodeId == "" {
-            return nil, fmt.Errorf(api.Error_msg_1002)
-        }
-        err, res := bidCreditReport.BidCreditReport.PreviewOrPdf(userId, orderCode, common.Int64All(decodeId))
-        if err != nil {
-            return nil, err
-        }
-        return res, nil
-    }()
+	data, err := func() (map[string]interface{}, error) {
+		userId, _ := this.GetSession("userId").(string)
+		if userId == "" {
+			return nil, fmt.Errorf(api.Error_msg_1001)
+		}
+		orderCode := this.GetString("order_code")
+		id := this.GetString("id")
+		decodeData := encrypt.DecodeArticleId(id)
+		var decodeId string
+		if len(decodeData) > 0 {
+			decodeId = decodeData[0]
+		}
+		if orderCode == "" && decodeId == "" {
+			return nil, fmt.Errorf(api.Error_msg_1002)
+		}
+		err, res := bidCreditReport.BidCreditReport.PreviewOrPdf(userId, orderCode, common.Int64All(decodeId))
+		if err != nil {
+			return nil, err
+		}
+		return res, nil
+	}()
 
-    this.ServeJson(api.NewResult(data, err))
+	this.ServeJson(api.NewResult(data, err))
 }
 
 func (this *BidCreditReport) EntSearch() {
-    if !api.R.CheckReqParam(this.ResponseWriter, this.Request, "entName") {
-        return
-    }
-    userId, _ := this.GetSession("userId").(string)
-    result := bidCreditReport.BidCreditReport.EntSearch(userId, map[string]interface{}{
-        "key_word":   this.GetString("entName"),
-        "page_index": 1,
-        "page_size":  g.Config().MustGet(gctx.New(), "bidCreditReport.entSearchPageSize").Int(),
-    })
-    if result.GetVar("code").String() != "10000" {
-        this.ServeJson(api.Result{Error_code: -1, Error_msg: result.String()})
-        return
-    }
-    datas := []api.M{}
-    for _, v := range result.GetVar("basic_info_models").Vars() {
-        datas = append(datas, api.M{
-            "cert_no": v.MapStrVar()["ep_cert_no"].String(),
-            "name":    v.MapStrVar()["ep_name"].String(),
-        })
-    }
-    this.ServeJson(api.Result{Data: datas})
+	if !api.R.CheckReqParam(this.ResponseWriter, this.Request, "entName") {
+		return
+	}
+	userId, _ := this.GetSession("userId").(string)
+	result := bidCreditReport.BidCreditReport.EntSearch(userId, map[string]interface{}{
+		"key_word":   this.GetString("entName"),
+		"page_index": 1,
+		"page_size":  g.Config().MustGet(gctx.New(), "bidCreditReport.entSearchPageSize").Int(),
+	})
+	if result.GetVar("code").String() != "10000" {
+		this.ServeJson(api.Result{Error_code: -1, Error_msg: result.String()})
+		return
+	}
+	datas := []api.M{}
+	for _, v := range result.GetVar("basic_info_models").Vars() {
+		datas = append(datas, api.M{
+			"cert_no": v.MapStrVar()["ep_cert_no"].String(),
+			"name":    v.MapStrVar()["ep_name"].String(),
+		})
+	}
+	this.ServeJson(api.Result{Data: datas})
 }
 
 func (this *BidCreditReport) GetReport() {
-    adminIdArr := g.Cfg().MustGet(context.TODO(), "bidCreditReport.adminIds").Strings()
-    fool := true
-    userId, _ := this.GetSession("mgoUserId").(string)
-    for _, adminId := range adminIdArr {
-        if userId == adminId {
-            fool = false
-            break
-        }
-    }
-    if fool {
-        this.ServeJson(map[string]interface{}{
-            "status": -1,
-            "msg":    "您没有该请求权限",
-            "data":   map[string]interface{}{},
-        })
-        return
-    }
-    Id, _ := this.GetInt("id")
-    reportData := util.Mysql.FindOne("bid_credit_report", map[string]interface{}{
-        "id": Id,
-    }, "submit_time,complete_time,send_mail_time,status,ent_name,cert_no,buyer,mail,prove_purchase,prove_executed,prove_dishonesty,prove_produce,report_url,download_url,prove_purchase_status,prove_executed_status,prove_dishonesty_status,prove_produce_status,creditchina", "")
-    if reportData == nil {
-        this.ServeJson(map[string]interface{}{
-            "status": -1,
-            "msg":    "该记录不存在",
-            "data":   map[string]interface{}{},
-        })
-    }
-    this.ServeJson(map[string]interface{}{
-        "status": 1,
-        "data":   reportData,
-    })
+	adminIdArr := g.Cfg().MustGet(context.TODO(), "bidCreditReport.adminIds").Strings()
+	fool := true
+	userId, _ := this.GetSession("mgoUserId").(string)
+	for _, adminId := range adminIdArr {
+		if userId == adminId {
+			fool = false
+			break
+		}
+	}
+	if fool {
+		this.ServeJson(map[string]interface{}{
+			"status": -1,
+			"msg":    "您没有该请求权限",
+			"data":   map[string]interface{}{},
+		})
+		return
+	}
+	Id, _ := this.GetInt("id")
+	reportData := util.Mysql.FindOne("bid_credit_report", map[string]interface{}{
+		"id": Id,
+	}, "submit_time,complete_time,send_mail_time,status,ent_name,cert_no,buyer,mail,prove_purchase,prove_executed,prove_dishonesty,prove_produce,report_url,download_url,prove_purchase_status,prove_executed_status,prove_dishonesty_status,prove_produce_status,creditchina", "")
+	if reportData == nil {
+		this.ServeJson(map[string]interface{}{
+			"status": -1,
+			"msg":    "该记录不存在",
+			"data":   map[string]interface{}{},
+		})
+	}
+	this.ServeJson(map[string]interface{}{
+		"status": 1,
+		"data":   reportData,
+	})
 }
 func (this *BidCreditReport) UpdateReport() {
-    adminIdArr := g.Cfg().MustGet(context.TODO(), "bidCreditReport.adminIds").Strings()
-    fool := true
-    userId, _ := this.GetSession("mgoUserId").(string)
-    for _, adminId := range adminIdArr {
-        if userId == adminId {
-            fool = false
-            break
-        }
-    }
-    if fool {
-        this.ServeJson(api.NewResult(nil, fmt.Errorf("您没有该请求权限")))
-        return
-    }
-    errMsg := func() error {
-        infoMap := map[string]interface{}{}
-        if string(this.Body()) == "" {
-            return fmt.Errorf("无效参数")
-        }
-        body := xweb.FilterXSS(string(this.Body()))
-        //接收参数
-        _ = json.Unmarshal([]byte(body), &infoMap)
-        if len(infoMap) == 0 {
-            return fmt.Errorf("无效参数")
-        }
-        Id := gconv.Int64(infoMap["id"])
-        updateData := map[string]interface{}{
-            "prove_purchase":          gconv.String(infoMap["prove_purchase"]),
-            "prove_executed":          gconv.String(infoMap["prove_executed"]),
-            "prove_dishonesty":        gconv.String(infoMap["prove_dishonesty"]),
-            "prove_produce":           gconv.String(infoMap["prove_produce"]),
-            "prove_purchase_status":   gconv.Int64(infoMap["prove_purchase_status"]),
-            "prove_executed_status":   gconv.Int64(infoMap["prove_executed_status"]),
-            "prove_dishonesty_status": gconv.Int64(infoMap["prove_dishonesty_status"]),
-            "prove_produce_status":    gconv.Int64(infoMap["prove_produce_status"]),
-            "creditchina":             gconv.String(infoMap["creditchina"]),
-        }
-        fool := util.Mysql.Update("bid_credit_report", map[string]interface{}{
-            "id": Id,
-        }, updateData,
-        )
-        if !fool {
-            return fmt.Errorf("图片修改失败")
-        }
-        bidCreditReport.BidCreditReport.Create(Id)
-        updateData["reportId"] = Id
-        updateData["method"] = "jianyu.upload"
-        updateData["createTime"] = time.Now().Unix()
-        util.Mgo_log.Save("bidcredit_report_log", updateData)
-        return nil
-    }()
-    if errMsg == nil {
-        this.ServeJson(api.NewResult(nil, nil))
-    }
-    this.ServeJson(api.NewResult(nil, errMsg))
+	adminIdArr := g.Cfg().MustGet(context.TODO(), "bidCreditReport.adminIds").Strings()
+	fool := true
+	userId, _ := this.GetSession("mgoUserId").(string)
+	for _, adminId := range adminIdArr {
+		if userId == adminId {
+			fool = false
+			break
+		}
+	}
+	if fool {
+		this.ServeJson(api.NewResult(nil, fmt.Errorf("您没有该请求权限")))
+		return
+	}
+	errMsg := func() error {
+		infoMap := map[string]interface{}{}
+		if string(this.Body()) == "" {
+			return fmt.Errorf("无效参数")
+		}
+		body := xweb.FilterXSS(string(this.Body()))
+		//接收参数
+		_ = json.Unmarshal([]byte(body), &infoMap)
+		if len(infoMap) == 0 {
+			return fmt.Errorf("无效参数")
+		}
+		Id := gconv.Int64(infoMap["id"])
+		updateData := map[string]interface{}{
+			"prove_purchase":          gconv.String(infoMap["prove_purchase"]),
+			"prove_executed":          gconv.String(infoMap["prove_executed"]),
+			"prove_dishonesty":        gconv.String(infoMap["prove_dishonesty"]),
+			"prove_produce":           gconv.String(infoMap["prove_produce"]),
+			"prove_purchase_status":   gconv.Int64(infoMap["prove_purchase_status"]),
+			"prove_executed_status":   gconv.Int64(infoMap["prove_executed_status"]),
+			"prove_dishonesty_status": gconv.Int64(infoMap["prove_dishonesty_status"]),
+			"prove_produce_status":    gconv.Int64(infoMap["prove_produce_status"]),
+			"creditchina":             gconv.String(infoMap["creditchina"]),
+		}
+		fool := util.Mysql.Update("bid_credit_report", map[string]interface{}{
+			"id": Id,
+		}, updateData,
+		)
+		if !fool {
+			return fmt.Errorf("图片修改失败")
+		}
+		bidCreditReport.BidCreditReport.Create(Id)
+		updateData["reportId"] = Id
+		updateData["method"] = "jianyu.upload"
+		updateData["createTime"] = time.Now().Unix()
+		util.Mgo_log.Save("bidcredit_report_log", updateData)
+		return nil
+	}()
+	if errMsg == nil {
+		this.ServeJson(api.NewResult(nil, nil))
+	}
+	this.ServeJson(api.NewResult(nil, errMsg))
 }
 
 const (
-    sourceTypeBidding = 1 // 标讯详情页
-    sourceTypeEnt     = 2 // 画像详情页
-    sourceTypeBuyer   = 3 // 采购单位详情页
-    sourceTypeProject = 4 // 项目详情页
+	sourceTypeBidding = 1 // 标讯详情页
+	sourceTypeEnt     = 2 // 画像详情页
+	sourceTypeBuyer   = 3 // 采购单位详情页
+	sourceTypeProject = 4 // 项目详情页
 )
 
 func (this *BidCreditReport) GetButton() {
-    data, err := func() (map[string]interface{}, error) {
-        rs := map[string]interface{}{
-            "buyer_report_button":   false,
-            "ent_report_button":     false,
-            "project_report_button": false,
-            "ent_crn":               map[string]interface{}{},
-            "discount_msg":          "",
-            "buyer_report_id`":      "",
-            "ent_report_ids":        map[string]interface{}{},
-            "project_report_id":     "",
-        }
-        ent_report_ids := map[string]interface{}{}
-        entcrn := map[string]interface{}{}
-        buyer := this.GetString("buyer")
-        entName := this.GetString("ent_name")
-        biddingId := this.GetString("bidding_id")
-        userId, _ := this.GetSession("userId").(string)
-        if userId == "" {
-            return rs, nil
-        }
-        if b, firstDiscount := entity.GetZmAnalysisReportFirstDiscount(consts.ZmAnalysisReportSinglePackageID, userId); b && firstDiscount > 0 {
-            rs["discount_msg"] = fmt.Sprintf(consts.ZmAnalysisReportFirstBuyDiscountMsg, firstDiscount/100)
-        }
-        if buyer != "" {
-            entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, buyer)
-            if entInfo.Crn != "" {
-                rs["buyer_report_button"] = true
-                // 查下载记录里面有没有下载过
-                if rid := bidCreditReport.BidCreditReport.GetReportId(userId, consts.ZmReportMoldBuyer, "", "", buyer); rid > 0 {
-                    rs["buyer_report_id"] = encrypt.EncodeArticleId(fmt.Sprintf("%v", rid))
-                }
-            }
-        }
-        if entName != "" {
-            entList := strings.Split(entName, ",")
-            for i := 0; i < len(entList); i++ {
-                entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, entList[i])
-                if entInfo.Crn != "" {
-                    rs["ent_report_button"] = true
-                    entcrn[entList[i]] = true
-                    if rid := bidCreditReport.BidCreditReport.GetReportId(userId, consts.ZmReportMoldEnt, "", entList[i], ""); rid > 0 {
-                        ent_report_ids[entList[i]] = encrypt.EncodeArticleId(fmt.Sprintf("%v", rid))
-                    }
-                } else {
-                    entcrn[entList[i]] = false
-                }
-            }
-            rs["ent_report_ids"] = ent_report_ids
+	data, err := func() (map[string]interface{}, error) {
+		rs := map[string]interface{}{
+			"buyer_report_button":   false,
+			"ent_report_button":     false,
+			"project_report_button": false,
+			"ent_crn":               map[string]interface{}{},
+			"discount_msg":          "",
+			"buyer_report_id`":      "",
+			"ent_report_ids":        map[string]interface{}{},
+			"project_report_id":     "",
+		}
+		ent_report_ids := map[string]interface{}{}
+		entcrn := map[string]interface{}{}
+		buyer := this.GetString("buyer")
+		entName := this.GetString("ent_name")
+		biddingId := this.GetString("bidding_id")
+		userId, _ := this.GetSession("userId").(string)
+		if userId == "" {
+			return rs, nil
+		}
+		if b, firstDiscount := entity.GetZmAnalysisReportFirstDiscount(consts.ZmAnalysisReportSinglePackageID, userId); b && firstDiscount > 0 {
+			rs["discount_msg"] = fmt.Sprintf(consts.ZmAnalysisReportFirstBuyDiscountMsg, firstDiscount/100)
+		}
+		if buyer != "" {
+			entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, buyer)
+			if entInfo.Crn != "" {
+				rs["buyer_report_button"] = true
+				// 查下载记录里面有没有下载过
+				if rid := bidCreditReport.BidCreditReport.GetReportId(userId, consts.ZmReportMoldBuyer, "", "", buyer); rid > 0 {
+					rs["buyer_report_id"] = encrypt.EncodeArticleId(fmt.Sprintf("%v", rid))
+				}
+			}
+		}
+		if entName != "" {
+			entList := strings.Split(entName, ",")
+			for i := 0; i < len(entList); i++ {
+				entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, entList[i])
+				if entInfo.Crn != "" {
+					rs["ent_report_button"] = true
+					entcrn[entList[i]] = true
+					if rid := bidCreditReport.BidCreditReport.GetReportId(userId, consts.ZmReportMoldEnt, "", entList[i], ""); rid > 0 {
+						ent_report_ids[entList[i]] = encrypt.EncodeArticleId(fmt.Sprintf("%v", rid))
+					}
+				} else {
+					entcrn[entList[i]] = false
+				}
+			}
+			rs["ent_report_ids"] = ent_report_ids
 
-        }
-        if biddingId != "" && buyer != "" && rs["buyer_report_button"] == true { // 项目报告 采购单位
-            decodeBiddingId := encrypt.DecodeArticleId2ByCheck(biddingId)
-            if len(decodeBiddingId) > 0 {
-                if entity.GetProjectNameByInfoId(decodeBiddingId[0]) != "" {
-                    rs["project_report_button"] = true
-                    if rid := bidCreditReport.BidCreditReport.GetReportId(userId, consts.ZmReportMoldProject, decodeBiddingId[0], "", ""); rid > 0 {
-                        rs["project_report_id"] = encrypt.EncodeArticleId(fmt.Sprintf("%v", rid))
-                    }
-                }
-            }
-        }
-        rs["ent_crn"] = entcrn
-        if rs["buyer_report_button"] == true || rs["project_report_button"] == true || rs["ent_report_button"] == true {
-            var source int
-            if biddingId != "" {
-                if strings.Contains(this.Request.Referer(), "content") {
-                    source = sourceTypeBidding
-                } else {
-                    source = sourceTypeProject
-                    rs["buyer_report_button"] = false // 项目详情页不展示采购单位和供应商报告下载按钮
-                    rs["ent_report_button"] = false
-                }
-            } else {
-                if entName != "" {
-                    source = sourceTypeEnt
-                } else {
-                    source = sourceTypeBuyer
-                }
-            }
-            util.Mgo_log.Save("zmreport_button_log", map[string]interface{}{
-                "rs":         rs,
-                "userId":     userId,
-                "buyer":      buyer,
-                "entName":    entName,
-                "biddingId":  biddingId,
-                "source":     source,
-                "referer":    this.Request.Referer(),
-                "createtime": time.Now().Unix(),
-            })
-        }
-        return rs, nil
-    }()
-    this.ServeJson(api.NewResult(data, err))
+		}
+		if biddingId != "" && buyer != "" && rs["buyer_report_button"] == true { // 项目报告 采购单位
+			decodeBiddingId := encrypt.DecodeArticleId2ByCheck(biddingId)
+			if len(decodeBiddingId) > 0 {
+				if entity.GetProjectNameByInfoId(decodeBiddingId[0]) != "" {
+					rs["project_report_button"] = true
+					if rid := bidCreditReport.BidCreditReport.GetReportId(userId, consts.ZmReportMoldProject, decodeBiddingId[0], "", ""); rid > 0 {
+						rs["project_report_id"] = encrypt.EncodeArticleId(fmt.Sprintf("%v", rid))
+					}
+				}
+			}
+		}
+		rs["ent_crn"] = entcrn
+		if rs["buyer_report_button"] == true || rs["project_report_button"] == true || rs["ent_report_button"] == true {
+			var source int
+			if biddingId != "" {
+				if strings.Contains(this.Request.Referer(), "content") {
+					source = sourceTypeBidding
+				} else {
+					source = sourceTypeProject
+					rs["buyer_report_button"] = false // 项目详情页不展示采购单位和供应商报告下载按钮
+					rs["ent_report_button"] = false
+				}
+			} else {
+				if entName != "" {
+					source = sourceTypeEnt
+				} else {
+					source = sourceTypeBuyer
+				}
+			}
+			util.Mgo_log.Save("zmreport_button_log", map[string]interface{}{
+				"rs":         rs,
+				"userId":     userId,
+				"buyer":      buyer,
+				"entName":    entName,
+				"biddingId":  biddingId,
+				"source":     source,
+				"referer":    this.Request.Referer(),
+				"createtime": time.Now().Unix(),
+			})
+		}
+		return rs, nil
+	}()
+	this.ServeJson(api.NewResult(data, err))
 }