|
@@ -366,22 +366,10 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
if spqp.IsEnt {
|
|
if spqp.IsEnt {
|
|
if spqp.BuySubject == 1 {
|
|
if spqp.BuySubject == 1 {
|
|
//企业主体是企业的企业查询
|
|
//企业主体是企业的企业查询
|
|
- if spqp.UserType == SubVipFlag {
|
|
|
|
- userStr = fmt.Sprintf(" a.entid='%s' and (a.source > 1) and (a.product=1) ", spqp.EntId)
|
|
|
|
-
|
|
|
|
- } else if spqp.UserType == MemberFlag {
|
|
|
|
- userStr = fmt.Sprintf(" a.entid='%s' and (a.source>1) and (a.product=2) ", spqp.EntId)
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- userStr = fmt.Sprintf(" a.entid='%s' and (a.source>1) and (a.product<1) ", spqp.EntId)
|
|
|
|
- }
|
|
|
|
|
|
+ userStr = fmt.Sprintf(" a.entid='%s' and (a.source > 1) ", spqp.EntId)
|
|
} else {
|
|
} else {
|
|
//企业主体是个人的企业查询
|
|
//企业主体是个人的企业查询
|
|
- if s.ModuleFlag == EntnicheFlag {
|
|
|
|
- userStr = fmt.Sprintf(" a.entid='%s' and a.product < 1", spqp.EntId)
|
|
|
|
- } else {
|
|
|
|
- userStr = fmt.Sprintf(" a.entid='%s'", spqp.EntId)
|
|
|
|
- }
|
|
|
|
|
|
+ userStr = fmt.Sprintf(" a.entid='%s' ", spqp.EntId)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if spqp.BuySubject == 1 {
|
|
if spqp.BuySubject == 1 {
|
|
@@ -1522,11 +1510,13 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
|
|
if (*res)["a_items"] == nil {
|
|
if (*res)["a_items"] == nil {
|
|
return MapToarr(keyData)
|
|
return MapToarr(keyData)
|
|
}
|
|
}
|
|
-
|
|
|
|
//2、entniche_rule表, 企业订阅关键词查询条件: {i_entid:123,i_deptid:0},取 o_entniche.a_items
|
|
//2、entniche_rule表, 企业订阅关键词查询条件: {i_entid:123,i_deptid:0},取 o_entniche.a_items
|
|
res_, _ := IC.Mgo.FindOneByField("entniche_rule", map[string]interface{}{
|
|
res_, _ := IC.Mgo.FindOneByField("entniche_rule", map[string]interface{}{
|
|
- "i_deptid": map[string]interface{}{"$exists": 0},
|
|
|
|
- "i_entid": common.Int64All(spqp.EntId),
|
|
|
|
|
|
+ "i_deptid": map[string]interface{}{"$exists": false},
|
|
|
|
+ "i_userid": map[string]interface{}{
|
|
|
|
+ "$exists": false,
|
|
|
|
+ },
|
|
|
|
+ "i_entid": common.Int64All(spqp.EntId),
|
|
}, `{"o_entniche":1}`)
|
|
}, `{"o_entniche":1}`)
|
|
o_entniche := &map[string]interface{}{}
|
|
o_entniche := &map[string]interface{}{}
|
|
if res_ != nil {
|
|
if res_ != nil {
|
|
@@ -1560,8 +1550,11 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
|
|
} else {
|
|
} else {
|
|
//企业关键词查找
|
|
//企业关键词查找
|
|
res_, _ := IC.Mgo.FindOneByField("entniche_rule", map[string]interface{}{
|
|
res_, _ := IC.Mgo.FindOneByField("entniche_rule", map[string]interface{}{
|
|
- "i_deptid": map[string]interface{}{"$exists": 0},
|
|
|
|
- "i_entid": common.Int64All(spqp.EntId),
|
|
|
|
|
|
+ "i_deptid": map[string]interface{}{"$exists": false},
|
|
|
|
+ "i_userid": map[string]interface{}{
|
|
|
|
+ "$exists": false,
|
|
|
|
+ },
|
|
|
|
+ "i_entid": common.Int64All(spqp.EntId),
|
|
}, `{"o_entniche":1}`)
|
|
}, `{"o_entniche":1}`)
|
|
o_entniche := &map[string]interface{}{}
|
|
o_entniche := &map[string]interface{}{}
|
|
if res_ != nil {
|
|
if res_ != nil {
|
|
@@ -1633,13 +1626,18 @@ func MergeArray(dest []interface{}, src []interface{}) (result []interface{}) {
|
|
if v["notkey"] != nil {
|
|
if v["notkey"] != nil {
|
|
otkeyArr := common.ObjArrToStringArr(v["notkey"].([]interface{}))
|
|
otkeyArr := common.ObjArrToStringArr(v["notkey"].([]interface{}))
|
|
for _, keyV := range otkeyArr {
|
|
for _, keyV := range otkeyArr {
|
|
- notkey += fmt.Sprintf(",%s", common.InterfaceToStr(keyV))
|
|
|
|
|
|
+ if common.InterfaceToStr(keyV) != "" {
|
|
|
|
+ notkey += fmt.Sprintf(",%s", common.InterfaceToStr(keyV))
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if v["key"] != nil {
|
|
if v["key"] != nil {
|
|
keyArr := common.ObjArrToStringArr(v["key"].([]interface{}))
|
|
keyArr := common.ObjArrToStringArr(v["key"].([]interface{}))
|
|
for _, keyV := range keyArr {
|
|
for _, keyV := range keyArr {
|
|
- key += fmt.Sprintf(",%s", common.InterfaceToStr(keyV))
|
|
|
|
|
|
+ if common.InterfaceToStr(keyV) != "" {
|
|
|
|
+ key += fmt.Sprintf(",%s", common.InterfaceToStr(keyV))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if v["matchway"] != nil {
|
|
if v["matchway"] != nil {
|
|
@@ -1648,7 +1646,9 @@ func MergeArray(dest []interface{}, src []interface{}) (result []interface{}) {
|
|
if v["appendkey"] != nil {
|
|
if v["appendkey"] != nil {
|
|
appendkeyArr := common.ObjArrToStringArr(v["appendkey"].([]interface{}))
|
|
appendkeyArr := common.ObjArrToStringArr(v["appendkey"].([]interface{}))
|
|
for _, keyV := range appendkeyArr {
|
|
for _, keyV := range appendkeyArr {
|
|
- appendkey += fmt.Sprintf(",%s", common.InterfaceToStr(keyV))
|
|
|
|
|
|
+ if common.InterfaceToStr(keyV) != "" {
|
|
|
|
+ appendkey += fmt.Sprintf(",%s", common.InterfaceToStr(keyV))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
k := fmt.Sprintf("%s_____%s_____%s_____%s", notkey, key, matchway, appendkey)
|
|
k := fmt.Sprintf("%s_____%s_____%s_____%s", notkey, key, matchway, appendkey)
|