|
@@ -99,7 +99,6 @@ type SubPushQueryParam struct {
|
|
|
Source string //信息来源
|
|
|
Staffs []string //分发人员
|
|
|
BaseServiceMysql *mysql.Mysql
|
|
|
- PushMysql *mysql.Mysql
|
|
|
NewUserId int64
|
|
|
IsEnt bool
|
|
|
SelectInfoIds []string
|
|
@@ -398,7 +397,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
logx.Info("countSql", countSql)
|
|
|
findSql = fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,a.attachment_count from %s a 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.PushMysql.CountBySql(countSql)
|
|
|
+ count = spqp.BaseServiceMysql.CountBySql(countSql)
|
|
|
} else {
|
|
|
//公共查询条件
|
|
|
//时间
|
|
@@ -640,7 +639,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size)
|
|
|
}
|
|
|
logx.Info(spqp.NewUserId, "subscribePush query sql:", findSql)
|
|
|
- list := spqp.PushMysql.SelectBySql(findSql)
|
|
|
+ list := spqp.BaseServiceMysql.SelectBySql(findSql)
|
|
|
if list != nil && len(*list) > 0 {
|
|
|
pushCas := s.GetJyPushs(*list)
|
|
|
if !spqp.Export {
|
|
@@ -1060,19 +1059,45 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
|
|
|
infoid := common.InterfaceToStr(v["_id"])
|
|
|
matchkeys := getKeys(title, keyword)
|
|
|
matchkey := strings.Join(matchkeys, " ")
|
|
|
+ subscopeclassStr := ""
|
|
|
+ area := common.If(v["area"] == nil, nil, common.If(common.ObjToString(v["area"]) == "A", 0, common.If(P.PushMapping.Area[common.ObjToString(v["area"])] > 0, P.PushMapping.Area[common.ObjToString(v["area"])], 0)))
|
|
|
+ city := common.If(v["city"] == nil, nil, common.If(P.PushMapping.City[common.ObjToString(v["city"])] > 0, P.PushMapping.City[common.ObjToString(v["city"])], 0))
|
|
|
+ subtype := common.If(v["subtype"] == nil, nil, common.If(P.PushMapping.Subtype[common.ObjToString(v["subtype"])] > 0, P.PushMapping.Subtype[common.ObjToString(v["subtype"])], 0))
|
|
|
+ toptype := common.If(v["subtype"] == nil, nil, common.If(P.PushMapping.Toptype[common.ObjToString(v["toptype"])] > 0, P.PushMapping.Toptype[common.ObjToString(v["toptype"])], 0))
|
|
|
+ buyerclass := common.If(v["buyerclass"] == nil, nil, common.If(P.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])] > 0, P.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])], 0))
|
|
|
+ attachment_count := 0
|
|
|
+ if v["isValidFile"] != nil {
|
|
|
+ isValidFile, _ := v["isValidFile"].(bool)
|
|
|
+ attachment_count = common.If(isValidFile, 1, 0).(int)
|
|
|
+ }
|
|
|
+ bidamount := common.If(v["bidamount"] == nil, nil, v["bidamount"])
|
|
|
+ budget := common.If(v["budget"] == nil, nil, v["budget"])
|
|
|
+ if s_subscopeclass := common.ObjToString(v["s_subscopeclass"]); s_subscopeclass != "" {
|
|
|
+ subscopeclass := []string{}
|
|
|
+ for _, v := range strings.Split(s_subscopeclass, ",") {
|
|
|
+ if subscopeclass_mapping, ok := P.PushMapping.Subscopeclass[v]; ok {
|
|
|
+ subscopeclass = append(subscopeclass, fmt.Sprint(subscopeclass_mapping))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(subscopeclass) > 0 {
|
|
|
+ subscopeclassStr = strings.Join(subscopeclass, ",")
|
|
|
+ }
|
|
|
+ }
|
|
|
redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
|
|
|
entid := spqp.EntId
|
|
|
entUserId := spqp.EntUserId
|
|
|
deptid := spqp.DeptId
|
|
|
+ //公共字段处理
|
|
|
+ pushInsert = append(pushInsert, common.InterfaceToStr(infoid), matchkey, now, area, city, buyerclass, toptype, subtype, subscopeclassStr, budget, bidamount, attachment_count)
|
|
|
switch s.ModuleFlag {
|
|
|
case EntnicheFlag:
|
|
|
- pushInsert = append(pushInsert, entid, deptid, entUserId, common.InterfaceToStr(infoid), matchkey, now, 1, product)
|
|
|
+ pushInsert = append(pushInsert, entid, deptid, entUserId, 1, product)
|
|
|
case MemberFlag:
|
|
|
- pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now)
|
|
|
+ pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId))
|
|
|
case SubVipFlag:
|
|
|
- pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 1)
|
|
|
+ pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), 1)
|
|
|
case SubFreeFlag:
|
|
|
- pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 0)
|
|
|
+ pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), 0)
|
|
|
}
|
|
|
redis.Put("pushcache_2_a", redisKey, 1, 86400)
|
|
|
resultList[i] = s.InfoFormat(&PushCa{
|
|
@@ -1085,11 +1110,11 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
|
|
|
id := int64(0)
|
|
|
switch s.ModuleFlag {
|
|
|
case EntnicheFlag:
|
|
|
- _, id = spqp.PushMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, ennicheInsertCollKey, pushInsert)
|
|
|
+ _, id = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, ennicheInsertCollKey, pushInsert)
|
|
|
case MemberFlag:
|
|
|
- _, id = spqp.PushMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, memberInsertCollKey, pushInsert)
|
|
|
+ _, id = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, memberInsertCollKey, pushInsert)
|
|
|
default:
|
|
|
- _, id = spqp.PushMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
|
|
|
+ _, id = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
|
|
|
}
|
|
|
for i := length - 1; i >= 0; i-- {
|
|
|
resultList[i].CaIndex = id
|