Browse Source

拓普 原文链接/附件修改

Jianghan 1 year ago
parent
commit
031410d6ac

+ 4 - 0
src/jfw/modules/publicapply/src/userbase/entity/entity.go

@@ -688,6 +688,8 @@ type SessUserInfo struct {
 	EntId        int64
 	PositionType int64
 	PositionId   int64
+	EntAccountId int64
+	EntUserId    int64
 	Phone        string
 	MgoUserId    string
 	UserId       string
@@ -703,6 +705,8 @@ func GetUserBaseInfo(sess *httpsession.Session) SessUserInfo {
 		EntId:        util.Int64All(getSession["entId"]),
 		PositionType: util.Int64All(getSession["positionType"]),
 		PositionId:   util.Int64All(getSession["positionId"]),
+		EntAccountId: util.Int64All(getSession["entAccountId"]),
+		EntUserId:    util.Int64All(getSession["entUserId"]),
 		Phone:        util.ObjToString(getSession["phone"]),
 		UserId:       util.ObjToString(getSession["userId"]),
 	}

+ 25 - 3
src/jfw/modules/publicapply/src/userbase/service/service.go

@@ -1,15 +1,15 @@
 package service
 
 import (
+	. "app.yhyue.com/moapp/jybase/api"
+	qu "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"encoding/json"
 	"fmt"
 	"jy/src/jfw/modules/publicapply/src/config"
 	"jy/src/jfw/modules/publicapply/src/userbase/entity"
 	"log"
-
-	. "app.yhyue.com/moapp/jybase/api"
-	qu "app.yhyue.com/moapp/jybase/common"
+	"strings"
 )
 
 // 大会员菜单
@@ -218,6 +218,28 @@ func (this *ServiceStruct) GetOriginalText() {
 		this.ServeJson(Result{Data: nil, Error_code: Error_code_1001, Error_msg: Error_msg_1001})
 		return
 	}
+	// 查询拓普权限,直接返回原文连接
+	resResp := config.Middleground.ResourceCenter.Haspowers(sessUser.AccountId, sessUser.EntAccountId, sessUser.EntId, sessUser.EntUserId)
+	if resResp != nil && strings.Contains(strings.Join(resResp.Powers, ","), "bi_yx_topnet") {
+		url = entity.GetOriginalTextUrl(biddingId)
+		if url == "" {
+			this.ServeJson(Result{
+				Data: map[string]interface{}{
+					"url":     "",
+					"status":  OriginalStatus5,
+					"surplus": 0,
+				},
+			})
+			return
+		}
+		//存记录
+		op.SavePowerRecord(url)
+		this.ServeJson(Result{Data: map[string]interface{}{
+			"url":     url,
+			"surplus": 0,
+		}})
+		return
+	}
 	// 2. 获取用户类型对应的条数
 	// a. 查看过返回地址
 	hasRecord, textData := op.FindOriginalPowerRecord()

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

@@ -5,6 +5,7 @@ userCenterKey: "usercenter.rpc" #用户中台rpc
 powerCheckCenterKey: "powercheck.rpc" #权益校验中台
 activityKey: "activity.rpc" #营销平台rpc
 bxbaseKey: "bxbase.rpc" #微服务基础信息rpc
+resourceCenterKey: "resource.rpc" #资源中台
 clickhouse:
   Addr: 192.168.3.207:19000
   UserName: jytop

+ 2 - 1
src/jfw/modules/subscribepay/src/config/config.go

@@ -422,7 +422,8 @@ func init() {
 		RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).
 		RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String()).
 		RegActivity(g.Cfg().MustGet(ctx, "activityKey").String()).
-		RegJyBase(g.Cfg().MustGet(ctx, "bxbaseKey").String())
+		RegJyBase(g.Cfg().MustGet(ctx, "bxbaseKey").String()).
+		RegResourceCenter(g.Cfg().MustGet(ctx, "resourceCenterKey").String())
 	for _, v := range Config.Mail {
 		mail := &mail.GmailAuth{
 			SmtpHost: v.Addr,

+ 2 - 0
src/jfw/modules/subscribepay/src/entity/basePack.go

@@ -275,6 +275,8 @@ func JyConsumePack(userId, product, platform string, remarks map[string]interfac
 		r, m, c = CStruct.fileConsume()
 	case "大客户平台":
 		r, m, c = CStruct.KeyAccountConsume()
+	case "拓普情报权益":
+		r, m, c = CStruct.KeyAccountConsume()
 	default:
 		r, m, c = CStruct.defaultConsume()
 	}

+ 6 - 0
src/jfw/modules/subscribepay/src/service/basePack.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"fmt"
+	"jy/src/jfw/modules/subscribepay/src/config"
 	"jy/src/jfw/modules/subscribepay/src/entity"
 	"log"
 	"strings"
@@ -60,6 +61,11 @@ func (this *ResourcePack) ConsumePack() {
 		if strings.Contains(this.Request.Referer(), "article/entservice") {
 			productName = "大客户平台"
 		}
+		resResp := config.Middleground.ResourceCenter.Haspowers(qutil.Int64All(this.GetSession("accountId")), qutil.Int64All(this.GetSession("entAccountId")),
+			qutil.Int64All(this.GetString("entId")), qutil.Int64All(this.GetSession("entUserId")))
+		if resResp != nil && strings.Contains(strings.Join(resResp.Powers, ","), "bi_yx_topnet") {
+			productName = "拓普情报权益"
+		}
 		log.Println(infoType, "----", remarks)
 		Ret, Msg, Code := entity.JyConsumePack(userId, productName, platform, remarks, this.Session())
 		if Msg != "" && Code == 0 {