WH01243 пре 2 година
родитељ
комит
ae66b07770

+ 3 - 3
jyBXSubscribe/rpc/init/db.go

@@ -18,7 +18,7 @@ import (
 var (
 	MainMysql        *mysql.Mysql
 	BaseServiceMysql *mysql.Mysql
-	pushServiceMysql *mysql.Mysql
+	PushMysql        *mysql.Mysql
 	Mgo              mongodb.MongodbSim
 	MgoBidding       mongodb.MongodbSim
 	GlobalCommonData *mysql.Mysql
@@ -94,7 +94,7 @@ func MysqlInit(mm *entity.Mysql) {
 	//初始化 pushServiceMysql
 	if mm.Push.Address != "" {
 		logx.Info("--初始化 推送 Push--")
-		pushServiceMysql = &mysql.Mysql{
+		PushMysql = &mysql.Mysql{
 			Address:      mm.Push.Address,
 			UserName:     mm.Push.UserName,
 			PassWord:     mm.Push.Password,
@@ -102,7 +102,7 @@ func MysqlInit(mm *entity.Mysql) {
 			MaxOpenConns: mm.Push.MaxOpenConns,
 			MaxIdleConns: mm.Push.MaxIdleConns,
 		}
-		pushServiceMysql.Init()
+		PushMysql.Init()
 	}
 
 }

+ 2 - 2
jyBXSubscribe/rpc/init/pushMapping.go

@@ -18,7 +18,7 @@ type pushMapping struct {
 
 //推送数据 在mysql中 信息类型和地区等存的对应id;查询的时候需进行转化;
 func (p *pushMapping) Init() {
-	infotype := pushServiceMysql.SelectBySql("select id,type,name from infotype")
+	infotype := PushMysql.SelectBySql("select id,type,name from infotype")
 	p.Toptype = map[string]int{}
 	p.Subtype = map[string]int{}
 	p.Buyerclass = map[string]int{}
@@ -54,7 +54,7 @@ func (p *pushMapping) Init() {
 	//
 	p.Area = map[string]int{}
 	p.City = map[string]int{}
-	province := pushServiceMysql.SelectBySql("select id,level,name from province")
+	province := PushMysql.SelectBySql("select id,level,name from province")
 	if province != nil && len(*province) > 0 {
 		for _, v := range *province {
 			id := common.IntAll(v["id"])

+ 1 - 0
jyBXSubscribe/rpc/internal/logic/bypushhistorylogic.go

@@ -64,6 +64,7 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 		Staffs:           staffIds,
 		NewUserId:        in.NewUserId,
 		BaseServiceMysql: IC.BaseServiceMysql,
+		PushMysql:        IC.PushMysql,
 		IsEnt:            in.IsEnt,
 		UserType:         in.UserType,
 		PositionType:     in.PositionType,

+ 1 - 0
jyBXSubscribe/rpc/internal/logic/getsublistlogic.go

@@ -78,6 +78,7 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 		DeptId:           in.DeptId,    //商机管理部门id
 		NewUserId:        in.NewUserId,
 		BaseServiceMysql: IC.BaseServiceMysql,
+		PushMysql:        IC.PushMysql,
 		IsEnt:            in.IsEnt,
 		BuySubject:       0,
 		UserType:         in.UserType,

+ 1 - 1
jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic.go

@@ -81,7 +81,7 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 			today_1 := t.Unix()
 			today_2 := t.AddDate(0, 0, 1).Unix()
 			//错误
-			if IC.BaseServiceMysql.CountBySql("select count(1) as count from pushsubscribe a left join global_common_data.dws_f_bid_baseinfo b on a.infoid=b.infoid   where a.isvip =1 and a.userid =? and b.buyerclass_code=?  and (a.date between ? and ? )", common.InterfaceToStr(in.NewUserId), 93, today_1, today_2) > 0 {
+			if IC.PushMysql.CountBySql("select count(1) as count from pushsubscribe a left join global_common_data.dws_f_bid_baseinfo b on a.infoid=b.infoid   where a.isvip =1 and a.userid =? and b.buyerclass_code=?  and (a.date between ? and ? )", common.InterfaceToStr(in.NewUserId), 93, today_1, today_2) > 0 {
 				resp.Data.OtherFlag = true
 			}
 		} else {

+ 1 - 1
jyBXSubscribe/rpc/internal/logic/getviewstatuslogic.go

@@ -62,7 +62,7 @@ func (l *GetViewStatusLogic) GetViewStatus(in *bxsubscribe.GetViewStatusReq) (*b
 	if len(ss) > 0 {
 		finsql = fmt.Sprintf(`SELECT userid,isvisit,visittime,date FROM pushentniche where  infoid =? and source in (2,3) %s order By date asc`, fmt.Sprintf(`and userid in (%s)`, strings.Join(ss, ",")))
 	}
-	data := IC.BaseServiceMysql.SelectBySql(finsql, in.InfoId)
+	data := IC.PushMysql.SelectBySql(finsql, in.InfoId)
 	userMap := make(map[int]string)
 	for _, u := range *users {
 		userMap[u.Id] = u.Name

+ 4 - 4
jyBXSubscribe/rpc/internal/logic/msgdistributorlogic.go

@@ -50,7 +50,7 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "缺少参数"}, nil
 	}
 	//获取分发信息的地区
-	infoRes := IC.BaseServiceMysql.SelectBySql(fmt.Sprintf("SELECT infoid FROM pushentniche WHERE id in('%s')", strings.Join(pushIds, "','")))
+	infoRes := IC.PushMysql.SelectBySql(fmt.Sprintf("SELECT infoid FROM pushentniche WHERE id in('%s')", strings.Join(pushIds, "','")))
 	if infoRes == nil || len(*infoRes) == 0 {
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "获取分发地区异常"}, nil
 	}
@@ -80,12 +80,12 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 		}
 	}
 	//查询分发信息内容
-	msgRes := IC.BaseServiceMysql.SelectBySql(fmt.Sprintf("SELECT * FROM pushentniche WHERE id in ('%s') and entid =?  ", strings.Join(pushIds, "','")), in.EntId)
+	msgRes := IC.PushMysql.SelectBySql(fmt.Sprintf("SELECT * FROM pushentniche WHERE id in ('%s') and entid =?  ", strings.Join(pushIds, "','")), in.EntId)
 	if msgRes == nil || len(*msgRes) == 0 {
 		return &bxsubscribe.StatusResp{ErrorCode: -1, ErrorMsg: "获取分发信息内容异常"}, nil
 	}
 	//分发数据库修改
-	ok := IC.BaseServiceMysql.ExecTx("分发数据库修改", func(tx *sql.Tx) bool {
+	ok := IC.PushMysql.ExecTx("分发数据库修改", func(tx *sql.Tx) bool {
 		insertRow := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid", "source", "date", "userid", "isvisit", "visittime", "pid"}
 		msgItems := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid"}
 		dateNew := time.Now().Unix()
@@ -98,7 +98,7 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 				insertValue = append(insertValue, msgValues...)
 				insertValue = append(insertValue, []interface{}{3, dateNew, uid, nil, nil, m["id"]}...)
 			}
-			affected, _ := IC.BaseServiceMysql.InsertBatchByTx(tx, "pushentniche", insertRow, insertValue)
+			affected, _ := IC.PushMysql.InsertBatchByTx(tx, "pushentniche", insertRow, insertValue)
 			if affected == 0 {
 				return false
 			}

+ 11 - 10
jyBXSubscribe/rpc/model/push.go

@@ -98,6 +98,7 @@ type SubPushQueryParam struct {
 	Source           string             //信息来源
 	Staffs           []string           //分发人员
 	BaseServiceMysql *mysql.Mysql
+	PushMysql        *mysql.Mysql
 	NewUserId        int64
 	IsEnt            bool
 	SelectInfoIds    []string
@@ -392,7 +393,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		logx.Info("countSql", countSql)
 		findSql = fmt.Sprintf("select id,date,infoid,isvisit,matchkeys,type,attachment_count  from %s   where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
 		//查询总数
-		count = spqp.BaseServiceMysql.CountBySql(countSql)
+		count = spqp.PushMysql.CountBySql(countSql)
 	} else {
 		//公共查询条件
 		//时间
@@ -631,13 +632,13 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		}
 		//查询总数
 		logx.Info("countSql", countSql)
-		count = spqp.BaseServiceMysql.CountBySql(countSql)
+		count = spqp.PushMysql.CountBySql(countSql)
 	}
 	if isLimit {
 		findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size)
 	}
 	logx.Info(spqp.NewUserId, "subscribePush query sql:", findSql)
-	list := spqp.BaseServiceMysql.SelectBySql(findSql)
+	list := spqp.PushMysql.SelectBySql(findSql)
 	if list != nil && len(*list) > 0 {
 		pushCas := s.GetJyPushs(*list)
 		if !spqp.Export {
@@ -906,19 +907,19 @@ func (s *subscribePush) SetRead(newUserId, id int64, userId, entUserId, entId st
 	}
 	if isEnt {
 		if s.ModuleFlag == EntnicheFlag {
-			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 ,visittime=now() where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
+			IC.PushMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 ,visittime=now() where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
 
 		} else {
-			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
+			IC.PushMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
 
 		}
 	} else {
 		if s.ModuleFlag == EntnicheFlag {
 			//商机管理
-			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1,visittime=now() where userid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entUserId, id)
+			IC.PushMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1,visittime=now() where userid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entUserId, id)
 		} else {
 			//其他
-			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where userid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), newUserId, id)
+			IC.PushMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where userid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), newUserId, id)
 		}
 	}
 	if !isEnt {
@@ -1124,11 +1125,11 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
 	id := int64(0)
 	switch s.ModuleFlag {
 	case EntnicheFlag:
-		_, id = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, ennicheInsertCollKey, pushInsert)
+		_, id = spqp.PushMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, ennicheInsertCollKey, pushInsert)
 	case MemberFlag:
-		_, id = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, memberInsertCollKey, pushInsert)
+		_, id = spqp.PushMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, memberInsertCollKey, pushInsert)
 	default:
-		_, id = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
+		_, id = spqp.PushMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
 	}
 	for i := length - 1; i >= 0; i-- {
 		resultList[i].CaIndex = id