|
@@ -18,18 +18,17 @@ import (
|
|
|
|
|
|
type SubscribePush struct {
|
|
|
*xweb.Action
|
|
|
- hasPushHistory xweb.Mapper `xweb:"/subscribe/historyPush"` //推送历史查询
|
|
|
- historyPaging xweb.Mapper `xweb:"/subscribe/historyPaging"` //推送历史翻页
|
|
|
- setRead xweb.Mapper `xweb:"/subscribe/setRead"` //推送记录已读
|
|
|
- keywordUpdate xweb.Mapper `xweb:"/subscribe/keywordUpdate"` //订阅词修改
|
|
|
- pushSetting xweb.Mapper `xweb:"/subscribe/pushSetting"` //推送设置
|
|
|
- vipSwitch xweb.Mapper `xweb:"/subscribe/vipSwitch"` //大会员、超级订阅切换
|
|
|
-
|
|
|
+ hasPushHistory xweb.Mapper `xweb:"/subscribe/historyPush"` //推送历史查询
|
|
|
+ historyPaging xweb.Mapper `xweb:"/subscribe/historyPaging"` //推送历史翻页
|
|
|
+ setRead xweb.Mapper `xweb:"/subscribe/setRead"` //推送记录已读
|
|
|
+ keywordUpdate xweb.Mapper `xweb:"/subscribe/keywordUpdate"` //订阅词修改
|
|
|
+ pushSetting xweb.Mapper `xweb:"/subscribe/pushSetting"` //推送设置
|
|
|
+ vipSwitch xweb.Mapper `xweb:"/subscribe/vipSwitch"` //大会员、超级订阅切换
|
|
|
getPushCount xweb.Mapper `xweb:"/subscribe/keyset/getPushCount"` //近3个月匹配数量【某组关键词】
|
|
|
getPushAllCount xweb.Mapper `xweb:"/subscribe/getPushAllCount"` //全部关键词-推送结果预览总数
|
|
|
}
|
|
|
|
|
|
-//VipSwitch 大会员、超级订阅切换
|
|
|
+//VipSwitch 大会员、超级订阅、商机管理切换
|
|
|
func (sp *SubscribePush) VipSwitch() {
|
|
|
userId, _ := sp.GetSession("userId").(string)
|
|
|
rData, errMsg := func() (interface{}, error) {
|
|
@@ -39,7 +38,7 @@ func (sp *SubscribePush) VipSwitch() {
|
|
|
switchOk := false
|
|
|
vt := sp.GetString("vt")
|
|
|
if vt == "" {
|
|
|
- jy.SwitchService.Get(sp.Session(), db.Mgo)
|
|
|
+ jy.SwitchService.GetEntniche(sp.Session(), db.Mgo,db.Mysql)
|
|
|
} else if vt == jy.SubVipFlag {
|
|
|
vipMsg := jy.GetBigVipUserBaseMsg(userId, db.Mysql, db.Mgo)
|
|
|
if vipMsg.VipStatus <= 0 {
|
|
@@ -54,6 +53,13 @@ func (sp *SubscribePush) VipSwitch() {
|
|
|
}
|
|
|
sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
|
|
|
switchOk = true
|
|
|
+ } else if vt == jy.EntnicheFlag {
|
|
|
+ vipMsg := jy.GetBigVipUserBaseMsg(userId, db.Mysql, db.Mgo)
|
|
|
+ if vipMsg.EntnicheStatus <= 0 {
|
|
|
+ return nil, fmt.Errorf("未购买商机管理")
|
|
|
+ }
|
|
|
+ sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
|
|
|
+ switchOk = true
|
|
|
} else {
|
|
|
return nil, fmt.Errorf("未知请求")
|
|
|
}
|
|
@@ -68,7 +74,7 @@ func (sp *SubscribePush) VipSwitch() {
|
|
|
sp.ServeJson(NewResult(rData, errMsg))
|
|
|
}
|
|
|
|
|
|
-//HasPushHistory 大会员、超级订阅推送历史 (原wx推送更改)
|
|
|
+//HasPushHistory 大会员、超级订阅,商机管理推送历史 (原wx推送更改)
|
|
|
func (sp *SubscribePush) HasPushHistory() {
|
|
|
userId := util.ObjToString(sp.GetSession("userId"))
|
|
|
if userId == "" {
|
|
@@ -76,7 +82,10 @@ func (sp *SubscribePush) HasPushHistory() {
|
|
|
}
|
|
|
vipType := sp.GetString("vt")
|
|
|
if vipType == "" { //默认取已切换的企业
|
|
|
- vipType = jy.SwitchService.Get(sp.Session(), db.Mgo)
|
|
|
+ vipType = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo,db.Mysql)
|
|
|
+ }
|
|
|
+ if vipType==jy.SwitchService.Entniche{
|
|
|
+ userId = util.ObjToString(sp.GetSession("entUserId"))
|
|
|
}
|
|
|
go entity.HistoryPush.UpdateUserPushUnread(userId, vipType)
|
|
|
user, _ := jy.NewSubscribePush().UserInfo(db.Mgo, userId)
|
|
@@ -121,6 +130,7 @@ func (sp *SubscribePush) HasPushHistory() {
|
|
|
isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 150
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//推送记录查询
|
|
|
pageNum, _ := sp.GetInteger("pageNum")
|
|
|
spqp := &jy.SubPushQueryParam{
|
|
@@ -139,6 +149,8 @@ func (sp *SubscribePush) HasPushHistory() {
|
|
|
}
|
|
|
if vipType == jy.SwitchService.Member {
|
|
|
spqp.PushMysql = db.MysqlMemberPush
|
|
|
+ } else if vipType == jy.SwitchService.Entniche {
|
|
|
+ spqp.PushMysql = db.MysqlEntnichePush
|
|
|
} else {
|
|
|
spqp.PushMysql = db.MysqlPush
|
|
|
}
|
|
@@ -191,6 +203,9 @@ func (sp *SubscribePush) HistoryPaging() {
|
|
|
if vipType == "" { //默认取已切换的企业
|
|
|
vipType = jy.SwitchService.Get(sp.Session(), db.Mgo)
|
|
|
}
|
|
|
+ if vipType==jy.SwitchService.Entniche{
|
|
|
+ userId = util.ObjToString(sp.GetSession("entUserId"))
|
|
|
+ }
|
|
|
pageNum, _ := sp.GetInteger("pageNum")
|
|
|
PageSize, _ := sp.GetInteger("pageSize")
|
|
|
if pageNum == 1 {
|
|
@@ -213,6 +228,8 @@ func (sp *SubscribePush) HistoryPaging() {
|
|
|
}
|
|
|
if vipType == jy.SwitchService.Member {
|
|
|
spqp.PushMysql = db.MysqlMemberPush
|
|
|
+ } else if vipType == jy.SwitchService.Entniche {
|
|
|
+ spqp.PushMysql = db.MysqlEntnichePush
|
|
|
} else {
|
|
|
spqp.PushMysql = db.MysqlPush
|
|
|
}
|