|
@@ -1,111 +1,111 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
- "jy/src/jfw/modules/publicapply/src/config"
|
|
|
- "jy/src/jfw/modules/publicapply/src/subscribePush/entity"
|
|
|
- "log"
|
|
|
- "regexp"
|
|
|
- "strings"
|
|
|
+ "jy/src/jfw/modules/publicapply/src/config"
|
|
|
+ "jy/src/jfw/modules/publicapply/src/subscribePush/entity"
|
|
|
+ "log"
|
|
|
+ "regexp"
|
|
|
+ "strings"
|
|
|
|
|
|
- qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
- "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"
|
|
|
+ qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "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"
|
|
|
)
|
|
|
|
|
|
type Subscribe struct {
|
|
|
- *xweb.Action
|
|
|
- update xweb.Mapper `xweb:"/subscribe/update"` //订阅修改
|
|
|
- setUserInfo xweb.Mapper `xweb:"/subscribe/setUserInfo"` //各种修改【关键词、关键词匹配方式、信息类型、项目匹配】
|
|
|
- session *httpsession.Session
|
|
|
+ *xweb.Action
|
|
|
+ update xweb.Mapper `xweb:"/subscribe/update"` //订阅修改
|
|
|
+ setUserInfo xweb.Mapper `xweb:"/subscribe/setUserInfo"` //各种修改【关键词、关键词匹配方式、信息类型、项目匹配】
|
|
|
+ session *httpsession.Session
|
|
|
}
|
|
|
|
|
|
// 大会员、超级订阅订阅修改
|
|
|
func (s *Subscribe) Update() {
|
|
|
- userId := qutil.ObjToString(s.GetSession("userId"))
|
|
|
- ent_id := qutil.IntAll(s.GetSession("entId"))
|
|
|
- entUserId := qutil.IntAll(s.GetSession("entUserId"))
|
|
|
- vSwitch := s.GetString("vSwitch")
|
|
|
- if vSwitch == "" {
|
|
|
- vSwitch = jy.SwitchService.Get(s.Session(), *config.Middleground) //v:vip m:member
|
|
|
- }
|
|
|
- sub := &entity.SubscribeSet{
|
|
|
- Area: *qutil.ObjToMap(s.GetString("area")),
|
|
|
- Industry: strings.Split(s.GetString("industry"), ","),
|
|
|
- UserId: userId,
|
|
|
- Type: vSwitch,
|
|
|
- EntId: ent_id,
|
|
|
- EntUserId: entUserId,
|
|
|
- Session: s.Session(),
|
|
|
- District: *qutil.ObjToMap(s.GetString("district")),
|
|
|
- }
|
|
|
- r := sub.SetAreaAndIndustry()
|
|
|
- if r.Err != nil {
|
|
|
- log.Printf("%s SaveChange err:%v\n", userId, r.Err.Error())
|
|
|
- }
|
|
|
- s.ServeJson(r.Format())
|
|
|
+ userId := qutil.ObjToString(s.GetSession("userId"))
|
|
|
+ ent_id := qutil.IntAll(s.GetSession("entId"))
|
|
|
+ entUserId := qutil.IntAll(s.GetSession("entUserId"))
|
|
|
+ vSwitch := s.GetString("vSwitch")
|
|
|
+ if vSwitch == "" {
|
|
|
+ vSwitch = jy.SwitchService.Get(s.Session(), *config.Middleground) //v:vip m:member
|
|
|
+ }
|
|
|
+ sub := &entity.SubscribeSet{
|
|
|
+ Area: *qutil.ObjToMap(s.GetString("area")),
|
|
|
+ Industry: strings.Split(s.GetString("industry"), ","),
|
|
|
+ UserId: userId,
|
|
|
+ Type: vSwitch,
|
|
|
+ EntId: ent_id,
|
|
|
+ EntUserId: entUserId,
|
|
|
+ Session: s.Session(),
|
|
|
+ District: *qutil.ObjToMap(s.GetString("district")),
|
|
|
+ }
|
|
|
+ r := sub.SetAreaAndIndustry()
|
|
|
+ if r.Err != nil {
|
|
|
+ log.Printf("%s SaveChange err:%v\n", userId, r.Err.Error())
|
|
|
+ }
|
|
|
+ s.ServeJson(r.Format())
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
- Rx = regexp.MustCompile("\n+")
|
|
|
+ Rx = regexp.MustCompile("\n+")
|
|
|
)
|
|
|
|
|
|
// 关键词、关键词匹配方式、信息类型、项目匹配
|
|
|
func (s *Subscribe) SetUserInfo() {
|
|
|
- r := map[string]interface{}{}
|
|
|
- userId := qutil.ObjToString(s.GetSession("userId"))
|
|
|
- entId := qutil.IntAll(s.GetSession("entId"))
|
|
|
- entUserId := qutil.IntAll(s.GetSession("entUserId"))
|
|
|
- vSwitch := s.GetString("vSwitch")
|
|
|
- if vSwitch == "" {
|
|
|
- vSwitch = jy.SwitchService.Get(s.Session(), *config.Middleground) //v:vip m:member "":free
|
|
|
- }
|
|
|
- if pageType := s.GetString("pageType"); pageType == "keyWords" {
|
|
|
- //
|
|
|
- matchWay, _ := s.GetInteger("match_way")
|
|
|
- matchMode := s.GetString("matchMode")
|
|
|
- classifyName := strings.Trim(s.GetString("classify_name"), "")
|
|
|
- kwsName := Rx.ReplaceAllString(strings.TrimSpace(s.GetString("kws_name")), " ")
|
|
|
- if strings.TrimSpace(kwsName) == "" && s.GetString("actionType") == "SK" {
|
|
|
- s.ServeJson(map[string]interface{}{"flag": false, "msg": "请录入正确关键词"})
|
|
|
- return
|
|
|
- }
|
|
|
- sub := &entity.KeyWordsSet{
|
|
|
- ClassifyIndex: s.GetString("classify_index"),
|
|
|
- ClassifyName: classifyName,
|
|
|
- KeyWordIndex: s.GetString("kws_index"),
|
|
|
- KeyWordName: strings.TrimSpace(kwsName),
|
|
|
- ActionType: s.GetString("actionType"),
|
|
|
- AppendKeyWord: s.GetSlice("addition_kws"),
|
|
|
- NotKeyWord: s.GetSlice("not_kws"),
|
|
|
- MatchWay: matchWay,
|
|
|
- Matchmode: matchMode,
|
|
|
- KeyWordsCount: s.GetString("kwscount"),
|
|
|
- Type: vSwitch,
|
|
|
- UserId: userId,
|
|
|
- DeleteKey: s.GetString("delete_key"),
|
|
|
- EntUserId: entUserId,
|
|
|
- EntId: entId,
|
|
|
- Session: s.Session(),
|
|
|
- }
|
|
|
- r = sub.UpdateKeyWords()
|
|
|
- } else {
|
|
|
- pmindex, _ := s.GetInteger("pmindex")
|
|
|
- matchtype := s.GetString("matchtype")
|
|
|
- other, _ := s.GetInteger("other")
|
|
|
- uo := &entity.UpdateOther{
|
|
|
- PageType: s.GetString("pageType"),
|
|
|
- Pmindex: pmindex,
|
|
|
- InfoTypeArr: s.GetString("infoTypeArr"),
|
|
|
- Matchtype: matchtype,
|
|
|
- UserId: userId,
|
|
|
- Type: vSwitch,
|
|
|
- OtherBuyerclass: other,
|
|
|
- EntUserId: entUserId,
|
|
|
- EntId: entId,
|
|
|
- Session: s.Session(),
|
|
|
- }
|
|
|
- r = uo.UpdateOther()
|
|
|
- }
|
|
|
- s.ServeJson(r)
|
|
|
+ r := map[string]interface{}{}
|
|
|
+ userId := qutil.ObjToString(s.GetSession("userId"))
|
|
|
+ entId := qutil.IntAll(s.GetSession("entId"))
|
|
|
+ entUserId := qutil.IntAll(s.GetSession("entUserId"))
|
|
|
+ vSwitch := s.GetString("vSwitch")
|
|
|
+ if vSwitch == "" {
|
|
|
+ vSwitch = jy.SwitchService.Get(s.Session(), *config.Middleground) //v:vip m:member "":free
|
|
|
+ }
|
|
|
+ if pageType := s.GetString("pageType"); pageType == "keyWords" {
|
|
|
+ //
|
|
|
+ matchWay, _ := s.GetInteger("match_way")
|
|
|
+ matchMode := s.GetString("matchMode")
|
|
|
+ classifyName := strings.Trim(s.GetString("classify_name"), "")
|
|
|
+ kwsName := Rx.ReplaceAllString(strings.TrimSpace(s.GetString("kws_name")), " ")
|
|
|
+ if strings.TrimSpace(kwsName) == "" && s.GetString("actionType") == "SK" {
|
|
|
+ s.ServeJson(map[string]interface{}{"flag": false, "msg": "请录入正确关键词"})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sub := &entity.KeyWordsSet{
|
|
|
+ ClassifyIndex: s.GetString("classify_index"),
|
|
|
+ ClassifyName: classifyName,
|
|
|
+ KeyWordIndex: s.GetString("kws_index"),
|
|
|
+ KeyWordName: strings.TrimSpace(kwsName),
|
|
|
+ ActionType: s.GetString("actionType"),
|
|
|
+ AppendKeyWord: s.GetSlice("addition_kws"),
|
|
|
+ NotKeyWord: s.GetSlice("not_kws"),
|
|
|
+ MatchWay: matchWay,
|
|
|
+ Matchmode: matchMode,
|
|
|
+ KeyWordsCount: s.GetString("kwscount"),
|
|
|
+ Type: vSwitch,
|
|
|
+ UserId: userId,
|
|
|
+ DeleteKey: s.GetString("delete_key"),
|
|
|
+ EntUserId: entUserId,
|
|
|
+ EntId: entId,
|
|
|
+ Session: s.Session(),
|
|
|
+ }
|
|
|
+ r = sub.UpdateKeyWords()
|
|
|
+ } else {
|
|
|
+ pmindex, _ := s.GetInteger("pmindex")
|
|
|
+ matchtype := s.GetString("matchtype")
|
|
|
+ other, _ := s.GetInteger("other")
|
|
|
+ uo := &entity.UpdateOther{
|
|
|
+ PageType: s.GetString("pageType"),
|
|
|
+ Pmindex: pmindex,
|
|
|
+ InfoTypeArr: s.GetString("infoTypeArr"),
|
|
|
+ Matchtype: matchtype,
|
|
|
+ UserId: userId,
|
|
|
+ Type: vSwitch,
|
|
|
+ OtherBuyerclass: other,
|
|
|
+ EntUserId: entUserId,
|
|
|
+ EntId: entId,
|
|
|
+ Session: s.Session(),
|
|
|
+ }
|
|
|
+ r = uo.UpdateOther()
|
|
|
+ }
|
|
|
+ s.ServeJson(r)
|
|
|
}
|