|
@@ -1,7 +1,6 @@
|
|
package model
|
|
package model
|
|
|
|
|
|
import (
|
|
import (
|
|
- "context"
|
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
IC "jyBXSubscribe/rpc/init"
|
|
IC "jyBXSubscribe/rpc/init"
|
|
@@ -20,7 +19,6 @@ import (
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/mysql"
|
|
"app.yhyue.com/moapp/jybase/mysql"
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
- "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
)
|
|
@@ -36,14 +34,12 @@ const (
|
|
MemberFlag = "mType"
|
|
MemberFlag = "mType"
|
|
EntnicheFlag = "eType"
|
|
EntnicheFlag = "eType"
|
|
oneDay = 24 * 60 * 60
|
|
oneDay = 24 * 60 * 60
|
|
- Baseinfo = "global_common_data.dws_f_bid_baseinfo"
|
|
|
|
- BidTags = "global_common_data.dws_f_bid_tags"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
var (
|
|
var (
|
|
- ennicheInsertCollKey = []string{"entid", "deptid", "userid", "infoid", "matchkeys", "date", "source", "product", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count"}
|
|
|
|
- subscribeInsertCollKey = []string{"userid", "infoid", "matchkeys", "date", "isvip", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count"}
|
|
|
|
- memberInsertCollKey = []string{"userid", "infoid", "matchkeys", "date", "items", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count"}
|
|
|
|
|
|
+ ennicheInsertCollKey = []string{"infoid", "matchkeys", "date", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "userid", "entid", "deptid", "source", "product"}
|
|
|
|
+ subscribeInsertCollKey = []string{"infoid", "matchkeys", "date", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "userid", "isvip"}
|
|
|
|
+ memberInsertCollKey = []string{"infoid", "matchkeys", "date", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "userid"}
|
|
)
|
|
)
|
|
|
|
|
|
var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{
|
|
var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{
|
|
@@ -387,20 +383,14 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
|
|
func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
|
|
func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
|
|
querys := []string{}
|
|
querys := []string{}
|
|
userStr := " "
|
|
userStr := " "
|
|
- leftJoinStr := " "
|
|
|
|
var (
|
|
var (
|
|
countSql, findSql string
|
|
countSql, findSql string
|
|
)
|
|
)
|
|
- codeMap, err := IC.CodeLib.CodeTransformation(context.Background(), &codeservice.Request{})
|
|
|
|
- if codeMap.Data == nil || err != nil {
|
|
|
|
- logx.Error("代码表获取失败")
|
|
|
|
- return result, count
|
|
|
|
- }
|
|
|
|
querys = append(querys, " 1=1 ")
|
|
querys = append(querys, " 1=1 ")
|
|
if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
|
|
if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
|
|
- countSql = fmt.Sprintf("select count(1) as count from %s a LEFT JOIN %s b ON a.infoid = b.infoid where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
|
|
|
+ countSql = fmt.Sprintf("select count(1) as count from %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
logx.Info("countSql", countSql)
|
|
logx.Info("countSql", countSql)
|
|
- findSql = fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count from %s a LEFT JOIN %s b ON a.infoid = b.infoid where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
|
|
|
+ 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.BaseServiceMysql.CountBySql(countSql)
|
|
} else {
|
|
} else {
|
|
@@ -418,8 +408,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
//城市
|
|
//城市
|
|
city := []string{}
|
|
city := []string{}
|
|
for _, v := range strings.Split(spqp.City, ",") {
|
|
for _, v := range strings.Split(spqp.City, ",") {
|
|
- if codeMap.Data.City[v] != "" {
|
|
|
|
- city = append(city, fmt.Sprint(codeMap.Data.City[v]))
|
|
|
|
|
|
+ if IC.PushMapping.City[v] > 0 {
|
|
|
|
+ city = append(city, fmt.Sprint(IC.PushMapping.City[v]))
|
|
} else {
|
|
} else {
|
|
city = append(city, "-1")
|
|
city = append(city, "-1")
|
|
}
|
|
}
|
|
@@ -428,14 +418,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
city = append(city, "9999")
|
|
city = append(city, "9999")
|
|
}
|
|
}
|
|
if len(city) > 0 {
|
|
if len(city) > 0 {
|
|
- sqlAreaCity = fmt.Sprintf("b.city_code in (%s)", strings.Join(city, ","))
|
|
|
|
|
|
+ sqlAreaCity = fmt.Sprintf("a.city in (%s)", strings.Join(city, ","))
|
|
}
|
|
}
|
|
//区域
|
|
//区域
|
|
var sqlArea = ""
|
|
var sqlArea = ""
|
|
area := []string{}
|
|
area := []string{}
|
|
for _, v := range strings.Split(spqp.Area, ",") {
|
|
for _, v := range strings.Split(spqp.Area, ",") {
|
|
- if codeMap.Data.Area[v] != "" {
|
|
|
|
- area = append(area, fmt.Sprint(codeMap.Data.Area[v]))
|
|
|
|
|
|
+ if IC.PushMapping.Area[v] > 0 {
|
|
|
|
+ area = append(area, fmt.Sprint(IC.PushMapping.Area[v]))
|
|
} else {
|
|
} else {
|
|
area = append(area, "-1")
|
|
area = append(area, "-1")
|
|
}
|
|
}
|
|
@@ -444,7 +434,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
area = append(area, "9999")
|
|
area = append(area, "9999")
|
|
}
|
|
}
|
|
if len(area) > 0 {
|
|
if len(area) > 0 {
|
|
- sqlArea = fmt.Sprintf("b.area_code in (%s)", strings.Join(area, ","))
|
|
|
|
|
|
+ sqlArea = fmt.Sprintf("a.area in (%s)", strings.Join(area, ","))
|
|
}
|
|
}
|
|
if sqlAreaCity != "" && sqlArea != "" {
|
|
if sqlAreaCity != "" && sqlArea != "" {
|
|
sqlAreaCity = "( " + sqlAreaCity + " or " + sqlArea + " )"
|
|
sqlAreaCity = "( " + sqlAreaCity + " or " + sqlArea + " )"
|
|
@@ -459,15 +449,13 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
if spqp.Buyerclass != "" {
|
|
if spqp.Buyerclass != "" {
|
|
buyerclass := []string{}
|
|
buyerclass := []string{}
|
|
for _, v := range strings.Split(spqp.Buyerclass, ",") {
|
|
for _, v := range strings.Split(spqp.Buyerclass, ",") {
|
|
- if codeMap.Data.Buyerclass[v] != "" {
|
|
|
|
- buyerclass = append(buyerclass, fmt.Sprint(codeMap.Data.Buyerclass[v]))
|
|
|
|
- }
|
|
|
|
|
|
+ buyerclass = append(buyerclass, fmt.Sprint(IC.PushMapping.Buyerclass[v]))
|
|
}
|
|
}
|
|
if len(buyerclass) == 1 {
|
|
if len(buyerclass) == 1 {
|
|
buyerclass = append(buyerclass, "9999")
|
|
buyerclass = append(buyerclass, "9999")
|
|
}
|
|
}
|
|
if len(buyerclass) > 0 {
|
|
if len(buyerclass) > 0 {
|
|
- querys = append(querys, fmt.Sprintf("b.buyerclass_code in (%s)", strings.Join(buyerclass, ",")))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("a.buyerclass in (%s)", strings.Join(buyerclass, ",")))
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -475,28 +463,25 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
if spqp.Subtype != "" {
|
|
if spqp.Subtype != "" {
|
|
subtype := []string{}
|
|
subtype := []string{}
|
|
for _, v := range strings.Split(spqp.Subtype, ",") {
|
|
for _, v := range strings.Split(spqp.Subtype, ",") {
|
|
- if codeMap.Data.Subtype[v] != "" {
|
|
|
|
- subtype = append(subtype, fmt.Sprint(codeMap.Data.Subtype[v]))
|
|
|
|
- }
|
|
|
|
|
|
+ subtype = append(subtype, fmt.Sprint(IC.PushMapping.Subtype[v]))
|
|
}
|
|
}
|
|
if len(subtype) == 1 {
|
|
if len(subtype) == 1 {
|
|
subtype = append(subtype, "9999")
|
|
subtype = append(subtype, "9999")
|
|
}
|
|
}
|
|
if len(subtype) > 0 {
|
|
if len(subtype) > 0 {
|
|
- querys = append(querys, fmt.Sprintf("b.subtype_code in (%s)", strings.Join(subtype, ",")))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("a.subtype in (%s)", strings.Join(subtype, ",")))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//信息行业
|
|
//信息行业
|
|
if spqp.Subscopeclass != "" {
|
|
if spqp.Subscopeclass != "" {
|
|
find_in_set := []string{}
|
|
find_in_set := []string{}
|
|
for _, v := range strings.Split(spqp.Subscopeclass, ",") {
|
|
for _, v := range strings.Split(spqp.Subscopeclass, ",") {
|
|
- if codeMap.Data.Subscopeclass[v] != "" {
|
|
|
|
- find_in_set = append(find_in_set, codeMap.Data.Subscopeclass[v])
|
|
|
|
- }
|
|
|
|
|
|
+ find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%d',a.subscopeclass)", IC.PushMapping.Subscopeclass[v]))
|
|
}
|
|
}
|
|
- if len(find_in_set) > 0 {
|
|
|
|
- leftJoinStr = fmt.Sprintf(" STRAIGHT_JOIN %s t on t.infoid = b.infoid and t.labelcode=2 ", BidTags)
|
|
|
|
- querys = append(querys, fmt.Sprintf(" t.labelvalues in (%s)", strings.Join(find_in_set, ",")))
|
|
|
|
|
|
+ if len(find_in_set) == 1 {
|
|
|
|
+ querys = append(querys, find_in_set[0])
|
|
|
|
+ } else if len(find_in_set) > 1 {
|
|
|
|
+ querys = append(querys, fmt.Sprintf("(%s)", strings.Join(find_in_set, " or ")))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//关键词
|
|
//关键词
|
|
@@ -517,19 +502,21 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
|
|
minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
|
|
maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
|
|
maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
|
|
if minPriceStr != "" && maxPriceStr != "" {
|
|
if minPriceStr != "" && maxPriceStr != "" {
|
|
- querys = append(querys, fmt.Sprintf("((b.bidamount>=%d and b.bidamount<=%d) or (b.budget>=%d and b.budget<=%d and b.bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("((a.bidamount>=%d and a.bidamount<=%d) or (a.budget>=%d and a.budget<=%d and a.bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
|
|
} else if minPriceStr != "" {
|
|
} else if minPriceStr != "" {
|
|
- querys = append(querys, fmt.Sprintf("(b.bidamount>=%d or (b.budget>=%d and b.bidamount is null))", minPrice, minPrice))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("(a.bidamount>=%d or (a.budget>=%d and a.bidamount is null))", minPrice, minPrice))
|
|
} else if maxPriceStr != "" {
|
|
} else if maxPriceStr != "" {
|
|
- querys = append(querys, fmt.Sprintf("(b.bidamount<=%d or (b.budget<=%d and b.bidamount is null))", maxPrice, maxPrice))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("( a.bidamount<=%d or (a.budget<=%d and a.bidamount is null))", maxPrice, maxPrice))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//附件
|
|
//附件
|
|
if spqp.FileExists != "" {
|
|
if spqp.FileExists != "" {
|
|
if spqp.FileExists == "1" {
|
|
if spqp.FileExists == "1" {
|
|
- querys = append(querys, fmt.Sprintf("b.isvalidfile =1 "))
|
|
|
|
- } else if spqp.FileExists == "-1" {
|
|
|
|
- querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
|
|
|
|
|
|
+ if spqp.FileExists == "1" {
|
|
|
|
+ querys = append(querys, fmt.Sprintf("a.attachment_count is not null"))
|
|
|
|
+ } else if spqp.FileExists == "-1" {
|
|
|
|
+ querys = append(querys, fmt.Sprintf("a.attachment_count is null"))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -574,10 +561,10 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
// 无查询分配人员、是否已读
|
|
// 无查询分配人员、是否已读
|
|
if spqp.IsRead == "" && len(staffs) == 0 {
|
|
if spqp.IsRead == "" && len(staffs) == 0 {
|
|
//查询数量(需要去重)
|
|
//查询数量(需要去重)
|
|
- countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""))
|
|
|
|
|
|
+ countSql = fmt.Sprintf("select count(1) from %s where %s %s %s", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and source = 2 ", ""))
|
|
//列表查询
|
|
//列表查询
|
|
- findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s %s order by a.date desc,a.id desc",
|
|
|
|
- aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""))
|
|
|
|
|
|
+ findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a where %s %s %s order by a.date desc,a.id desc",
|
|
|
|
+ aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and source = 2 ", ""))
|
|
} else {
|
|
} else {
|
|
//查询分配人员或是否已读
|
|
//查询分配人员或是否已读
|
|
staffQuery := " 1=1 "
|
|
staffQuery := " 1=1 "
|
|
@@ -591,9 +578,10 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
staffQuery += " and a.isvisit=1"
|
|
staffQuery += " and a.isvisit=1"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c STRAIGHT_JOIN %s b ON c.infoid = b.infoid %s WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
|
|
|
|
|
|
+ countSql = fmt.Sprintf("select count(1) from %s a where %s %s %s and ((%s) or EXISTS ( SELECT 1 from %s c WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable,
|
|
|
|
+ strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
|
|
//列表查询
|
|
//列表查询
|
|
- findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c STRAIGHT_JOIN %s b ON c.infoid = b.infoid %s WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) order by a.date desc,a.id desc ", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
|
|
|
|
|
|
+ findSql = fmt.Sprintf("a.select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) order by a.date desc,a.id desc ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// 是否已读
|
|
// 是否已读
|
|
@@ -629,17 +617,17 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//查询数量
|
|
//查询数量
|
|
- countSql = fmt.Sprintf("select count(1) as count from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr, strings.Join(querys, " and "))
|
|
|
|
|
|
+ countSql = fmt.Sprintf("select count(1) as count from %s a where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, strings.Join(querys, " and "))
|
|
//列表查询语句
|
|
//列表查询语句
|
|
- findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
|
|
|
|
|
|
+ findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,a.attachment_count"
|
|
if s.ModuleFlag == EntnicheFlag {
|
|
if s.ModuleFlag == EntnicheFlag {
|
|
findSql += ", IF(a.source is NULL,1,a.source) as source "
|
|
findSql += ", IF(a.source is NULL,1,a.source) as source "
|
|
}
|
|
}
|
|
if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
|
|
if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
|
|
findSql += ",a.isvip"
|
|
findSql += ",a.isvip"
|
|
}
|
|
}
|
|
- findSql = fmt.Sprintf("%s from %s a STRAIGHT_JOIN %s b ON 1=1 %s and a.infoid = b.infoid %s where %s"+
|
|
|
|
- " order by a.date desc,a.id desc", findSql, aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
|
|
|
|
|
|
+ findSql = fmt.Sprintf("%s from %s a where 1=1 %s and %s"+
|
|
|
|
+ " order by a.date desc,a.id desc", findSql, aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, strings.Join(querys, " and "))
|
|
}
|
|
}
|
|
//查询总数
|
|
//查询总数
|
|
logx.Info("countSql", countSql)
|
|
logx.Info("countSql", countSql)
|
|
@@ -1073,15 +1061,57 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
|
|
entid := spqp.EntId
|
|
entid := spqp.EntId
|
|
entUserId := spqp.EntUserId
|
|
entUserId := spqp.EntUserId
|
|
deptid := spqp.DeptId
|
|
deptid := spqp.DeptId
|
|
|
|
+
|
|
|
|
+ subscopeclass := ""
|
|
|
|
+ if s_subscopeclass := common.ObjToString(v["s_subscopeclass"]); s_subscopeclass != "" {
|
|
|
|
+ subscopeclassArr := []string{}
|
|
|
|
+ for _, v := range strings.Split(s_subscopeclass, ",") {
|
|
|
|
+ if subscopeclass_mapping, ok := IC.PushMapping.Subscopeclass[v]; ok {
|
|
|
|
+ subscopeclassArr = append(subscopeclassArr, fmt.Sprint(subscopeclass_mapping))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if len(subscopeclassArr) > 0 {
|
|
|
|
+ subscopeclass = strings.Join(subscopeclassArr, ",")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ common.Int64All(v["bidamount"])
|
|
|
|
+ isValidFile := common.If(v["isValidFile"] == nil, false, v["isValidFile"].(bool))
|
|
|
|
+ attachment_count := common.If(isValidFile.(bool), 1, 0).(int)
|
|
|
|
+ pushInsert = append(pushInsert,
|
|
|
|
+ common.InterfaceToStr(infoid),
|
|
|
|
+ matchkey,
|
|
|
|
+ now,
|
|
|
|
+ common.If(v["area"] == nil, 0, common.If(common.ObjToString(v["area"]) == "A", 0, common.If(IC.PushMapping.Area[common.ObjToString(v["area"])] > 0, IC.PushMapping.Area[common.ObjToString(v["area"])], 0).(int)).(int)),
|
|
|
|
+ common.If(v["city"] == nil, 0, common.If(IC.PushMapping.City[common.ObjToString(v["city"])] > 0, IC.PushMapping.City[common.ObjToString(v["city"])], 0).(int)),
|
|
|
|
+ common.If(v["buyerclass"] == nil, 0, common.If(IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])] > 0, IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])], 0).(int)),
|
|
|
|
+ common.If(v["toptype"] == nil, 0, common.If(IC.PushMapping.Toptype[common.ObjToString(v["toptype"])] > 0, IC.PushMapping.Toptype[common.ObjToString(v["toptype"])], 0).(int)),
|
|
|
|
+ common.If(v["subtype"] == nil, 0, common.If(IC.PushMapping.Subtype[common.ObjToString(v["subtype"])] > 0, IC.PushMapping.Subtype[common.ObjToString(v["subtype"])], 0).(int)),
|
|
|
|
+ subscopeclass,
|
|
|
|
+ common.Int64All(v["budget"]),
|
|
|
|
+ common.Int64All(v["bidamount"]),
|
|
|
|
+ attachment_count,
|
|
|
|
+ )
|
|
switch s.ModuleFlag {
|
|
switch s.ModuleFlag {
|
|
case EntnicheFlag:
|
|
case EntnicheFlag:
|
|
- pushInsert = append(pushInsert, entid, deptid, entUserId, common.InterfaceToStr(infoid), matchkey, now, 1, product)
|
|
|
|
|
|
+ pushInsert = append(pushInsert,
|
|
|
|
+ entUserId,
|
|
|
|
+ entid,
|
|
|
|
+ deptid,
|
|
|
|
+ 1,
|
|
|
|
+ product)
|
|
case MemberFlag:
|
|
case MemberFlag:
|
|
- pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now)
|
|
|
|
|
|
+ pushInsert = append(pushInsert,
|
|
|
|
+ spqp.UserId,
|
|
|
|
+ )
|
|
case SubVipFlag:
|
|
case SubVipFlag:
|
|
- pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 1)
|
|
|
|
|
|
+ pushInsert = append(pushInsert,
|
|
|
|
+ spqp.UserId,
|
|
|
|
+ 1,
|
|
|
|
+ )
|
|
case SubFreeFlag:
|
|
case SubFreeFlag:
|
|
- pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 0)
|
|
|
|
|
|
+ pushInsert = append(pushInsert,
|
|
|
|
+ spqp.UserId,
|
|
|
|
+ 0)
|
|
}
|
|
}
|
|
redis.Put("pushcache_2_a", redisKey, 1, 86400)
|
|
redis.Put("pushcache_2_a", redisKey, 1, 86400)
|
|
resultList[i] = s.InfoFormat(&PushCa{
|
|
resultList[i] = s.InfoFormat(&PushCa{
|