|
@@ -11,7 +11,6 @@ import (
|
|
"bp.jydev.jianyu360.cn/BaseService/pushpkg/dfa"
|
|
"bp.jydev.jianyu360.cn/BaseService/pushpkg/dfa"
|
|
)
|
|
)
|
|
|
|
|
|
-//
|
|
|
|
type MgoConf struct {
|
|
type MgoConf struct {
|
|
Address string
|
|
Address string
|
|
Size int
|
|
Size int
|
|
@@ -23,12 +22,10 @@ type MgoConf struct {
|
|
ExperienceDbName string
|
|
ExperienceDbName string
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type RedisConf struct {
|
|
type RedisConf struct {
|
|
Address string
|
|
Address string
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type MysqlConf struct {
|
|
type MysqlConf struct {
|
|
DbName string
|
|
DbName string
|
|
Address string
|
|
Address string
|
|
@@ -38,7 +35,6 @@ type MysqlConf struct {
|
|
MaxIdleConns int
|
|
MaxIdleConns int
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type EsConf struct {
|
|
type EsConf struct {
|
|
Address string
|
|
Address string
|
|
Size int
|
|
Size int
|
|
@@ -47,19 +43,17 @@ type EsConf struct {
|
|
Password string
|
|
Password string
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type MemberService struct {
|
|
type MemberService struct {
|
|
IsBuy bool
|
|
IsBuy bool
|
|
Services map[int]*memberService
|
|
Services map[int]*memberService
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type memberService struct {
|
|
type memberService struct {
|
|
Id int
|
|
Id int
|
|
StartTime string
|
|
StartTime string
|
|
}
|
|
}
|
|
|
|
|
|
-//关键词
|
|
|
|
|
|
+// 关键词
|
|
type KeySet struct {
|
|
type KeySet struct {
|
|
Item string `json:"item"` //分类名称
|
|
Item string `json:"item"` //分类名称
|
|
Keys []string `json:"key"` //关键词
|
|
Keys []string `json:"key"` //关键词
|
|
@@ -70,7 +64,7 @@ type KeySet struct {
|
|
MatchWay int `json:"matchway"` //匹配模式 0:精准匹配 1:模糊匹配
|
|
MatchWay int `json:"matchway"` //匹配模式 0:精准匹配 1:模糊匹配
|
|
}
|
|
}
|
|
|
|
|
|
-//解析订阅词
|
|
|
|
|
|
+// 解析订阅词
|
|
type SubSet struct {
|
|
type SubSet struct {
|
|
MatchWay int //匹配方式 1-标题 2-正文
|
|
MatchWay int //匹配方式 1-标题 2-正文
|
|
Matchbuyerclass_other int //是否开启其他按钮
|
|
Matchbuyerclass_other int //是否开启其他按钮
|
|
@@ -94,7 +88,7 @@ type SubSet struct {
|
|
MaxMailSize int //邮件最大条数
|
|
MaxMailSize int //邮件最大条数
|
|
}
|
|
}
|
|
|
|
|
|
-//推送设置
|
|
|
|
|
|
+// 推送设置
|
|
type PushSet struct {
|
|
type PushSet struct {
|
|
Email string //邮箱
|
|
Email string //邮箱
|
|
SubSet *PushSetChild //订阅推送设置
|
|
SubSet *PushSetChild //订阅推送设置
|
|
@@ -127,9 +121,10 @@ type PushSetChild struct {
|
|
WxPush int //是否开启微信推送
|
|
WxPush int //是否开启微信推送
|
|
AppPush int //是否开启app推送
|
|
AppPush int //是否开启app推送
|
|
MailPush int //是否开启邮箱推送
|
|
MailPush int //是否开启邮箱推送
|
|
|
|
+ Nomsgtip int //是否开启无消息推送提醒
|
|
}
|
|
}
|
|
|
|
|
|
-//用户基本信息
|
|
|
|
|
|
+// 用户基本信息
|
|
type UserInfo struct {
|
|
type UserInfo struct {
|
|
Id string //mongoid
|
|
Id string //mongoid
|
|
BaseUserId int64 //mysql用户id
|
|
BaseUserId int64 //mysql用户id
|
|
@@ -193,7 +188,7 @@ func NewUserInfo(temp map[string]interface{}, tp int) *UserInfo {
|
|
return ui
|
|
return ui
|
|
}
|
|
}
|
|
|
|
|
|
-//解析用户的推送设置
|
|
|
|
|
|
+// 解析用户的推送设置
|
|
func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
subSet, _ := obj["o_subset"].(map[string]interface{})
|
|
subSet, _ := obj["o_subset"].(map[string]interface{})
|
|
times, _ := subSet["a_times"].([]interface{})
|
|
times, _ := subSet["a_times"].([]interface{})
|
|
@@ -203,6 +198,7 @@ func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
entInfo, _ := obj["o_entinfo"].(map[string]interface{})
|
|
entInfo, _ := obj["o_entinfo"].(map[string]interface{})
|
|
followProject, _ := obj["o_follow_project"].(map[string]interface{})
|
|
followProject, _ := obj["o_follow_project"].(map[string]interface{})
|
|
followEnt, _ := obj["o_follow_ent"].(map[string]interface{})
|
|
followEnt, _ := obj["o_follow_ent"].(map[string]interface{})
|
|
|
|
+
|
|
u.PushSet = &PushSet{
|
|
u.PushSet = &PushSet{
|
|
Email: strings.TrimSpace(util.ObjToString(obj["s_email"])),
|
|
Email: strings.TrimSpace(util.ObjToString(obj["s_email"])),
|
|
SubSet: &PushSetChild{
|
|
SubSet: &PushSetChild{
|
|
@@ -211,6 +207,7 @@ func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
MailPush: util.IntAll(subSet["i_mailpush"]),
|
|
MailPush: util.IntAll(subSet["i_mailpush"]),
|
|
RateMode: util.IntAll(subSet["i_ratemode"]),
|
|
RateMode: util.IntAll(subSet["i_ratemode"]),
|
|
Times: util.ObjArrToStringArr(times),
|
|
Times: util.ObjArrToStringArr(times),
|
|
|
|
+ Nomsgtip: util.IntAllDef(obj["i_nomsgtip"], 1), //默认开启
|
|
},
|
|
},
|
|
WeekReport: &PushSetChild{
|
|
WeekReport: &PushSetChild{
|
|
WxPush: util.IntAllDef(weekReport["i_wxpush"], 1),
|
|
WxPush: util.IntAllDef(weekReport["i_wxpush"], 1),
|
|
@@ -246,7 +243,7 @@ func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
u.PushSet.ResetSubSet()
|
|
u.PushSet.ResetSubSet()
|
|
}
|
|
}
|
|
|
|
|
|
-//解析用户的推送设置
|
|
|
|
|
|
+// 解析用户的推送设置
|
|
func (u *UserInfo) PushSetFilter() {
|
|
func (u *UserInfo) PushSetFilter() {
|
|
if u.Subscribe == 0 || u.S_m_openid == "" {
|
|
if u.Subscribe == 0 || u.S_m_openid == "" {
|
|
if u.PushSet.SubSet != nil {
|
|
if u.PushSet.SubSet != nil {
|
|
@@ -327,7 +324,7 @@ func (u *UserInfo) PushSetFilter() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//解析用户的订阅设置
|
|
|
|
|
|
+// 解析用户的订阅设置
|
|
func (u *UserInfo) GetSubSet(isFreeUser bool, userId string, obj map[string]interface{}) {
|
|
func (u *UserInfo) GetSubSet(isFreeUser bool, userId string, obj map[string]interface{}) {
|
|
subSet := &SubSet{
|
|
subSet := &SubSet{
|
|
Keys: []string{},
|
|
Keys: []string{},
|
|
@@ -483,7 +480,7 @@ func (u *UserInfo) GetSubSet(isFreeUser bool, userId string, obj map[string]inte
|
|
u.SubSet = subSet
|
|
u.SubSet = subSet
|
|
}
|
|
}
|
|
|
|
|
|
-//得到用户的关键词
|
|
|
|
|
|
+// 得到用户的关键词
|
|
func (u *UserInfo) GetKeySets(a_key interface{}) ([]*KeySet, error) {
|
|
func (u *UserInfo) GetKeySets(a_key interface{}) ([]*KeySet, error) {
|
|
var keySets []*KeySet
|
|
var keySets []*KeySet
|
|
if a_key == nil {
|
|
if a_key == nil {
|
|
@@ -517,7 +514,6 @@ func (u *UserInfo) GetKeySets(a_key interface{}) ([]*KeySet, error) {
|
|
return keySets, err
|
|
return keySets, err
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type Entniche struct {
|
|
type Entniche struct {
|
|
EntId int //企业id
|
|
EntId int //企业id
|
|
EntName string //企业名称
|
|
EntName string //企业名称
|
|
@@ -535,7 +531,7 @@ type Entniche struct {
|
|
DisVip int //分发-大会员
|
|
DisVip int //分发-大会员
|
|
}
|
|
}
|
|
|
|
|
|
-//用户基本信息-扩展
|
|
|
|
|
|
+// 用户基本信息-扩展
|
|
type UserInfoExtend struct {
|
|
type UserInfoExtend struct {
|
|
CreateTime int64 //
|
|
CreateTime int64 //
|
|
Size int
|
|
Size int
|
|
@@ -550,7 +546,7 @@ func (u *UserInfo) Add(k string, m *map[string]map[*UserInfo]bool) {
|
|
(*m)[k] = mk
|
|
(*m)[k] = mk
|
|
}
|
|
}
|
|
|
|
|
|
-//添加信息类型映射关系
|
|
|
|
|
|
+// 添加信息类型映射关系
|
|
func (u *UserInfo) AddSbuype(m *map[string]map[*UserInfo]bool) {
|
|
func (u *UserInfo) AddSbuype(m *map[string]map[*UserInfo]bool) {
|
|
if len(u.SubSet.Subtypes) == 0 {
|
|
if len(u.SubSet.Subtypes) == 0 {
|
|
u.Add("", m)
|
|
u.Add("", m)
|
|
@@ -561,7 +557,7 @@ func (u *UserInfo) AddSbuype(m *map[string]map[*UserInfo]bool) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//添加采购单位类型映射关系
|
|
|
|
|
|
+// 添加采购单位类型映射关系
|
|
func (u *UserInfo) AddBuyerclass(m *map[string]map[*UserInfo]bool) {
|
|
func (u *UserInfo) AddBuyerclass(m *map[string]map[*UserInfo]bool) {
|
|
//如果有关键词 有采购单位行业,行业加上“其它”
|
|
//如果有关键词 有采购单位行业,行业加上“其它”
|
|
if len(u.SubSet.Buyerclasss) == 0 {
|
|
if len(u.SubSet.Buyerclasss) == 0 {
|
|
@@ -576,7 +572,7 @@ func (u *UserInfo) AddBuyerclass(m *map[string]map[*UserInfo]bool) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//添加区域映射关系
|
|
|
|
|
|
+// 添加区域映射关系
|
|
func (u *UserInfo) AddArea(m *map[string]map[*UserInfo]bool) {
|
|
func (u *UserInfo) AddArea(m *map[string]map[*UserInfo]bool) {
|
|
if len(u.SubSet.Areas) == 0 {
|
|
if len(u.SubSet.Areas) == 0 {
|
|
u.Add("", m)
|
|
u.Add("", m)
|
|
@@ -587,7 +583,7 @@ func (u *UserInfo) AddArea(m *map[string]map[*UserInfo]bool) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//添加区域城市映射关系
|
|
|
|
|
|
+// 添加区域城市映射关系
|
|
func (u *UserInfo) AddAreaCity(area, city *map[string]map[*UserInfo]bool) {
|
|
func (u *UserInfo) AddAreaCity(area, city *map[string]map[*UserInfo]bool) {
|
|
if len(u.SubSet.Area) == 0 {
|
|
if len(u.SubSet.Area) == 0 {
|
|
u.Add("", area)
|
|
u.Add("", area)
|
|
@@ -612,7 +608,7 @@ func (u *UserInfo) AddAreaCity(area, city *map[string]map[*UserInfo]bool) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//把用户挂在词下面
|
|
|
|
|
|
+// 把用户挂在词下面
|
|
func (u *UserInfo) MakeKeyUser(keys []string, key_user *map[string]*[]*UserInfo) {
|
|
func (u *UserInfo) MakeKeyUser(keys []string, key_user *map[string]*[]*UserInfo) {
|
|
mp := map[string]bool{}
|
|
mp := map[string]bool{}
|
|
for _, key := range keys {
|
|
for _, key := range keys {
|
|
@@ -678,7 +674,7 @@ type KeyDfa struct {
|
|
Notkey_user *map[string]*[]*UserInfo
|
|
Notkey_user *map[string]*[]*UserInfo
|
|
}
|
|
}
|
|
|
|
|
|
-//所有用户的关键词和排除词
|
|
|
|
|
|
+// 所有用户的关键词和排除词
|
|
func (p *KeyDfa) CreateDaf() {
|
|
func (p *KeyDfa) CreateDaf() {
|
|
//关键词
|
|
//关键词
|
|
p.Key = &dfa.DFA{}
|
|
p.Key = &dfa.DFA{}
|
|
@@ -696,25 +692,22 @@ func (p *KeyDfa) CreateDaf() {
|
|
p.NotKey.AddWord(notKeys...)
|
|
p.NotKey.AddWord(notKeys...)
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type MatchUser struct {
|
|
type MatchUser struct {
|
|
Keys []string
|
|
Keys []string
|
|
MatchWays []string
|
|
MatchWays []string
|
|
MatchWay map[string]bool
|
|
MatchWay map[string]bool
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type RelationProjectUser struct {
|
|
type RelationProjectUser struct {
|
|
TopTypes []string
|
|
TopTypes []string
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type PushInfo struct {
|
|
type PushInfo struct {
|
|
Ids []interface{}
|
|
Ids []interface{}
|
|
Info map[string]interface{}
|
|
Info map[string]interface{}
|
|
}
|
|
}
|
|
|
|
|
|
-//推送返回结果
|
|
|
|
|
|
+// 推送返回结果
|
|
type PushResult struct {
|
|
type PushResult struct {
|
|
WxStatus int
|
|
WxStatus int
|
|
AppStatus int
|
|
AppStatus int
|
|
@@ -723,7 +716,6 @@ type PushResult struct {
|
|
Infos *SortList
|
|
Infos *SortList
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type PushParam struct {
|
|
type PushParam struct {
|
|
JpushTitle string
|
|
JpushTitle string
|
|
LastInfoDate int64
|
|
LastInfoDate int64
|
|
@@ -736,7 +728,6 @@ type PushParam struct {
|
|
IsPush bool
|
|
IsPush bool
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
type BiddingInfo struct {
|
|
type BiddingInfo struct {
|
|
Id string
|
|
Id string
|
|
Title string
|
|
Title string
|
|
@@ -757,7 +748,7 @@ type BiddingInfo struct {
|
|
Infotype string
|
|
Infotype string
|
|
}
|
|
}
|
|
|
|
|
|
-//身份信息
|
|
|
|
|
|
+// 身份信息
|
|
type IdentityInfo struct {
|
|
type IdentityInfo struct {
|
|
Name string
|
|
Name string
|
|
PersonId int64
|
|
PersonId int64
|