|
@@ -245,13 +245,70 @@ func GetKeySets(a_key interface{}) ([]*KeySet, error) {
|
|
|
return keySets, err
|
|
|
}
|
|
|
|
|
|
-//解析用户的订阅词
|
|
|
-func GetSubSet(isFreeUser bool, userId string, obj map[string]interface{}) *SubSet {
|
|
|
- mailpush := util.IntAll(obj["i_mailpush"])
|
|
|
- email := strings.TrimSpace(util.ObjToString(obj["s_email"]))
|
|
|
- if mailpush == 1 && !MailReg.MatchString(email) {
|
|
|
- mailpush = -1
|
|
|
+//解析用户的推送设置
|
|
|
+func GetPushSet(userId string, obj map[string]interface{}) *PushSet {
|
|
|
+ subSet, _ := obj["o_subset"].(map[string]interface{})
|
|
|
+ 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{})
|
|
|
+ entInfo, _ := obj["o_entinfo"].(map[string]interface{})
|
|
|
+ followProject, _ := obj["o_follow_project"].(map[string]interface{})
|
|
|
+ followEnt, _ := obj["o_follow_ent"].(map[string]interface{})
|
|
|
+ pushSet := &PushSet{
|
|
|
+ Email: strings.TrimSpace(util.ObjToString(obj["s_email"])),
|
|
|
+ SubSet: &PushSetChild{
|
|
|
+ WxPush: util.IntAllDef(subSet["i_wxpush"], 1),
|
|
|
+ AppPush: util.IntAllDef(subSet["i_apppush"], 1),
|
|
|
+ MailPush: util.IntAll(subSet["i_mailpush"]),
|
|
|
+ RateMode: util.IntAllDef(subSet["i_ratemode"], 5),
|
|
|
+ Times: util.ObjArrToStringArr(times),
|
|
|
+ },
|
|
|
+ WeekReport: &PushSetChild{
|
|
|
+ WxPush: util.IntAllDef(weekReport["i_wxpush"], 1),
|
|
|
+ AppPush: util.IntAllDef(weekReport["i_apppush"], 1),
|
|
|
+ MailPush: util.IntAll(weekReport["i_mailpush"]),
|
|
|
+ },
|
|
|
+ MonthReport: &PushSetChild{
|
|
|
+ WxPush: util.IntAllDef(monthReport["i_wxpush"], 1),
|
|
|
+ AppPush: util.IntAllDef(monthReport["i_apppush"], 1),
|
|
|
+ MailPush: util.IntAll(monthReport["i_mailpush"]),
|
|
|
+ },
|
|
|
+ NewprojectForecast: &PushSetChild{
|
|
|
+ WxPush: util.IntAllDef(newprojectForecast["i_wxpush"], 1),
|
|
|
+ AppPush: util.IntAllDef(newprojectForecast["i_apppush"], 1),
|
|
|
+ MailPush: util.IntAll(newprojectForecast["i_mailpush"]),
|
|
|
+ },
|
|
|
+ EntInfo: &PushSetChild{
|
|
|
+ WxPush: util.IntAllDef(entInfo["i_wxpush"], 1),
|
|
|
+ AppPush: util.IntAllDef(entInfo["i_apppush"], 1),
|
|
|
+ MailPush: util.IntAll(entInfo["i_mailpush"]),
|
|
|
+ },
|
|
|
+ FollowProject: &PushSetChild{
|
|
|
+ WxPush: util.IntAllDef(followProject["i_wxpush"], 1),
|
|
|
+ AppPush: util.IntAllDef(followProject["i_apppush"], 1),
|
|
|
+ MailPush: util.IntAll(followProject["i_mailpush"]),
|
|
|
+ },
|
|
|
+ FollowEnt: &PushSetChild{
|
|
|
+ WxPush: util.IntAllDef(followEnt["i_wxpush"], 1),
|
|
|
+ AppPush: util.IntAllDef(followEnt["i_apppush"], 1),
|
|
|
+ MailPush: util.IntAll(followEnt["i_mailpush"]),
|
|
|
+ },
|
|
|
+ }
|
|
|
+ if !MailReg.MatchString(pushSet.Email) {
|
|
|
+ pushSet.SubSet.MailPush = -1
|
|
|
+ pushSet.WeekReport.MailPush = -1
|
|
|
+ pushSet.MonthReport.MailPush = -1
|
|
|
+ pushSet.NewprojectForecast.MailPush = -1
|
|
|
+ pushSet.EntInfo.MailPush = -1
|
|
|
+ pushSet.FollowProject.MailPush = -1
|
|
|
+ pushSet.FollowEnt.MailPush = -1
|
|
|
}
|
|
|
+ return pushSet
|
|
|
+}
|
|
|
+
|
|
|
+//解析用户的订阅设置
|
|
|
+func GetSubSet(isFreeUser bool, userId string, obj map[string]interface{}) *SubSet {
|
|
|
subSet := &SubSet{
|
|
|
Keys: []string{},
|
|
|
Notkeys: []string{},
|
|
@@ -263,14 +320,9 @@ func GetSubSet(isFreeUser bool, userId string, obj map[string]interface{}) *SubS
|
|
|
Areas: []string{},
|
|
|
Subtypes: []string{},
|
|
|
Buyerclasss: []string{},
|
|
|
- WxPush: util.IntAllDef(obj["i_wxpush"], 1),
|
|
|
- AppPush: util.IntAllDef(obj["i_apppush"], 1),
|
|
|
- MailPush: mailpush,
|
|
|
- Email: email,
|
|
|
MatchWay: util.IntAllDef(obj["i_matchway"], 1),
|
|
|
Matchbuyerclass_other: util.IntAllDef(obj["i_matchbuyerclass_other"], 1),
|
|
|
ProjectMatch: util.IntAll(obj["i_projectmatch"]),
|
|
|
- RateMode: util.IntAllDef(obj["i_ratemode"], 2),
|
|
|
MaxPushSize: util.IntAll(obj["i_maxpushsize"]),
|
|
|
MaxMailSize: util.IntAll(obj["i_maxmailsize"]),
|
|
|
}
|