Browse Source

feat:业主监控

wangchuanjin 1 năm trước cách đây
mục cha
commit
56a397f2a5
2 tập tin đã thay đổi với 51 bổ sung0 xóa
  1. 18 0
      p/public.go
  2. 33 0
      p/struct.go

+ 18 - 0
p/public.go

@@ -775,3 +775,21 @@ func ResourceCenterPowers(msl *Mysql, positionId int64) map[string]bool {
 	}
 	return powers
 }
+
+//加载业主监控
+func LoadOwnerMonitor(mgo *MongodbSim, userId string) map[string]*OwnerMonitor {
+	result := map[string]*OwnerMonitor{}
+	list, _ := mgo.Find("follow_customer", map[string]interface{}{"userId": userId}, nil, `{"_id":1,"name":1,"date":1}`, false, -1, -1)
+	if list != nil {
+		for _, v := range *list {
+			name, _ := v["name"].(string)
+			date := util.Int64All(v["date"])
+			result[name] = &OwnerMonitor{
+				Id:         BsonIdToSId(v["_id"]),
+				EntName:    name,
+				CreateTime: date,
+			}
+		}
+	}
+	return result
+}

+ 33 - 0
p/struct.go

@@ -100,6 +100,7 @@ type PushSet struct {
 	EntInfo            *PushSetChild //企业情报监控-企业工商变动推送设置
 	FollowProject      *PushSetChild //项目进度监控推送设置
 	FollowEnt          *PushSetChild //企业情报监控-企业中标动态推送设置
+	OwnerMonitor       *PushSetChild //业主监控推送设置
 }
 
 func (p *PushSet) Reset() {
@@ -156,6 +157,16 @@ func (p *PushSet) Reset() {
 		p.FollowEnt.Times = append(p.FollowEnt.Times, "09:00")
 	}
 	sort.Strings(p.FollowEnt.Times)
+	//
+	if p.OwnerMonitor.RateMode < 1 || p.OwnerMonitor.RateMode > 4 {
+		p.OwnerMonitor.RateMode = 1
+		if len(p.OwnerMonitor.Times) == 0 {
+			p.OwnerMonitor.Times = append(p.OwnerMonitor.Times, "09:00", "14:00")
+		}
+	} else if p.OwnerMonitor.RateMode == 2 && len(p.OwnerMonitor.Times) == 0 {
+		p.OwnerMonitor.Times = append(p.OwnerMonitor.Times, "09:00")
+	}
+	sort.Strings(p.OwnerMonitor.Times)
 }
 
 type PushSetChild struct {
@@ -282,6 +293,8 @@ func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
 	followProject_times, _ := followProject["a_times"].([]interface{})
 	followEnt, _ := obj["o_follow_ent"].(map[string]interface{})
 	followEnt_times, _ := followEnt["a_times"].([]interface{})
+	ownerMonitor, _ := obj["o_owner_monitor"].(map[string]interface{})
+	ownerMonitor_times, _ := ownerMonitor["a_times"].([]interface{})
 	u.PushSet = &PushSet{
 		Email: strings.TrimSpace(util.ObjToString(obj["s_email"])),
 		SubSet: &PushSetChild{
@@ -330,6 +343,13 @@ func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
 			RateMode: util.IntAll(followEnt["i_ratemode"]),
 			Times:    util.ObjArrToStringArr(followEnt_times),
 		},
+		OwnerMonitor: &PushSetChild{
+			WxPush:   util.IntAllDef(ownerMonitor["i_wxpush"], 1),
+			AppPush:  util.IntAllDef(ownerMonitor["i_apppush"], 1),
+			MailPush: util.IntAll(ownerMonitor["i_mailpush"]),
+			RateMode: util.IntAll(ownerMonitor["i_ratemode"]),
+			Times:    util.ObjArrToStringArr(ownerMonitor_times),
+		},
 	}
 	u.PushSet.Reset()
 }
@@ -884,3 +904,16 @@ type BiddingInfo struct {
 	Toptype         string
 	Infotype        string
 }
+
+type OwnerMonitorInfo struct {
+	*UserInfo
+	OwnerMonitor []*OwnerMonitor //关注
+}
+
+//
+type OwnerMonitor struct {
+	Id         string    //关注id
+	EntName    string    //企业名称
+	CreateTime int64     //关注时间
+	Infos      CSortList //匹配上的信息
+}