wangshan 2 年之前
父节点
当前提交
4777ba1507
共有 6 个文件被更改,包括 34 次插入32 次删除
  1. 5 2
      src/config.json
  2. 0 6
      src/config.yaml
  3. 3 3
      src/go.mod
  4. 2 2
      src/go.sum
  5. 19 5
      src/service/action/exhibition.go
  6. 5 14
      src/service/config/config.go

+ 5 - 2
src/config.json

@@ -16,7 +16,7 @@
 	},
     "redis": {
     	"main": {
-			"address": "other=192.168.3.11:1712,session=192.168.3.11:1713"
+			"address": "other=192.168.3.11:1712,session=192.168.3.11:1713,newother=192.168.3.11:1712"
 		}
     },
     "mysql": {
@@ -848,5 +848,8 @@
 	],
 	"bindPopRedis": "merge",
 	"maxBindPop": 5,
-	"accountMergeOnline": "2015-03-30 00:00:00"
+	"accountMergeOnline": "2015-03-30 00:00:00",
+	"nsq": "192.168.3.240:4260",
+	"nsqTopic": "jy_event",
+	"exhibitionTimeOut": 7200
 }

+ 0 - 6
src/config.yaml

@@ -3,9 +3,3 @@ etcd:
   - 192.168.3.149:2379
 powerCheckCenterKey: "powercheck.rpc" #权益校验中台
 userCenterKey: "usercenter.rpc" #用户中台rpc
-
-appId: 10000
-userDoc:
-  key: jydocs.stdlib.rpc
-  address:
-    - 192.168.3.149:2379

+ 3 - 3
src/go.mod

@@ -4,15 +4,16 @@ go 1.20
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20230629025419-641ebbfdeaeb
-	app.yhyue.com/moapp/jypkg v0.0.0-20230712091846-607abb6659b8
+	app.yhyue.com/moapp/jypkg v0.0.0-20230714093939-910ef5563e8c
+	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.13
 	github.com/gogf/gf/v2 v2.4.4
+	github.com/nsqio/go-nsq v1.1.0
 )
 
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
 	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547 // indirect
-	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae // indirect
 	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e // indirect
 	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230222052351-9d6fad062447 // indirect
 	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
@@ -64,7 +65,6 @@ require (
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
 	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
-	github.com/nsqio/go-nsq v1.1.0 // indirect
 	github.com/olekukonko/tablewriter v0.0.5 // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic/v7 v7.0.22 // indirect

+ 2 - 2
src/go.sum

@@ -7,8 +7,8 @@ app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
 app.yhyue.com/moapp/jybase v0.0.0-20230629025419-641ebbfdeaeb h1:kHJ6q3ZFi6YroYZnpsbrTArXELHhtfrNvXY7fgs4jJ4=
 app.yhyue.com/moapp/jybase v0.0.0-20230629025419-641ebbfdeaeb/go.mod h1:D40Ae0rQilH8Hc5o2Vtt04Tjh/DNEFpcS3/WkJMPJb8=
-app.yhyue.com/moapp/jypkg v0.0.0-20230712091846-607abb6659b8 h1:sniEXPEs7gcn0PS/RTCFVpfSYS6K3GBqJ8gtuQsmgMM=
-app.yhyue.com/moapp/jypkg v0.0.0-20230712091846-607abb6659b8/go.mod h1:wbDWBpLODtGhkQw4dCShvmRr6G8CazuW8kWq42paQOM=
+app.yhyue.com/moapp/jypkg v0.0.0-20230714093939-910ef5563e8c h1:e5lk37RyaM9HsisO8ZyEb9S7Zywb7278rHrjiKyeTfY=
+app.yhyue.com/moapp/jypkg v0.0.0-20230714093939-910ef5563e8c/go.mod h1:wbDWBpLODtGhkQw4dCShvmRr6G8CazuW8kWq42paQOM=
 app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae h1:6rDDaz6yxvE8viTSzEBwKYOFWq14TMfuBivSazUZMz4=
 app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae/go.mod h1:b0zZHev3gmJao1Fo+2Z2KPVjsuLOJVvVxf+kCnu9WkA=
 bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e h1:h+VEI3o1qC0jeCzkFGTrLI4f27cfa/W/y+0sXokWMgE=

+ 19 - 5
src/service/action/exhibition.go

@@ -33,8 +33,8 @@ func (w *ExhibitionStruct) GetExhibitionActiveHref(email, phone, source string,
 	}
 	//是否需要账号合并--未绑定手机号
 	var (
-		mgoUserId = session.Get("mgoUserId").(string)
-		token     = ""
+		mgoUserId, _ = session.Get("mgoUserId").(string)
+		token        = ""
 	)
 	//phone  绑定此手机号
 	if thisPhone, _ := session.Get("phone").(string); thisPhone == "" {
@@ -44,6 +44,20 @@ func (w *ExhibitionStruct) GetExhibitionActiveHref(email, phone, source string,
 	fmt.Println(phone, "------")
 	//留资福利 及 留资后跳转地址
 	if res := w.ExhibitionActive("", source, session, "second_ad_code,guide_page,welfare_type,welfare_content"); res != nil {
+		//供 文库  获取福利 使用
+		go func() {
+			key := fmt.Sprintf("exhibition_active_%s", mgoUserId)
+			if redis.Incr("newother", key) == 1 {
+				_ = redis.SetExpire("newother", key, Sysconfig.ExhibitionTimeOut)
+				err := jy.Publish(Mgo_Log, Sysconfig.Nsq, Sysconfig.NsqTopic, jy.Jywx_exhibition_active, mgoUserId, jy.Jywx_node1, map[string]interface{}{
+					"welfareType":    res["welfare_type"],
+					"welfareContent": res["welfare_content"],
+				})
+				if err != nil {
+					log.Println("nsq队列写入失败-->", "jy_docs_exhibition_active", mgoUserId)
+				}
+			}
+		}()
 		href = util.ObjToString(res["toDirect"])
 	}
 	if token != "" {
@@ -63,13 +77,13 @@ func (w *ExhibitionStruct) ExhibitionActive(host, source string, session *httpse
 		switch {
 		case strings.Contains("first_ad_code", params):
 			res["bindOrNot"] = false
-			if session.Get("phone") == "" {
+			if phone, _ := session.Get("phone").(string); phone == "" {
 				res["bindOrNot"] = true
 			}
 			res["adList"] = w.GetJyAdList(host, util.ObjToString(activeInfo["first_ad_code"]))
 		case strings.Contains("second_ad_code", params):
-			//福利
-			go ExhibitionWelfare(session, util.Int64All(activeInfo["welfare_type"]), util.ObjToString(activeInfo["welfare_content"]))
+			//福利--因 go-zero 版本不同,无法直接调 文库中台,改为前端直接调文库服务
+			//go ExhibitionWelfare(session, util.Int64All(activeInfo["welfare_type"]), util.ObjToString(activeInfo["welfare_content"]))
 			res["toDirect"] = fmt.Sprintf("%s?ad=%s", util.ObjToString("guide_page"), util.ObjToString("second_ad_code"))
 		}
 	}

+ 5 - 14
src/service/config/config.go

@@ -73,6 +73,9 @@ type config struct {
 	BindPopRedis       string
 	MaxBindPop         int
 	AccountMergeOnline string
+	Nsq                string
+	NsqTopic           string
+	ExhibitionTimeOut  int
 }
 
 type esConf struct {
@@ -124,8 +127,6 @@ var (
 	GmailAuth    []*mail.GmailAuth
 	Middleground *middleground.Middleground
 	Compatible   *compatible.Compatible
-	//UserDocLib   userlibclient.UserLib
-	AppId string
 )
 
 func init() {
@@ -192,13 +193,13 @@ func init() {
 		//
 		if len(Sysconfig.Mail) > 0 {
 			for _, v := range Sysconfig.Mail {
-				mail := &mail.GmailAuth{
+				GMail := &mail.GmailAuth{
 					SmtpHost: v.Addr,
 					SmtpPort: v.Port,
 					User:     v.User,
 					Pwd:      v.Pwd,
 				}
-				GmailAuth = append(GmailAuth, mail)
+				GmailAuth = append(GmailAuth, GMail)
 			}
 		}
 	}
@@ -208,14 +209,4 @@ func init() {
 		RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String()).
 		RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String())
 	Compatible = compatible.NewCompatible(&MQFW, Base, Mysql, Middleground)
-	//文库中台
-	//UserDocLib = userlibclient.NewUserLib(zrpc.MustNewClient(zrpc.RpcClientConf{
-	//	Etcd: discov.EtcdConf{
-	//		Key:   g.Cfg().MustGet(ctx, "userDoc.key").String(),
-	//		Hosts: g.Cfg().MustGet(ctx, "userDoc.address").Strings(),
-	//	},
-	//}))
-	//
-	AppId = g.Cfg().MustGet(ctx, "appId").String()
-	//
 }