Эх сурвалжийг харах

Merge branch 'master' into feature/v3.1.12

lianbingjie 1 жил өмнө
parent
commit
4b40cd14ee

+ 7 - 2
src/config.json

@@ -811,7 +811,6 @@
     "activity_start":1635436800,
     "activity_end":1635436800,
     "smsServiceRpc":"127.0.0.1:932",
-
 	"appNewUserTime": 1667985243,
 	"appNewSales": [
 		{
@@ -872,5 +871,11 @@
 	"accountMergeOnline": "2015-03-30 00:00:00",
 	"nsq": "192.168.3.240:4260",
 	"nsqTopic": "jy_event",
-	"exhibitionTimeOut": 7200
+	"exhibitionTimeOut": 7200,
+	"pointsEtcdConf": {
+		"hosts": [
+			"127.0.0.1:2379"
+		],
+		"key": "resourcescenter.rpc",
+	}
 }

+ 26 - 23
src/go.mod

@@ -1,12 +1,14 @@
 module salesLeads/src
 
-go 1.20
+go 1.19
 
 require (
+	app.yhyue.com/moapp/jyResourcesCenter v0.0.0-20231024011103-8a2aacdbbd3e
 	app.yhyue.com/moapp/jybase v0.0.0-20230629025419-641ebbfdeaeb
 	app.yhyue.com/moapp/jypkg v0.0.0-20230714093939-910ef5563e8c
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.13
-	github.com/gogf/gf/v2 v2.4.4
+	github.com/gogf/gf/v2 v2.5.5
+	github.com/zeromicro/go-zero v1.5.5
 )
 
 require (
@@ -16,11 +18,11 @@ require (
 	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
-	github.com/BurntSushi/toml v1.1.0 // indirect
+	github.com/BurntSushi/toml v1.2.0 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.2.1 // indirect
 	github.com/cespare/xxhash/v2 v2.2.0 // indirect
-	github.com/clbanning/mxj/v2 v2.5.5 // indirect
+	github.com/clbanning/mxj/v2 v2.7.0 // indirect
 	github.com/coreos/go-semver v0.3.1 // indirect
 	github.com/coreos/go-systemd/v22 v22.5.0 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
@@ -57,8 +59,8 @@ require (
 	github.com/magiconair/properties v1.8.7 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect
 	github.com/mattn/go-colorable v0.1.13 // indirect
-	github.com/mattn/go-isatty v0.0.17 // indirect
-	github.com/mattn/go-runewidth v0.0.13 // indirect
+	github.com/mattn/go-isatty v0.0.19 // indirect
+	github.com/mattn/go-runewidth v0.0.15 // indirect
 	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -69,23 +71,22 @@ require (
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic/v7 v7.0.22 // indirect
 	github.com/openzipkin/zipkin-go v0.4.1 // indirect
-	github.com/pelletier/go-toml/v2 v2.0.8 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.9 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
-	github.com/prometheus/client_golang v1.15.1 // indirect
+	github.com/prometheus/client_golang v1.16.0 // indirect
 	github.com/prometheus/client_model v0.3.0 // indirect
 	github.com/prometheus/common v0.42.0 // indirect
-	github.com/prometheus/procfs v0.9.0 // indirect
-	github.com/rivo/uniseg v0.2.0 // indirect
+	github.com/prometheus/procfs v0.10.1 // indirect
+	github.com/rivo/uniseg v0.4.4 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
-	github.com/xdg-go/scram v1.1.1 // indirect
-	github.com/xdg-go/stringprep v1.0.3 // indirect
+	github.com/xdg-go/scram v1.1.2 // indirect
+	github.com/xdg-go/stringprep v1.0.4 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	github.com/zeromicro/go-zero v1.5.3 // indirect
 	go.etcd.io/etcd/api/v3 v3.5.9 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.9 // indirect
-	go.mongodb.org/mongo-driver v1.11.6 // indirect
+	go.mongodb.org/mongo-driver v1.12.1 // indirect
 	go.opentelemetry.io/otel v1.15.1 // indirect
 	go.opentelemetry.io/otel/exporters/jaeger v1.15.1 // indirect
 	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect
@@ -98,20 +99,22 @@ require (
 	go.opentelemetry.io/otel/trace v1.15.1 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
 	go.uber.org/atomic v1.10.0 // indirect
-	go.uber.org/automaxprocs v1.5.2 // indirect
+	go.uber.org/automaxprocs v1.5.3 // indirect
 	go.uber.org/multierr v1.9.0 // indirect
 	go.uber.org/zap v1.24.0 // indirect
-	golang.org/x/crypto v0.6.0 // indirect
-	golang.org/x/net v0.10.0 // indirect
+	golang.org/x/crypto v0.14.0 // indirect
+	golang.org/x/net v0.17.0 // indirect
 	golang.org/x/oauth2 v0.7.0 // indirect
-	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/sys v0.8.0 // indirect
-	golang.org/x/term v0.8.0 // indirect
-	golang.org/x/text v0.9.0 // indirect
+	golang.org/x/sync v0.2.0 // indirect
+	golang.org/x/sys v0.13.0 // indirect
+	golang.org/x/term v0.13.0 // indirect
+	golang.org/x/text v0.13.0 // indirect
 	golang.org/x/time v0.3.0 // indirect
 	google.golang.org/appengine v1.6.7 // indirect
-	google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
-	google.golang.org/grpc v1.56.1 // indirect
+	google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect
+	google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect
+	google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
+	google.golang.org/grpc v1.57.0 // indirect
 	google.golang.org/protobuf v1.31.0 // indirect
 	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 691 - 6
src/go.sum


+ 37 - 7
src/service/action/info.go

@@ -1,6 +1,7 @@
 package action
 
 import (
+	"context"
 	"encoding/json"
 	"fmt"
 	"log"
@@ -10,6 +11,8 @@ import (
 	"strings"
 	"time"
 
+	"app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenterclient"
+
 	qu "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 
@@ -170,7 +173,7 @@ func (i *Info) EchoInfo() {
 	r := func() Result {
 		userid, _ := i.GetSession("userId").(string)
 		data := map[string]interface{}{}
-		if userinfo, ok := MQFW.FindById("user", userid, `{"s_phone":1,"s_m_phone":1,"s_myemail":1,"s_company":1}`); userinfo != nil && ok && len(*userinfo) > 0 {
+		if userinfo, ok := MQFW.FindById("user", userid, `{"s_phone":1,"s_m_phone":1,"s_myemail":1,"s_company":1,"identity_info":1}`); userinfo != nil && ok && len(*userinfo) > 0 {
 			s_phone := qu.ObjToString((*userinfo)["s_phone"])
 			phone := qu.If(s_phone == "", qu.ObjToString((*userinfo)["s_m_phone"]), s_phone)
 			if phone != "" {
@@ -199,6 +202,12 @@ func (i *Info) EchoInfo() {
 			}
 			data["mail"] = mail
 			data["company"] = qu.ObjToString((*userinfo)["s_company"])
+			if identityInfo, _ := (*userinfo)["identity_info"].(map[string]interface{}); identityInfo != nil {
+				data["position"], _ = identityInfo["position"].(string)
+				data["department"], _ = identityInfo["dept_name"].(string)
+				data["branch"], _ = identityInfo["dept_name"].(string)
+				data["companyType"], _ = identityInfo["ent_type"].(string)
+			}
 		}
 		rdata, ok := MQFW.Find("saleLeads", map[string]interface{}{
 			"userid": userid,
@@ -331,6 +340,21 @@ var FreeExperKey = "free_%s_%s_%s"
 
 func FreeuserManage(source, userid string) {
 	ss := strings.Split(source, "_")
+	if ss[0] == "article" && ss[1] == "attach" {
+		//附件下载包新增
+		ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+		ResourcesRpc.PurchaseUserBalance(ctx, &resourcesCenterclient.Resources{
+			AppId:        "10000",
+			UserId:       userid,
+			ResourceType: "附件下载包",
+			AccountId:    userid,
+			Name:         "附件下载包",
+			Number:       1,
+			Spec:         "个",
+			EndTime:      "2099-12-30",
+			Model:        4,
+		})
+	}
 	redis.PutKV(fmt.Sprintf(FreeExperKey, ss[0], ss[1], userid), 1)
 }
 
@@ -343,16 +367,11 @@ func Free_users(source, userid string) bool {
 	}
 	return true
 }
-
 func (i *Info) AppIsNewUerSales() {
 	defer qu.Catch()
 	r := func() Result {
 		userid := qu.ObjToString(i.GetSession("userId"))
-		log.Println(userid)
-		//userid = "64d3590aab4ecee691b55df8"
-		//if qu.IntAll(redis.Get("other", fmt.Sprintf(AppNewUserRegistration, userid))) == 1 {
-		//	return Result{}
-		//}
+		log.Println("用户id:", userid)
 		data := Compatible.Select(userid, `{"l_registedate":1,"app_first_login":1}`)
 		if data == nil || len(*data) == 0 {
 			return Result{Error_code: -1, Error_msg: "无用户数据", Data: nil}
@@ -373,6 +392,7 @@ func (i *Info) AppNewUerSales() {
 			return NewResultSales{Error_code: -1, Error_msg: Error_msg_1003}
 		}
 		body := xweb.FilterXSS(string(i.Body()))
+		log.Println("body:", body)
 		//接收参数
 		json.Unmarshal([]byte(body), &infoMap)
 		if len(infoMap) == 0 {
@@ -441,11 +461,21 @@ func (i *Info) AppNewUerSales() {
 				}
 			}
 			MQFW.Save("saleLeads", infoMap)
+			if len(keyWord) > 0 {
+				jy.Publish(Mgo_Log, Sysconfig.Nsq, Sysconfig.NsqTopic, "task", qu.ObjToString(i.GetSession("mgoUserId")), jy.Jywx_node1, map[string]interface{}{
+					"code":       1015, //首次订阅
+					"types":      "subscribeKeyWords",
+					"num":        50,
+					"baseUserId": i.GetSession("base_user_id"),
+					"positionId": i.GetSession("positionId"),
+				})
+			}
 		}
 		m["app_first_login"] = 1
 		ok := Compatible.Update(userid, map[string]interface{}{
 			"$set": m,
 		})
+
 		//更新消息接收设置
 		msgSet := qu.ObjToMap(infoMap["msgSet"])
 		setMap := map[string]interface{}{}

+ 15 - 1
src/service/action/whether.go

@@ -56,7 +56,7 @@ func (w *whether) CNode(mgoUserId, userId string, session *httpsession.Session)
 		delete(rM, "createtime")
 		delete(rM, "client")
 	}
-	if userinfo, ok := MQFW.FindById("user", mgoUserId, `{"s_phone":1,"s_m_phone":1,"s_myemail":1,"s_company":1`); userinfo != nil && ok && len(*userinfo) > 0 {
+	if userinfo, ok := MQFW.FindById("user", mgoUserId, `{"s_phone":1,"s_m_phone":1,"s_myemail":1,"s_company":1,"identity_info":1`); userinfo != nil && ok && len(*userinfo) > 0 {
 		s_phone := qu.ObjToString((*userinfo)["s_phone"])
 		phone := qu.If(s_phone == "", qu.ObjToString((*userinfo)["s_m_phone"]), s_phone)
 		if phone != "" {
@@ -91,6 +91,20 @@ func (w *whether) CNode(mgoUserId, userId string, session *httpsession.Session)
 		if rM["company"] == nil || rM["company"] == "" {
 			rM["company"] = qu.ObjToString((*userinfo)["s_company"])
 		}
+		if identityInfo, _ := (*userinfo)["identity_info"].(map[string]interface{}); identityInfo != nil {
+			if rM["position"] == nil || rM["position"] == "" {
+				rM["position"], _ = identityInfo["position"].(string)
+			}
+			if rM["department"] == nil || rM["department"] == "" {
+				rM["department"], _ = identityInfo["dept_name"].(string)
+			}
+			if rM["branch"] == nil || rM["branch"] == "" {
+				rM["branch"], _ = identityInfo["dept_name"].(string)
+			}
+			if rM["companyType"] == nil || rM["companyType"] == "" {
+				rM["companyType"], _ = identityInfo["ent_type"].(string)
+			}
+		}
 	}
 	return rM, tel
 }

+ 16 - 1
src/service/config/config.go

@@ -1,6 +1,9 @@
 package config
 
 import (
+	"app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenterclient"
+	"github.com/zeromicro/go-zero/core/discov"
+	"github.com/zeromicro/go-zero/zrpc"
 	"log"
 
 	util "app.yhyue.com/moapp/jybase/common"
@@ -79,8 +82,12 @@ type config struct {
 	Nsq                string
 	NsqTopic           string
 	ExhibitionTimeOut  int
+	PointsEtcdConf     etcdConf
+}
+type etcdConf struct {
+	Hosts []string
+	Key   string
 }
-
 type esConf struct {
 	Version  string
 	Address  string
@@ -131,6 +138,7 @@ var (
 	GmailAuth    []*mail.GmailAuth
 	Middleground *middleground.Middleground
 	Compatible   *compatible.Compatible
+	ResourcesRpc resourcesCenterclient.ResourcesCenter
 )
 
 func init() {
@@ -227,6 +235,13 @@ func init() {
 		RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String()).
 		RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String())
 	Compatible = compatible.NewCompatible(&MQFW, Base, Mysql, Middleground)
+	resourcesRpcClient := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: Sysconfig.PointsEtcdConf.Hosts,
+			Key:   Sysconfig.PointsEtcdConf.Key,
+		},
+	})
+	ResourcesRpc = resourcesCenterclient.NewResourcesCenter(resourcesRpcClient)
 }
 
 func GetMsgType() {

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно