zhangxinlei1996 1 год назад
Родитель
Сommit
39eb75e294
10 измененных файлов с 163 добавлено и 32 удалено
  1. 5 1
      api/etc/crmapplication.yaml
  2. 15 0
      api/etc/push.yaml
  3. 8 5
      api/internal/config/config.go
  4. 9 0
      go.mod
  5. 3 0
      go.sum
  6. 4 4
      service/custom.go
  7. 11 9
      service/sale_chance.go
  8. 22 13
      service/sale_clue.go
  9. 60 0
      service/sendMsg.go
  10. 26 0
      service/user.go

+ 5 - 1
api/etc/crmapplication.yaml

@@ -22,4 +22,8 @@ BaseCenterRpc:
   Etcd:
     Hosts:
     - 192.168.3.206:2379
-    Key: basecenter.rpc
+    Key: basecenter.rpc
+TimeTaskSwitch: true
+StationMailHref: https://web-qmx_admin.jydev.jianyu360.com/api/admin
+StationMailAction: /message/sendMessageApi
+TestId: 6103bb722abfa5f4d81bb1d1

+ 15 - 0
api/etc/push.yaml

@@ -0,0 +1,15 @@
+TimeTaskSwitch: true
+StationMailHref: https://web-qmx_admin.jydev.jianyu360.com/api/admin
+StationMailAction: /message/sendMessageApi
+TestId: 6103bb722abfa5f4d81bb1d1
+SaleClue:
+  Title: 创建销售线索通知
+  Content: %s于%s创建销售线索
+SaleChance:
+  Title: 创建销售机会通知
+  Content: %s于%s创建销售机会%s
+Custom:
+  Title: 创建客户通知
+  Content: %s于%s创建客户%s
+
+  

+ 8 - 5
api/internal/config/config.go

@@ -12,11 +12,14 @@ type Config struct {
 		ServerCode string
 		Etcd       []string
 	}
-	UserCenterRpc zrpc.RpcClientConf
-	FileCenterRpc zrpc.RpcClientConf
-	OssBucketName string
-	OssUrl        string
-	BaseCenterRpc zrpc.RpcClientConf
+	UserCenterRpc     zrpc.RpcClientConf
+	FileCenterRpc     zrpc.RpcClientConf
+	OssBucketName     string
+	OssUrl            string
+	BaseCenterRpc     zrpc.RpcClientConf
+	StationMailHref   string
+	StationMailAction string
+	TestId            string
 }
 
 type Db struct {

+ 9 - 0
go.mod

@@ -22,16 +22,19 @@ require (
 	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e // indirect
 	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230225125145-431a4f70093a // indirect
 	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
+	github.com/BurntSushi/toml v0.4.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/bits-and-blooms/bitset v1.2.0 // 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/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
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
 	github.com/emicklei/go-restful/v3 v3.9.0 // indirect
 	github.com/fatih/color v1.15.0 // indirect
+	github.com/fsnotify/fsnotify v1.6.0 // indirect
 	github.com/garyburd/redigo v1.6.2 // indirect
 	github.com/go-logr/logr v1.2.4 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
@@ -50,15 +53,19 @@ require (
 	github.com/google/go-cmp v0.5.9 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/uuid v1.3.0 // indirect
+	github.com/gorilla/websocket v1.5.0 // indirect
+	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/klauspost/compress v1.15.15 // indirect
+	github.com/longbridgeapp/sqlparser v0.3.1 // 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/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
@@ -66,6 +73,7 @@ require (
 	github.com/mschoch/smat v0.2.0 // 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
 	github.com/openzipkin/zipkin-go v0.4.1 // indirect
@@ -75,6 +83,7 @@ require (
 	github.com/prometheus/client_model v0.3.0 // indirect
 	github.com/prometheus/common v0.42.0 // indirect
 	github.com/prometheus/procfs v0.10.1 // indirect
+	github.com/rivo/uniseg v0.2.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/tealeg/xlsx v1.0.5 // indirect
 	github.com/thinxer/go-word2vec v0.0.0-20150917053916-5c19ec7379ed // indirect

+ 3 - 0
go.sum

@@ -227,6 +227,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
 github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
 github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
+github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
 github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM=
 github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
 github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
@@ -287,6 +288,7 @@ github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrt
 github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
 github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
 github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
+github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
 github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
 github.com/go-xorm/builder v0.3.4/go.mod h1:KxkQkNN1DpPKTedxXyTQcmH+rXfvk4LZ9SOOBoZBAxw=
 github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM=
@@ -1144,6 +1146,7 @@ golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
 golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=

+ 4 - 4
service/custom.go

@@ -99,8 +99,8 @@ func SaleCustomAdd(tx *sql.Tx, args []interface{}) int64 {
 	return id
 }
 
-//EmployCustomUpdate 是否创建客户修改
-func CustomUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64) bool {
+//EmployUpdate 是否创建线索/机会/客户修改
+func EmployUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64, key string) bool {
 	tablename := ""
 	id := int64(0)
 	if employ_custom_id > 0 {
@@ -113,7 +113,7 @@ func CustomUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64
 	if tablename == "" || id == 0 {
 		return true
 	}
-	return cm.CrmMysql.UpdateByTx(tx, tablename, map[string]interface{}{"id": id, "position_id": positionId}, map[string]interface{}{"is_create_custom": 1})
+	return cm.CrmMysql.UpdateByTx(tx, tablename, map[string]interface{}{"id": id, "position_id": positionId}, map[string]interface{}{key: 1})
 }
 
 func SaveCustom(ctx context.Context, argsCustom, argsTask, argsTaskTeam []interface{}, employ_info_id, employ_custom_id, positionId int64, createPerson string, transferArr []int64) bool {
@@ -125,7 +125,7 @@ func SaveCustom(ctx context.Context, argsCustom, argsTask, argsTaskTeam []interf
 		argsTask = append(argsTask, customId)
 		//任务车存储
 		taskId := TaskAdd(tx, argsTask, argsTaskTeam, transferArr, positionId)
-		ok := CustomUpdate(tx, employ_info_id, employ_custom_id, positionId)
+		ok := EmployUpdate(tx, employ_info_id, employ_custom_id, positionId, "is_create_custom")
 		//插入台账
 		ok2 := SaveLedger(ctx, positionId, customId, taskId, "创建客户", fmt.Sprintf("%s创建了客户", createPerson), createPerson)
 		if customId > 0 && taskId > 0 && ok && ok2 {

+ 11 - 9
service/sale_chance.go

@@ -71,18 +71,18 @@ func (this *SaleChanceService) Add(ctx context.Context) int64 {
 		//任务
 		argsTask = append(argsTask, this.EntId, this.ChanceName+"的跟进任务", 2, this.PositionId, 1, nowtime, 1, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime))
 
-		if !SaveChange(ctx, args, argsTask, argsTaskTeam, this.PositionId, this.BusinessType, this.CreateName, transferArr) {
+		if !SaveChange(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.CustomId, this.PositionId, this.BusinessType, this.CreateName, transferArr) {
 			return 0
 		}
 	} else if this.Types == 1 {
-		//线索
-		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.CustomId, this.BusinessType, this.ChanceName, this.Summary, this.ChanceClassify, qu.If(this.ExpectedOrderTime == 0, nil, expect_deal_time), qu.If(this.ExpectedMoney == 0, nil, this.ExpectedMoney), qu.If(this.Remarks == "", nil, this.Remarks), nowtime)
+		//线索机会
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.CustomId, this.BusinessType, this.ChanceName, this.Summary, this.ChanceClassify, qu.If(this.ExpectedOrderTime == 0, nil, expect_deal_time), qu.If(this.ExpectedMoney == 0, nil, this.ExpectedMoney), qu.If(this.Remarks == "", nil, this.Remarks), nowtime, this.CreateName)
 		//任务
 		argsTask = append(argsTask, this.EntId, this.ChanceName+"的跟进任务", 2, this.PositionId, 1, nowtime, 1, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime))
 		//任务团队
 		argsTaskTeam = append(argsTaskTeam, this.PositionId, this.EntUserId, this.CreateName, 1, nowtime)
 		//存库
-		if !SaveChange(ctx, args, argsTask, argsTaskTeam, this.PositionId, this.BusinessType, this.CreateName, []int64{}) {
+		if !SaveChange(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.CustomId, this.PositionId, this.BusinessType, this.CreateName, []int64{}) {
 			return 0
 		}
 	}
@@ -92,13 +92,13 @@ func (this *SaleChanceService) Add(ctx context.Context) int64 {
 
 // SaleChangeAdd 机会存储
 func SaleChangeAdd(tx *sql.Tx, args []interface{}) int64 {
-	fields := []string{"position_id", "ent_id", "ent_user_id", "employ_info_id", "custom_id", "tpl_id", "name", "summary", "classify", "expect_deal_time", "expect_deal_amount", "remark", "create_time"}
+	fields := []string{"position_id", "ent_id", "ent_user_id", "employ_info_id", "custom_id", "tpl_id", "name", "summary", "classify", "expect_deal_time", "expect_deal_amount", "remark", "create_time", "create_person"}
 	_, id := cm.CrmMysql.InsertBatchByTx(tx, entity.SALE_CHANCE, fields, args)
 	return id
 }
 
 // Save 存库
-func SaveChange(ctx context.Context, argsChange, argsTask, argsTaskTeam []interface{}, positionId, tplId int64, createName string, transferArr []int64) bool {
+func SaveChange(ctx context.Context, argsChange, argsTask, argsTaskTeam []interface{}, employ_info_id, employ_custom_id, positionId, tplId int64, createName string, transferArr []int64) bool {
 	//存库
 	return cm.CrmMysql.ExecTx("创建机会", func(tx *sql.Tx) bool {
 		//插入机会
@@ -108,13 +108,15 @@ func SaveChange(ctx context.Context, argsChange, argsTask, argsTaskTeam []interf
 		//任务车存储
 		taskId := TaskAdd(tx, argsTask, argsTaskTeam, transferArr, positionId)
 		//操作台帐
-		ok := SaveLedger(ctx, positionId, changeId, taskId, "创建销售机会", fmt.Sprintf("%s创建了销售机会", createName), createName)
+		ok1 := SaveLedger(ctx, positionId, changeId, taskId, "创建销售机会", fmt.Sprintf("%s创建了销售机会", createName), createName)
+		//是否创建销售计划
+		ok2 := EmployUpdate(tx, employ_info_id, employ_custom_id, positionId, "is_create_chance")
 		//任务执行计划
 		planId := TaskExecutePlanAdd(tx, tplId, taskId)
-		if changeId > 0 && taskId > 0 && ok && planId > 0 {
+		if changeId > 0 && taskId > 0 && ok1 && ok2 && planId > 0 {
 			return true
 		}
-		log.Println("save change err: ", changeId, taskId, ok, planId)
+		log.Println("save change err: ", changeId, taskId, ok1, ok2, planId)
 		return false
 	})
 }

+ 22 - 13
service/sale_clue.go

@@ -36,10 +36,12 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
 	args := []interface{}{}
 	argsTask := []interface{}{}
 	argsTaskTeam := []interface{}{}
+	// userIds, positionIds := "", ""
 	//判断处理方式
 	//转办
 	if this.Types == 2 {
 		transferArr := []int64{}
+		baseUserIdArr := []int64{}
 		for _, v := range this.User {
 			i_entuserid := v
 			resp, err := cm.UserCenterRpc.IdentityByEntUserId(ctx, &pb.IdentityReq{
@@ -47,20 +49,25 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
 			})
 			if err != nil {
 				log.Println("获取用户职位id信息出错", i_entuserid, "的信息出错", err)
-				return 0
+				return -1
 			} else if resp == nil {
 				log.Println("entuser用户", i_entuserid, "没有找到职位信息")
-				return 0
+				return -1
 			}
 			transferArr = append(transferArr, resp.PositionId)
+			baseUserIdArr = append(baseUserIdArr, resp.UserId)
+			//查询mgo
 		}
+		// &User{
+		// 	baseUserIds
+		// }
 		//线索
 		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, nowtime, this.CreateName)
 		//任务
 		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 1, nowtime, 1, qu.If(this.FollowUpTime == 0, nil, nextFollowTime))
 
-		if !Save(ctx, args, argsTask, argsTaskTeam, this.PositionId, this.CreateName, transferArr) {
-			return 0
+		if !Save(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, 0, this.PositionId, this.CreateName, transferArr) {
+			return -1
 		}
 	} else if this.Types == 1 {
 		//线索
@@ -70,11 +77,11 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
 		//任务团队
 		argsTaskTeam = append(argsTaskTeam, this.PositionId, this.EntUserId, this.CreateName, 1, nowtime)
 		//存库
-		if !Save(ctx, args, argsTask, argsTaskTeam, this.PositionId, this.CreateName, []int64{}) {
-			return 0
+		if !Save(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, 0, this.PositionId, this.CreateName, []int64{}) {
+			return -1
 		}
 	}
-
+	// StationMailPush
 	return 1
 }
 
@@ -96,9 +103,9 @@ func TaskAdd(tx *sql.Tx, args, taskTeamArgs []interface{}, transferArr []int64,
 	teamId, transferId := int64(0), int64(0)
 	if len(taskTeamArgs) > 0 {
 		//自办
-		taskTeamFields := []string{"position_id", "ent_user_id", "name", "role", "create_time", "task_id"}
+		// taskTeamFields := []string{"position_id", "ent_user_id", "name", "role", "create_time", "task_id"}
 		taskTeamArgs = append(taskTeamArgs, id)
-		_, teamId = cm.CrmMysql.InsertBatchByTx(tx, entity.TASK_TEAM, taskTeamFields, taskTeamArgs)
+		// _, teamId = cm.CrmMysql.InsertBatchByTx(tx, entity.TASK_TEAM, taskTeamFields, taskTeamArgs)
 	} else if len(transferArr) > 0 {
 		//转办
 		taskTransferFields := []string{"transfer_id", "responsible_id", "create_time", "task_id"}
@@ -116,7 +123,7 @@ func TaskAdd(tx *sql.Tx, args, taskTeamArgs []interface{}, transferArr []int64,
 }
 
 //Save 存库
-func Save(ctx context.Context, argsClue, argsTask, argsTaskTeam []interface{}, positionId int64, createName string, transferArr []int64) bool {
+func Save(ctx context.Context, argsClue, argsTask, argsTaskTeam []interface{}, employ_info_id, employ_custom_id, positionId int64, createName string, transferArr []int64) bool {
 	//存库
 	return cm.CrmMysql.ExecTx("创建线索", func(tx *sql.Tx) bool {
 		//插入线索
@@ -125,12 +132,14 @@ func Save(ctx context.Context, argsClue, argsTask, argsTaskTeam []interface{}, p
 		argsTask = append(argsTask, clueId)
 		//任务车存储
 		taskId := TaskAdd(tx, argsTask, argsTaskTeam, transferArr, positionId)
+		//是否创建销售线索
+		ok1 := EmployUpdate(tx, employ_info_id, employ_custom_id, positionId, "is_create_clue")
 		//操作台帐
-		ok := SaveLedger(ctx, positionId, clueId, taskId, "创建销售线索", fmt.Sprintf("%s创建了销售线索", createName), createName)
-		if clueId > 0 && taskId > 0 && ok {
+		ok2 := SaveLedger(ctx, positionId, clueId, taskId, "创建销售线索", fmt.Sprintf("%s创建了销售线索", createName), createName)
+		if clueId > 0 && taskId > 0 && ok1 && ok2 {
 			return true
 		}
-		log.Println("save clue err: ", clueId, taskId, ok)
+		log.Println("save clue err: ", clueId, taskId, ok1, ok2)
 		return false
 	})
 }

+ 60 - 0
service/sendMsg.go

@@ -0,0 +1,60 @@
+package service
+
+import (
+	"context"
+	"encoding/json"
+	"fmt"
+	"log"
+
+	qu "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
+	cm "bp.jydev.jianyu360.cn/CRM/application/api/common"
+	"github.com/gogf/gf/v2/frame/g"
+)
+
+//将用户格式化成 123,456 格式
+func FormatUserId(useridArr []string) (userids string) {
+	userids = ""
+	for k, v := range useridArr {
+		userids += v
+		if k+1 != len(useridArr) {
+			userids += ","
+		}
+	}
+	return
+}
+
+//站内信推送
+func StationMailPush(userIds, positionIds, title, content, pcLandingPage, appLandingPage, wxLandingPage string) {
+	href := fmt.Sprintf("%s?_action=%s&userIds=%s&msgType=11&title=%s&content=%s&link=%s&sendMode=2&sendTime=%s&androidUrl=%s&iosUrl=%s&weChatUrl=%s&_token=12311&reqSource=1&callPlatform=crm&menuname=message&positionIds=%s",
+		cm.C.StationMailHref, cm.C.StationMailAction, userIds, title, content, pcLandingPage, date.NowFormat(date.Date_Short_Layout), appLandingPage, appLandingPage, wxLandingPage, positionIds)
+	log.Println(href)
+	resp := Get(href, nil)
+	log.Println(resp)
+	ret := map[string]interface{}{}
+	err := json.Unmarshal([]byte(resp), &ret)
+	if err != nil {
+		log.Println(err)
+		return
+	}
+	if ret != nil && len(ret) > 0 {
+		if data := qu.ObjToMap(ret["data"]); data != nil && len(*data) > 0 {
+			if qu.Int64All((*data)["status"]) != 1 {
+				log.Println("推送失败")
+			}
+		}
+	}
+	return
+}
+
+//公共get方法
+func Get(url string, param map[string]interface{}) (str string) {
+	ctx := context.Background()
+	if r, err := g.Client().Get(ctx, url, param); err != nil {
+		g.Log().Error(ctx, err)
+	} else {
+		defer r.Close()
+		str = r.ReadAllString()
+	}
+	return
+}

+ 26 - 0
service/user.go

@@ -0,0 +1,26 @@
+package service
+
+import (
+	"app.yhyue.com/moapp/jybase/mongodb"
+	cm "bp.jydev.jianyu360.cn/CRM/application/api/common"
+	"github.com/gogf/gf/v2/util/gconv"
+)
+
+type User struct {
+	BaseUserIds []int64
+}
+
+func (this *User) GetUserId([]int64) map[string]int64 {
+	m := map[string]int64{}
+	data, ok := cm.Mgo.Find("user", map[string]interface{}{
+		"base_user_id": map[string]interface{}{
+			"$in": this.BaseUserIds,
+		},
+	}, nil, `{"_id":1,"base_user_id":1}`, false, -1, -1)
+	if ok && data != nil && len(*data) > 0 {
+		for _, v := range *data {
+			m[mongodb.BsonIdToSId(v["_id"])] = gconv.Int64(v["base_user_id"])
+		}
+	}
+	return m
+}