|
@@ -7,6 +7,7 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
@@ -113,7 +114,7 @@ func (l *BusinessIntelligence) MeMonitoring() {
|
|
|
userId := gconv.String(l.GetSession("userId"))
|
|
|
rData := func() interface{} {
|
|
|
data := make(map[string]int64)
|
|
|
- for _, s := range []string{"claimCount", "collectCount", "projectFollowCount", "entFollowCount"} {
|
|
|
+ for _, s := range []string{"claimCount", "collectCount", "projectFollowCount", "entFollowCount", "ownerMonitoring"} {
|
|
|
l.MeListCount(s, userId, data)
|
|
|
}
|
|
|
return data
|
|
@@ -138,28 +139,114 @@ func (l *BusinessIntelligence) MeListCount(classify string, userid string, data
|
|
|
case "collectCount": //收藏
|
|
|
isPay := Power(l.Session())
|
|
|
maxCount := qutil.If(isPay, config.Config.PayUserCollLimit, config.Config.FreeUserCollLimit).(int64)
|
|
|
- allCount := db.Base.CountBySql(fmt.Sprintf(`select count(*) from jianyu.bdcollection where userid ='%s'`, userid))
|
|
|
- count = qutil.If(allCount > maxCount, maxCount, allCount).(int64)
|
|
|
+ if maxCount > 0 {
|
|
|
+ allCount := db.Base.CountBySql(fmt.Sprintf(`select count(*) from jianyu.bdcollection where userid ='%s'`, userid))
|
|
|
+ count = qutil.If(allCount > maxCount, maxCount, allCount).(int64)
|
|
|
+ }
|
|
|
return
|
|
|
case "projectFollowCount": //项目关注
|
|
|
followProjectManager, err := entity.CreateProjectFollowManager(l.Session())
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- allCount := db.Base.CountBySql(`select count(*) from follow_project_monitor where s_userid= ?`, userid)
|
|
|
maxNum := gconv.Int64(followProjectManager.MaxNum)
|
|
|
- count = qutil.If(allCount > maxNum, maxNum, allCount).(int64)
|
|
|
+ if maxNum > 0 {
|
|
|
+ allCount := db.Base.CountBySql(`select count(*) from follow_project_monitor where s_userid= ?`, userid)
|
|
|
+ count = qutil.If(allCount > maxNum, maxNum, allCount).(int64)
|
|
|
+ }
|
|
|
return
|
|
|
case "entFollowCount": //企业关注
|
|
|
followEntManager, err := entity.CreateEntFollowManager(l.Session())
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- allCount := db.Base.CountBySql(fmt.Sprintf(`SELECT count(*) FROM follow_ent_monitor WHERE s_userid="%s" `, userid))
|
|
|
maxNum := gconv.Int64(followEntManager.MaxNum)
|
|
|
- count = qutil.If(allCount > maxNum, maxNum, allCount).(int64)
|
|
|
+ if maxNum > 0 {
|
|
|
+ allCount := db.Base.CountBySql(fmt.Sprintf(`SELECT count(*) FROM follow_ent_monitor WHERE s_userid="%s" `, userid))
|
|
|
+ count = qutil.If(allCount > maxNum, maxNum, allCount).(int64)
|
|
|
+ }
|
|
|
return
|
|
|
+ case "ownerMonitoring":
|
|
|
+ userInfo := jy.GetBigVipUserBaseMsg(l.Session(), *config.Middleground)
|
|
|
+ userid = qutil.If(userInfo.Pid != "", userInfo.Pid, userid).(string)
|
|
|
+ userSession := util.GetUserBaseInfo(l.Session())
|
|
|
+ BigMsg := config.Middleground.PowerCheckCenter.Check("10000", userSession.MgoUserId, userSession.BaseUserId, userSession.AccountId, userSession.EntId, userSession.PositionType, userSession.PositionId)
|
|
|
+ maxCount, _ := getCustomerLimit(BigMsg)
|
|
|
+ if maxCount > 0 {
|
|
|
+ allCount := db.Mgo.Count("follow_customer", map[string]interface{}{
|
|
|
+ "userId": userid,
|
|
|
+ })
|
|
|
+ count = qutil.Int64All(qutil.If(allCount > maxCount, maxCount, allCount))
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 获取关注项目数量限制
|
|
|
+// limitStatus 1 -超级订阅用户 2-非超级订阅(例如:大会员、新老版商机管理、企业管理服务用户)
|
|
|
+func getCustomerLimit(userInfo *powercheck.CheckResp) (count int, limitStatus int) {
|
|
|
+ if userInfo.Free.IsFree {
|
|
|
+ return config.Config.FollowCustomer.Free, 0
|
|
|
+ }
|
|
|
+ limitStatus = 2
|
|
|
+ // 大会员
|
|
|
+ if userInfo.Member.Status > 0 {
|
|
|
+ //P303 业主监控 老版大会员权限调整2024.2.4 发版之前的大会员
|
|
|
+ if userInfo.Member.StartTime < 1707051600 {
|
|
|
+ for i := 0; i < len(userInfo.Member.MemberPowerList); i++ {
|
|
|
+ if userInfo.Member.MemberPowerList[i] == 7 {
|
|
|
+ userInfo.Member.MemberPowerList = append(userInfo.Member.MemberPowerList, 25) //业主监控专家版500
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var flag bool
|
|
|
+ for i := 0; i < len(userInfo.Member.MemberPowerList); i++ {
|
|
|
+ serviceId := userInfo.Member.MemberPowerList[i]
|
|
|
+ if c, b := config.Config.FollowCustomer.Member[fmt.Sprintf("%v", serviceId)]; b {
|
|
|
+ count = c
|
|
|
+ flag = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if !flag {
|
|
|
+ count = config.Config.FollowCustomer.Member["default"]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 商机管理
|
|
|
+ if userInfo.Entniche.Status > 0 && userInfo.Entniche.PowerSource < 1 {
|
|
|
+ // 新商机管理
|
|
|
+ if userInfo.Entniche.IsNew > 0 {
|
|
|
+ if config.Config.FollowCustomer.Ent.New > count {
|
|
|
+ count = config.Config.FollowCustomer.Ent.New
|
|
|
+ }
|
|
|
+ } else if config.Config.FollowCustomer.Ent.Old > count {
|
|
|
+ // 旧商机管理
|
|
|
+ count = config.Config.FollowCustomer.Ent.Old
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 企业服务
|
|
|
+ if userInfo.Entniche.Status > 0 && userInfo.Entniche.PowerSource > 0 {
|
|
|
+ if config.Config.FollowCustomer.EntService > count {
|
|
|
+ count = config.Config.FollowCustomer.EntService
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 超级订阅
|
|
|
+ if userInfo.Vip.Status > 0 {
|
|
|
+ // 新超级订阅
|
|
|
+ if userInfo.Vip.Upgrade > 0 {
|
|
|
+ if config.Config.FollowCustomer.Vip.New > count {
|
|
|
+ limitStatus = 1
|
|
|
+ count = config.Config.FollowCustomer.Vip.New
|
|
|
+ }
|
|
|
+ } else if config.Config.FollowCustomer.Vip.Old > count {
|
|
|
+ // 旧超级订阅
|
|
|
+ limitStatus = 1
|
|
|
+ count = config.Config.FollowCustomer.Vip.Old
|
|
|
+ }
|
|
|
}
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
// 是否是付费用户 -bool: true:是 fasle:不是
|