|
@@ -105,6 +105,7 @@ func (p *PushSet) ResetSubSet() {
|
|
|
if p.SubSet == nil {
|
|
|
return
|
|
|
}
|
|
|
+ //
|
|
|
if p.SubSet.RateMode == 0 || p.SubSet.RateMode == 5 {
|
|
|
p.SubSet.RateMode = 2
|
|
|
if len(p.SubSet.Times) == 0 {
|
|
@@ -114,6 +115,42 @@ func (p *PushSet) ResetSubSet() {
|
|
|
p.SubSet.Times = append(p.SubSet.Times, "09:00")
|
|
|
}
|
|
|
sort.Strings(p.SubSet.Times)
|
|
|
+ //
|
|
|
+ if p.EntInfo.RateMode == 0 || p.EntInfo.RateMode == 5 {
|
|
|
+ p.EntInfo.RateMode = 2
|
|
|
+ if len(p.EntInfo.Times) == 0 {
|
|
|
+ p.EntInfo.Times = append(p.EntInfo.Times, "09:00", "14:00")
|
|
|
+ }
|
|
|
+ } else if p.EntInfo.RateMode == 2 && len(p.EntInfo.Times) == 0 {
|
|
|
+ p.EntInfo.Times = append(p.EntInfo.Times, "09:00")
|
|
|
+ }
|
|
|
+ //
|
|
|
+ if p.NewprojectForecast.RateMode == 0 || p.NewprojectForecast.RateMode == 5 {
|
|
|
+ p.NewprojectForecast.RateMode = 2
|
|
|
+ if len(p.NewprojectForecast.Times) == 0 {
|
|
|
+ p.NewprojectForecast.Times = append(p.NewprojectForecast.Times, "09:00", "14:00")
|
|
|
+ }
|
|
|
+ } else if p.NewprojectForecast.RateMode == 2 && len(p.NewprojectForecast.Times) == 0 {
|
|
|
+ p.NewprojectForecast.Times = append(p.NewprojectForecast.Times, "09:00")
|
|
|
+ }
|
|
|
+ //
|
|
|
+ if p.FollowProject.RateMode == 0 || p.FollowProject.RateMode == 5 {
|
|
|
+ p.FollowProject.RateMode = 2
|
|
|
+ if len(p.FollowProject.Times) == 0 {
|
|
|
+ p.FollowProject.Times = append(p.FollowProject.Times, "09:00", "14:00")
|
|
|
+ }
|
|
|
+ } else if p.FollowProject.RateMode == 2 && len(p.FollowProject.Times) == 0 {
|
|
|
+ p.FollowProject.Times = append(p.FollowProject.Times, "09:00")
|
|
|
+ }
|
|
|
+ //
|
|
|
+ if p.FollowEnt.RateMode == 0 || p.FollowEnt.RateMode == 5 {
|
|
|
+ p.FollowEnt.RateMode = 2
|
|
|
+ if len(p.FollowEnt.Times) == 0 {
|
|
|
+ p.FollowEnt.Times = append(p.FollowEnt.Times, "09:00", "14:00")
|
|
|
+ }
|
|
|
+ } else if p.FollowEnt.RateMode == 2 && len(p.FollowEnt.Times) == 0 {
|
|
|
+ p.FollowEnt.Times = append(p.FollowEnt.Times, "09:00")
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
type PushSetChild struct {
|
|
@@ -192,13 +229,17 @@ func NewUserInfo(temp map[string]interface{}, tp int) *UserInfo {
|
|
|
// 解析用户的推送设置
|
|
|
func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
|
subSet, _ := obj["o_subset"].(map[string]interface{})
|
|
|
- times, _ := subSet["a_times"].([]interface{})
|
|
|
+ subSet_times, _ := subSet["a_times"].([]interface{})
|
|
|
weekReport, _ := obj["o_week_report"].(map[string]interface{})
|
|
|
monthReport, _ := obj["o_month_report"].(map[string]interface{})
|
|
|
newprojectForecast, _ := obj["o_newproject_forecast"].(map[string]interface{})
|
|
|
+ newprojectForecast_times, _ := newprojectForecast["a_times"].([]interface{})
|
|
|
entInfo, _ := obj["o_entinfo"].(map[string]interface{})
|
|
|
+ entInfo_times, _ := entInfo["a_times"].([]interface{})
|
|
|
followProject, _ := obj["o_follow_project"].(map[string]interface{})
|
|
|
+ followProject_times, _ := followProject["a_times"].([]interface{})
|
|
|
followEnt, _ := obj["o_follow_ent"].(map[string]interface{})
|
|
|
+ followEnt_times, _ := followEnt["a_times"].([]interface{})
|
|
|
u.PushSet = &PushSet{
|
|
|
Email: strings.TrimSpace(util.ObjToString(obj["s_email"])),
|
|
|
SubSet: &PushSetChild{
|
|
@@ -206,7 +247,7 @@ func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
|
AppPush: util.IntAllDef(subSet["i_apppush"], 0),
|
|
|
MailPush: util.IntAll(subSet["i_mailpush"]),
|
|
|
RateMode: util.IntAll(subSet["i_ratemode"]),
|
|
|
- Times: util.ObjArrToStringArr(times),
|
|
|
+ Times: util.ObjArrToStringArr(subSet_times),
|
|
|
Nomsgtip: util.IntAllDef(subSet["i_nomsgtip"], 1), //默认开启
|
|
|
},
|
|
|
WeekReport: &PushSetChild{
|
|
@@ -223,21 +264,29 @@ func (u *UserInfo) GetPushSet(obj map[string]interface{}) {
|
|
|
WxPush: util.IntAllDef(newprojectForecast["i_wxpush"], 1),
|
|
|
AppPush: util.IntAllDef(newprojectForecast["i_apppush"], 1),
|
|
|
MailPush: util.IntAll(newprojectForecast["i_mailpush"]),
|
|
|
+ RateMode: util.IntAll(subSet["i_ratemode"]),
|
|
|
+ Times: util.ObjArrToStringArr(newprojectForecast_times),
|
|
|
},
|
|
|
EntInfo: &PushSetChild{
|
|
|
WxPush: util.IntAllDef(entInfo["i_wxpush"], 1),
|
|
|
AppPush: util.IntAllDef(entInfo["i_apppush"], 1),
|
|
|
MailPush: util.IntAll(entInfo["i_mailpush"]),
|
|
|
+ RateMode: util.IntAll(entInfo["i_ratemode"]),
|
|
|
+ Times: util.ObjArrToStringArr(entInfo_times),
|
|
|
},
|
|
|
FollowProject: &PushSetChild{
|
|
|
WxPush: util.IntAllDef(followProject["i_wxpush"], 1),
|
|
|
AppPush: util.IntAllDef(followProject["i_apppush"], 1),
|
|
|
MailPush: util.IntAll(followProject["i_mailpush"]),
|
|
|
+ RateMode: util.IntAll(followProject["i_ratemode"]),
|
|
|
+ Times: util.ObjArrToStringArr(followProject_times),
|
|
|
},
|
|
|
FollowEnt: &PushSetChild{
|
|
|
WxPush: util.IntAllDef(followEnt["i_wxpush"], 1),
|
|
|
AppPush: util.IntAllDef(followEnt["i_apppush"], 1),
|
|
|
MailPush: util.IntAll(followEnt["i_mailpush"]),
|
|
|
+ RateMode: util.IntAll(followEnt["i_ratemode"]),
|
|
|
+ Times: util.ObjArrToStringArr(followEnt_times),
|
|
|
},
|
|
|
}
|
|
|
u.PushSet.ResetSubSet()
|