Przeglądaj źródła

Merge branch 'feature/v4.7.55' of http://192.168.3.207:8080/qmx/jy into feature/v4.7.55

zhangxinlei1996 2 lat temu
rodzic
commit
83adb430e4
46 zmienionych plików z 1630 dodań i 2091 usunięć
  1. 1 5
      src/config.json
  2. 2 1
      src/config.yaml
  3. 3 2
      src/go.mod
  4. 5 4
      src/go.sum
  5. 1 16
      src/jfw/config/config.go
  6. 1 26
      src/jfw/front/front.go
  7. 6 6
      src/jfw/front/supsearch.go
  8. 5 10
      src/jfw/front/swordfish.go
  9. 0 15
      src/jfw/front/vipsubscribe.go
  10. 0 2
      src/jfw/front/wxMyOrder.go
  11. 359 368
      src/jfw/front/wxkeyset.go
  12. 0 76
      src/jfw/modules/app/src/app/filter/baseuserfilter.go
  13. 0 3
      src/jfw/modules/app/src/app/filter/filter.go
  14. 0 1
      src/jfw/modules/app/src/app/front/bigMember.go
  15. 0 20
      src/jfw/modules/app/src/app/front/front.go
  16. 7 7
      src/jfw/modules/app/src/app/front/login.go
  17. 396 401
      src/jfw/modules/app/src/app/front/me.go
  18. 0 1
      src/jfw/modules/app/src/app/front/shorturl.go
  19. 0 3
      src/jfw/modules/app/src/app/front/vipsubscribe.go
  20. 0 2
      src/jfw/modules/app/src/app/front/wxkeyset.go
  21. 0 6
      src/jfw/modules/bigmember/src/entity/portrailUtil.go
  22. 0 2
      src/jfw/modules/bigmember/src/entity/portrait.go
  23. 0 1
      src/jfw/modules/bigmember/src/service/analysis/decision.go
  24. 0 2
      src/jfw/modules/bigmember/src/service/analysis/potential.go
  25. 0 1
      src/jfw/modules/bigmember/src/service/analysis/util.go
  26. 0 1
      src/jfw/modules/bigmember/src/service/portrait/subvipPortraitAction.go
  27. 0 34
      src/jfw/modules/bigmember/src/service/push/push.go
  28. 0 3
      src/jfw/modules/bigmember/src/service/subscribe/subscribe.go
  29. 5 139
      src/jfw/modules/bigmember/src/service/use/use.go
  30. 0 14
      src/jfw/modules/bigmember/src/util/power.go
  31. 0 1
      src/jfw/modules/distribution/src/service/action/share.go
  32. 4 6
      src/jfw/modules/publicapply/src/attachmentdow/service/service.go
  33. 1 3
      src/jfw/modules/publicapply/src/bidcollection/entity/entity.go
  34. 2 3
      src/jfw/modules/publicapply/src/customer/entity/entiy.go
  35. 9 35
      src/jfw/modules/publicapply/src/dataexport/entity/collection.go
  36. 1 2
      src/jfw/modules/publicapply/src/me/me.go
  37. 263 299
      src/jfw/modules/publicapply/src/subscribePush/entity/historyPush.go
  38. 2 5
      src/jfw/modules/publicapply/src/subscribePush/entity/keyWords.go
  39. 509 518
      src/jfw/modules/publicapply/src/subscribePush/entity/setting.go
  40. 2 2
      src/jfw/modules/publicapply/src/subscribePush/service/subscribe.go
  41. 0 2
      src/jfw/modules/subscribepay/src/service/dataexportPack.go
  42. 0 5
      src/jfw/modules/subscribepay/src/service/orderDetails.go
  43. 0 6
      src/jfw/modules/subscribepay/src/service/orderListDetails.go
  44. 46 24
      src/jfw/modules/subscribepay/src/service/userAccountInfo.go
  45. 0 5
      src/jfw/modules/subscribepay/src/service/vipSubscribeChange.go
  46. 0 3
      src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

+ 1 - 5
src/config.json

@@ -3,7 +3,7 @@
   "qrModelID": "2",
   "numTimeNumber": 15,
   "strTimeNumber": 30,
-  "webport": "84",
+  "webport": "83",
   "webrpcport": "8084",
   "weixinrpc": "127.0.0.1:8083",
   "cacheflag": false,
@@ -331,10 +331,6 @@
   "fileSignBool": true,
   "baseUserFilterFlag": false,
   "userCenterApi": "https://web-zxl.jydev.jianyu360.com",
-  "resourceCenter": "https://web-zxl.jydev.jianyu360.com",
-  "resourceCenterUrl": {
-    "haspowers": "/resourceCenter/haspowers"
-  },
   "keywordsLimit": 35,
   "detailMosaicTxt": "略",
   "needMosaic": {

+ 2 - 1
src/config.yaml

@@ -2,4 +2,5 @@ etcd:
   hosts:
   - 127.0.0.1:2379
 userCenterKey: "usercenter.rpc" #用户中台rpc
-powerCheckCenterKey: "powercheck.rpc" #权益校验中台
+powerCheckCenterKey: "powercheck.rpc" #权益校验中台
+resourceCenterKey: "resource.rpc" #资源中台

+ 3 - 2
src/go.mod

@@ -4,7 +4,7 @@ go 1.18
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
-	app.yhyue.com/moapp/jypkg v0.0.0-20230206012003-5d4c95f141d8
+	app.yhyue.com/moapp/jypkg v0.0.0-20230207011456-5bf93ef29526
 	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230129060002-f69424aa14ba
 	github.com/SKatiyar/qr v0.0.0-20151201054752-25b6bdf44e67
 	github.com/dchest/captcha v1.0.0
@@ -17,7 +17,8 @@ require (
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
 	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae // indirect
-	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230206065131-a8c8e98e8a1f // indirect
+	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.4 // indirect
 	github.com/BurntSushi/toml v1.1.0 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.1.3 // indirect

+ 5 - 4
src/go.sum

@@ -13,20 +13,21 @@ app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tc
 app.yhyue.com/moapp/jybase v0.0.0-20230109015757-aa3d5e19b196/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
 app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a h1:wD4aWPSYdiX1cIP4lzzPD2s7fYhKa3muIf97l9tonJE=
 app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jypkg v0.0.0-20230206012003-5d4c95f141d8 h1:3vkKP2S15Pwe8A8412k2s29X9CaiKEQmg8lVHMi6D00=
-app.yhyue.com/moapp/jypkg v0.0.0-20230206012003-5d4c95f141d8/go.mod h1:NrRgv24VIpf/xMMvsGC1EgoD+z6z5ea3MqIVxEcSPhE=
+app.yhyue.com/moapp/jypkg v0.0.0-20230207011456-5bf93ef29526 h1:flPNVocLyDxYpNfEVzooyk2MZL8Sk3KY4lW1N6zR9+E=
+app.yhyue.com/moapp/jypkg v0.0.0-20230207011456-5bf93ef29526/go.mod h1:dWrHpP8IddYxjsh/nYB1loIww2sYV8oWOINiAqPsgCY=
 app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae h1:6rDDaz6yxvE8viTSzEBwKYOFWq14TMfuBivSazUZMz4=
 app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae/go.mod h1:b0zZHev3gmJao1Fo+2Z2KPVjsuLOJVvVxf+kCnu9WkA=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4/go.mod h1:BMLd/5wb3BIEGhnEgF9y1sJN9P5/Dw9kYsoiE9V8I9g=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c h1:g49jOlhZlBCJ3IgJA0rotfNf2Gh22pISffUtqxB8XtY=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
+bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230206065131-a8c8e98e8a1f h1:GGypCGojBHNnHOOQJY64CilUWxbbfOLpxhDBpmoDr/c=
+bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230206065131-a8c8e98e8a1f/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220418005748-8ba5d936dd53/go.mod h1:E5lcDI3k4FESLxiAetCfWQTq8qfpy9cv0yN1oKoEO34=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220419023723-0b32d4a41751/go.mod h1:6KL5LMEku83uRbre0W/bj5kXG2I6pJGBFtktmtp51yM=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220419063004-233fc7ce006c/go.mod h1:6KL5LMEku83uRbre0W/bj5kXG2I6pJGBFtktmtp51yM=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220420075831-0b59892e9982/go.mod h1:wsHNO91h37H+xE4ZNny0yd7mtpODeDJxbVYhIRMR+qw=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.3/go.mod h1:Z353aucNO5hH4ZYjeKST3kE1PN3W8/uPc4J8s0Upz40=
+bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.4 h1:LXD8woSkDDtqCQ19S9TGvx7GVir300nGszoIidBTlGM=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.4/go.mod h1:rRiGzKG4F/fmkNxXQCxrkxNWc8yf1SmW8qWCKfGIQSM=
 bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220418072311-2062bed1e700/go.mod h1:KjcrxTzM96tBc6G4B8tlLBn1lrVy5UJYF8+eTdP4xAE=
 bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220421015128-4a36f3eac5c5/go.mod h1:GT0QC4aaKDuXxAvaU4G02XjCc31TU1ctqBGqxQYOfC4=

+ 1 - 16
src/jfw/config/config.go

@@ -17,16 +17,11 @@ var (
 	WeixinConfig         map[string]interface{}
 	PhoneFilterConfig    map[string]interface{}
 	Wxoauth, Wxoauthinfo string
-	ResourceApi          ResourceApiConfig
 	GmailAuth            []*mail.GmailAuth
 	EntnichePcConf       *entnichePcConf
 	Middleground         *middleground.Middleground
 )
 
-type ResourceApiConfig struct {
-	HasPowers string // 获取我的所有权限api
-}
-
 type entnichePcConf struct {
 	EntnichePcUser   []int  `json:"entnichePcUser"`
 	HideEntnicheMenu []int  `json:"hideEntnicheMenu"`
@@ -55,16 +50,6 @@ func init() {
 
 	//PC端商机管理配置
 	util.ReadConfig("./entnichePc.json", &EntnichePcConf)
-	// 资源中心
-	resourceCenterUrl, ok := Sysconfig["resourceCenterUrl"].(map[string]interface{})
-	if !ok {
-		panic("未获取到资源中心url配置")
-	}
-	resourceCenter, ok := Sysconfig["resourceCenter"].(string)
-	if !ok {
-		panic("未获取到资源中心配置")
-	}
-	ResourceApi.HasPowers = resourceCenter + util.ObjToString(resourceCenterUrl["haspowers"])
 	var ctx = gctx.New()
-	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String())
+	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String()).RegResourceCenter(g.Cfg().MustGet(ctx, "resourceCenterKey").String())
 }

+ 1 - 26
src/jfw/front/front.go

@@ -654,32 +654,7 @@ func (f *Front) SignOut() error {
 		jy.DelUnlimitSessionId(fmt.Sprint(f.Session().Id()), userId) //多账号
 		jy.ClearBigVipUserPower(userId)
 	}
-	f.DelSession("rpcBackUserInfo")
-	f.DelSession("user")
-	f.DelSession("s_nickname")
-	f.DelSession("openid")
-	f.DelSession("s_m_openid")
-	f.DelSession("userId")
-	f.DelSession("DataExportVerifyEmail_val")
-	f.DelSession("DataExportVerifyPhone_val")
-	f.DelSession("phoneAuthTime")
-	f.DelSession("mailAuthTime")
-	f.DelSession("phone")
-	//entbase 企业信息
-	f.DelSession("entId")
-	f.DelSession("entName")
-	f.DelSession("entUserId")
-	f.DelSession("frameworkEntId")
-	f.DelSession("frameworkEntName")
-	f.DelSession("base_user_id")
-	//用户身份
-	f.DelSession("personId")
-	f.DelSession("userName")
-	f.DelSession("userAccountId")
-	f.DelSession("entAccountId")
-	f.DelSession("userPositionId")
-	f.DelSession("entUserPositionId")
-	f.DelSession("entAccountId")
+	f.Session().Clear()
 	f.ServeJson("ok")
 	return nil
 }

+ 6 - 6
src/jfw/front/supsearch.go

@@ -250,8 +250,8 @@ func (p *Pcsearch) GetNewBids() error {
 		if domainPageType, ok := DomainPageType[bidField]; ok {
 			pageType = domainPageType
 		}
-		vipStatus := jy.GetVipState( p.Session(), *config.Middleground, userId)
-		if (vipStatus.BigMember <= 0 && vipStatus.VipState <= 0) || (!jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprint(util.Int64All(baseUserId)), MedicalFunctionCode)) {
+		vipStatus := jy.GetVipState(p.Session(), *config.Middleground, userId)
+		if (vipStatus.BigMember <= 0 && vipStatus.VipState <= 0) || (!jy.HasBidFieldPower(config.Middleground, util.Int64All(baseUserId), MedicalFunctionCode)) {
 			p.ServeJson(map[string]interface{}{
 				"list":      []map[string]interface{}{},
 				"count":     0,
@@ -350,7 +350,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	if selectType == "" {
 		selectType = "title,content"
 	}
-	isPayedUser, publishtime, queryItems, _, _ := bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0, pageSize,  p.Session(), *config.Middleground)
+	isPayedUser, publishtime, queryItems, _, _ := bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0, pageSize, p.Session(), *config.Middleground)
 	if isPayedUser {
 		buyerclass = p.GetString("buyerclass")
 		hasBuyerTel, hasWinnerTel = p.GetString("buyertel"), p.GetString("winnertel")
@@ -375,7 +375,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 		fileExists = util.ObjToString(p.GetSession("Echo_fileExists"))
 		city = util.ObjToString(p.GetSession("Echo_city"))
 		bidField = util.ObjToString(p.GetSession("Echo_bid_field")) // 领域化数据 0101-医疗行业
-		_, _, queryItems, _, _ = bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0, pageSize,  p.Session(), *config.Middleground)
+		_, _, queryItems, _, _ = bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0, pageSize, p.Session(), *config.Middleground)
 	}
 	keywordsLimit := util.IntAllDef(config.Sysconfig["keywordsLimit"], 35)
 	searchLimit := public.IsSearchLimit(queryItems)
@@ -401,9 +401,9 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	isSearch := true
 	if bidField != "" {
 		isSearch = false
-		vipStatus := jy.GetVipState( p.Session(), *config.Middleground, userId)
+		vipStatus := jy.GetVipState(p.Session(), *config.Middleground, userId)
 		if vipStatus.BigMember > 0 || vipStatus.VipState > 0 {
-			if jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprint(util.Int64All(baseUserId)), MedicalFunctionCode) {
+			if jy.HasBidFieldPower(config.Middleground, util.Int64All(baseUserId), MedicalFunctionCode) {
 				isSearch = true
 			}
 		}

+ 5 - 10
src/jfw/front/swordfish.go

@@ -97,8 +97,8 @@ func (m *Front) PcAjaxReq() {
 	reqType := m.GetString("reqType")
 	if bidField != "" { // 如果是领域化数据 判断是否是付费用户 是否有权限
 
-		vipStatus := jy.GetVipState( m.Session(), *config.Middleground, userId)
-		if (vipStatus.BigMember <= 0 && vipStatus.VipState <= 0) || (!jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprint(util.Int64All(baseUserId)), MedicalFunctionCode)) {
+		vipStatus := jy.GetVipState(m.Session(), *config.Middleground, userId)
+		if (vipStatus.BigMember <= 0 && vipStatus.VipState <= 0) || (!jy.HasBidFieldPower(config.Middleground, util.Int64All(baseUserId), MedicalFunctionCode)) {
 			m.ServeJson(map[string]interface{}{
 				"list": []map[string]interface{}{},
 			})
@@ -144,7 +144,7 @@ func (m *Front) PcAjaxReq() {
 		start                     int
 		city                      string //城市
 	)
-	isPayedUser, publishtime, queryItems, currentPage, start = bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), currentPage, pageSize,  m.Session(), *config.Middleground)
+	isPayedUser, publishtime, queryItems, currentPage, start = bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), currentPage, pageSize, m.Session(), *config.Middleground)
 	if isPayedUser {
 		buyerclass = m.GetString("buyerclass")
 		hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
@@ -343,8 +343,6 @@ func (m *Front) Getpage() error {
 	userid := util.ObjToString(m.GetSession("userId"))
 	var msgset map[string]interface{}
 	if userid != "" {
-		//one, _ := mongodb.FindById("user", userid, `{"o_jy":1}`)
-		//msg := (*one)["o_jy"]
 		msg := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
 		if msg != nil {
 			msgset = (*msg)
@@ -400,7 +398,7 @@ func (m *Front) WxsearchlistPaging() {
 			var notkey string = ""                        //排除词
 			var fileExists = m.GetString("fileExists")    //是否有附件--所有用户都可用此功能 0:全部;1:有附件;-1:无附件
 			var city string = ""                          //城市
-			vipStatus := jy.GetVipState( m.Session(), *config.Middleground, userId)
+			vipStatus := jy.GetVipState(m.Session(), *config.Middleground, userId)
 			isPayedUser = vipStatus.IsPayedUser()
 			queryItems := vipStatus.GetQueryItems(selectType, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]))
 			if isPayedUser {
@@ -444,7 +442,6 @@ func (m *Front) WxsearchlistPaging() {
 			redis.Del("other", "s_"+userId)
 			redis.Put("other", "s_"+userId, strings.Join(arrs, ","), -1)
 		}
-		//one, _ := mongodb.FindById("user", userId, `{"o_jy":1}`)
 		o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
 		if o_jy != nil {
 			a_key, _ := (*o_jy)["a_key"].([]interface{})
@@ -919,8 +916,6 @@ func (m *Front) AjaxReq() error {
 		break
 	case "subscribe": //直接订阅
 		if userid := m.GetSession("userId"); userid != nil {
-			/*r, _ := mongodb.FindById("user", userid.(string), `{"o_jy":1}`)
-			  o_jy, _ := (*r)["o_jy"].(map[string]interface{})*/
 			o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
 			a_key, _ := (*o_jy)["a_key"].([]interface{})
 			keysArray := processKeyword(m.GetString("keys"))
@@ -1867,7 +1862,7 @@ func (m *Front) Subscribe() error {
 	isBuyed := false
 	if userId, _ := m.GetSession("userId").(string); userId != "" {
 
-		vStatus := jy.GetVipState( m.Session(), *config.Middleground, userId)
+		vStatus := jy.GetVipState(m.Session(), *config.Middleground, userId)
 		isBuyed = vStatus.VipState > 0
 	}
 	m.T["isBuyed"] = isBuyed

+ 0 - 15
src/jfw/front/vipsubscribe.go

@@ -227,8 +227,6 @@ func (s *Subscribepay) Introduce() error {
 	if userId == "" {
 		return s.Redirect("/swordfish/about?v=1")
 	}
-	// m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
-
 	m := jy.GetBigVipUserBaseMsg( s.Session(), *config.Middleground)
 	if m == nil {
 		return s.Redirect("/swordfish/about?v=2")
@@ -267,12 +265,6 @@ func (s *Subscribepay) TrialInfo() error {
 	if userId == "" {
 		return s.Redirect("/swordfish/about")
 	}
-	//m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1}`)
-	/*if !ok || len(*m) == 0 {
-	        return s.Redirect("/swordfish/about")
-	}*/
-	//obj := util.ObjToMap((*m)["o_vipjy"])
-	//  s.T["trialSign"] = util.IntAll((*obj)["i_trial"]) == 1
 	s.T["trialSign"] = true
 	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
 	return s.Render("/weixin/vipsubscribe/trial_info.html", &s.T)
@@ -284,8 +276,6 @@ func (s *Subscribepay) ToPurchasePage(flag string) {
 	if userId == "" {
 		return
 	}
-	//m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
-
 	m := jy.GetBigVipUserBaseMsg( s.Session(), *config.Middleground)
 	if m == nil {
 		s.Redirect("/swordfish/about?v=2")
@@ -431,9 +421,6 @@ func (s *Subscribepay) OpenInvoice(order_code string) {
 
 //预热活动链接跳转
 func (s *Subscribepay) PreheatPoster() {
-	//myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-	// u, ok := public.MQFW.FindOne("user", `{"s_m_openid":"`+myopenid+`","s_unionid":{"$ne":"`+myopenid+`"}}`)
-
 	u := jy.GetBigVipUserBaseMsg( s.Session(), *config.Middleground)
 	if u != nil {
 		if u.VipStatus == 1 || u.VipStatus == 2 {
@@ -478,8 +465,6 @@ func (s *Subscribepay) Msgremind() error {
 	if userId == "" {
 		return s.Render("_error.html")
 	}
-	//user, ok := public.MQFW.FindById("user", userId, `{"i_vip_status":1,"l_vip_endtime":1,"i_member_status":1,"i_member_endtime":1}`)
-
 	user := jy.GetBigVipUserBaseMsg( s.Session(), *config.Middleground)
 	if user == nil {
 		return s.Render("_error.html")

+ 0 - 2
src/jfw/front/wxMyOrder.go

@@ -187,8 +187,6 @@ func (w *WxMyOrder) Myset() error {
 	userid := util.ObjToString(w.GetSession("userId"))
 	isVip := false
 	if userid != "" {
-		//user, ok := mongodb.FindById("user", userid, `{"i_vip_status":1}`)
-
 		user := jy.GetBigVipUserBaseMsg( w.Session(), *config.Middleground)
 		if user != nil {
 			if user.VipStatus == 1 || user.VipStatus == 2 {

+ 359 - 368
src/jfw/front/wxkeyset.go

@@ -1,404 +1,395 @@
 package front
 
 import (
-	"fmt"
-	"jy/src/jfw/config"
-	"jy/src/jfw/wx"
-	"net/url"
-	"regexp"
-	"strconv"
-	"strings"
+    "fmt"
+    "jy/src/jfw/config"
+    "jy/src/jfw/wx"
+    "net/url"
+    "regexp"
+    "strconv"
+    "strings"
 
-	util "app.yhyue.com/moapp/jybase/common"
-	. "app.yhyue.com/moapp/jybase/date"
-	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-	//	"sync"
-	"time"
+    util "app.yhyue.com/moapp/jybase/common"
+    . "app.yhyue.com/moapp/jybase/date"
+    "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+    //	"sync"
+    "time"
 )
 
 //进入订阅词设置
 func (m *Front) WxKeyset(tpl string) error {
-	defer util.Catch()
-	userid := util.ObjToString(m.GetSession("userId"))
-	surprise := m.GetSession("surprise")
-	if userid == "" {
-		return m.Redirect("/swordfish/share/-1")
-	}
-	if tiptext := m.GetString("tiptext"); tiptext != "" {
-		go mongodb.Save("opentip_log", map[string]interface{}{
-			"tiptext":    tiptext,
-			"userid":     userid,
-			"createtime": time.Now().Unix(),
-			"type":       "keyset",
-		})
-	}
+    defer util.Catch()
+    userid := util.ObjToString(m.GetSession("userId"))
+    surprise := m.GetSession("surprise")
+    if userid == "" {
+        return m.Redirect("/swordfish/share/-1")
+    }
+    if tiptext := m.GetString("tiptext"); tiptext != "" {
+        go mongodb.Save("opentip_log", map[string]interface{}{
+            "tiptext":    tiptext,
+            "userid":     userid,
+            "createtime": time.Now().Unix(),
+            "type":       "keyset",
+        })
+    }
+    vipMsg := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
+    if (tpl == "index" || tpl == "filterset") && vipMsg.VipStatus <= 0 && vipMsg.Status <= 0 && isInTSguide(userid) { //仅免费用户跳转向导页面
+        return m.Redirect("/front/tenderSubscribe/guide?url=" + url.QueryEscape(m.Request.RequestURI))
+    }
+    //到新订阅设置
+    if vipMsg.VipStatus > 0 || vipMsg.IsUpgrade {
+        return m.Redirect("/front/vipsubscribe/toSubVipSetPage")
+    }
+    if tpl == "seniorset" {
+        data := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
+        if data != nil {
+            if data.Data.Free.FreeHasKey {
+                m.T["haskeyword"] = true
+            }
 
-	vipMsg := jy.GetBigVipUserBaseMsg( m.Session(), *config.Middleground)
-	if (tpl == "index" || tpl == "filterset") && vipMsg.VipStatus <= 0 && vipMsg.Status <= 0 && isInTSguide(userid) { //仅免费用户跳转向导页面
-		return m.Redirect("/front/tenderSubscribe/guide?url=" + url.QueryEscape(m.Request.RequestURI))
-	}
-	//到新订阅设置
-	if vipMsg.VipStatus > 0 || vipMsg.IsUpgrade {
-		return m.Redirect("/front/vipsubscribe/toSubVipSetPage")
-	}
-	if tpl == "seniorset" {
-		//data, ok := mongodb.FindById("user", userid, `{"o_jy":1}`)
-
-		data := jy.GetBigVipUserBaseMsg( m.Session(), *config.Middleground)
-
-		if data != nil {
-			if data.Data.Free.FreeHasKey {
-				m.T["haskeyword"] = true
-			}
-
-		}
-	}
-	s_surprise := ""
-	if tpl == "index" || tpl == "filterset" {
-		//data, ok := mongodb.FindById("user", userid, `{"o_jy":1}`)
-		o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
-		if o_jy != nil && len(*o_jy) > 0 {
-			s_surprise = util.ObjToString((*o_jy)["s_surprise"])
-		}
-	}
-	m.T["s_surprise"] = s_surprise
-	m.T["surprise"] = surprise
-	m.T["openid"] = se.EncodeString(util.ObjToString(m.GetSession("s_m_openid")))
-	m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
-	mynickname, _ := m.Session().Get("s_nickname").(string)
-	myavatar, _ := m.Session().Get("s_avatar").(string)
-	m.T["nickname"] = mynickname
-	m.T["avatar"] = myavatar
-	//直播活动和预热活动期间
-	if config.ActiveConfig.Live_Active_End > time.Now().Unix() && time.Now().Unix() > config.ActiveConfig.Live_Preheat_Start {
-		m.T["LiveState"] = true
-	}
-	return m.Render("/weixin/wxkeyset/"+tpl+".html", &m.T)
+        }
+    }
+    s_surprise := ""
+    if tpl == "index" || tpl == "filterset" {
+        o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
+        if o_jy != nil && len(*o_jy) > 0 {
+            s_surprise = util.ObjToString((*o_jy)["s_surprise"])
+        }
+    }
+    m.T["s_surprise"] = s_surprise
+    m.T["surprise"] = surprise
+    m.T["openid"] = se.EncodeString(util.ObjToString(m.GetSession("s_m_openid")))
+    m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
+    mynickname, _ := m.Session().Get("s_nickname").(string)
+    myavatar, _ := m.Session().Get("s_avatar").(string)
+    m.T["nickname"] = mynickname
+    m.T["avatar"] = myavatar
+    //直播活动和预热活动期间
+    if config.ActiveConfig.Live_Active_End > time.Now().Unix() && time.Now().Unix() > config.ActiveConfig.Live_Preheat_Start {
+        m.T["LiveState"] = true
+    }
+    return m.Render("/weixin/wxkeyset/"+tpl+".html", &m.T)
 }
 
 //ajax各种请求
 func (m *Front) WxKeysetAjaxReq() {
-	defer util.Catch()
-	userId, _ := m.GetSession("userId").(string)
-	positionType := util.Int64All(m.GetSession("positionType"))
-	if userId == "" {
-		m.ServeJson(map[string]interface{}{
-			"flag": false,
-		})
-		return
-	}
-	types := "o_jy"
-	if positionType == 1 {
-		types = "o_entniche"
-	}
-	//增加锁,防止map读写
-	//	lock, _ := m.Session().Get("Lock").(*sync.Mutex)
-	//	lock.Lock()
-	//	defer lock.Unlock()
-	reqType := m.GetString("reqType")
-	if reqType == "getKeyset" { //获取高级设置
-		//data, ok := mongodb.FindById("user", userId, `{"o_jy":1,"l_registedate":1}`)
-		o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
-
-		data := jy.GetBigVipUserBaseMsg( m.Session(), *config.Middleground)
-		if o_jy != nil {
-			//o_jy, _ = (*data)["o_jy"].(map[string]interface{})
-			(*o_jy)["i_new"] = NewUserByVIP(o_jy, data.Data.Free.Registedate)
-			a_key, _ := (*o_jy)["a_key"].([]interface{})
-			m.SetSession("o_jy_a_key", a_key)
-		}
-		m.ServeJson(o_jy)
-		return
-	}
-	/*******************以下是修改操作******************/
-	index := ""
-	saveData := make(map[string]interface{})
-	if reqType == "saveKeyWords" { //保存关键词
-		a_key, _ := m.GetSession("o_jy_a_key").([]interface{})
-		keyWords := m.GetSlice("keyWords")
-		indexs := m.GetSlice("indexs")
-		var keyMaps []map[string]interface{}
-		a_keycopy := make([]map[string]interface{}, len(a_key))
-		//复制
-		for k, v := range a_key {
-			key := v.(map[string]interface{})
-			keycopy := map[string]interface{}{}
-			for k1, v1 := range key {
-				keycopy[k1] = v1
-			}
-			isExists := false
-			for _, i := range indexs {
-				if k == util.IntAll(i) {
-					isExists = true
-					break
-				}
-			}
-			//isExists =false已经被删除
-			keycopy["flag"] = !isExists
-			a_keycopy[k] = keycopy
-		}
-		for k, v := range keyWords {
-			if strings.Trim(v, " ") == "" {
-				continue
-			}
-			if k >= 10 {
-				break
-			}
-			index := util.IntAll(indexs[k])
-			key := map[string]interface{}{}
-			if index < len(a_keycopy) {
-				key = a_keycopy[index]
-				flag, _ := key["flag"].(bool)
-				if flag {
-					key = map[string]interface{}{}
-				} else {
-					delete(key, "flag")
-				}
-			}
-			keys := processKeyword(v)
-			if keys != nil {
-				key["key"] = keys
-				if len(key) > 0 {
-					keyMaps = append(keyMaps, key)
-				}
-			}
-		}
-		saveData[fmt.Sprintf("%s.a_key", types)] = keyMaps
-	} else if reqType == "saveArea" { //保存信息范围
-		index = m.GetString("index")
-		saveData[types+"o.a_key."+index+".area"] = m.GetSlice("area")
-	} else if reqType == "saveInfotype" { //保存信息类型
-		index = m.GetString("index")
-		saveData[types+".a_key."+index+".infotype"] = m.GetSlice("infotype")
-	} else if reqType == "saveNotkey" { //保存排除关键词
-		index = m.GetString("index")
-		notkey := m.GetSlice("notkey")
-		if len(notkey) > 10 {
-			notkey = notkey[0:10]
-		}
-		for k, v := range notkey {
-			notkey[k] = strings.Replace(v, " ", "", -1)
-		}
-		saveData[types+".a_key."+index+".notkey"] = notkey
-	} else if reqType == "saveSeniorset" { //保存高级设置
-		//推送频率:1实时 2每日一推 3自定义时间
-		ratemode, _ := m.GetInteger("ratemode")
-		if ratemode != 2 && ratemode != 3 {
-			ratemode = 1
-		}
-		saveData[types+".i_ratemode"] = ratemode
-		//接收方式:1微信  2邮箱 3信息+邮箱
-		wxpush, _ := m.GetInteger("wxpush")
-		mailpush, _ := m.GetInteger("mailpush")
-		if wxpush == 0 && mailpush == 0 {
-			wxpush = 1
-		}
-		if ratemode == 3 {
-			saveData[types+".i_rmstart"], _ = m.GetInteger("rmstart")
-			saveData[types+".i_rmend"], _ = m.GetInteger("rmend")
-		}
-		saveData[types+".s_email"] = strings.Trim(m.GetString("email"), " ")
-		saveData[types+".i_wxpush"] = wxpush
-		saveData[types+"o_jy.i_mailpush"] = mailpush
-	} else if reqType == "delKeysWord" { //
-		index = m.GetString("index")
-		var keyMaps = []map[string]interface{}{}
-		a_key, _ := m.GetSession("o_jy_a_key").([]interface{})
-		for k, v := range a_key {
-			if k != util.IntAll(index) {
-				keyMaps = append(keyMaps, v.(map[string]interface{}))
-			}
-		}
-		saveData[types+".a_key"] = keyMaps
-	} else if reqType == "setSurp" {
-		saveData[types+".s_surprise"] = "A"
-		m.SetSession("surprise", "A")
-	} else if reqType == "saveKeyWordsNew" { //保存 or 修改 整个订阅词接口
-		index = m.GetString("index")
-		indexInt := util.IntAll(index)
-		area := m.GetSlice("area")
-		infotype := m.GetSlice("infotype")
-		notkey := m.GetSlice("notkey")
-		keyWords := m.GetString("keyWords")
-		a_key, a_key_ok := m.GetSession("o_jy_a_key").([]interface{})
-		if len(notkey) > 10 {
-			notkey = notkey[0:10]
-		}
-		for k, v := range notkey {
-			notkey[k] = strings.Replace(v, " ", "", -1)
-		}
-		keys := processKeyword(keyWords)
-		if keys == nil || indexInt >= 10 {
-			m.ServeJson(map[string]interface{}{
-				"flag": false,
-			})
-			return
-		}
-		saveKey := map[string]interface{}{
-			"key":      []string{keys[0]},
-			"area":     fliterEmptyArr(area),
-			"notkey":   fliterEmptyArr(notkey),
-			"infotype": fliterEmptyArr(infotype),
-		}
-		var optime time.Time
-		var regtime int64
-		if o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000"); o_jy != nil && len(*o_jy) > 0 {
-			//if rd, ok := mongodb.FindById("user", userId, `{"o_jy":1,"l_registedate":1}`); rd != nil && ok && len(*rd) > 0 {
-			//获取活动上线时间
-			o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
-
-			data := jy.GetBigVipUserBaseMsg( m.Session(), *config.Middleground)
-			optimalTime, _ := config.Sysconfig["optimalTime"].(string)
-			optime, _ = time.ParseInLocation(Date_Full_Layout, optimalTime, time.Local)
-			regtime = data.Data.Free.Registedate
-			if o_jy != nil && len(*o_jy) > 0 {
-				if (*o_jy)["i_new"] == nil {
-					if time.Unix(regtime, 0).After(optime) {
-						saveData[types+".i_new"] = 1
-					} else {
-						saveData[types+".i_new"] = 0
-					}
-				}
-				if (*o_jy)["a_key"] != nil {
-					ak, _ := (*o_jy)["a_key"].([]interface{})
-					if len(ak) > indexInt {
-						if akmap, _ := ak[indexInt].(map[string]interface{}); akmap["from"] != nil {
-							saveKey["from"] = akmap["from"]
-						}
-					}
-				}
-			}
-		}
-		if !a_key_ok && indexInt == 0 { //第一次新增
-			index = ""
-			saveData[types+".a_key"] = []map[string]interface{}{saveKey}
-			if time.Unix(regtime, 0).Before(optime) {
-				saveData[types+".i_new"] = 1
-			}
-		} else { //修改新增
-			if indexInt > len(a_key) {
-				indexInt = len(a_key)
-			}
-			saveData[fmt.Sprintf("%s.a_key.%d", types, indexInt)] = saveKey
-		}
-	}
-	//修改操作
-	var flag bool
-	if len(saveData) > 0 {
-		saveData[types+".l_modifydate"] = time.Now().Unix()
-		query := map[string]interface{}{
-			"i_userid": util.Int64All(m.GetSession("entUserId")),
-			"i_entid":  util.Int64All(m.GetSession("entId")),
-			"i_type":   2,
-		}
-		if index == "" {
-			if positionType == 0 {
-				flag = mongodb.UpdateById("user", userId, map[string]interface{}{
-					"$set": saveData,
-				})
-			} else {
-				flag = mongodb.Update("entniche_rule", query, map[string]interface{}{
-					"$set": saveData,
-				}, true, false)
-			}
+    defer util.Catch()
+    userId, _ := m.GetSession("userId").(string)
+    positionType := util.Int64All(m.GetSession("positionType"))
+    if userId == "" {
+        m.ServeJson(map[string]interface{}{
+            "flag": false,
+        })
+        return
+    }
+    types := "o_jy"
+    if positionType == 1 {
+        types = "o_entniche"
+    }
+    //增加锁,防止map读写
+    //	lock, _ := m.Session().Get("Lock").(*sync.Mutex)
+    //	lock.Lock()
+    //	defer lock.Unlock()
+    reqType := m.GetString("reqType")
+    if reqType == "getKeyset" { //获取高级设置
+        o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
+        data := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
+        if o_jy != nil {
+            //o_jy, _ = (*data)["o_jy"].(map[string]interface{})
+            (*o_jy)["i_new"] = NewUserByVIP(o_jy, data.Data.Free.Registedate)
+            a_key, _ := (*o_jy)["a_key"].([]interface{})
+            m.SetSession("o_jy_a_key", a_key)
+        }
+        m.ServeJson(o_jy)
+        return
+    }
+    /*******************以下是修改操作******************/
+    index := ""
+    saveData := make(map[string]interface{})
+    if reqType == "saveKeyWords" { //保存关键词
+        a_key, _ := m.GetSession("o_jy_a_key").([]interface{})
+        keyWords := m.GetSlice("keyWords")
+        indexs := m.GetSlice("indexs")
+        var keyMaps []map[string]interface{}
+        a_keycopy := make([]map[string]interface{}, len(a_key))
+        //复制
+        for k, v := range a_key {
+            key := v.(map[string]interface{})
+            keycopy := map[string]interface{}{}
+            for k1, v1 := range key {
+                keycopy[k1] = v1
+            }
+            isExists := false
+            for _, i := range indexs {
+                if k == util.IntAll(i) {
+                    isExists = true
+                    break
+                }
+            }
+            //isExists =false已经被删除
+            keycopy["flag"] = !isExists
+            a_keycopy[k] = keycopy
+        }
+        for k, v := range keyWords {
+            if strings.Trim(v, " ") == "" {
+                continue
+            }
+            if k >= 10 {
+                break
+            }
+            index := util.IntAll(indexs[k])
+            key := map[string]interface{}{}
+            if index < len(a_keycopy) {
+                key = a_keycopy[index]
+                flag, _ := key["flag"].(bool)
+                if flag {
+                    key = map[string]interface{}{}
+                } else {
+                    delete(key, "flag")
+                }
+            }
+            keys := processKeyword(v)
+            if keys != nil {
+                key["key"] = keys
+                if len(key) > 0 {
+                    keyMaps = append(keyMaps, key)
+                }
+            }
+        }
+        saveData[fmt.Sprintf("%s.a_key", types)] = keyMaps
+    } else if reqType == "saveArea" { //保存信息范围
+        index = m.GetString("index")
+        saveData[types+"o.a_key."+index+".area"] = m.GetSlice("area")
+    } else if reqType == "saveInfotype" { //保存信息类型
+        index = m.GetString("index")
+        saveData[types+".a_key."+index+".infotype"] = m.GetSlice("infotype")
+    } else if reqType == "saveNotkey" { //保存排除关键词
+        index = m.GetString("index")
+        notkey := m.GetSlice("notkey")
+        if len(notkey) > 10 {
+            notkey = notkey[0:10]
+        }
+        for k, v := range notkey {
+            notkey[k] = strings.Replace(v, " ", "", -1)
+        }
+        saveData[types+".a_key."+index+".notkey"] = notkey
+    } else if reqType == "saveSeniorset" { //保存高级设置
+        //推送频率:1实时 2每日一推 3自定义时间
+        ratemode, _ := m.GetInteger("ratemode")
+        if ratemode != 2 && ratemode != 3 {
+            ratemode = 1
+        }
+        saveData[types+".i_ratemode"] = ratemode
+        //接收方式:1微信  2邮箱 3信息+邮箱
+        wxpush, _ := m.GetInteger("wxpush")
+        mailpush, _ := m.GetInteger("mailpush")
+        if wxpush == 0 && mailpush == 0 {
+            wxpush = 1
+        }
+        if ratemode == 3 {
+            saveData[types+".i_rmstart"], _ = m.GetInteger("rmstart")
+            saveData[types+".i_rmend"], _ = m.GetInteger("rmend")
+        }
+        saveData[types+".s_email"] = strings.Trim(m.GetString("email"), " ")
+        saveData[types+".i_wxpush"] = wxpush
+        saveData[types+"o_jy.i_mailpush"] = mailpush
+    } else if reqType == "delKeysWord" { //
+        index = m.GetString("index")
+        var keyMaps = []map[string]interface{}{}
+        a_key, _ := m.GetSession("o_jy_a_key").([]interface{})
+        for k, v := range a_key {
+            if k != util.IntAll(index) {
+                keyMaps = append(keyMaps, v.(map[string]interface{}))
+            }
+        }
+        saveData[types+".a_key"] = keyMaps
+    } else if reqType == "setSurp" {
+        saveData[types+".s_surprise"] = "A"
+        m.SetSession("surprise", "A")
+    } else if reqType == "saveKeyWordsNew" { //保存 or 修改 整个订阅词接口
+        index = m.GetString("index")
+        indexInt := util.IntAll(index)
+        area := m.GetSlice("area")
+        infotype := m.GetSlice("infotype")
+        notkey := m.GetSlice("notkey")
+        keyWords := m.GetString("keyWords")
+        a_key, a_key_ok := m.GetSession("o_jy_a_key").([]interface{})
+        if len(notkey) > 10 {
+            notkey = notkey[0:10]
+        }
+        for k, v := range notkey {
+            notkey[k] = strings.Replace(v, " ", "", -1)
+        }
+        keys := processKeyword(keyWords)
+        if keys == nil || indexInt >= 10 {
+            m.ServeJson(map[string]interface{}{
+                "flag": false,
+            })
+            return
+        }
+        saveKey := map[string]interface{}{
+            "key":      []string{keys[0]},
+            "area":     fliterEmptyArr(area),
+            "notkey":   fliterEmptyArr(notkey),
+            "infotype": fliterEmptyArr(infotype),
+        }
+        var optime time.Time
+        var regtime int64
+        if o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000"); o_jy != nil && len(*o_jy) > 0 {
+            //获取活动上线时间
+            o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
+            data := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
+            optimalTime, _ := config.Sysconfig["optimalTime"].(string)
+            optime, _ = time.ParseInLocation(Date_Full_Layout, optimalTime, time.Local)
+            regtime = data.Data.Free.Registedate
+            if o_jy != nil && len(*o_jy) > 0 {
+                if (*o_jy)["i_new"] == nil {
+                    if time.Unix(regtime, 0).After(optime) {
+                        saveData[types+".i_new"] = 1
+                    } else {
+                        saveData[types+".i_new"] = 0
+                    }
+                }
+                if (*o_jy)["a_key"] != nil {
+                    ak, _ := (*o_jy)["a_key"].([]interface{})
+                    if len(ak) > indexInt {
+                        if akmap, _ := ak[indexInt].(map[string]interface{}); akmap["from"] != nil {
+                            saveKey["from"] = akmap["from"]
+                        }
+                    }
+                }
+            }
+        }
+        if !a_key_ok && indexInt == 0 { //第一次新增
+            index = ""
+            saveData[types+".a_key"] = []map[string]interface{}{saveKey}
+            if time.Unix(regtime, 0).Before(optime) {
+                saveData[types+".i_new"] = 1
+            }
+        } else { //修改新增
+            if indexInt > len(a_key) {
+                indexInt = len(a_key)
+            }
+            saveData[fmt.Sprintf("%s.a_key.%d", types, indexInt)] = saveKey
+        }
+    }
+    //修改操作
+    var flag bool
+    if len(saveData) > 0 {
+        saveData[types+".l_modifydate"] = time.Now().Unix()
+        query := map[string]interface{}{
+            "i_userid": util.Int64All(m.GetSession("entUserId")),
+            "i_entid":  util.Int64All(m.GetSession("entId")),
+            "i_type":   2,
+        }
+        if index == "" {
+            if positionType == 0 {
+                flag = mongodb.UpdateById("user", userId, map[string]interface{}{
+                    "$set": saveData,
+                })
+            } else {
+                flag = mongodb.Update("entniche_rule", query, map[string]interface{}{
+                    "$set": saveData,
+                }, true, false)
+            }
 
-		} else {
-			if intIndex, e := strconv.Atoi(index); e == nil && intIndex >= 0 && intIndex < 10 {
-				if positionType == 0 {
-					flag = mongodb.UpdateById("user", userId, map[string]interface{}{
-						"$set": saveData,
-					})
-				} else {
-					flag = mongodb.Update("entniche_rule", query, map[string]interface{}{
-						"$set": saveData,
-					}, true, false)
-				}
+        } else {
+            if intIndex, e := strconv.Atoi(index); e == nil && intIndex >= 0 && intIndex < 10 {
+                if positionType == 0 {
+                    flag = mongodb.UpdateById("user", userId, map[string]interface{}{
+                        "$set": saveData,
+                    })
+                } else {
+                    flag = mongodb.Update("entniche_rule", query, map[string]interface{}{
+                        "$set": saveData,
+                    }, true, false)
+                }
 
-			}
-		}
-	}
-	m.ServeJson(map[string]interface{}{
-		"flag": flag,
-	})
-	return
+            }
+        }
+    }
+    m.ServeJson(map[string]interface{}{
+        "flag": flag,
+    })
+    return
 }
 
 //过滤[""]数组
 func fliterEmptyArr(beforeArr []string) []string {
-	afterArr := []string{}
-	for _, v := range beforeArr {
-		if v == "" {
-			continue
-		}
-		afterArr = append(afterArr, v)
-	}
-	return afterArr
+    afterArr := []string{}
+    for _, v := range beforeArr {
+        if v == "" {
+            continue
+        }
+        afterArr = append(afterArr, v)
+    }
+    return afterArr
 }
 
 //高级设置
 func (m *Front) WxKeysetSeniorset() error {
-	defer util.Catch()
-	userid := util.ObjToString(m.GetSession("userId"))
-	myopenid := util.ObjToString(m.GetSession("s_m_openid"))
-	if myopenid == "" || userid == "" {
-		return m.Redirect("/swordfish/share/-1")
-	}
-	m.T["openid"] = se.EncodeString(myopenid)
-	m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
-	mynickname, _ := m.Session().Get("s_nickname").(string)
-	myavatar, _ := m.Session().Get("s_avatar").(string)
-	m.T["nickname"] = mynickname
-	m.T["avatar"] = myavatar
-	return m.Render("/weixin/wxkeyset/seniorset.html")
+    defer util.Catch()
+    userid := util.ObjToString(m.GetSession("userId"))
+    myopenid := util.ObjToString(m.GetSession("s_m_openid"))
+    if myopenid == "" || userid == "" {
+        return m.Redirect("/swordfish/share/-1")
+    }
+    m.T["openid"] = se.EncodeString(myopenid)
+    m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
+    mynickname, _ := m.Session().Get("s_nickname").(string)
+    myavatar, _ := m.Session().Get("s_avatar").(string)
+    m.T["nickname"] = mynickname
+    m.T["avatar"] = myavatar
+    return m.Render("/weixin/wxkeyset/seniorset.html")
 }
 
 //高级设置
 func (m *Front) WxKeysetFilterset() error {
-	defer util.Catch()
-	userid := util.ObjToString(m.GetSession("userId"))
-	myopenid := util.ObjToString(m.GetSession("s_m_openid"))
-	if myopenid == "" || userid == "" {
-		return m.Redirect("/swordfish/share/-1")
-	}
-	m.T["openid"] = se.EncodeString(myopenid)
-	m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
-	mynickname, _ := m.Session().Get("s_nickname").(string)
-	myavatar, _ := m.Session().Get("s_avatar").(string)
-	m.T["nickname"] = mynickname
-	m.T["avatar"] = myavatar
-	return m.Render("/weixin/wxkeyset/filterset.html")
+    defer util.Catch()
+    userid := util.ObjToString(m.GetSession("userId"))
+    myopenid := util.ObjToString(m.GetSession("s_m_openid"))
+    if myopenid == "" || userid == "" {
+        return m.Redirect("/swordfish/share/-1")
+    }
+    m.T["openid"] = se.EncodeString(myopenid)
+    m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
+    mynickname, _ := m.Session().Get("s_nickname").(string)
+    myavatar, _ := m.Session().Get("s_avatar").(string)
+    m.T["nickname"] = mynickname
+    m.T["avatar"] = myavatar
+    return m.Render("/weixin/wxkeyset/filterset.html")
 }
 
 //保存入库之前,处理订阅的关键词
 func processKeyword(keyword string) []string {
-	keywordReg := regexp.MustCompile("([\\s\u3000\u2003\u00a0+,,])+")
-	spaceReg := regexp.MustCompile("\\s+")
-	keyword = keywordReg.ReplaceAllString(keyword, " ")
-	keyword = spaceReg.ReplaceAllString(keyword, " ")
-	keyword = strings.Trim(keyword, " ")
-	if keyword == "" {
-		return nil
-	}
-	return strings.Split(keyword, " ")
+    keywordReg := regexp.MustCompile("([\\s\u3000\u2003\u00a0+,,])+")
+    spaceReg := regexp.MustCompile("\\s+")
+    keyword = keywordReg.ReplaceAllString(keyword, " ")
+    keyword = spaceReg.ReplaceAllString(keyword, " ")
+    keyword = strings.Trim(keyword, " ")
+    if keyword == "" {
+        return nil
+    }
+    return strings.Split(keyword, " ")
 }
 
 //超级订阅优化,免费订阅判断新老用户  1:新用户 0:老用户
 func NewUserByVIP(ojy *map[string]interface{}, regtime int64) int {
-	/*  if len(*mData) == 0 || mData == nil {
-	            return 1
-	    }
-	    ojy, _ := (*mData)["o_jy"].(map[string]interface{})*/
-	if len(*ojy) > 0 && ojy != nil {
-		if (*ojy)["i_new"] != nil {
-			return util.IntAllDef((*ojy)["i_new"], 1)
-		}
-		optimalTime, _ := config.Sysconfig["optimalTime"].(string)
-		optime, _ := time.ParseInLocation(Date_Full_Layout, optimalTime, time.Local)
-		//regtime, _ := (*mData)["l_registedate"].(int64)
-		//如果a_key 存在 即为老用户
-		if ((*ojy)["a_key"] == nil && time.Unix(regtime, 0).Before(optime)) || (time.Unix(regtime, 0).After(optime)) {
-			return 1
-		}
-	}
-	return 0
+    /*  if len(*mData) == 0 || mData == nil {
+                return 1
+        }
+        ojy, _ := (*mData)["o_jy"].(map[string]interface{})*/
+    if len(*ojy) > 0 && ojy != nil {
+        if (*ojy)["i_new"] != nil {
+            return util.IntAllDef((*ojy)["i_new"], 1)
+        }
+        optimalTime, _ := config.Sysconfig["optimalTime"].(string)
+        optime, _ := time.ParseInLocation(Date_Full_Layout, optimalTime, time.Local)
+        //regtime, _ := (*mData)["l_registedate"].(int64)
+        //如果a_key 存在 即为老用户
+        if ((*ojy)["a_key"] == nil && time.Unix(regtime, 0).Before(optime)) || (time.Unix(regtime, 0).After(optime)) {
+            return 1
+        }
+    }
+    return 0
 }

+ 0 - 76
src/jfw/modules/app/src/app/filter/baseuserfilter.go

@@ -1,76 +0,0 @@
-package filter
-
-import (
-	"jy/src/jfw/modules/app/src/jfw/config"
-	"log"
-	"net/http"
-
-	util "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/usercenter"
-	"app.yhyue.com/moapp/jypkg/public"
-
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-)
-
-type baseUserFilter struct {
-	W          http.ResponseWriter
-	R          *http.Request
-	Session    *httpsession.Session
-	GetSession map[string]interface{}
-}
-
-//判断session中是否存在base_user_id 不存在则更新
-
-func (this *baseUserFilter) Do() bool {
-	if flag, _ := config.Sysconfig["baseUserFilterFlag"].(bool); !flag {
-		return true
-	}
-	if this.R.Method == "POST" {
-		return true
-	}
-	if uid := this.GetSession["userId"]; uid != nil && uid != "" {
-		baseUserId := this.GetSession["base_user_id"]
-		if baseUserId == nil || baseUserId == 0 {
-			data, ok := public.MQFW.FindById("user", util.ObjToString(uid), `{"base_user_id":1}`)
-			if data != nil && ok && len(*data) > 0 {
-				if base_user_id := util.Int64All((*data)["base_user_id"]); base_user_id > 0 {
-					baseUserId = base_user_id
-					this.Session.Set("base_user_id", (*data)["base_user_id"])
-				} else {
-					log.Printf("%s用户暂无base_user_id", uid)
-				}
-			}
-		}
-		personId := this.GetSession["personId"]
-		if personId == nil || personId == 0 {
-			//获取自然人id,个人账户id,企业账户id,企业雇员职位id,企业雇员账户id,个人职位id
-			ck := &http.Cookie{}
-			entId := util.Int64All(this.GetSession["entId"])
-			identity := usercenter.GetUserIdentity(util.ObjToString(config.Sysconfig["userCenterApi"]), util.ObjToString(uid), util.Int64All(baseUserId), entId, ck)
-			if identity != nil {
-				if identity.PersonId > 0 {
-					this.Session.Set("personId", identity.PersonId)
-				}
-				if identity.UserName != "" {
-					this.Session.Set("userName", identity.UserName)
-				}
-				if identity.PersonId > 0 {
-					this.Session.Set("userAccountId", identity.PersonId)
-				}
-				if identity.EntAccountId > 0 {
-					this.Session.Set("entAccountId", identity.EntAccountId)
-				}
-				if identity.EntUserAccountId > 0 {
-					this.Session.Set("entUserAccountId", identity.EntUserAccountId)
-				}
-				if identity.UserPositionId > 0 {
-					this.Session.Set("userPositionId", identity.UserPositionId)
-				}
-				if identity.EntUserPositionId > 0 {
-					this.Session.Set("entUserPositionId", identity.EntUserPositionId)
-				}
-			}
-		}
-	}
-	return true
-}

+ 0 - 3
src/jfw/modules/app/src/app/filter/filter.go

@@ -64,8 +64,5 @@ func (f *Filter) Do(w http.ResponseWriter, r *http.Request) bool {
 	if !(&phoneFilter{w, r, session, getSession}).Do() {
 		return false
 	}
-	if !(&baseUserFilter{w, r, session, getSession}).Do() {
-		return false
-	}
 	return true
 }

+ 0 - 1
src/jfw/modules/app/src/app/front/bigMember.go

@@ -34,7 +34,6 @@ func (s *NewBigMemberAction) PowerClear() {
 
 func (s *NewBigMemberAction) VipPageManager(htmlName string) error {
 	if !freePageReg.MatchString(htmlName) {
-
 		bigBaseMsg := jy.GetBigVipUserBaseMsg( s.Session(), *config.Middleground)
 		//大会员页面权限判断
 		if !bigBaseMsg.CheckBigVipFrontPower(htmlName) {

+ 0 - 20
src/jfw/modules/app/src/app/front/front.go

@@ -231,8 +231,6 @@ func isInTSguide(userid string, session *httpsession.Session) bool {
 	if userid == "" {
 		return false
 	}
-
-	//data, ok := mongodb.FindById("user", userid, `{"o_jy":1,"i_ts_guide":1,"":1,"i_member_status":1,"i_vip_status":1,"s_phone":1,"s_m_phone":1}`)
 	data := jy.GetBigVipUserBaseMsg( session,  *config.Middleground)
 	//付费用户无免费订阅,不进入订阅向导页面
 	if data.Data.Vip.Status > 0 || data.Data.Vip.Status > 0 {
@@ -551,26 +549,9 @@ func (s *Front) ShowRedSpotOnMenu() {
 	subscribe, project, ent, notice := 0, 0, 0, 0
 	if userid != "" {
 		users, ok := mongodb.FindById("user", userid, `{"s_phone":1,"s_m_phone":1,i_member_status":1,"i_apppushunread":1,"i_member_apppushunread":1,"s_member_mainid":1,"i_member_sub_status":1}`)
-
-
 		user := jy.GetBigVipUserBaseMsg( s.Session(),  *config.Middleground)
 		uid := ""
 		isNew := user.Data.Entniche.IsNew > 0
-		/* res := public.Mysql.SelectBySql(`SELECT isNew,i.name,i.phone,i.status,i.auth_status,u.power FROM entniche_user u LEFT JOIN entniche_info i
-		   			ON u.ent_id=i.id
-		   			where u.phone=? `, s_phone)
-		                   if res != nil && len(*res) > 0 {
-		                           //entname := qutil.ObjToString((*res)[0]["name"])
-		                           //已购买企业未过期-商机管理用户
-		                           for _, v := range *res {
-		                                   if util.IntAll(v["status"]) == 1 && util.IntAll(v["power"]) == 1 {
-		                                           if util.IntAll(v["isNew"]) == 1 {
-		                                                   isNew = true
-		                                           }
-		                                           break
-		                                   }
-		                           }
-		                   }*/
 		if ok && users != nil {
 			if jy.SwitchService.IsMember(s.Session(),   *config.Middleground) {
 				subscribe = util.IntAll((*users)["i_member_apppushunread"])
@@ -592,7 +573,6 @@ func (s *Front) ShowRedSpotOnMenu() {
 			uid = userid
 		}
 		powerMap := user.PowerMap
-		//powerMap := jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW).PowerMap
 		if memberStatus > 0 && (powerMap[13] || powerMap[16]) {
 			ent = util.IntAll(public.BaseMysql.Count("follow_ent_monitor", map[string]interface{}{
 				"i_apppushunread": 1,

+ 7 - 7
src/jfw/modules/app/src/app/front/login.go

@@ -91,7 +91,7 @@ func (l *Login) Login() error {
 			if url != "" {
 				status := 1
 				from := l.GetString("from")
-				if l.GetSession("userId") == nil || from == "restart" {
+				if l.GetSession("mgoUserId") == nil || from == "restart" {
 					status = autoLogin(sign, from, l.Session(), l.ResponseWriter)
 				}
 				if status == 1 {
@@ -134,7 +134,7 @@ func (l *Login) Login() error {
 			return -1 //用户名或密码不正确
 		} else if reqType == "signLogin" {
 			returnStatus := 0
-			if l.GetSession("userId") != nil {
+			if l.GetSession("mgoUserId") != nil {
 				returnStatus = 1
 			} else {
 				returnStatus = autoLogin(l.GetString("sign"), "", l.Session(), l.ResponseWriter)
@@ -142,7 +142,7 @@ func (l *Login) Login() error {
 			(userInfo)["headimageurl"] = l.GetSession("s_headimageurl")
 			(userInfo)["nickname"] = l.GetSession("s_nickname")
 			(userInfo)["s_phone"] = l.GetSession("s_phone")
-			(userInfo)["userid"] = l.GetSession("userId")
+			(userInfo)["userid"] = l.GetSession("mgoUserId")
 			(userInfo)["app_name"] = l.GetSession("app_name")
 			return returnStatus
 		} else if reqType == "sendIdentCode" {
@@ -260,7 +260,7 @@ func (l *Login) Login() error {
 	}()
 	result := map[string]interface{}{
 		"status": status,
-		"userId": l.GetSession("userId"),
+		"userId": l.GetSession("mgoUserId"),
 	}
 	if returnSign != "" {
 		result["sign"] = returnSign
@@ -735,7 +735,7 @@ func (l *Login) WxLogin() {
 	//返回
 	result := map[string]interface{}{
 		"status": status,
-		"userId": l.GetSession("userId"),
+		"userId": l.GetSession("mgoUserId"),
 	}
 	if returnSign != "" {
 		result["sign"] = returnSign
@@ -830,7 +830,7 @@ func (l *Login) SignOut() {
 	status := 1
 	sign := l.GetString("sign")
 	isKicked, _ := l.GetBool("isKicked")
-	userid, _ := l.GetSession("userId").(string)
+	userid, _ := l.GetSession("mgoUserId").(string)
 	jpushid, _ := l.GetSession("s_jpushid").(string)
 	if (userid == "" || jpushid == "") && sign != "" {
 		u, s := analySign("退出登录", sign)
@@ -867,7 +867,7 @@ func (l *Login) AfterPageLoadToCheck() {
 		userId = u.UserId
 	}
 	if userId == "" {
-		userId, _ = l.GetSession("userId").(string)
+		userId, _ = l.GetSession("mgoUserId").(string)
 	}
 	update, _ := config.Sysconfig["update"].(map[string]interface{})
 	ios_openUpdate, _ := update["ios_openUpdate"].(bool)

+ 396 - 401
src/jfw/modules/app/src/app/front/me.go

@@ -1,282 +1,277 @@
 package front
 
 import (
-        "fmt"
-        . "jy/src/jfw/modules/app/src/app/jyutil"
-        "jy/src/jfw/modules/app/src/jfw/config"
-        "log"
-        "strings"
-        "time"
+	"fmt"
+	. "jy/src/jfw/modules/app/src/app/jyutil"
+	"jy/src/jfw/modules/app/src/jfw/config"
+	"log"
+	"strings"
+	"time"
 
-        qutil "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/redis"
-        "app.yhyue.com/moapp/jybase/usercenter"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "app.yhyue.com/moapp/jypkg/public"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jybase/usercenter"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"app.yhyue.com/moapp/jypkg/public"
 
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
-        "go.mongodb.org/mongo-driver/bson"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"go.mongodb.org/mongo-driver/bson"
 )
 
 type Me struct {
-        *xweb.Action
-        meIndex             xweb.Mapper `xweb:"/jyapp/free/me"`
-        meSet               xweb.Mapper `xweb:"/jyapp/free/set"`
-        meSetPhone          xweb.Mapper `xweb:"/jyapp/free/setphone"`
-        meCustomer          xweb.Mapper `xweb:"/jyapp/free/customer"`
-        meset_info          xweb.Mapper `xweb:"/jyapp/free/setinfo"`             //修改页面需要的参数
-        updatepwd           xweb.Mapper `xweb:"/jyapp/updatepwd"`                //修改密码
-        pushMsgSet          xweb.Mapper `xweb:"/jyapp/free/pushMsgSet"`          //推送消息设置
-        iframe              xweb.Mapper `xweb:"/jyapp/free/iframe"`              //使用帮助
-        solveWay            xweb.Mapper `xweb:"/jyapp/free/solveWay"`            //android收不到推送的解决办法
-        notice              xweb.Mapper `xweb:"/jyapp/free/notice"`              //通知
-        noticeList          xweb.Mapper `xweb:"/jyapp/free/notice/list"`         //获取通知
-        checkUpdate         xweb.Mapper `xweb:"/jyapp/free/checkUpdate"`         //检查是否更新
-        newVersionUpdateLog xweb.Mapper `xweb:"/jyapp/free/newVersionUpdateLog"` //检查是否更新
-        download            xweb.Mapper `xweb:"/jyapp/free/download/(weixin|normal)"`
-        controlGrayUpdate   xweb.Mapper `xweb:"/jyapp/free/controlGrayUpdate/(user|channel)"` //app灰度更新
-        accountSafe         xweb.Mapper `xweb:"/jyapp/free/accountSafe"`                      //账号安全
-        getAccountInfo      xweb.Mapper `xweb:"/jyapp/free/getAccountInfo"`                   //账号安全获取信息
-        appVersion          xweb.Mapper `xweb:"/jyapp/free/appVersion"`                       //app版本号检测
+	*xweb.Action
+	meIndex             xweb.Mapper `xweb:"/jyapp/free/me"`
+	meSet               xweb.Mapper `xweb:"/jyapp/free/set"`
+	meSetPhone          xweb.Mapper `xweb:"/jyapp/free/setphone"`
+	meCustomer          xweb.Mapper `xweb:"/jyapp/free/customer"`
+	meset_info          xweb.Mapper `xweb:"/jyapp/free/setinfo"`             //修改页面需要的参数
+	updatepwd           xweb.Mapper `xweb:"/jyapp/updatepwd"`                //修改密码
+	pushMsgSet          xweb.Mapper `xweb:"/jyapp/free/pushMsgSet"`          //推送消息设置
+	iframe              xweb.Mapper `xweb:"/jyapp/free/iframe"`              //使用帮助
+	solveWay            xweb.Mapper `xweb:"/jyapp/free/solveWay"`            //android收不到推送的解决办法
+	notice              xweb.Mapper `xweb:"/jyapp/free/notice"`              //通知
+	noticeList          xweb.Mapper `xweb:"/jyapp/free/notice/list"`         //获取通知
+	checkUpdate         xweb.Mapper `xweb:"/jyapp/free/checkUpdate"`         //检查是否更新
+	newVersionUpdateLog xweb.Mapper `xweb:"/jyapp/free/newVersionUpdateLog"` //检查是否更新
+	download            xweb.Mapper `xweb:"/jyapp/free/download/(weixin|normal)"`
+	controlGrayUpdate   xweb.Mapper `xweb:"/jyapp/free/controlGrayUpdate/(user|channel)"` //app灰度更新
+	accountSafe         xweb.Mapper `xweb:"/jyapp/free/accountSafe"`                      //账号安全
+	getAccountInfo      xweb.Mapper `xweb:"/jyapp/free/getAccountInfo"`                   //账号安全获取信息
+	appVersion          xweb.Mapper `xweb:"/jyapp/free/appVersion"`                       //app版本号检测
 
-        //静态页面通用地址-未登录
-        staticPage xweb.Mapper `xweb:"/jyapp/free/staticPage/(.+)"`
-        myInfo     xweb.Mapper `xweb:"/jyapp/myinfo"`
+	//静态页面通用地址-未登录
+	staticPage xweb.Mapper `xweb:"/jyapp/free/staticPage/(.+)"`
+	myInfo     xweb.Mapper `xweb:"/jyapp/myinfo"`
 }
 
 func init() {
-        xweb.AddAction(&Me{})
+	xweb.AddAction(&Me{})
 }
 
 func (m *Me) AppVersion() {
-        m.Render("/me/appVersion.html", &m.T)
+	m.Render("/me/appVersion.html", &m.T)
 }
 
 // StaticPage 静态页面
 func (m *Me) StaticPage(pagename string) error {
-        return m.Render("/staticpage/" + pagename)
+	return m.Render("/staticpage/" + pagename)
 }
 func (m *Me) MeIndex() error {
-        userid := qutil.ObjToString(m.GetSession("userId"))
-        //检测用户是否绑定邮箱
-        if userid != "" {
-                res, err := mongodb.FindById("user", userid, nil)
-                if len(*res) > 0 && err {
-                        if qutil.ObjToString((*res)["s_myemail"]) == "" {
-                                m.T["isNoEmail"] = true
-                        }
-                        if qutil.Int64All((*res)["i_vip_status"]) == 1 || qutil.Int64All((*res)["i_vip_status"]) == 2 {
-                                m.T["isVip"] = true
-                        }
-                        m.T["member_status"] = qutil.If((*res)["i_member_status"] != nil, qutil.Int64All((*res)["i_member_status"]), 0)
-                        power := []int{} //GetNewPower(userid)
-
-                        powerMap := jy.GetBigVipUserBaseMsg( m.Session(), *config.Middleground).PowerMap
-                        for k := range powerMap {
-                                power = append(power, k)
-                        }
-                        m.T["power"] = power
-                } else {
-                        return m.Redirect("/jyapp/free/login?back=index&flag=quit")
-                }
-        } else {
-                return m.Redirect("/jyapp/free/login?back=index&flag=quit")
-        }
-        m.T["isIosExam"], m.T["isIosExamPhone"], _, m.T["isEnt"] = IosExamInfo(m.Action, false, true)
-        return m.Render("/me/mine.html", &m.T)
+	userid := qutil.ObjToString(m.GetSession("mgoUserId"))
+	//检测用户是否绑定邮箱
+	if userid != "" {
+		b := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
+		if b.Email == "" {
+			m.T["isNoEmail"] = true
+		}
+		if b.VipStatus > 0 {
+			m.T["isVip"] = true
+		}
+		m.T["member_status"] = b.Status
+		power := []int{} //GetNewPower(userid)
+		for k := range b.PowerMap {
+			power = append(power, k)
+		}
+		m.T["power"] = power
+	} else {
+		return m.Redirect("/jyapp/free/login?back=index&flag=quit")
+	}
+	m.T["isIosExam"], m.T["isIosExamPhone"], _, m.T["isEnt"] = IosExamInfo(m.Action, false, true)
+	return m.Render("/me/mine.html", &m.T)
 }
 func (m *Me) MeSet() error {
-        return m.Render("/me/setting.html")
+	return m.Render("/me/setting.html")
 }
 func (m *Me) MeSetPhone() error {
-        return m.Render("/me/setphone.html")
+	return m.Render("/me/setphone.html")
 }
 func (m *Me) MeCustomer() error {
-        return m.Render("/me/customer.html")
+	return m.Render("/me/customer.html")
 }
 
 func (m *Me) Meset_info() {
-        userid := qutil.ObjToString(m.GetSession("userId"))
-        hasPwd := false
-        isVip := false
-        if userid != "" {
-                user, ok := mongodb.FindById("user", userid, `{"s_password":1,"i_vip_status":1}`)
-                if ok && user != nil {
-                        if qutil.ObjToString((*user)["s_password"]) != "" {
-                                hasPwd = true
-                        }
-                        if qutil.Int64All((*user)["i_vip_status"]) == 1 || qutil.Int64All((*user)["i_vip_status"]) == 2 {
-                                isVip = true
-                        }
-                }
+	userid := qutil.ObjToString(m.GetSession("mgoUserId"))
+	hasPwd := false
+	isVip := false
+	if userid != "" {
+		user, ok := mongodb.FindById("user", userid, `{"s_password":1}`)
+		if ok && user != nil {
+			if qutil.ObjToString((*user)["s_password"]) != "" {
+				hasPwd = true
+			}
+			b := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
+			if b.VipStatus > 0 {
+				isVip = true
+			}
+		}
 
-        }
-        m.ServeJson(map[string]interface{}{
-                "isVip":  isVip,
-                "hasPwd": hasPwd,
-        })
+	}
+	m.ServeJson(map[string]interface{}{
+		"isVip":  isVip,
+		"hasPwd": hasPwd,
+	})
 }
 func (m *Me) PushMsgSet() error {
-        return m.Render("/me/pushMsgSet.html")
+	return m.Render("/me/pushMsgSet.html")
 }
 func (m *Me) Iframe() error {
-        return m.Render("/me/iframe.html")
+	return m.Render("/me/iframe.html")
 }
 func (m *Me) SolveWay() error {
-        return m.Render("/me/solveWay.html")
+	return m.Render("/me/solveWay.html")
 }
 func (m *Me) Notice() error {
-        userId, _ := m.GetSession("userId").(string)
-        if userId != "" {
-                mongodb.Update("jyapp_notice", map[string]interface{}{
-                        "s_userid": userId,
-                        "i_unread": 1,
-                        "$and":     []bson.M{{"s_type": bson.M{"$ne": "message"}}, {"s_type": bson.M{"$ne": "titleMessage"}}},
-                }, map[string]interface{}{
-                        "$set": map[string]interface{}{
-                                "i_unread":    0,
-                                "l_timestamp": time.Now().Unix(),
-                        },
-                }, false, true)
-        }
-        return m.Render("/me/notice.html")
+	userId, _ := m.GetSession("userId").(string)
+	if userId != "" {
+		mongodb.Update("jyapp_notice", map[string]interface{}{
+			"s_userid": userId,
+			"i_unread": 1,
+			"$and":     []bson.M{{"s_type": bson.M{"$ne": "message"}}, {"s_type": bson.M{"$ne": "titleMessage"}}},
+		}, map[string]interface{}{
+			"$set": map[string]interface{}{
+				"i_unread":    0,
+				"l_timestamp": time.Now().Unix(),
+			},
+		}, false, true)
+	}
+	return m.Render("/me/notice.html")
 }
 func (m *Me) NoticeList() {
-        userId, _ := m.GetSession("userId").(string)
-        pageNum, _ := m.GetInteger("pageNum")
-        var list *[]map[string]interface{}
-        if userId != "" {
-                list, _ = mongodb.Find("jyapp_notice", map[string]interface{}{
-                        "s_userid": userId,
-                }, `{"l_comeintime":-1}`, nil, false, pageNum*100, 100)
-        }
-        if public.Mysql.CountBySql("select count(*) from dis_partner where uid=? and type!=3 ", userId) > 0 {
-                for key := range *list {
-                        (*list)[key]["isExhibition"] = false
-                }
-        } else {
-                for key := range *list {
-                        (*list)[key]["isExhibition"] = true
-                }
-        }
-        m.ServeJson(map[string]interface{}{
-                "list": list,
-        })
+	userId, _ := m.GetSession("userId").(string)
+	pageNum, _ := m.GetInteger("pageNum")
+	var list *[]map[string]interface{}
+	if userId != "" {
+		list, _ = mongodb.Find("jyapp_notice", map[string]interface{}{
+			"s_userid": userId,
+		}, `{"l_comeintime":-1}`, nil, false, pageNum*100, 100)
+	}
+	if public.Mysql.CountBySql("select count(*) from dis_partner where uid=? and type!=3 ", userId) > 0 {
+		for key := range *list {
+			(*list)[key]["isExhibition"] = false
+		}
+	} else {
+		for key := range *list {
+			(*list)[key]["isExhibition"] = true
+		}
+	}
+	m.ServeJson(map[string]interface{}{
+		"list": list,
+	})
 }
 func (m *Me) Download(from string) error {
-        m.T["from"] = from
-        m.T["source"] = m.GetString("source")
-        m.T["code"] = m.GetString("code")
-        return m.Render("/me/download.html", &m.T)
+	m.T["from"] = from
+	m.T["source"] = m.GetString("source")
+	m.T["code"] = m.GetString("code")
+	return m.Render("/me/download.html", &m.T)
 }
 func (l *Me) Updatepwd() error {
-        defer qutil.Catch()
-        if l.Method() == "GET" {
-                return l.Render("/me/updatepwd.html")
-        }
-        status := func() string {
-                userid := qutil.ObjToString(l.GetSession("userId"))
-                if userid == "" {
-                        return "timeout"
-                }
-                user, ok := mongodb.FindById("user", userid, `{"s_password":1}`)
-                if !ok || user == nil || len(*user) == 0 {
-                        return ""
-                }
-                oldpwd := l.GetString("oldpwd")
-                newpwd := l.GetString("newpwd")
-                if !passwordReg.MatchString(strings.TrimSpace(oldpwd)) || !passwordReg.MatchString(strings.TrimSpace(newpwd)) {
-                        return "pwdFormatError"
-                }
-                password, _ := (*user)["s_password"].(string)
-                if password != qutil.GetMd5String(oldpwd) {
-                        return "pwdError"
-                }
-                if mongodb.UpdateById("user", userid, map[string]interface{}{
-                        "$set": map[string]interface{}{
-                                "s_password":      qutil.GetMd5String(newpwd),
-                                "l_updatepwdtime": time.Now().Unix(), //增加修改密码时间
-                        },
-                }) {
-                        //调用用户中台
-                        ck, _ := l.GetCookie("SESSIONID")
-                        usercenter.UpdateBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, ck)
-                        return "y"
-                } else {
-                        return "saveError"
-                }
-        }()
-        l.ServeJson(map[string]interface{}{
-                "status": status,
-        })
-        return nil
+	defer qutil.Catch()
+	if l.Method() == "GET" {
+		return l.Render("/me/updatepwd.html")
+	}
+	status := func() string {
+		userid := qutil.ObjToString(l.GetSession("mgoUserId"))
+		if userid == "" {
+			return "timeout"
+		}
+		user, ok := mongodb.FindById("user", userid, `{"s_password":1}`)
+		if !ok || user == nil || len(*user) == 0 {
+			return ""
+		}
+		oldpwd := l.GetString("oldpwd")
+		newpwd := l.GetString("newpwd")
+		if !passwordReg.MatchString(strings.TrimSpace(oldpwd)) || !passwordReg.MatchString(strings.TrimSpace(newpwd)) {
+			return "pwdFormatError"
+		}
+		password, _ := (*user)["s_password"].(string)
+		if password != qutil.GetMd5String(oldpwd) {
+			return "pwdError"
+		}
+		if mongodb.UpdateById("user", userid, map[string]interface{}{
+			"$set": map[string]interface{}{
+				"s_password":      qutil.GetMd5String(newpwd),
+				"l_updatepwdtime": time.Now().Unix(), //增加修改密码时间
+			},
+		}) {
+			//调用用户中台
+			ck, _ := l.GetCookie("SESSIONID")
+			usercenter.UpdateBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, ck)
+			return "y"
+		} else {
+			return "saveError"
+		}
+	}()
+	l.ServeJson(map[string]interface{}{
+		"status": status,
+	})
+	return nil
 }
 
 //
 func (l *Me) CheckUpdate() error {
-        defer qutil.Catch()
-        channel := l.GetString("channel")
-        u, s := analySign("", l.GetString("token"))
-        userId := ""
-        if s == 1 {
-                userId = u.UserId
-        }
-        if userId == "" {
-                userId, _ = l.GetSession("userId").(string)
-        }
-        isNeedUpdate := 0
-        update, _ := config.Sysconfig["update"].(map[string]interface{})
-        grayUpdate, _ := update["grayupdate"].(bool)
-        newChannel := channel
-        newSystem := -1
-        if strings.HasPrefix(l.GetString("from"), "server-") {
-                system, err := l.GetInt("system")
-                if err == nil && system >= 11 {
-                        newSystem = int(system)
-                }
-        }
-        version := l.GetString("version")
-        updateFlag := ClientUpdate.IsNeedUpdate(userId, version, qutil.ObjToString(update["version"]), newChannel, newSystem, grayUpdate)
-        if updateFlag {
-                if mustupdate, _ := update["mustupdate"].(bool); mustupdate {
-                        isNeedUpdate = 2
-                } else {
-                        isNeedUpdate = 1
-                }
-        }
-        isBrowserUpdate := qutil.IntAll(update["isBrowserUpdate"])
-        if grayUpdate {
-                isBrowserUpdate = 4
-        }
-        result := map[string]interface{}{
-                "isNeedUpdate":    isNeedUpdate,       //0:不需要更新 1:提示更新 2:强制更新
-                "isBrowserUpdate": isBrowserUpdate,    //0:只走app内部更新 1:先app内部更新,再走应用市场,再走浏览器更新 2:只走浏览器更新 3:先app内部更新,再走应用市场 4:先app内部更新,再走浏览器更新
-                "version":         update["version"],  //新版本号
-                "tipspace":        update["tipspace"], //提示间隔时间
-                "apkurl":          ClientUpdate.ApkUrl(channel, qutil.ObjToString(update["apkurl"])),
-        }
-        if version == "" { //3.0.3及以前版本
-                exists := false
-                if userId != "" {
-                        exists, _ = redis.Exists(ClientUpdate.RedisCode, "app_clientupdate_"+userId)
-                        if exists {
-                                redis.Del(ClientUpdate.RedisCode, "app_clientupdate_"+userId)
-                        }
-                }
-                if exists {
-                        result["mustupdate"] = update["mustupdate"]
-                        result["userflag"] = updateFlag
-                } else {
-                        result["mustupdate"] = false
-                        result["userflag"] = false
-                        result["version"] = "3.0.3"
-                }
-        }
-        if userId != "" && (l.GetString("from") == "server-appVersion-2" || l.GetString("from") == "server-mainSearch") {
-                redis.Put(ClientUpdate.RedisCode, "app_clientupdate_"+userId, 1, 5)
-        }
-        l.ServeJson(result)
-        return nil
+	defer qutil.Catch()
+	channel := l.GetString("channel")
+	u, s := analySign("", l.GetString("token"))
+	userId := ""
+	if s == 1 {
+		userId = u.UserId
+	}
+	if userId == "" {
+		userId, _ = l.GetSession("mgoUserId").(string)
+	}
+	isNeedUpdate := 0
+	update, _ := config.Sysconfig["update"].(map[string]interface{})
+	grayUpdate, _ := update["grayupdate"].(bool)
+	newChannel := channel
+	newSystem := -1
+	if strings.HasPrefix(l.GetString("from"), "server-") {
+		system, err := l.GetInt("system")
+		if err == nil && system >= 11 {
+			newSystem = int(system)
+		}
+	}
+	version := l.GetString("version")
+	updateFlag := ClientUpdate.IsNeedUpdate(userId, version, qutil.ObjToString(update["version"]), newChannel, newSystem, grayUpdate)
+	if updateFlag {
+		if mustupdate, _ := update["mustupdate"].(bool); mustupdate {
+			isNeedUpdate = 2
+		} else {
+			isNeedUpdate = 1
+		}
+	}
+	isBrowserUpdate := qutil.IntAll(update["isBrowserUpdate"])
+	if grayUpdate {
+		isBrowserUpdate = 4
+	}
+	result := map[string]interface{}{
+		"isNeedUpdate":    isNeedUpdate,       //0:不需要更新 1:提示更新 2:强制更新
+		"isBrowserUpdate": isBrowserUpdate,    //0:只走app内部更新 1:先app内部更新,再走应用市场,再走浏览器更新 2:只走浏览器更新 3:先app内部更新,再走应用市场 4:先app内部更新,再走浏览器更新
+		"version":         update["version"],  //新版本号
+		"tipspace":        update["tipspace"], //提示间隔时间
+		"apkurl":          ClientUpdate.ApkUrl(channel, qutil.ObjToString(update["apkurl"])),
+	}
+	if version == "" { //3.0.3及以前版本
+		exists := false
+		if userId != "" {
+			exists, _ = redis.Exists(ClientUpdate.RedisCode, "app_clientupdate_"+userId)
+			if exists {
+				redis.Del(ClientUpdate.RedisCode, "app_clientupdate_"+userId)
+			}
+		}
+		if exists {
+			result["mustupdate"] = update["mustupdate"]
+			result["userflag"] = updateFlag
+		} else {
+			result["mustupdate"] = false
+			result["userflag"] = false
+			result["version"] = "3.0.3"
+		}
+	}
+	if userId != "" && (l.GetString("from") == "server-appVersion-2" || l.GetString("from") == "server-mainSearch") {
+		redis.Put(ClientUpdate.RedisCode, "app_clientupdate_"+userId, 1, 5)
+	}
+	l.ServeJson(result)
+	return nil
 }
 
 /*
@@ -299,193 +294,193 @@ func (l *Me) CheckUpdate() error {
     error           //下载失败的异常信息
 */
 func (l *Me) NewVersionUpdateLog() {
-        u, s := analySign("", l.GetString("token"))
-        userId := ""
-        if u != nil && s == 1 {
-                userId = u.UserId
-        }
-        if l.GetString("event") == "server_tip" && userId != "" {
-                redis.Del(ClientUpdate.RedisCode, "app_clientupdate_"+userId)
-        }
-        public.Mgo_Log.Save("jyapp_newversion_updatelog", map[string]interface{}{
-                "createtime":      time.Now().Unix(),
-                "userid":          userId,
-                "event":           l.GetString("event"),
-                "current_version": l.GetString("current_version"),
-                "new_version":     l.GetString("new_version"),
-                "channel":         l.GetString("channel"),
-                "phonetype":       l.GetString("phonetype"),
-                "system":          l.GetString("system"),
-                "ip":              l.IP(),
-                "proxy":           l.Proxy(),
-                "user-agent":      l.Header("User-Agent"),
-                "error":           l.GetString("error"),
-        })
-        l.ServeJson(map[string]interface{}{})
+	u, s := analySign("", l.GetString("token"))
+	userId := ""
+	if u != nil && s == 1 {
+		userId = u.UserId
+	}
+	if l.GetString("event") == "server_tip" && userId != "" {
+		redis.Del(ClientUpdate.RedisCode, "app_clientupdate_"+userId)
+	}
+	public.Mgo_Log.Save("jyapp_newversion_updatelog", map[string]interface{}{
+		"createtime":      time.Now().Unix(),
+		"userid":          userId,
+		"event":           l.GetString("event"),
+		"current_version": l.GetString("current_version"),
+		"new_version":     l.GetString("new_version"),
+		"channel":         l.GetString("channel"),
+		"phonetype":       l.GetString("phonetype"),
+		"system":          l.GetString("system"),
+		"ip":              l.IP(),
+		"proxy":           l.Proxy(),
+		"user-agent":      l.Header("User-Agent"),
+		"error":           l.GetString("error"),
+	})
+	l.ServeJson(map[string]interface{}{})
 }
 
 //
 func (l *Me) MyInfo() {
-        r := map[string]interface{}{
-                "userType": "free",
-        }
-        userId, _ := l.GetSession("userId").(string)
-        positionType := qutil.Int64All(l.GetSession("positionType"))
-        user, ok := &map[string]interface{}{}, false
-        if positionType == 0 {
-                user, ok = mongodb.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,"o_jy":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1,"i_vip_subtips":1,"i_entniche_first":1}`)
-        } else {
+	r := map[string]interface{}{
+		"userType": "free",
+	}
+	userId, _ := l.GetSession("userId").(string)
+	positionType := qutil.Int64All(l.GetSession("positionType"))
+	user, ok := &map[string]interface{}{}, false
+	if positionType == 0 {
+		user, ok = mongodb.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,"o_jy":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1,"i_vip_subtips":1,"i_entniche_first":1}`)
+	} else {
 
-        }
-        if ok && user != nil {
-                isExpire := -1
-                isPassCount := false
-                hasKeyFlag := false
-                tedayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
-                if qutil.IntAll((*user)["i_vip_status"]) > 0 {
-                        r["userType"] = "vip"
-                        var threeRemind = int64(3 * 24 * 60 * 60)
-                        var twoRemind = int64(2 * 24 * 60 * 60)
-                        var oneRemind = int64(1 * 24 * 60 * 60)
-                        _endtime := qutil.Int64All((*user)["l_vip_endtime"])
-                        now_unix := time.Now().Unix()
-                        //是否到期
-                        if _endtime-now_unix < threeRemind && _endtime-now_unix >= twoRemind {
-                                isExpire = 3 //即将到期
-                        } else if _endtime-now_unix < twoRemind && _endtime-now_unix >= oneRemind {
-                                isExpire = 2 //即将到期
-                        } else if _endtime-now_unix < oneRemind && _endtime-now_unix >= 0 {
-                                isExpire = 1 //即将到期
-                        }
-                        isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) >= 2000
-                        o_vipjy, _ := (*user)["o_vipjy"].(map[string]interface{})
-                        if o_vipjy["a_items"] != nil {
-                                a_itmes := qutil.ObjArrToMapArr(o_vipjy["a_items"].([]interface{}))
-                                hasKeyFlag = len(a_itmes) > 0
-                        }
-                } else {
-                        isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) >= 150
-                        o_jy, _ := (*user)["o_jy"].(map[string]interface{})
-                        if o_jy != nil || len(o_jy) == 0 {
-                                a_key, _ := o_jy["a_key"].([]interface{})
-                                hasKeyFlag = len(a_key) > 0
-                        }
-                }
-                //商机管理处理
-                phone := ""
-                if s_phone, _ := (*user)["s_phone"].(string); s_phone != "" {
-                        phone = s_phone
-                } else if s_m_phone, _ := (*user)["s_m_phone"].(string); s_m_phone != "" {
-                        phone = s_m_phone
-                }
-                isEnt := false
-                if phone != "" {
-                        //已购买企业未过期
-                        log.Println("SELECT status FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1", phone)
-                        if entInfo := public.Mysql.SelectBySql(`SELECT status,isNew FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1)`, phone); len((*entInfo)) > 0 {
-                                for _, v := range *entInfo {
-                                        //&& qutil.IntAll(v["isNew"]
-                                        if qutil.IntAll(v["status"]) == 1 {
-                                                isEnt = true
-                                                break
-                                        }
+	}
+	if ok && user != nil {
+		isExpire := -1
+		isPassCount := false
+		hasKeyFlag := false
+		tedayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
+		if qutil.IntAll((*user)["i_vip_status"]) > 0 {
+			r["userType"] = "vip"
+			var threeRemind = int64(3 * 24 * 60 * 60)
+			var twoRemind = int64(2 * 24 * 60 * 60)
+			var oneRemind = int64(1 * 24 * 60 * 60)
+			_endtime := qutil.Int64All((*user)["l_vip_endtime"])
+			now_unix := time.Now().Unix()
+			//是否到期
+			if _endtime-now_unix < threeRemind && _endtime-now_unix >= twoRemind {
+				isExpire = 3 //即将到期
+			} else if _endtime-now_unix < twoRemind && _endtime-now_unix >= oneRemind {
+				isExpire = 2 //即将到期
+			} else if _endtime-now_unix < oneRemind && _endtime-now_unix >= 0 {
+				isExpire = 1 //即将到期
+			}
+			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) >= 2000
+			o_vipjy, _ := (*user)["o_vipjy"].(map[string]interface{})
+			if o_vipjy["a_items"] != nil {
+				a_itmes := qutil.ObjArrToMapArr(o_vipjy["a_items"].([]interface{}))
+				hasKeyFlag = len(a_itmes) > 0
+			}
+		} else {
+			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) >= 150
+			o_jy, _ := (*user)["o_jy"].(map[string]interface{})
+			if o_jy != nil || len(o_jy) == 0 {
+				a_key, _ := o_jy["a_key"].([]interface{})
+				hasKeyFlag = len(a_key) > 0
+			}
+		}
+		//商机管理处理
+		phone := ""
+		if s_phone, _ := (*user)["s_phone"].(string); s_phone != "" {
+			phone = s_phone
+		} else if s_m_phone, _ := (*user)["s_m_phone"].(string); s_m_phone != "" {
+			phone = s_m_phone
+		}
+		isEnt := false
+		if phone != "" {
+			//已购买企业未过期
+			log.Println("SELECT status FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1", phone)
+			if entInfo := public.Mysql.SelectBySql(`SELECT status,isNew FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1)`, phone); len((*entInfo)) > 0 {
+				for _, v := range *entInfo {
+					//&& qutil.IntAll(v["isNew"]
+					if qutil.IntAll(v["status"]) == 1 {
+						isEnt = true
+						break
+					}
 
-                                }
-                        }
-                }
-                if isEnt {
-                        r["userType"] = "entniche"
-                }
-                r["isExpire"] = isExpire
-                r["vipStatus"] = qutil.IntAll((*user)["i_vip_status"])
-                r["isPassCount"] = isPassCount
-                r["haskey"] = hasKeyFlag
-        }
-        l.ServeJson(r)
+				}
+			}
+		}
+		if isEnt {
+			r["userType"] = "entniche"
+		}
+		r["isExpire"] = isExpire
+		r["vipStatus"] = qutil.IntAll((*user)["i_vip_status"])
+		r["isPassCount"] = isPassCount
+		r["haskey"] = hasKeyFlag
+	}
+	l.ServeJson(r)
 }
 
 //
 func (l *Me) AccountSafe() error {
-        return l.Render("/me/account.html")
+	return l.Render("/me/account.html")
 }
 
 func (l *Me) GetAccountInfo() {
-        userid := l.GetSession("userId").(string)
-        info := map[string]interface{}{}
+	userid := l.GetSession("mgoUserId").(string)
+	info := map[string]interface{}{}
 
-        res, _ := public.MQFW.FindById("user", userid, `{"s_myemail":1,"s_phone":1,"s_m_phone":1}`)
-        delete(*res, "_id")
-        if len(*res) > 0 {
-                if (*res)["s_myemail"] != nil {
-                        info["email"] = (*res)["s_myemail"]
-                }
-                if s_phone, _ := (*res)["s_phone"].(string); s_phone != "" {
-                        info["phone"] = s_phone
-                } else if s_m_phone, _ := (*res)["s_m_phone"].(string); s_m_phone != "" {
-                        info["phone"] = s_m_phone
-                }
-        }
-        l.ServeJson(map[string]interface{}{
-                "data": info,
-        })
-        return
+	res, _ := public.MQFW.FindById("user", userid, `{"s_myemail":1,"s_phone":1,"s_m_phone":1}`)
+	delete(*res, "_id")
+	if len(*res) > 0 {
+		if (*res)["s_myemail"] != nil {
+			info["email"] = (*res)["s_myemail"]
+		}
+		if s_phone, _ := (*res)["s_phone"].(string); s_phone != "" {
+			info["phone"] = s_phone
+		} else if s_m_phone, _ := (*res)["s_m_phone"].(string); s_m_phone != "" {
+			info["phone"] = s_m_phone
+		}
+	}
+	l.ServeJson(map[string]interface{}{
+		"data": info,
+	})
+	return
 }
 
 //
 func (l *Me) ControlGrayUpdate(t string) {
-        if l.GetString("pwd") != "lHJ5agM3eiKczOPk3IVj" {
-                l.Write("密码错误!")
-                return
-        }
-        value := l.GetForm()["v"]
-        redisAddr := map[string]string{}
-        for _, v := range strings.Split(public.DbConf.Redis.Main.Address, ",") {
-                rs := strings.Split(v, "=")
-                if len(rs) == 2 {
-                        redisAddr[rs[0]] = rs[1]
-                }
-        }
-        if t == "user" {
-                if len(value) == 0 {
-                        l.Write("请连redis %s 使用命令 keys app_grayupdate_appoint_user_* 查看具体灰度更新人员名单", redisAddr[ClientUpdate.RedisCode])
-                } else {
-                        redis.DelByCodePattern(ClientUpdate.RedisCode, "app_grayupdate_appoint_user_*")
-                        if value[0] == "" {
-                                l.Write("已清除灰度更新人员名单")
-                        } else {
-                                for _, v := range strings.Split(value[0], ",") {
-                                        redis.PutCKV(ClientUpdate.RedisCode, "app_grayupdate_appoint_user_"+v, 1)
-                                }
-                                l.Write("灰度发布人员名单:<br>&nbsp;&nbsp;&nbsp;%s", strings.ReplaceAll(value[0], ",", "<br>&nbsp;&nbsp;&nbsp;"))
-                        }
-                }
-        } else if t == "channel" {
-                if len(value) == 0 {
-                        msg := fmt.Sprintf("请连redis %s 使用命令 keys app_grayupdate_channel_user_* 查看渠道内灰度更新人员名单", redisAddr[ClientUpdate.RedisCode])
-                        msg += "<br><br>渠道灰度更新配置详情:"
-                        for _, v := range redis.GetKeysByPattern(ClientUpdate.RedisCode, "app_grayupdate_channel_max_*") {
-                                vv := string(v.([]uint8))
-                                msg += fmt.Sprintf("<br>&nbsp;&nbsp;&nbsp;渠道名:%s,最大数:%d,当前数:%d", strings.TrimPrefix(vv, "app_grayupdate_channel_max_"), qutil.IntAll(redis.Get(ClientUpdate.RedisCode, vv)), qutil.IntAll(redis.Get(ClientUpdate.RedisCode, strings.ReplaceAll(vv, "_max_", "_count_"))))
-                        }
-                        l.Write(msg)
-                } else {
-                        if value[0] == "" {
-                                redis.DelByCodePattern(ClientUpdate.RedisCode, "app_grayupdate_channel_*")
-                                l.Write("已清除渠道灰度更新配置")
-                        } else {
-                                redis.DelByCodePattern(ClientUpdate.RedisCode, "app_grayupdate_channel_max_*")
-                                msg := "增量的渠道灰度更新,如需全量请先清除,配置详情:"
-                                for _, v := range strings.Split(value[0], ",") {
-                                        vs := strings.Split(v, ":")
-                                        if len(vs) != 2 {
-                                                continue
-                                        }
-                                        if redis.PutCKV(ClientUpdate.RedisCode, "app_grayupdate_channel_max_"+vs[0], qutil.IntAll(vs[1])) {
-                                                msg += fmt.Sprintf("<br>&nbsp;&nbsp;&nbsp;渠道名:%s,最大数:%s", vs[0], vs[1])
-                                        }
-                                }
-                                l.Write(msg)
-                        }
-                }
-        }
+	if l.GetString("pwd") != "lHJ5agM3eiKczOPk3IVj" {
+		l.Write("密码错误!")
+		return
+	}
+	value := l.GetForm()["v"]
+	redisAddr := map[string]string{}
+	for _, v := range strings.Split(public.DbConf.Redis.Main.Address, ",") {
+		rs := strings.Split(v, "=")
+		if len(rs) == 2 {
+			redisAddr[rs[0]] = rs[1]
+		}
+	}
+	if t == "user" {
+		if len(value) == 0 {
+			l.Write("请连redis %s 使用命令 keys app_grayupdate_appoint_user_* 查看具体灰度更新人员名单", redisAddr[ClientUpdate.RedisCode])
+		} else {
+			redis.DelByCodePattern(ClientUpdate.RedisCode, "app_grayupdate_appoint_user_*")
+			if value[0] == "" {
+				l.Write("已清除灰度更新人员名单")
+			} else {
+				for _, v := range strings.Split(value[0], ",") {
+					redis.PutCKV(ClientUpdate.RedisCode, "app_grayupdate_appoint_user_"+v, 1)
+				}
+				l.Write("灰度发布人员名单:<br>&nbsp;&nbsp;&nbsp;%s", strings.ReplaceAll(value[0], ",", "<br>&nbsp;&nbsp;&nbsp;"))
+			}
+		}
+	} else if t == "channel" {
+		if len(value) == 0 {
+			msg := fmt.Sprintf("请连redis %s 使用命令 keys app_grayupdate_channel_user_* 查看渠道内灰度更新人员名单", redisAddr[ClientUpdate.RedisCode])
+			msg += "<br><br>渠道灰度更新配置详情:"
+			for _, v := range redis.GetKeysByPattern(ClientUpdate.RedisCode, "app_grayupdate_channel_max_*") {
+				vv := string(v.([]uint8))
+				msg += fmt.Sprintf("<br>&nbsp;&nbsp;&nbsp;渠道名:%s,最大数:%d,当前数:%d", strings.TrimPrefix(vv, "app_grayupdate_channel_max_"), qutil.IntAll(redis.Get(ClientUpdate.RedisCode, vv)), qutil.IntAll(redis.Get(ClientUpdate.RedisCode, strings.ReplaceAll(vv, "_max_", "_count_"))))
+			}
+			l.Write(msg)
+		} else {
+			if value[0] == "" {
+				redis.DelByCodePattern(ClientUpdate.RedisCode, "app_grayupdate_channel_*")
+				l.Write("已清除渠道灰度更新配置")
+			} else {
+				redis.DelByCodePattern(ClientUpdate.RedisCode, "app_grayupdate_channel_max_*")
+				msg := "增量的渠道灰度更新,如需全量请先清除,配置详情:"
+				for _, v := range strings.Split(value[0], ",") {
+					vs := strings.Split(v, ":")
+					if len(vs) != 2 {
+						continue
+					}
+					if redis.PutCKV(ClientUpdate.RedisCode, "app_grayupdate_channel_max_"+vs[0], qutil.IntAll(vs[1])) {
+						msg += fmt.Sprintf("<br>&nbsp;&nbsp;&nbsp;渠道名:%s,最大数:%s", vs[0], vs[1])
+					}
+				}
+				l.Write(msg)
+			}
+		}
+	}
 }

+ 0 - 1
src/jfw/modules/app/src/app/front/shorturl.go

@@ -51,7 +51,6 @@ func (s *Short) Article(stype, id string) error {
 	if b {
 		return s.Redirect("/jyapp/free/mob/err")
 	}
-
 	userPower := jy.GetBigVipUserBaseMsg( s.Session(),  *config.Middleground)
 	var (
 		isEntnicheNew bool   = userPower.EntIsNew           //新版超级订阅

+ 0 - 3
src/jfw/modules/app/src/app/front/vipsubscribe.go

@@ -112,10 +112,8 @@ func (s *Subscribepay) ToSetPage() {
 			s.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
 		}
 	}
-
 	vSwitch = jy.SwitchService.GetEntniche(s.Session(),   *config.Middleground) //v:vip m:member
 	bigBaseMsg := jy.GetBigVipUserBaseMsg( s.Session(),  *config.Middleground)
-	//bigBaseMsg := jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW)
 	if (vSwitch == "" || vSwitch == "v") && bigBaseMsg.VipStatus <= 0 && !bigBaseMsg.IsUpgrade {
 		s.Redirect("/jyapp/wxkeyset/keyset/index")
 	}
@@ -251,7 +249,6 @@ func (s *Subscribepay) ToSetKeyWordPage() {
 
 	vSwitch = jy.SwitchService.GetEntniche(s.Session(),   *config.Middleground) //v:vip m:member
 	bigBaseMsg := jy.GetBigVipUserBaseMsg( s.Session(),  *config.Middleground)
-	//bigBaseMsg := jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW)
 	//如果没有首次使用
 	if vSwitch == "m" && bigBaseMsg.Status > 0 && !bigBaseMsg.Used {
 		s.Redirect("/jyapp/big/page/init") //跳转至首次初始化页面

+ 0 - 2
src/jfw/modules/app/src/app/front/wxkeyset.go

@@ -27,9 +27,7 @@ func (m *Front) WxKeyset(tpl string) error {
 		return m.Redirect("/jyapp/tenderSubscribe/guide?url=" + url.QueryEscape(m.Request.RequestURI))
 	}
 	//到新订阅设置
-
 	vipMsg := jy.GetBigVipUserBaseMsg( m.Session(),  *config.Middleground)
-	//vipMsg := jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW)
 	if vipMsg.IsUpgrade {
 		return m.Redirect("/jyapp/vipsubscribe/toSubVipSetPage")
 	}

+ 0 - 6
src/jfw/modules/bigmember/src/entity/portrailUtil.go

@@ -198,12 +198,6 @@ func InterfaceToStruct(src, to interface{}) error {
 
 //获取用户行业
 func getUserSetIndustry(session *httpsession.Session) []string {
-        /*uData, _ := db.Mgo.FindById(C_User, userId, `{"o_member_jy":1}`)
-        if uData == nil || len(*uData) == 0 {
-        	return nil
-        }
-        memberSet := qutil.ObjToMap((*uData)["o_member_jy"])
-        */
         memberSet := jy.GetSubScribeInfo(session, db.Mgo, "m", "10000")
         if len(*memberSet) == 0 {
                 return nil

+ 0 - 2
src/jfw/modules/bigmember/src/entity/portrait.go

@@ -71,7 +71,6 @@ func CreatePortraitManagerForContacts(session *httpsession.Session, entType int6
 		return nil, errors.New("参数异常")
 	}
 	bigMsg := jy.GetBigVipUserBaseMsg( session, *config.Middleground)
-
 	//0:采购单位;1:中标企业
 	switch entType {
 	case 0:
@@ -124,7 +123,6 @@ func CreateSubVipPortraitManager(userid string, pageFlag, searchValue string, is
 	}
 	if pageFlag != "entDetail" { //需要权限校验的接口
 		bigMsg := jy.GetBigVipUserBaseMsg( session, *config.Middleground)
-
 		if bigMsg.VipStatus <= 0 || bigMsg.Vip_BuySet.Upgrade != 1 { //免费用户留资体验
 			if searchValue != "" && jy.Portraitexperience(userid, searchValue, isWinner) {
 				return &Portrait{userid,session}, 3, nil, true

+ 0 - 1
src/jfw/modules/bigmember/src/service/analysis/decision.go

@@ -80,7 +80,6 @@ func (this *Analysis) TrialInfo() {
 	rData, errMsg := func() (interface{}, error) {
 		//userInfo, ok := db.Mgo.FindById(C_User, userId, nil)
 		baseMsg := jy.GetBigVipUserBaseMsg( this.Session(),*config.Middleground)
-
 		if baseMsg == nil {
 			return -2, nil
 		}

+ 0 - 2
src/jfw/modules/bigmember/src/service/analysis/potential.go

@@ -167,9 +167,7 @@ func (this *Analysis) CsORRsList() {
 			if entName == "" {
 				log.Println("大会员初始化 企业名称有误-", userId, main_userId)
 			}
-			//userInfo, ok := db.Mgo.FindById(C_User, main_userId, nil)
 			userInfo := jy.GetBigVipUserBaseMsg( this.Session(),*config.Middleground)
-
 			if userInfo != nil {
 				var isTrial = userInfo.Status == 4
 				var c_limitcount = 5

+ 0 - 1
src/jfw/modules/bigmember/src/service/analysis/util.go

@@ -47,7 +47,6 @@ func (this *SelectC) UserStatusChecked() bool {
                 serviceId = 8
         }
         userPower := jy.GetBigVipUserBaseMsg( this.Session, *config.Middleground)
-
         return userPower.Status > 0 && userPower.PowerMap[serviceId]
 }
 

+ 0 - 1
src/jfw/modules/bigmember/src/service/portrait/subvipPortraitAction.go

@@ -219,7 +219,6 @@ func (this *SubVipPortrait) PortraitUsage() {
         userId := qutil.ObjToString(this.GetSession("userId"))
         rData, errMsg := func() (interface{}, error) {
                 bigMsg := jy.GetBigVipUserBaseMsg( this.Session(),*config.Middleground)
-
                 if bigMsg.VipStatus <= 0 && bigMsg.Vip_BuySet.Upgrade != 1 {
                         return nil, fmt.Errorf("非法请求")
                 }

+ 0 - 34
src/jfw/modules/bigmember/src/service/push/push.go

@@ -38,39 +38,8 @@ type pushSet struct {
 //后期
 //4.6.0修改 只把有权益的存入map返给前端, k:权益 v:是否开启
 func (a *Action) Items() {
-	//userId, _ := a.GetSession("userId").(string)
 	bigMsg := jy.GetBigVipUserBaseMsg( a.Session(), *config.Middleground)
 	subScribeInfo := jy.GetSubScribeInfo(a.Session(), Mgo, "m", "10000")
-	//2222
-	/*user, _ := Mgo.FindById(C_User, userId, `{"i_member_status":1,"i_vip_status":1,"s_phone":1,"s_m_phone":1,"o_member_jy":1}`)
-	  s_phone, _ := (*user)["s_phone"].(string)
-	  if s_phone == "" {
-	  	s_phone, _ = (*user)["s_m_phone"].(string)
-	  }
-	  data := M{}
-	  member_status := util.IntAll((*user)["i_member_status"])
-	  vip_status := util.IntAll((*user)["i_vip_status"])
-	  if vip_status > 0 {
-	  	data["super_subscribe"] = true //超级订阅
-	  } else {
-	  	data["super_subscribe"] = true //超级订阅
-	  }
-	  if member_status > 0 {
-	  	o_member_jy, _ := (*user)["o_member_jy"].(map[string]interface{})
-	  	data["member_subscribe"] = OpenStatus(o_member_jy, "member_subscribe", a.Session()) //大会员订阅
-	  	delete(data, "free_subscribe")                                                      //有大会员订阅没有免费订阅
-	  }
-	  if member_status <= 0 && vip_status <= 0 {
-	  	data["follow_ent"] = true     //企业关注
-	  	data["follow_project"] = true //项目关注
-	  }
-	  //商机管理
-	  if Mysql.Count("entniche_info", map[string]interface{}{
-	  	"phone":  s_phone,
-	  	"status": 1,
-	  }) > 0 {
-	  	data["entniche"] = true
-	  }*/
 	data := M{}
 	data["super_subscribe"] = true //超级订阅
 	if bigMsg.Status > 0 {
@@ -155,9 +124,7 @@ func (a *Action) Detail() {
 			"wxpush":         util.IntAll((*o_vipjy)["i_wxpush"]),
 		}
 	case "free_subscribe":
-		//user, _ := Mgo.FindById(C_User, userId, `{"s_myemail":1,"o_jy":1}`)
 		o_jy := jy.GetSubScribeInfo(a.Session(), Mgo, "f", "10000")
-		//o_jy, _ := (*user)["o_jy"].(map[string]interface{})
 		apppush := util.IntAll((*o_jy)["i_apppush"])
 		mailpush := util.IntAll((*o_jy)["i_mailpush"])
 		if apppush == 0 && mailpush == 0 {
@@ -428,7 +395,6 @@ func OpenStatus(ojy map[string]interface{}, types string, BigMsg *jy.BigVipBaseM
 			"follow_ent":     util.IntAllDef(ojy["i_follow_ent"], 1),
 		}
 		power := []int{}
-		//BigMsg := jy.GetBigVipUserBaseMsg( session,*config.Middleground)
 		for k := range BigMsg.PowerMap {
 			power = append(power, k)
 		}

+ 0 - 3
src/jfw/modules/bigmember/src/service/subscribe/subscribe.go

@@ -50,9 +50,6 @@ func (s *Subscribe) FreeUserSubscribe() {
 	t := time.Now()
 	redisKey := fmt.Sprintf("%d_%s_%d_freeSubscription_%s", t.Year(), t.Month(), t.Day(), userId)
 	bigMsg := jy.GetBigVipUserBaseMsg( s.Session(), *config.Middleground)
-	/*res, _ := db.Mgo.FindById(C_User, userId, `{"i_vip_status":1,"i_member_status":1,"s_m_phone":1,"s_phone":1,"o_jy":1,""l_search_prompt":1}`)
-	  isVip = qutil.IntAll((*res)["i_vip_status"]) > 0*/
-
 	oJy := jy.GetSubScribeInfo(s.Session(), db.Mgo, "f", "10000")
 	//oJy, _ := (*res)["o_jy"].(map[string]interface{})
 	freeArea := true

+ 5 - 139
src/jfw/modules/bigmember/src/service/use/use.go

@@ -64,18 +64,7 @@ func (u *Use) SubPageMoveTip() {
 				}, true, false)
 			}
 		} else { //查询是否提示弹框
-			/*if uData, _ := db.Mgo.FindById("user", userId, `"i_member_status":1,"i_member_starttime":1,"o_member_jy":1`); uData != nil && len(*uData) > 0 {
-				startTime := qu.Int64All((*uData)["i_member_starttime"])
-				memberStatus := qu.Int64All((*uData)["i_member_status"])
-				if memberStatus > 0 && startTime < config.Config.OldSubscribeMoveTip {
-					o_member_jy, ok := (*uData)["o_member_jy"].(map[string]interface{})
-					if ok && qu.Int64All(o_member_jy["i_moveTip"]) == 0 {
-						flag = true
-					}
-				}
-			}*/
 			bigMsg := jy.GetBigVipUserBaseMsg(u.Session(), *config.Middleground)
-
 			//后期需要更改
 			startTime := bigMsg.StartTime
 			memberStatus := bigMsg.Status
@@ -232,6 +221,9 @@ func (u *Use) Info() {
 			return Result{Data: M{"status": -1}, Error_msg: "未登录"}
 		}
 		mainid, _, _ := util.MainUserId(u.Session())
+		if mainid == "" {
+			mainid = userid
+		}
 		d := map[string]interface{}{
 			"member_status": 0,
 		}
@@ -255,15 +247,13 @@ func (u *Use) Info() {
 			i_member_starttime = bigVipBaseMsg.Data.Member.StartTime
 			i_member_endtime = bigVipBaseMsg.Data.Member.EndTime
 		}
-
 		if i_member_status != 0 {
 			//是否展示附加词合并
 			appendK_bl := false
 			if btip, _ := (*o_member_jy)["b_keytip"].(bool); !btip && i_member_status > 0 && o_member_jy != nil && len(*o_member_jy) > 0 {
 				//判断大会员是否是企业版的
-				o_vipjy := &map[string]interface{}{}
-				if o_vipjy != nil {
-					for _, v := range (*o_vipjy)["a_items"].([]interface{}) {
+				if o_member_jy != nil {
+					for _, v := range (*o_member_jy)["a_items"].([]interface{}) {
 						tmp := qu.ObjToMap(v.(map[string]interface{}))
 						a_key := (*tmp)["a_key"].([]interface{})
 						for _, n := range a_key {
@@ -712,130 +702,6 @@ func (u *Use) IsAdd() {
 	r := func() Result {
 		//uRefer := u.Refer()
 		var userInfo = &UserInfo{}
-		/*phone, _ := u.GetSession("phone").(string)
-		  entId := qu.IntAll(u.GetSession("entId"))
-		  if userid == "" {
-		          return Result{Data: nil, Error_msg: "未登录"}
-		  }
-		  var (
-		          userInfo      = &UserInfo{}
-		          userCacheBool = false
-		  )
-
-		  baseInfoCacheKey := fmt.Sprintf(jy.IsGetUserBaseInfoRedisKey, userid)
-		  if bytes, err := redis.GetBytes(jy.BaseInfoCacheDb, baseInfoCacheKey); err == nil && len(*bytes) > 0 {
-		          err = json.Unmarshal(*bytes, &userInfo)
-		          if err == nil {
-		                  userCacheBool = true
-		          } else {
-		                  log.Println("缓存异常")
-		          }
-		  }
-		  if !userCacheBool {
-		          bigPower := jy.GetBigVipUserBaseMsg(userid, db.Mysql, db.Mgo)
-		          userInfo = &UserInfo{
-		                  BigMemberStatus: bigPower.Status,
-		                  Combo:           level_map[bigPower.Status],
-		                  IsSubCount:      bigPower.Pid != "",
-		                  IsMemberTrial:   bigPower.HasTrial,
-		                  IsUsed:          bigPower.Used,
-		                  EntName:         bigPower.EntName,
-		                  EntNiche:        bigPower.EntnicheStatus > 0,
-		                  VipStatus:       bigPower.VipStatus,
-		                  Viper:           bigPower.Vip_BuySet.Upgrade > 0,
-		                  IsFree:          bigPower.VipStatus <= 0 && bigPower.Status <= 0 && bigPower.EntnicheStatus <= 0,
-		                  IsFreeUpgrade:   bigPower.IsUpgrade,
-		                  EntIsNew:        bigPower.EntIsNew,
-		                  IsEntService:    bigPower.IsEntService,
-		                  MemberPowerType: bigPower.MemberPowerType,
-		                  VipPowerType:    bigPower.VipPowerType,
-		          }
-		          log.Println(entId, "----", phone)
-		          if entId == 0 && phone != "" {
-		                  entId = initEntSess(phone)
-		          }
-		          log.Println(entId, "--111--", phone)
-		          if entId > 0 && bigPower.EntInfo[entId] != nil {
-		                  userInfo.EntName = bigPower.EntInfo[entId].Name
-		                  userInfo.EntRoleId = bigPower.EntInfo[entId].RoleId
-		                  //是否是商机管理有效用户:1、管理员;2、员工已分配功能
-		                  userInfo.EntNiche = bigPower.EntInfo[entId].Status == 1 && (bigPower.EntInfo[entId].IsPower || bigPower.EntInfo[entId].RoleId > 0)
-		                  userInfo.EntIsNew = bigPower.EntInfo[entId].IsNew && userInfo.EntNiche
-		                  //有商机管理服务的用户 就不是商机管理用户
-		                  if userInfo.IsEntService = bigPower.EntInfo[entId].IsService && bigPower.EntInfo[entId].IsPower; userInfo.IsEntService {
-		                          userInfo.EntIsNew = false
-		                          userInfo.EntNiche = false
-		                  }
-		          }
-		          power := []int{}
-		          for k, _ := range bigPower.PowerMap {
-		                  power = append(power, k)
-		          }
-		          userInfo.Powers = power
-		          //是否是免费用户
-		          userInfo.IsFree = bigPower.VipStatus <= 0 && bigPower.Status <= 0 && !userInfo.EntNiche
-		          //存储缓存
-		          go func() {
-		                  if bytes, err := json.Marshal(userInfo); err == nil && bytes != nil {
-		                          if redis.PutBytes(jy.BaseInfoCacheDb, baseInfoCacheKey, &bytes, config.Config.IsAddCacheTime+rand.Intn(120)) != nil {
-		                                  log.Println("信息缓存异常")
-		                          }
-		                  }
-		          }()
-		  }
-		  //不存缓存
-		  //vip
-		  if userInfo.VipStatus > 0 {
-		          vipBool := true
-		          if len(config.Config.IsAddUrls.Vip) > 0 && uRefer != "" {
-		                  vipBool = false
-		                  for _, v := range config.Config.IsAddUrls.Vip {
-		                          if strings.Contains(uRefer, v) {
-		                                  vipBool = true
-		                                  break
-		                          }
-		                  }
-
-		          }
-		          if vipBool {
-		                  //没有大会员附件下载权限
-		                  var notBigFileBool = userInfo.BigMemberStatus <= 0 || !strings.Contains(intStringsJoin(userInfo.Powers), "3")
-		                  //超级订阅非大会员用户附件下载本月可用次数
-		                  uk := qu.If(notBigFileBool && userInfo.VipStatus > 0 && userInfo.Viper, "v", "f").(string)
-		                  //附件下载包的剩余次数
-		                  filePackKey := fmt.Sprintf(jy.FilePackNumKey, userid, fmt.Sprint(time.Now().Month()))
-		                  filePackNum := redis.GetInt(jy.PowerCacheDb, filePackKey)
-		                  userInfo.FileNum = config.Config.FileUploadNum[uk] - redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.VipFileUploadNumKey, userid, fmt.Sprint(time.Now().Month()))) + filePackNum
-		          }
-		  }
-		  //免费用户  // 商机管理用户 可以用免费用户的企业画像权限 留资有一次权限 所以也要验证商机管理用户
-		  if userInfo.IsFree || userInfo.EntNiche {
-		          freeBool := true
-		          if len(config.Config.IsAddUrls.Free) > 0 && uRefer != "" {
-		                  freeBool = false
-		                  for _, v := range config.Config.IsAddUrls.Free {
-		                          if strings.Contains(uRefer, v) {
-		                                  freeBool = true
-		                                  break
-		                          }
-		                  }
-
-		          }
-		          if freeBool {
-		                  //免费用户是否有关键词
-		                  user, ok := db.Mgo.FindById("user", userid, `{"o_jy":1}`)
-		                  if ok && user != nil {
-		                          o_jy, _ := (*user)["o_jy"].(map[string]interface{})
-		                          a_key, _ := o_jy["a_key"].([]interface{})
-		                          userInfo.FreeHasKey = len(a_key) > 0
-		                  }
-		                  //免费用户可查看企业画像次数//免费用户可查看采购单位画像次数//免费用户可以进行附件下载次数
-		                  userInfo.FreeEntPort, userInfo.FreeBuyerPort, userInfo.FreeFile = jy.FreeExperience(userid)
-		          }
-		  }
-		  userInfo.CustomerService = config.Config.Customers
-		  return Result{Data: userInfo}*/
-		//resp := grpc.PowerCheck.Check( userid, baseUserId, accountId, entId)
 		bigPower := jy.GetBigVipUserBaseMsg(u.Session(), *config.Middleground)
 		userInfo = &UserInfo{
 			BigMemberStatus: bigPower.Status,

+ 0 - 14
src/jfw/modules/bigmember/src/util/power.go

@@ -13,20 +13,6 @@ import (
 //后期
 //获取用户主账号userid
 func MainUserId(session *httpsession.Session) (string, string, int) {
-        /*data, ok := db.Mgo.FindById("user", userid, `{"s_member_mainid":1,"s_phone":1,"i_member_status":1,"i_member_sub_status":1}`)
-          if ok && *data != nil && len(*data) > 0 {
-          	if (*data)["s_member_mainid"] != nil && qutil.IntAllDef((*data)["i_member_sub_status"], 0) == 1 {
-          		userid = qutil.ObjToString((*data)["s_member_mainid"])
-          	}
-          	if (*data)["s_phone"] != nil {
-          		phone = qutil.ObjToString((*data)["s_phone"])
-          	} else if (*data)["s_m_phone"] != nil {
-          		phone = qutil.ObjToString((*data)["s_m_phone"])
-          	}
-          	if (*data)["i_member_status"] != nil {
-          		i_member_status = qutil.IntAll((*data)["i_member_status"])
-          	}
-          }*/
         bigMsg := jy.GetBigVipUserBaseMsg( session, *config.Middleground)
         return bigMsg.Data.Member.Pid, "phone", bigMsg.Status
 }

+ 0 - 1
src/jfw/modules/distribution/src/service/action/share.go

@@ -119,7 +119,6 @@ func (this *Share) LinkShare(discored string) error {
     fmt.Println(userId, openid, "user", `{"s_m_openid":"`+openid+`}`, `{"o_jy":1:"o_vipjy":1,"i_vip_status":1}`)
     if discored[len(discored)-4:len(discored)-2] == "GX" {
         if disType == "A" {
-            //user, ok := MQFW.FindOneByField("user", `{"s_m_openid":"`+openid+`"}`, `{"o_jy":1:"o_vipjy":1,"i_vip_status":1}`)
             user := jy.GetBigVipUserBaseMsg(this.Session(), *Middleground)
             log.Println(user)
             if user != nil {

+ 4 - 6
src/jfw/modules/publicapply/src/attachmentdow/service/service.go

@@ -35,8 +35,8 @@ func (u *Dow) SupplyInfoFileDownload() {
 			return Result{Data: nil, Error_msg: "未登录"}
 		}
 
-		BaseMsg := jy.GetBigVipUserBaseMsg( u.Session(),*config.Middleground)
-		vipStatus := jy.GetVipState( u.Session(),*config.Middleground, userid)
+		BaseMsg := jy.GetBigVipUserBaseMsg(u.Session(), *config.Middleground)
+		vipStatus := jy.GetVipState(u.Session(), *config.Middleground, userid)
 		isPower := false
 		//大会员下载权限判断
 		if BaseMsg.Status > 0 && BaseMsg.PowerMap[3] {
@@ -119,10 +119,8 @@ func (u *Dow) Subdow() {
 		if userid == "" {
 			return Result{Data: nil, Error_msg: "未登录"}
 		}
-
-		BaseMsg := jy.GetBigVipUserBaseMsg( u.Session(),*config.Middleground)
-		vipStatus := jy.GetVipState( u.Session(),*config.Middleground, userid)
-
+		BaseMsg := jy.GetBigVipUserBaseMsg(u.Session(), *config.Middleground)
+		vipStatus := jy.GetVipState(u.Session(), *config.Middleground, userid)
 		var (
 			mon string
 			ss  int

+ 1 - 3
src/jfw/modules/publicapply/src/bidcollection/entity/entity.go

@@ -438,9 +438,7 @@ func GetCollList(c *util.CollList, session *httpsession.Session) map[string]inte
 func Power(session *httpsession.Session) (bool, map[string]interface{}) {
 	isVip, isMember, isEnt, privatedata := false, false, false, false
 	vipstatus := 0
-	//isVip, isMember, isEnt, privatedata
-	//resp := grpc.PowerCheck.Check( userid, baseUserId, accountId, entId)
-	resp := jy.GetBigVipUserBaseMsg( session, *config.Middleground)
+	resp := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
 	if resp != nil {
 		if resp.VipStatus > 1 {
 			vipstatus = 1

+ 2 - 3
src/jfw/modules/publicapply/src/customer/entity/entiy.go

@@ -94,9 +94,8 @@ func (this *CustomerOperation) CList(pageSize, pageNo, entUserId int, keyword, i
 		total = db.Mgo.Count(fc, query)
 		redis.Put(redisName, fmt.Sprintf(redisCountKey, this.UserId), total, 2*60*60)
 	}
-
 	//大会员客户关注上限
-	BigMsg := jy.GetBigVipUserBaseMsg( this.Session,*config.Middleground)
+	BigMsg := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
 	entVip := jy.GetEntnicheState(this.UserId, db.Mysql, db.Mgo)
 	customerMap := map[string]interface{}{}
 	if entVip.EntnicheStatus > 0 {
@@ -177,7 +176,7 @@ func (this *CustomerOperation) CheckPower() string {
 		msg = "登录异常"
 	} else {
 		//查询是否是大会员
-		if userPower := jy.GetBigVipUserBaseMsg( this.Session,*config.Middleground); userPower.Status > 0 {
+		if userPower := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground); userPower.Status > 0 {
 			count := redis.GetInt(redisName, fmt.Sprintf(redisCountKey, this.UserId))
 			if count < 1 {
 				query := map[string]interface{}{

+ 9 - 35
src/jfw/modules/publicapply/src/dataexport/entity/collection.go

@@ -1,42 +1,16 @@
 package entity
 
 import (
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "jy/src/jfw/modules/publicapply/src/config"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"jy/src/jfw/modules/publicapply/src/config"
 )
 
 func IsPay(session *httpsession.Session) bool {
-        isVip, isMember, isEnt := false, false, false
-        /*data, ok := db.Mgo.FindById("user", userid, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1,"o_vipjy":1`)
-        if data != nil && len(*data) > 0 && ok {
-        	i_vip_status := util.IntAll((*data)["i_vip_status"])
-        	if i_vip_status > 1 {
-        		isVip = true
-        	}
-        	if i_member_status := util.IntAllDef((*data)["i_member_status"], 0); i_member_status > 0 {
-        		isMember = true
-        	}
-        	if s_phone, _ := (*data)["s_phone"].(string); s_phone != "" {
-        		phone = s_phone
-        	} else if s_m_phone, _ := (*data)["s_m_phone"].(string); s_m_phone != "" {
-        		phone = s_m_phone
-        	}
-        	if phone != "" {
-        		//已购买企业未过期
-        		if entInfo := *db.Mysql.SelectBySql(`SELECT status,isNew FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1)`, phone); len(entInfo) > 0 {
-        			for _, v := range entInfo {
-        				if util.IntAll(v["status"]) == 1 && util.IntAll(v["isNew"]) == 1 {
-        					isEnt = true
-        					break
-        				}
-        			}
-        		}
-        	}
-        }*/
-        data := jy.GetBigVipUserBaseMsg( session, *config.Middleground)
-        isVip = data.Data.Vip.Status > 0
-        isEnt = data.Data.Entniche.Status > 0
-        isMember = data.Data.Member.Status > 0
-        return isVip || isEnt || isMember
+	isVip, isMember, isEnt := false, false, false
+	data := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
+	isVip = data.Data.Vip.Status > 0
+	isEnt = data.Data.Entniche.Status > 0
+	isMember = data.Data.Member.Status > 0
+	return isVip || isEnt || isMember
 }

+ 1 - 2
src/jfw/modules/publicapply/src/me/me.go

@@ -34,8 +34,7 @@ func (m *Me) MyInfo() {
 		"userType": "free",
 	}
 	userId, _ := m.GetSession("userId").(string)
-	//user, ok := db.Mgo.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,"o_jy":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1,"o_member_jy":1}`)
-	user := jy.GetBigVipUserBaseMsg( m.Session(),*config.Middleground)
+	user := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
 	if user != nil {
 		isExpire := -1
 		isPassCount := false

+ 263 - 299
src/jfw/modules/publicapply/src/subscribePush/entity/historyPush.go

@@ -1,18 +1,18 @@
 package entity
 
 import (
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "encoding/json"
-        "fmt"
-        "jy/src/jfw/modules/publicapply/src/config"
-        "jy/src/jfw/modules/publicapply/src/db"
-        "log"
-        "strings"
-        "time"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/publicapply/src/config"
+	"jy/src/jfw/modules/publicapply/src/db"
+	"log"
+	"strings"
+	"time"
 
-        util "app.yhyue.com/moapp/jybase/common"
-        elastic "app.yhyue.com/moapp/jybase/esv1"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	util "app.yhyue.com/moapp/jybase/common"
+	elastic "app.yhyue.com/moapp/jybase/esv1"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 
 type historyPush struct {
@@ -22,324 +22,288 @@ var HistoryPush = &historyPush{}
 
 //UpdateUserPushUnread 更新app未读标识为已读
 func (hp *historyPush) UpdateUserPushUnread(userid string, vt string) {
-        if vt == jy.MemberFlag {
-                db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_member_apppushunread": 0}})
-        } else if vt == jy.EntnicheFlag {
-                db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_entniche_apppushunread": 0}})
-        } else {
-                db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_apppushunread": 0}})
+	if vt == jy.MemberFlag {
+		db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_member_apppushunread": 0}})
+	} else if vt == jy.EntnicheFlag {
+		db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_entniche_apppushunread": 0}})
+	} else {
+		db.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_apppushunread": 0}})
 
-        }
+	}
 }
 
 //IsInTsGuide 是否进入向导
 func (hp *historyPush) IsInTsGuide(session *httpsession.Session) bool {
-        //后期
-        /*data, ok := db.Mgo.FindById("user", userid, `{"o_jy":1,"i_ts_guide":1,"":1,"i_member_status":1,"i_vip_status":1}`)
-          if ok {
-          	//付费用户无免费订阅,不进入订阅向导页面
-          	if util.IntAll((*data)["i_member_status"]) > 0 || util.IntAll((*data)["i_vip_status"]) > 0 {
-          		return false
-          	}
-          	o_jy, _ := (*data)["o_jy"].(map[string]interface{})
-          	i_ts_guide := util.IntAll((*data)["i_ts_guide"])
-          	if i_ts_guide == 2 || (i_ts_guide == 0 && len(o_jy) == 0) {
-          		return true
-          	}
-          }*/
-        data := jy.GetBigVipUserBaseMsg( session,*config.Middleground)
-        if data.Data.Member.Status > 0 || data.Data.Vip.Status > 0 {
-                return false
-        }
-        return false
+	data := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
+	if data.Data.Member.Status > 0 || data.Data.Vip.Status > 0 {
+		return false
+	}
+	return false
 }
 
 func PushView(userid, allquery, field string, pageNum, pageSize int, session *httpsession.Session) (keys []interface{}, list *[]map[string]interface{}) {
-        if userid == "" {
-                return
-        }
-        /*tmp, ok := db.Mgo.FindById("user", userid, `{"_id":1,"o_jy":1}`)
-          if !ok || tmp == nil || len(*tmp) == 0 {
-                  return
-          }
-          o_jy := (*tmp)["o_jy"].(map[string]interface{})
-          a_key, _ := o_jy["a_key"].([]interface{})
-          if len(a_key) == 0 {
-                  return
-          }*/
-        data := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
-        if data == nil || len(*data) == 0 {
-                return
-        }
-        a_key, _ := (*data)["a_key"].([]interface{})
-        if len(a_key) == 0 {
-                return
-        }
-        for _, v := range a_key {
-                keyMap, _ := v.(map[string]interface{})
-                key, _ := keyMap["key"].([]interface{})
-                keys = append(keys, key)
-        }
-        var allkeys []elastic.KeyConfig //用户配置
-        _bs, err := json.Marshal(a_key)
-        if err == nil {
-                json.Unmarshal(_bs, &allkeys)
-        }
-        list = elastic.GetResForJY(INDEX, TYPE, allkeys, allquery, `"title"`, `{"publishtime":"desc"}`, field, (pageNum-1)*pageSize, pageSize)
-        return
+	if userid == "" {
+		return
+	}
+	/*tmp, ok := db.Mgo.FindById("user", userid, `{"_id":1,"o_jy":1}`)
+	  if !ok || tmp == nil || len(*tmp) == 0 {
+	          return
+	  }
+	  o_jy := (*tmp)["o_jy"].(map[string]interface{})
+	  a_key, _ := o_jy["a_key"].([]interface{})
+	  if len(a_key) == 0 {
+	          return
+	  }*/
+	data := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
+	if data == nil || len(*data) == 0 {
+		return
+	}
+	a_key, _ := (*data)["a_key"].([]interface{})
+	if len(a_key) == 0 {
+		return
+	}
+	for _, v := range a_key {
+		keyMap, _ := v.(map[string]interface{})
+		key, _ := keyMap["key"].([]interface{})
+		keys = append(keys, key)
+	}
+	var allkeys []elastic.KeyConfig //用户配置
+	_bs, err := json.Marshal(a_key)
+	if err == nil {
+		json.Unmarshal(_bs, &allkeys)
+	}
+	list = elastic.GetResForJY(INDEX, TYPE, allkeys, allquery, `"title"`, `{"publishtime":"desc"}`, field, (pageNum-1)*pageSize, pageSize)
+	return
 }
 
 const (
-        bidField   = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","isValidFile","spidercode","site"`
-        bidTime    = `{"range":{"publishtime":{"gt":%d}}}`
-        bidSort    = `{"publishtime":"desc"}`
-        findfields = `"title"`
+	bidField   = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","isValidFile","spidercode","site"`
+	bidTime    = `{"range":{"publishtime":{"gt":%d}}}`
+	bidSort    = `{"publishtime":"desc"}`
+	findfields = `"title"`
 )
 
 type defaultPush struct {
-        UserId     string
-        EntId      int
-        Size       int
-        ModuleFlag string
-        Session    *httpsession.Session
+	UserId     string
+	EntId      int
+	Size       int
+	ModuleFlag string
+	Session    *httpsession.Session
 }
 
 func DefaultPushList(userId, moduleFlag string, entId int) (keyword []byte, list *[]map[string]interface{}, deptId int) {
-        if userId == "" {
-                return
-        }
-        dp := defaultPush{
-                UserId:     userId,
-                EntId:      entId,
-                Size:       50,
-                ModuleFlag: moduleFlag,
-        }
-        scd, deptid := dp.getUserInfo()
-        if len(scd.Keyword) > 0 {
-                deptId = deptid
-                keyword, _ = json.Marshal(scd.Keyword)
-                //获取查询语句
-                qstr := dp.getDefaultDatasSQL(scd)
-                list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSort, bidField, 0, dp.Size, 0, false)
-        }
-        return
+	if userId == "" {
+		return
+	}
+	dp := defaultPush{
+		UserId:     userId,
+		EntId:      entId,
+		Size:       50,
+		ModuleFlag: moduleFlag,
+	}
+	scd, deptid := dp.getUserInfo()
+	if len(scd.Keyword) > 0 {
+		deptId = deptid
+		keyword, _ = json.Marshal(scd.Keyword)
+		//获取查询语句
+		qstr := dp.getDefaultDatasSQL(scd)
+		list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSort, bidField, 0, dp.Size, 0, false)
+	}
+	return
 }
 
 //获取用户信息
 func (d *defaultPush) getUserInfo() (vc *ViewCondition, deptId int) {
-        t1 := time.Now()
-        var isPayBool = false
-        var tmpInfo = struct {
-                Items      []interface{}
-                BuyerClass []interface{}
-                SubType    []interface{}
-                Area       map[string]interface{}
-                SelectType string
-        }{}
-        data := jy.GetBigVipUserBaseMsg( d.Session,*config.Middleground)
-        switch d.ModuleFlag {
-        case "m":
-                //大会员
-                /* userMap, ok := db.Mgo.FindById("user", d.UserId, `{"o_member_jy":1,"i_member_status":1}`)
-                   if !ok || userMap == nil || len(*userMap) == 0 {
-                           return &ViewCondition{}, 0
-                   }*/
-                //if util.IntAll((*userMap)["i_member_status"]) > 0 {
-                if data.Data.Member.Status > 0 {
-                        //订阅词获取
-                        o_member_jy := jy.GetSubScribeInfo(d.Session, db.Mgo, "m", "10000")
-                        isPayBool = true
-                        tmpInfo.Items, _ = (*o_member_jy)["a_items"].([]interface{})
-                        tmpInfo.BuyerClass, _ = (*o_member_jy)["a_buyerclass"].([]interface{})
-                        tmpInfo.SubType, _ = (*o_member_jy)["a_infotype"].([]interface{})
-                        tmpInfo.Area, _ = (*o_member_jy)["o_area"].(map[string]interface{})
-                }
-        case "v":
-                //超级订阅
-                /*  userMap, ok := db.Mgo.FindById("user", d.UserId, `{"o_vipjy":1,"i_vip_status":1}`)
-                    if !ok || userMap == nil || len(*userMap) == 0 {
-                            return &ViewCondition{}, 0
-                    }
-                    if util.IntAll((*userMap)["i_vip_status"]) > 0 {*/
-                if data.Data.Member.Status > 0 {
-                        //订阅词获取
-                        o_vipjy := jy.GetSubScribeInfo(d.Session, db.Mgo, "v", "10000")
-                        isPayBool = true
-                        tmpInfo.Items, _ = (*o_vipjy)["a_items"].([]interface{})
-                        tmpInfo.BuyerClass, _ = (*o_vipjy)["a_buyerclass"].([]interface{})
-                        tmpInfo.SubType, _ = (*o_vipjy)["a_infotype"].([]interface{})
-                        tmpInfo.Area, _ = (*o_vipjy)["o_area"].(map[string]interface{})
-                }
-        case "s":
-                //商机管理
-                /*entUserId, _ := strconv.Atoi(d.UserId)
-                  if d.UserId == "" || d.EntId == 0 {
-                          return &ViewCondition{}, 0
-                  }
-                  var entInfo map[string]interface{}
-                  entInfo, deptId = (&es.MatchJob{}).Start(d.EntId, entUserId)*/
-                // if entInfo != nil && len(entInfo) > 0 {
-                if data.Data.Entniche.Status > 0 {
-                        //订阅词获取
-                        entInfo := jy.GetSubScribeInfo(d.Session, db.Mgo, "s", "10000")
-                        isPayBool = true
-                        tmpInfo.Items, _ = (*entInfo)["a_items"].([]interface{})
-                        tmpInfo.BuyerClass, _ = (*entInfo)["a_buyerclass"].([]interface{})
-                        tmpInfo.SubType, _ = (*entInfo)["a_infotype"].([]interface{})
-                        tmpInfo.Area, _ = (*entInfo)["o_area"].(map[string]interface{})
-                }
-        default:
-                //免费用户
-                /*userMap, ok := db.Mgo.FindById("user", d.UserId, `{"o_jy":1}`)
-                if !ok || userMap == nil || len(*userMap) == 0 {
-                        return &ViewCondition{}, 0
-                }
-                o_jy, _ := (*userMap)["o_jy"].(map[string]interface{})*/
-
-                        //订阅词获取
-                o_jy := jy.GetSubScribeInfo(d.Session, db.Mgo, "f", "10000")
-                if (*o_jy)["a_key"] != nil {
-                        tmpInfo.Items, _ = (*o_jy)["a_key"].([]interface{})
-                        //信息类型
-                        tmpInfo.SubType, _ = (*o_jy)["a_infotype"].([]interface{})
-                        //省份
-                        tmpInfo.Area, _ = (*o_jy)["o_area"].(map[string]interface{})
-                        if util.IntAllDef((*o_jy)["i_ppstatus"], 0) == 1 && (*o_jy)["o_area_p"] != nil {
-                                tmpInfo.Area, _ = (*o_jy)["o_area_p"].(map[string]interface{})
-                        }
-                }
-        }
-        vc = &ViewCondition{
-                Buyerclass: util.ObjArrToStringArr(tmpInfo.BuyerClass),
-                Subtype:    util.ObjArrToStringArr(tmpInfo.SubType),
-                Area:       getStringArrFromDbResult(tmpInfo.Area, 1),
-                City:       getStringArrFromDbResult(tmpInfo.Area, 2),
-                SelectType: "1",
-        }
-        //付费用户
-        if isPayBool {
-                d.Size = 1000
-                vc.Keyword = getKeyWordArrFromDbResult(tmpInfo.Items, "", -1)
-        } else {
-                vc.Keyword = getKeyWordArrFromDbResultByFree(tmpInfo.Items, "", -1)
-        }
-        log.Println("获取用户信息耗时:", time.Since(t1).Seconds())
-        return
+	t1 := time.Now()
+	var isPayBool = false
+	var tmpInfo = struct {
+		Items      []interface{}
+		BuyerClass []interface{}
+		SubType    []interface{}
+		Area       map[string]interface{}
+		SelectType string
+	}{}
+	data := jy.GetBigVipUserBaseMsg(d.Session, *config.Middleground)
+	switch d.ModuleFlag {
+	case "m":
+		//大会员
+		if data.Data.Member.Status > 0 {
+			//订阅词获取
+			o_member_jy := jy.GetSubScribeInfo(d.Session, db.Mgo, "m", "10000")
+			isPayBool = true
+			tmpInfo.Items, _ = (*o_member_jy)["a_items"].([]interface{})
+			tmpInfo.BuyerClass, _ = (*o_member_jy)["a_buyerclass"].([]interface{})
+			tmpInfo.SubType, _ = (*o_member_jy)["a_infotype"].([]interface{})
+			tmpInfo.Area, _ = (*o_member_jy)["o_area"].(map[string]interface{})
+		}
+	case "v":
+		//超级订阅
+		if data.Data.Member.Status > 0 {
+			//订阅词获取
+			o_vipjy := jy.GetSubScribeInfo(d.Session, db.Mgo, "v", "10000")
+			isPayBool = true
+			tmpInfo.Items, _ = (*o_vipjy)["a_items"].([]interface{})
+			tmpInfo.BuyerClass, _ = (*o_vipjy)["a_buyerclass"].([]interface{})
+			tmpInfo.SubType, _ = (*o_vipjy)["a_infotype"].([]interface{})
+			tmpInfo.Area, _ = (*o_vipjy)["o_area"].(map[string]interface{})
+		}
+	case "s":
+		//商机管理
+		if data.Data.Entniche.Status > 0 {
+			//订阅词获取
+			entInfo := jy.GetSubScribeInfo(d.Session, db.Mgo, "s", "10000")
+			isPayBool = true
+			tmpInfo.Items, _ = (*entInfo)["a_items"].([]interface{})
+			tmpInfo.BuyerClass, _ = (*entInfo)["a_buyerclass"].([]interface{})
+			tmpInfo.SubType, _ = (*entInfo)["a_infotype"].([]interface{})
+			tmpInfo.Area, _ = (*entInfo)["o_area"].(map[string]interface{})
+		}
+	default:
+		//免费用户
+		//订阅词获取
+		o_jy := jy.GetSubScribeInfo(d.Session, db.Mgo, "f", "10000")
+		if (*o_jy)["a_key"] != nil {
+			tmpInfo.Items, _ = (*o_jy)["a_key"].([]interface{})
+			//信息类型
+			tmpInfo.SubType, _ = (*o_jy)["a_infotype"].([]interface{})
+			//省份
+			tmpInfo.Area, _ = (*o_jy)["o_area"].(map[string]interface{})
+			if util.IntAllDef((*o_jy)["i_ppstatus"], 0) == 1 && (*o_jy)["o_area_p"] != nil {
+				tmpInfo.Area, _ = (*o_jy)["o_area_p"].(map[string]interface{})
+			}
+		}
+	}
+	vc = &ViewCondition{
+		Buyerclass: util.ObjArrToStringArr(tmpInfo.BuyerClass),
+		Subtype:    util.ObjArrToStringArr(tmpInfo.SubType),
+		Area:       getStringArrFromDbResult(tmpInfo.Area, 1),
+		City:       getStringArrFromDbResult(tmpInfo.Area, 2),
+		SelectType: "1",
+	}
+	//付费用户
+	if isPayBool {
+		d.Size = 1000
+		vc.Keyword = getKeyWordArrFromDbResult(tmpInfo.Items, "", -1)
+	} else {
+		vc.Keyword = getKeyWordArrFromDbResultByFree(tmpInfo.Items, "", -1)
+	}
+	log.Println("获取用户信息耗时:", time.Since(t1).Seconds())
+	return
 }
 
 //获取查询语句
 func (d *defaultPush) getDefaultDatasSQL(scd *ViewCondition) (str string) {
-        query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
-        query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
-        multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
-        query_bool_must_and := `{"bool":{"must":[%s]%s}}`
+	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
+	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
+	multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
+	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
 
-        bools := []string{}
-        musts := []string{}
-        //发布时间最新7天
-        musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, 0, -7).Unix()))
-        //省份
-        areaCity := []string{}
-        if len(scd.Area) > 0 {
-                areaquery := `{"terms":{"area":[`
-                for k, v := range scd.Area {
-                        if k > 0 {
-                                areaquery += `,`
-                        }
-                        areaquery += `"` + v + `"`
-                }
-                areaquery += `]}}`
-                areaCity = append(areaCity, areaquery)
-        }
+	bools := []string{}
+	musts := []string{}
+	//发布时间最新7天
+	musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, 0, -7).Unix()))
+	//省份
+	areaCity := []string{}
+	if len(scd.Area) > 0 {
+		areaquery := `{"terms":{"area":[`
+		for k, v := range scd.Area {
+			if k > 0 {
+				areaquery += `,`
+			}
+			areaquery += `"` + v + `"`
+		}
+		areaquery += `]}}`
+		areaCity = append(areaCity, areaquery)
+	}
 
-        //城市
-        if len(scd.City) > 0 {
-                areaquery := `{"terms":{"city":[`
-                for k, v := range scd.City {
-                        if k > 0 {
-                                areaquery += `,`
-                        }
-                        areaquery += `"` + v + `"`
-                }
-                areaquery += `]}}`
-                areaCity = append(areaCity, areaquery)
-        }
-        if len(areaCity) > 0 {
-                musts = append(musts, fmt.Sprintf(query_bool_should, strings.Join(areaCity, ",")))
-        }
-        if len(scd.Subtype) > 0 {
-                subquery := `{"terms":{"subtype":[`
-                for k, v := range scd.Subtype {
-                        if k > 0 {
-                                subquery += `,`
-                        }
-                        subquery += `"` + v + `"`
-                }
-                subquery += `]}}`
-                musts = append(musts, subquery)
-        }
-        if len(scd.Buyerclass) > 0 {
-                Buyerclass := `{"terms":{"buyerclass":[`
-                for k, v := range scd.Buyerclass {
-                        if k > 0 {
-                                Buyerclass += `,`
-                        }
-                        Buyerclass += `"` + v + `"`
-                }
-                Buyerclass += `]}}`
-                musts = append(musts, Buyerclass)
-        }
-        boolsNum := 0 //should
-        if len(scd.Keyword) > 0 {
-                boolsNum = 1
-                if scd.SelectType == "" || scd.SelectType == "2" {
-                        scd.SelectType = "detail\", \"title"
-                } else {
-                        scd.SelectType = "title"
-                }
-                multi_match = fmt.Sprintf(multi_match, "%s", "\""+scd.SelectType+"\"")
+	//城市
+	if len(scd.City) > 0 {
+		areaquery := `{"terms":{"city":[`
+		for k, v := range scd.City {
+			if k > 0 {
+				areaquery += `,`
+			}
+			areaquery += `"` + v + `"`
+		}
+		areaquery += `]}}`
+		areaCity = append(areaCity, areaquery)
+	}
+	if len(areaCity) > 0 {
+		musts = append(musts, fmt.Sprintf(query_bool_should, strings.Join(areaCity, ",")))
+	}
+	if len(scd.Subtype) > 0 {
+		subquery := `{"terms":{"subtype":[`
+		for k, v := range scd.Subtype {
+			if k > 0 {
+				subquery += `,`
+			}
+			subquery += `"` + v + `"`
+		}
+		subquery += `]}}`
+		musts = append(musts, subquery)
+	}
+	if len(scd.Buyerclass) > 0 {
+		Buyerclass := `{"terms":{"buyerclass":[`
+		for k, v := range scd.Buyerclass {
+			if k > 0 {
+				Buyerclass += `,`
+			}
+			Buyerclass += `"` + v + `"`
+		}
+		Buyerclass += `]}}`
+		musts = append(musts, Buyerclass)
+	}
+	boolsNum := 0 //should
+	if len(scd.Keyword) > 0 {
+		boolsNum = 1
+		if scd.SelectType == "" || scd.SelectType == "2" {
+			scd.SelectType = "detail\", \"title"
+		} else {
+			scd.SelectType = "title"
+		}
+		multi_match = fmt.Sprintf(multi_match, "%s", "\""+scd.SelectType+"\"")
 
-                for _, v := range scd.Keyword {
-                        shoulds := []string{}
-                        must_not := []string{}
-                        //附加词
-                        for _, vv := range v.Keyword {
-                                vv = strings.TrimSpace(vv)
-                                if vv == "" {
-                                        continue
-                                }
-                                shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
+		for _, v := range scd.Keyword {
+			shoulds := []string{}
+			must_not := []string{}
+			//附加词
+			for _, vv := range v.Keyword {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
 
-                        for _, vv := range v.Appended {
-                                vv = strings.TrimSpace(vv)
-                                if vv == "" {
-                                        continue
-                                }
-                                shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
+			for _, vv := range v.Appended {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
 
-                        //排除词
-                        for _, vv := range v.Exclude {
-                                vv = strings.TrimSpace(vv)
-                                if vv == "" {
-                                        continue
-                                }
-                                must_not = append(must_not, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
+			//排除词
+			for _, vv := range v.Exclude {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				must_not = append(must_not, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
 
-                        //添加
-                        if len(shoulds) > 0 {
-                                notStr := ""
-                                if len(must_not) > 0 {
-                                        notStr = fmt.Sprintf(`,"must_not":[%s]`, strings.Join(must_not, ","))
-                                }
-                                bools = append(bools, fmt.Sprintf(query_bool_must_and, strings.Join(shoulds, ","), notStr))
-                        }
-                }
-        }
+			//添加
+			if len(shoulds) > 0 {
+				notStr := ""
+				if len(must_not) > 0 {
+					notStr = fmt.Sprintf(`,"must_not":[%s]`, strings.Join(must_not, ","))
+				}
+				bools = append(bools, fmt.Sprintf(query_bool_must_and, strings.Join(shoulds, ","), notStr))
+			}
+		}
+	}
 
-        qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
-        log.Println("----", qstr)
-        return qstr
+	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
+	log.Println("----", qstr)
+	return qstr
 }

+ 2 - 5
src/jfw/modules/publicapply/src/subscribePush/entity/keyWords.go

@@ -35,7 +35,7 @@ type KeyWordsSet struct {
 }
 
 func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
-	power := jy.GetBigVipUserBaseMsg( this.Session,*config.Middleground)
+	power := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
 	if this.Type == "m" && power.Status < 0 {
 		return map[string]interface{}{"flag": false, "msg": "暂无权限"}
 	}
@@ -77,8 +77,6 @@ func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
 //
 func directSubKWSFree(types string, keys string, session *httpsession.Session) map[string]interface{} {
 	userId := qutil.ObjToString(session.Get("userId"))
-	//data, ok := db.Mgo.FindById("user", userId, fmt.Sprintf(`{"%s":1}`, types))
-
 	var repleat = false
 	var kwsCount = 0
 	if len([]rune(keys)) > 20 {
@@ -244,7 +242,6 @@ func DeleteKeyWordsFree(types, deletekey string, session *httpsession.Session) m
 //免费用户修改 保存关键词
 func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, session *httpsession.Session) map[string]interface{} {
 	flag := true
-	//data, ok := db.Mgo.FindById("user", userId, `{"`+types+`":1}`)
 	data := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
 	saveData := map[string]interface{}{}
 	positionType := qutil.Int64All(session.Get("positionType"))
@@ -804,7 +801,7 @@ type UpdateOther struct {
 }
 
 func (this *UpdateOther) UpdateOther() map[string]interface{} {
-	power := jy.GetBigVipUserBaseMsg( this.Session,*config.Middleground)
+	power := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
 	positionType := qutil.Int64All(this.Session.Get("positionType"))
 	if this.Type == "m" && power.Status < 0 {
 		return map[string]interface{}{"flag": false, "msg": "暂无权限"}

+ 509 - 518
src/jfw/modules/publicapply/src/subscribePush/entity/setting.go

@@ -1,596 +1,587 @@
 package entity
 
 import (
-        qutil "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "app.yhyue.com/moapp/jybase/redis"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "errors"
-        "fmt"
-        "jy/src/jfw/modules/publicapply/src/config"
-        "jy/src/jfw/modules/publicapply/src/db"
-        "jy/src/jfw/modules/publicapply/src/util"
-        "log"
-        "sort"
-        "strings"
-        "time"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"errors"
+	"fmt"
+	"jy/src/jfw/modules/publicapply/src/config"
+	"jy/src/jfw/modules/publicapply/src/db"
+	"jy/src/jfw/modules/publicapply/src/util"
+	"log"
+	"sort"
+	"strings"
+	"time"
 )
 
 //订阅设置设置修改
 type SubscribeSet struct {
-        Area      map[string]interface{} //地区
-        Industry  []string               //行业
-        UserId    string                 //用户id
-        Type      string                 //类型
-        EntId     int
-        EntUserId int
-        Session   *httpsession.Session
+	Area      map[string]interface{} //地区
+	Industry  []string               //行业
+	UserId    string                 //用户id
+	Type      string                 //类型
+	EntId     int
+	EntUserId int
+	Session   *httpsession.Session
 }
 
 func (this *SubscribeSet) SetAreaAndIndustry() *FuncResult {
-        area := this.Area
-        industry := this.Industry
-        userId := this.UserId
-        typ := this.Type
-        if typ == "m" {
-                return memberSet(area, industry, userId, this.Session)
-        } else if typ == "v" {
-                return vipSet(area, industry, userId, this.Session)
-        } else {
-                return freeSet(area, industry, userId, this.Session)
-        }
+	area := this.Area
+	industry := this.Industry
+	userId := this.UserId
+	typ := this.Type
+	if typ == "m" {
+		return memberSet(area, industry, userId, this.Session)
+	} else if typ == "v" {
+		return vipSet(area, industry, userId, this.Session)
+	} else {
+		return freeSet(area, industry, userId, this.Session)
+	}
 }
 
 //
 func freeSet(area map[string]interface{}, industry []string, userId string, session *httpsession.Session) *FuncResult {
-        //isfirst:是否第一次设置地区;ppb:是否购买省级订阅包; areacount:省份订阅包购买的省份数量-1:全国 无限制调整
-        isfirst, ppb, areacount := IsCanSet(userId, area, session)
-        //购买省份订阅包 已调整地区次数
-        ppnum := 0
-        //免费用户购买省份订阅包 按月算
-        ym := fmt.Sprint(time.Now().Year()) + "-" + fmt.Sprint(time.Now().Month())
-        if ppb {
-                ppnum = redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym))
-        } else if len(area) == 0 {
-                return &FuncResult{false, errors.New("地区参数异常"), nil}
-        }
-        //免费用户未购买省份订阅包 按年算
-        year := fmt.Sprint(time.Now().Year())
-        //免费用户 已调整地区次数
-        fpnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year))
-        // log.Println(len(area), "fpnum:", fpnum, "ppnum:", ppnum)
-        //第一次设置地区 || 购买全国  不扣次数
-        var issetredis = areacount > -1 && !isfirst
-        if issetredis {
-                //地区范围判断
-                if areacount+jy.BaseAreaNum < len(area) {
-                        return &FuncResult{false, errors.New("超出地区可设置范围"), nil}
-                }
-                //地区调整次数判断
-                if areacount+jy.BaseAreaNum <= ppnum { //+fpnum
-                        return &FuncResult{false, errors.New(fmt.Sprintf("订阅地区调整次数(%d)已用完", areacount+jy.BaseAreaNum)), nil}
-                }
-        }
-        //清楚缓存
-        jy.ClearBigVipUserPower(userId)
-        if !FreeSubChange(userId, &area, industry, ppb, isfirst) {
-                return &FuncResult{false, errors.New("保存修改出错"), nil}
-        } else if issetredis { //更新调整次数 非全国(第一次 不消耗次数)
-                //优先使用省份订阅包次数
-                // log.Println(areacount, "---", ppnum)
-                // log.Println(jy.BaseAreaNum, "---", fpnum)
-                if ppb {
-                        if areacount+jy.BaseAreaNum > ppnum {
-                                redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym), ppnum+1, 31*24*60*60)
-                        } else {
-                                log.Println(fmt.Sprintf("免费用户购买省份订阅包设置地区 扣除次数异常  userId:%s", userId))
-                        }
-                } else if jy.BaseAreaNum > fpnum {
-                        redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year), fpnum+1, 365*24*60*60)
-                } else {
-                        log.Println(fmt.Sprintf("免费用户设置地区 扣除次数异常  userId:%s", userId))
-                }
-        }
-        SetLog(userId, "o_jy", 0, session)
-        return &FuncResult{true, nil, map[string]interface{}{
-                "doSuccess": true,
-        }}
+	//isfirst:是否第一次设置地区;ppb:是否购买省级订阅包; areacount:省份订阅包购买的省份数量-1:全国 无限制调整
+	isfirst, ppb, areacount := IsCanSet(userId, area, session)
+	//购买省份订阅包 已调整地区次数
+	ppnum := 0
+	//免费用户购买省份订阅包 按月算
+	ym := fmt.Sprint(time.Now().Year()) + "-" + fmt.Sprint(time.Now().Month())
+	if ppb {
+		ppnum = redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym))
+	} else if len(area) == 0 {
+		return &FuncResult{false, errors.New("地区参数异常"), nil}
+	}
+	//免费用户未购买省份订阅包 按年算
+	year := fmt.Sprint(time.Now().Year())
+	//免费用户 已调整地区次数
+	fpnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year))
+	// log.Println(len(area), "fpnum:", fpnum, "ppnum:", ppnum)
+	//第一次设置地区 || 购买全国  不扣次数
+	var issetredis = areacount > -1 && !isfirst
+	if issetredis {
+		//地区范围判断
+		if areacount+jy.BaseAreaNum < len(area) {
+			return &FuncResult{false, errors.New("超出地区可设置范围"), nil}
+		}
+		//地区调整次数判断
+		if areacount+jy.BaseAreaNum <= ppnum { //+fpnum
+			return &FuncResult{false, errors.New(fmt.Sprintf("订阅地区调整次数(%d)已用完", areacount+jy.BaseAreaNum)), nil}
+		}
+	}
+	//清楚缓存
+	jy.ClearBigVipUserPower(userId)
+	if !FreeSubChange(userId, &area, industry, ppb, isfirst) {
+		return &FuncResult{false, errors.New("保存修改出错"), nil}
+	} else if issetredis { //更新调整次数 非全国(第一次 不消耗次数)
+		//优先使用省份订阅包次数
+		// log.Println(areacount, "---", ppnum)
+		// log.Println(jy.BaseAreaNum, "---", fpnum)
+		if ppb {
+			if areacount+jy.BaseAreaNum > ppnum {
+				redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym), ppnum+1, 31*24*60*60)
+			} else {
+				log.Println(fmt.Sprintf("免费用户购买省份订阅包设置地区 扣除次数异常  userId:%s", userId))
+			}
+		} else if jy.BaseAreaNum > fpnum {
+			redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year), fpnum+1, 365*24*60*60)
+		} else {
+			log.Println(fmt.Sprintf("免费用户设置地区 扣除次数异常  userId:%s", userId))
+		}
+	}
+	SetLog(userId, "o_jy", 0, session)
+	return &FuncResult{true, nil, map[string]interface{}{
+		"doSuccess": true,
+	}}
 }
 
 //免费用户地区调整
 func FreeSubChange(userId string, area *map[string]interface{}, industry []string, ppb, isfirst bool) bool {
-        setMap := map[string]interface{}{"$set": map[string]interface{}{
-                "o_jy.o_area":    area, //设置地区
-                "o_jy.i_newfree": 1,    //老免费用户=>新订阅设置页面 20211122
-        }}
-        if ppb {
-                setMap = map[string]interface{}{"$set": map[string]interface{}{
-                        "o_jy.o_area_p":  area, //设置地区
-                        "o_jy.i_newfree": 1,    //老免费用户=>新订阅设置页面 20211122
-                }}
-        }
-        updateOk := db.Mgo.UpdateById("user", userId, setMap)
-        if !updateOk {
-                return false
-        }
-        return true
+	setMap := map[string]interface{}{"$set": map[string]interface{}{
+		"o_jy.o_area":    area, //设置地区
+		"o_jy.i_newfree": 1,    //老免费用户=>新订阅设置页面 20211122
+	}}
+	if ppb {
+		setMap = map[string]interface{}{"$set": map[string]interface{}{
+			"o_jy.o_area_p":  area, //设置地区
+			"o_jy.i_newfree": 1,    //老免费用户=>新订阅设置页面 20211122
+		}}
+	}
+	updateOk := db.Mgo.UpdateById("user", userId, setMap)
+	if !updateOk {
+		return false
+	}
+	return true
 }
 
 //是否可进行地区调整
 func IsCanSet(userId string, areamap map[string]interface{}, session *httpsession.Session) (bool, bool, int) {
-        areacount := 0
-        myarea := []string{}
-        setarea := []string{}
-        myareamap := map[string]interface{}{}
-        o_jy := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
-        //mData, ok := db.Mgo.FindById("user", userId, `{"o_jy":1}`)
-        /*if !ok || len(*mData) == 0 || mData == nil {
-                return false, false, areacount
-        }*/
-        //o_jy, _ := (*mData)["o_jy"].(map[string]interface{})
-        //地区是否完全一致
-        if (*o_jy)["o_area"] != nil {
-                myareamap = *qutil.ObjToMap((*o_jy)["o_area"])
+	areacount := 0
+	myarea := []string{}
+	setarea := []string{}
+	myareamap := map[string]interface{}{}
+	o_jy := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
+	//地区是否完全一致
+	if (*o_jy)["o_area"] != nil {
+		myareamap = *qutil.ObjToMap((*o_jy)["o_area"])
 
-        }
-        //是否购买省份订阅包
-        if (*o_jy)["i_ppstatus"] != nil && qutil.IntAll((*o_jy)["i_ppstatus"]) > 0 {
-                o_buyset_p, _ := (*o_jy)["o_buyset_p"].(map[string]interface{})
-                areacount = qutil.IntAll(o_buyset_p["areacount"]) //-1 全国无限制
-                myareamap = *qutil.ObjToMap((*o_jy)["o_area_p"])
-        }
-        myareabool := map[string]bool{}
-        areasize := 0
-        //库中地区
-        for oak, _ := range myareamap {
-                myareabool[oak] = true
-                myarea = append(myarea, oak)
-        }
-        //参数地区
-        for sak, _ := range areamap {
-                if myareabool[sak] {
-                        areasize += 1
-                }
-                setarea = append(setarea, sak)
-        }
-        if areaSort(setarea) == areaSort(myarea) || areasize == len(setarea) {
-                log.Println(setarea, "-地区选择前后一致或地区调整在已选择地区范围内-", myarea)
-                return true, qutil.IntAll((*o_jy)["i_ppstatus"]) > 0, areacount
-        }
-        // log.Println(areaSort(setarea) == areaSort(myarea), "---areacount:", areacount)
-        return (*o_jy)["o_area"] == nil, qutil.IntAll((*o_jy)["i_ppstatus"]) > 0, areacount
+	}
+	//是否购买省份订阅包
+	if (*o_jy)["i_ppstatus"] != nil && qutil.IntAll((*o_jy)["i_ppstatus"]) > 0 {
+		o_buyset_p, _ := (*o_jy)["o_buyset_p"].(map[string]interface{})
+		areacount = qutil.IntAll(o_buyset_p["areacount"]) //-1 全国无限制
+		myareamap = *qutil.ObjToMap((*o_jy)["o_area_p"])
+	}
+	myareabool := map[string]bool{}
+	areasize := 0
+	//库中地区
+	for oak, _ := range myareamap {
+		myareabool[oak] = true
+		myarea = append(myarea, oak)
+	}
+	//参数地区
+	for sak, _ := range areamap {
+		if myareabool[sak] {
+			areasize += 1
+		}
+		setarea = append(setarea, sak)
+	}
+	if areaSort(setarea) == areaSort(myarea) || areasize == len(setarea) {
+		log.Println(setarea, "-地区选择前后一致或地区调整在已选择地区范围内-", myarea)
+		return true, qutil.IntAll((*o_jy)["i_ppstatus"]) > 0, areacount
+	}
+	// log.Println(areaSort(setarea) == areaSort(myarea), "---areacount:", areacount)
+	return (*o_jy)["o_area"] == nil, qutil.IntAll((*o_jy)["i_ppstatus"]) > 0, areacount
 }
 
 //
 func areaSort(area []string) string {
-        sort.Slice(area, func(i, j int) bool {
-                return area[i] < area[j]
-        })
-        return strings.Join(area, ",")
+	sort.Slice(area, func(i, j int) bool {
+		return area[i] < area[j]
+	})
+	return strings.Join(area, ",")
 }
 
 //
 func vipSet(area map[string]interface{}, industry []string, userId string, session *httpsession.Session) *FuncResult {
-        if len(industry) == 1 && industry[0] == "" {
-                industry = []string{}
-        }
-        positionType := qutil.Int64All(session.Get("positionType"))
-        rData, oldBuyset, isVip := GetVipDetail(session)
-        if !isVip {
-                return &FuncResult{false, errors.New("请求异常,非vip状态"), nil}
-        }
-        if rData == nil || len(*rData) == 0 {
-                return &FuncResult{false, errors.New("获取信息失败"), nil}
-        }
-        newBuyset := NewBuySet(&area, industry, oldBuyset.Upgrade == 1)
+	if len(industry) == 1 && industry[0] == "" {
+		industry = []string{}
+	}
+	positionType := qutil.Int64All(session.Get("positionType"))
+	rData, oldBuyset, isVip := GetVipDetail(session)
+	if !isVip {
+		return &FuncResult{false, errors.New("请求异常,非vip状态"), nil}
+	}
+	if rData == nil || len(*rData) == 0 {
+		return &FuncResult{false, errors.New("获取信息失败"), nil}
+	}
+	newBuyset := NewBuySet(&area, industry, oldBuyset.Upgrade == 1)
 
-        if needUpgrade := needUpgrade(newBuyset, oldBuyset); needUpgrade {
-                log.Printf("%s 订阅内容超出套餐 %+v area:%v industry:%v", userId, oldBuyset, area, industry)
-                return &FuncResult{false, errors.New("订阅内容超出套餐"), nil}
-        }
-        if positionType == 1 {
-                if !VipSubChange(userId, qutil.ObjToMap((*rData)["o_entniche"]), &area, industry, session) {
-                        return &FuncResult{false, errors.New("保存修改出错"), nil}
-                }
-        } else {
-                if !VipSubChange(userId, qutil.ObjToMap((*rData)["o_vipjy"]), &area, industry, session) {
-                        return &FuncResult{false, errors.New("保存修改出错"), nil}
-                }
-        }
+	if needUpgrade := needUpgrade(newBuyset, oldBuyset); needUpgrade {
+		log.Printf("%s 订阅内容超出套餐 %+v area:%v industry:%v", userId, oldBuyset, area, industry)
+		return &FuncResult{false, errors.New("订阅内容超出套餐"), nil}
+	}
+	if positionType == 1 {
+		if !VipSubChange(userId, qutil.ObjToMap((*rData)["o_entniche"]), &area, industry, session) {
+			return &FuncResult{false, errors.New("保存修改出错"), nil}
+		}
+	} else {
+		if !VipSubChange(userId, qutil.ObjToMap((*rData)["o_vipjy"]), &area, industry, session) {
+			return &FuncResult{false, errors.New("保存修改出错"), nil}
+		}
+	}
 
-        SetLog(userId, "o_vipjy", positionType, session)
-        return &FuncResult{true, nil, map[string]interface{}{
-                "doSuccess": true,
-        }}
+	SetLog(userId, "o_vipjy", positionType, session)
+	return &FuncResult{true, nil, map[string]interface{}{
+		"doSuccess": true,
+	}}
 }
 
 //大会员订阅设置
 func memberSet(area map[string]interface{}, industry []string, userId string, session *httpsession.Session) *FuncResult {
-        if data := jy.GetBigVipUserBaseMsg( session, *config.Middleground); data.Status <= 0 {
-                return &FuncResult{false, errors.New("请求异常,非大会员状态"), nil}
-        }
-        if len(industry) == 1 && industry[0] == "" {
-                industry = []string{}
-        }
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if !MemberSubChange(userId, &area, industry, session) {
-                return &FuncResult{false, errors.New("保存修改出错"), nil}
-        }
-        SetLog(userId, "o_member_jy", positionType, session)
-        return &FuncResult{true, nil, map[string]interface{}{
-                "doSuccess": true,
-        }}
+	if data := jy.GetBigVipUserBaseMsg(session, *config.Middleground); data.Status <= 0 {
+		return &FuncResult{false, errors.New("请求异常,非大会员状态"), nil}
+	}
+	if len(industry) == 1 && industry[0] == "" {
+		industry = []string{}
+	}
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if !MemberSubChange(userId, &area, industry, session) {
+		return &FuncResult{false, errors.New("保存修改出错"), nil}
+	}
+	SetLog(userId, "o_member_jy", positionType, session)
+	return &FuncResult{true, nil, map[string]interface{}{
+		"doSuccess": true,
+	}}
 }
 
 //购买内容
 type SubvipBuySet struct {
-        Upgrade         int   `json:"upgrade"`         //是否是升级版;1是 其他不是
-        AreaCount       int   `json:"areacount"`       //-1 全国  >0 省份数量
-        NewCitys        []int `json:"newcitys"`        //城市数量(新)
-        BuyerclassCount int   `json:"buyerclasscount"` //行业数
+	Upgrade         int   `json:"upgrade"`         //是否是升级版;1是 其他不是
+	AreaCount       int   `json:"areacount"`       //-1 全国  >0 省份数量
+	NewCitys        []int `json:"newcitys"`        //城市数量(新)
+	BuyerclassCount int   `json:"buyerclasscount"` //行业数
 }
 
 //获取省份,城市,行业购买内容
 //[省份,城市,行业]
 func GetVipDetail(session *httpsession.Session) (*map[string]interface{}, *SubvipBuySet, bool) {
-        /* mData, ok := db.Mgo.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1,"l_vip_endtime":1,"l_vip_starttime":1,"isread":1}`)
-           if !ok || len(*mData) == 0 || mData == nil {
-                   return nil, nil, false
-           }*/
-        data := jy.GetBigVipUserBaseMsg( session,*config.Middleground)
-        //是否处于vip状态
-        vipStatus := data.Data.Vip.Status
-        o_jy := jy.GetSubScribeInfo(session, db.Mgo, "v", "10000")
-        tmp := qutil.ObjToMap((*o_jy)["o_buyset"])
-        newCity, _ := (*tmp)["newcitys"].([]interface{})
-        return o_jy, &SubvipBuySet{
-                qutil.IntAll((*tmp)["upgrade"]),
-                qutil.IntAll((*tmp)["areacount"]),
-                util.ConfirmIntArr(newCity),
-                qutil.IntAll((*tmp)["buyerclasscount"]),
-        }, vipStatus > 0
+	data := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
+	//是否处于vip状态
+	vipStatus := data.Data.Vip.Status
+	o_jy := jy.GetSubScribeInfo(session, db.Mgo, "v", "10000")
+	tmp := qutil.ObjToMap((*o_jy)["o_buyset"])
+	newCity, _ := (*tmp)["newcitys"].([]interface{})
+	return o_jy, &SubvipBuySet{
+		qutil.IntAll((*tmp)["upgrade"]),
+		qutil.IntAll((*tmp)["areacount"]),
+		util.ConfirmIntArr(newCity),
+		qutil.IntAll((*tmp)["buyerclasscount"]),
+	}, vipStatus > 0
 }
 
 var SubVipPrice subVipPrice
 
 func init() {
-        qutil.ReadConfig("./subvip_price.json", &SubVipPrice)
+	qutil.ReadConfig("./subvip_price.json", &SubVipPrice)
 }
 
 //价格表
 type subVipPrice struct {
-        Old struct {
-                Month struct {
-                        OneCity_oneBuyerClass     int `json:"oneCity_oneBuyerClass"`     //一个城市一个行业
-                        OneCity_allBuyerClass     int `json:"oneCity_allBuyerClass"`     //一个城市全部行业
-                        OneProvince_oneBuyerClass int `json:"oneProvince_oneBuyerClass"` //一个省份一个行业
-                        OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
-                        AllProvince_oneBuyerClass int `json:"allProvince_oneBuyerClass"` //全国一个行业
-                        AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
-                } `json:"month"`
-                Year struct {
-                        OneCity_oneBuyerClass     int `json:"oneCity_oneBuyerClass"`     //一个城市一个行业
-                        OneCity_allBuyerClass     int `json:"oneCity_allBuyerClass"`     //一个城市全部行业
-                        OneProvince_oneBuyerClass int `json:"oneProvince_oneBuyerClass"` //一个省份一个行业
-                        OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
-                        AllProvince_oneBuyerClass int `json:"allProvince_oneBuyerClass"` //全国一个行业
-                        AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
-                } `json:"year"`
-                CityPrice          int `json:"cityPrice"`          //单个城市价格
-                ProvincePrice      int `json:"provincePrice"`      //单个省份价格
-                BuyerClassPrice    int `json:"buyerClassPrice"`    //单个行业价格
-                CityMaxCount       int `json:"cityMaxCount"`       //单个省份城市可计价最大数量
-                ProvinceMaxCount   int `json:"provinceMaxCount"`   //所有地区中省份可计价最大数量
-                BuyerClassMaxCount int `json:"buyerClassMaxCount"` //行业价格可计价最大数量
-                MonthMaxCount      int `json:"monthMaxCount"`      //月份可计价最大数量
-        } `json:"old"`
-        New struct {
-                Month struct {
-                        OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
-                        AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
-                } `json:"month"`
-                Quarter struct {
-                        OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
-                        AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
-                } `json:"quarter"`
-                Year struct {
-                        OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
-                        AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
-                } `json:"year"`
-                ProvincePrice    int `json:"provincePrice"`    //单个省份价格
-                ProvinceMaxCount int `json:"provinceMaxCount"` //所有地区中省份可计价最大数量
-                MonthMaxCount    int `json:"monthMaxCount"`    //月份可计价最大数量
-        } `json:"new"`
-        Discount float64 `json:"discount"` //折扣(测试使用)
+	Old struct {
+		Month struct {
+			OneCity_oneBuyerClass     int `json:"oneCity_oneBuyerClass"`     //一个城市一个行业
+			OneCity_allBuyerClass     int `json:"oneCity_allBuyerClass"`     //一个城市全部行业
+			OneProvince_oneBuyerClass int `json:"oneProvince_oneBuyerClass"` //一个省份一个行业
+			OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
+			AllProvince_oneBuyerClass int `json:"allProvince_oneBuyerClass"` //全国一个行业
+			AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
+		} `json:"month"`
+		Year struct {
+			OneCity_oneBuyerClass     int `json:"oneCity_oneBuyerClass"`     //一个城市一个行业
+			OneCity_allBuyerClass     int `json:"oneCity_allBuyerClass"`     //一个城市全部行业
+			OneProvince_oneBuyerClass int `json:"oneProvince_oneBuyerClass"` //一个省份一个行业
+			OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
+			AllProvince_oneBuyerClass int `json:"allProvince_oneBuyerClass"` //全国一个行业
+			AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
+		} `json:"year"`
+		CityPrice          int `json:"cityPrice"`          //单个城市价格
+		ProvincePrice      int `json:"provincePrice"`      //单个省份价格
+		BuyerClassPrice    int `json:"buyerClassPrice"`    //单个行业价格
+		CityMaxCount       int `json:"cityMaxCount"`       //单个省份城市可计价最大数量
+		ProvinceMaxCount   int `json:"provinceMaxCount"`   //所有地区中省份可计价最大数量
+		BuyerClassMaxCount int `json:"buyerClassMaxCount"` //行业价格可计价最大数量
+		MonthMaxCount      int `json:"monthMaxCount"`      //月份可计价最大数量
+	} `json:"old"`
+	New struct {
+		Month struct {
+			OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
+			AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
+		} `json:"month"`
+		Quarter struct {
+			OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
+			AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
+		} `json:"quarter"`
+		Year struct {
+			OneProvince_allBuyerClass int `json:"oneProvince_allBuyerClass"` //一个省份全部行业
+			AllProvince_allBuyerClass int `json:"allProvince_allBuyerClass"` //全国全行业
+		} `json:"year"`
+		ProvincePrice    int `json:"provincePrice"`    //单个省份价格
+		ProvinceMaxCount int `json:"provinceMaxCount"` //所有地区中省份可计价最大数量
+		MonthMaxCount    int `json:"monthMaxCount"`    //月份可计价最大数量
+	} `json:"new"`
+	Discount float64 `json:"discount"` //折扣(测试使用)
 }
 
 //超级订阅获取购买项
 func NewBuySet(area *map[string]interface{}, industry []string, isUpgrade bool) *SubvipBuySet {
-        pCount := -1
-        citys := []int{}
-        if area != nil {
-                if (*area)["全国"] != nil {
-                        area = &map[string]interface{}{}
-                } else if pCount_tmp := qutil.IntAll((*area)["areacount"]); pCount_tmp > 0 {
-                        pCount = pCount_tmp
-                }
-        }
-        buyset := SubvipBuySet{}
-        if !isUpgrade {
-                buyset.Upgrade = 0 //升级版超级订阅标识
-                if len(*area) > 0 {
-                        pCount = 0
-                        for _, v := range *area {
-                                tmp := v.([]interface{})
-                                if len(tmp) == 0 || len(tmp) > SubVipPrice.Old.CityMaxCount { //省份
-                                        pCount++
-                                } else { //城市
-                                        citys = append(citys, len(tmp))
-                                }
-                        }
-                        //省份数量自动转换全国
-                        if pCount > SubVipPrice.Old.ProvinceMaxCount {
-                                pCount = -1
-                                citys = []int{}
-                        }
-                }
-                buyset.NewCitys = citys
-                buyset.AreaCount = pCount //地区
-                //行业数量自动转换全行业
-                buyset.BuyerclassCount = len(industry)
-                if len(industry) > SubVipPrice.Old.BuyerClassMaxCount || len(industry) == 0 {
-                        buyset.BuyerclassCount = -1
-                }
-        } else {
-                buyset.Upgrade = 1 //升级版超级订阅标识
-                if len(*area) > 0 {
-                        pCount = len(*area)
-                        //省份数量自动转换全国
-                        if pCount > SubVipPrice.New.ProvinceMaxCount {
-                                pCount = -1
-                        }
-                } else {
-                        buyset.AreaCount = -1 //全国
-                }
-                buyset.AreaCount = pCount   //地区
-                buyset.NewCitys = citys     //城市,4.4改版不支持购买城市
-                buyset.BuyerclassCount = -1 //行业,4.4改版只能购买全行业
-        }
-        return &buyset
+	pCount := -1
+	citys := []int{}
+	if area != nil {
+		if (*area)["全国"] != nil {
+			area = &map[string]interface{}{}
+		} else if pCount_tmp := qutil.IntAll((*area)["areacount"]); pCount_tmp > 0 {
+			pCount = pCount_tmp
+		}
+	}
+	buyset := SubvipBuySet{}
+	if !isUpgrade {
+		buyset.Upgrade = 0 //升级版超级订阅标识
+		if len(*area) > 0 {
+			pCount = 0
+			for _, v := range *area {
+				tmp := v.([]interface{})
+				if len(tmp) == 0 || len(tmp) > SubVipPrice.Old.CityMaxCount { //省份
+					pCount++
+				} else { //城市
+					citys = append(citys, len(tmp))
+				}
+			}
+			//省份数量自动转换全国
+			if pCount > SubVipPrice.Old.ProvinceMaxCount {
+				pCount = -1
+				citys = []int{}
+			}
+		}
+		buyset.NewCitys = citys
+		buyset.AreaCount = pCount //地区
+		//行业数量自动转换全行业
+		buyset.BuyerclassCount = len(industry)
+		if len(industry) > SubVipPrice.Old.BuyerClassMaxCount || len(industry) == 0 {
+			buyset.BuyerclassCount = -1
+		}
+	} else {
+		buyset.Upgrade = 1 //升级版超级订阅标识
+		if len(*area) > 0 {
+			pCount = len(*area)
+			//省份数量自动转换全国
+			if pCount > SubVipPrice.New.ProvinceMaxCount {
+				pCount = -1
+			}
+		} else {
+			buyset.AreaCount = -1 //全国
+		}
+		buyset.AreaCount = pCount   //地区
+		buyset.NewCitys = citys     //城市,4.4改版不支持购买城市
+		buyset.BuyerclassCount = -1 //行业,4.4改版只能购买全行业
+	}
+	return &buyset
 }
 
 //是否需要升级
 func needUpgrade(newBuySet, oldBuySet *SubvipBuySet) bool {
-        if newBuySet.Upgrade != 1 { //旧版本订阅是否需要升级校验
-                BuyerclassUpgrade, AreaNeedUpgrade := false, false
-                UpgradeBuyset := &SubvipBuySet{
-                        oldBuySet.Upgrade,
-                        oldBuySet.AreaCount,
-                        oldBuySet.NewCitys,
-                        oldBuySet.BuyerclassCount,
-                }
-                //比较行业
-                if oldBuySet.BuyerclassCount != -1 {
-                        //若当前买的不是全行业,并且当前行业数量小于新行业数量时
-                        if oldBuySet.BuyerclassCount < newBuySet.BuyerclassCount || newBuySet.BuyerclassCount == -1 {
-                                BuyerclassUpgrade = true
-                                //计算升级后的buySet
-                                UpgradeBuyset.BuyerclassCount = newBuySet.BuyerclassCount
-                        }
-                }
-                //比较地区
-                if oldBuySet.AreaCount != -1 {
-                        if newBuySet.AreaCount == -1 { //升级为全国
-                                UpgradeBuyset.AreaCount = newBuySet.AreaCount
-                                UpgradeBuyset.NewCitys = newBuySet.NewCitys
-                                AreaNeedUpgrade = true
-                        } else {
-                                oldCitysBuyOne, oldCitysBuyTwo := 0, 0
-                                newCitysBuyOne, newCitysBuyTwo := 0, 0
-                                oldCopy := []int{} //复制(防止影响原数组)
-                                for _, v := range oldBuySet.NewCitys {
-                                        if v == 1 {
-                                                oldCitysBuyOne++
-                                        } else {
-                                                oldCitysBuyTwo++
-                                        }
-                                        oldCopy = append(oldCopy, v)
-                                }
-                                UpgradeBuyset.NewCitys = oldCopy
-                                for _, v := range newBuySet.NewCitys {
-                                        if v == 1 {
-                                                newCitysBuyOne++
-                                        } else {
-                                                newCitysBuyTwo++
-                                        }
-                                }
+	if newBuySet.Upgrade != 1 { //旧版本订阅是否需要升级校验
+		BuyerclassUpgrade, AreaNeedUpgrade := false, false
+		UpgradeBuyset := &SubvipBuySet{
+			oldBuySet.Upgrade,
+			oldBuySet.AreaCount,
+			oldBuySet.NewCitys,
+			oldBuySet.BuyerclassCount,
+		}
+		//比较行业
+		if oldBuySet.BuyerclassCount != -1 {
+			//若当前买的不是全行业,并且当前行业数量小于新行业数量时
+			if oldBuySet.BuyerclassCount < newBuySet.BuyerclassCount || newBuySet.BuyerclassCount == -1 {
+				BuyerclassUpgrade = true
+				//计算升级后的buySet
+				UpgradeBuyset.BuyerclassCount = newBuySet.BuyerclassCount
+			}
+		}
+		//比较地区
+		if oldBuySet.AreaCount != -1 {
+			if newBuySet.AreaCount == -1 { //升级为全国
+				UpgradeBuyset.AreaCount = newBuySet.AreaCount
+				UpgradeBuyset.NewCitys = newBuySet.NewCitys
+				AreaNeedUpgrade = true
+			} else {
+				oldCitysBuyOne, oldCitysBuyTwo := 0, 0
+				newCitysBuyOne, newCitysBuyTwo := 0, 0
+				oldCopy := []int{} //复制(防止影响原数组)
+				for _, v := range oldBuySet.NewCitys {
+					if v == 1 {
+						oldCitysBuyOne++
+					} else {
+						oldCitysBuyTwo++
+					}
+					oldCopy = append(oldCopy, v)
+				}
+				UpgradeBuyset.NewCitys = oldCopy
+				for _, v := range newBuySet.NewCitys {
+					if v == 1 {
+						newCitysBuyOne++
+					} else {
+						newCitysBuyTwo++
+					}
+				}
 
-                                p_Diff := newBuySet.AreaCount - oldBuySet.AreaCount
-                                c_1_diff := newCitysBuyOne - oldCitysBuyOne
-                                c_2_diff := newCitysBuyTwo - oldCitysBuyTwo
+				p_Diff := newBuySet.AreaCount - oldBuySet.AreaCount
+				c_1_diff := newCitysBuyOne - oldCitysBuyOne
+				c_2_diff := newCitysBuyTwo - oldCitysBuyTwo
 
-                                if p_Diff > 0 {
-                                        UpgradeBuyset.AreaCount = newBuySet.AreaCount
-                                }
+				if p_Diff > 0 {
+					UpgradeBuyset.AreaCount = newBuySet.AreaCount
+				}
 
-                                if p_Diff > 0 || p_Diff+c_2_diff > 0 || p_Diff+c_2_diff+c_1_diff > 0 {
-                                        //有多余未使用名额保留
-                                        if p_Diff+c_2_diff+c_1_diff < 0 {
-                                                if c_1_diff < 0 && p_Diff+c_2_diff >= 0 {
-                                                        c_1_diff = -(p_Diff + c_2_diff)
-                                                }
-                                                if c_2_diff < 0 && p_Diff+c_1_diff >= 0 {
-                                                        c_2_diff = -(p_Diff + c_1_diff)
-                                                }
-                                        }
+				if p_Diff > 0 || p_Diff+c_2_diff > 0 || p_Diff+c_2_diff+c_1_diff > 0 {
+					//有多余未使用名额保留
+					if p_Diff+c_2_diff+c_1_diff < 0 {
+						if c_1_diff < 0 && p_Diff+c_2_diff >= 0 {
+							c_1_diff = -(p_Diff + c_2_diff)
+						}
+						if c_2_diff < 0 && p_Diff+c_1_diff >= 0 {
+							c_2_diff = -(p_Diff + c_1_diff)
+						}
+					}
 
-                                        //需要升级
-                                        AreaNeedUpgrade = true
-                                        //计算升级后的buySet
-                                        if p_Diff < 0 { //有剩余省份未使用
-                                                if c_2_diff > 0 {
-                                                        c_2_diff += p_Diff //转移给两个市使用
-                                                } else {
-                                                        c_1_diff += p_Diff //转移给一个市使用
-                                                }
-                                        } else { //省份数量增加
-                                                UpgradeBuyset.AreaCount = newBuySet.AreaCount
-                                        }
-                                        del_2_flag, del_1_flag := 0, 0 //被占用
-                                        if c_2_diff < 0 {              //有两个城市的名额未使用完
-                                                if p_Diff > 0 {
-                                                        //转移给一个省使用
-                                                        if c_2_diff+p_Diff > 0 {
-                                                                del_2_flag += -c_2_diff
-                                                                c_2_diff = 0
-                                                                //p_Diff -= -c_2_diff;
-                                                        } else {
-                                                                c_2_diff += p_Diff
-                                                                del_2_flag += p_Diff
-                                                                //p_Diff = 0
-                                                        }
-                                                }
-                                                if c_1_diff > 0 && c_2_diff < 0 { //转移给一个市使用
-                                                        c_1_diff += c_2_diff
-                                                }
-                                        }
-                                        if c_1_diff < 0 { //有一个城市的名额未使用完
-                                                if p_Diff > 0 {
-                                                        if c_1_diff+p_Diff > 0 {
-                                                                del_1_flag += -c_1_diff
-                                                                c_1_diff = 0
-                                                                //p_Diff -= -c_1_diff
-                                                        } else {
-                                                                c_1_diff += p_Diff
-                                                                del_1_flag += p_Diff
-                                                                //p_Diff = 0
-                                                        }
-                                                }
-                                                if c_2_diff > 0 && c_1_diff < 0 {
-                                                        if c_1_diff+c_2_diff > 0 {
-                                                                del_1_flag += -c_1_diff
-                                                                c_1_diff = 0
-                                                                //c_2_diff -= -c_1_diff;
-                                                        } else {
-                                                                c_1_diff += c_2_diff
-                                                                del_1_flag += c_2_diff
-                                                                //c_2_diff = 0
-                                                        }
-                                                }
-                                        }
-                                        //删除顶替
-                                        log.Println("start", UpgradeBuyset.NewCitys, del_2_flag, del_1_flag)
-                                        index_flag := 0
-                                        for del_2_flag > 0 || del_1_flag > 0 {
-                                                valueFlag := UpgradeBuyset.NewCitys[index_flag]
-                                                if del_2_flag > 0 && valueFlag == 2 {
-                                                        UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys[:index_flag], UpgradeBuyset.NewCitys[index_flag+1:]...)
-                                                        del_2_flag--
-                                                        continue
-                                                } else if del_1_flag > 0 && valueFlag == 1 {
-                                                        UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys[:index_flag], UpgradeBuyset.NewCitys[index_flag+1:]...)
-                                                        del_1_flag--
-                                                        continue
-                                                }
-                                                index_flag++
-                                        }
-                                        log.Println("end", UpgradeBuyset.NewCitys, c_2_diff, c_1_diff)
-                                        //增加新增
-                                        for i := c_2_diff; i > 0; i-- { //添加购买两个市数量
-                                                UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys, 2)
-                                        }
+					//需要升级
+					AreaNeedUpgrade = true
+					//计算升级后的buySet
+					if p_Diff < 0 { //有剩余省份未使用
+						if c_2_diff > 0 {
+							c_2_diff += p_Diff //转移给两个市使用
+						} else {
+							c_1_diff += p_Diff //转移给一个市使用
+						}
+					} else { //省份数量增加
+						UpgradeBuyset.AreaCount = newBuySet.AreaCount
+					}
+					del_2_flag, del_1_flag := 0, 0 //被占用
+					if c_2_diff < 0 {              //有两个城市的名额未使用完
+						if p_Diff > 0 {
+							//转移给一个省使用
+							if c_2_diff+p_Diff > 0 {
+								del_2_flag += -c_2_diff
+								c_2_diff = 0
+								//p_Diff -= -c_2_diff;
+							} else {
+								c_2_diff += p_Diff
+								del_2_flag += p_Diff
+								//p_Diff = 0
+							}
+						}
+						if c_1_diff > 0 && c_2_diff < 0 { //转移给一个市使用
+							c_1_diff += c_2_diff
+						}
+					}
+					if c_1_diff < 0 { //有一个城市的名额未使用完
+						if p_Diff > 0 {
+							if c_1_diff+p_Diff > 0 {
+								del_1_flag += -c_1_diff
+								c_1_diff = 0
+								//p_Diff -= -c_1_diff
+							} else {
+								c_1_diff += p_Diff
+								del_1_flag += p_Diff
+								//p_Diff = 0
+							}
+						}
+						if c_2_diff > 0 && c_1_diff < 0 {
+							if c_1_diff+c_2_diff > 0 {
+								del_1_flag += -c_1_diff
+								c_1_diff = 0
+								//c_2_diff -= -c_1_diff;
+							} else {
+								c_1_diff += c_2_diff
+								del_1_flag += c_2_diff
+								//c_2_diff = 0
+							}
+						}
+					}
+					//删除顶替
+					log.Println("start", UpgradeBuyset.NewCitys, del_2_flag, del_1_flag)
+					index_flag := 0
+					for del_2_flag > 0 || del_1_flag > 0 {
+						valueFlag := UpgradeBuyset.NewCitys[index_flag]
+						if del_2_flag > 0 && valueFlag == 2 {
+							UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys[:index_flag], UpgradeBuyset.NewCitys[index_flag+1:]...)
+							del_2_flag--
+							continue
+						} else if del_1_flag > 0 && valueFlag == 1 {
+							UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys[:index_flag], UpgradeBuyset.NewCitys[index_flag+1:]...)
+							del_1_flag--
+							continue
+						}
+						index_flag++
+					}
+					log.Println("end", UpgradeBuyset.NewCitys, c_2_diff, c_1_diff)
+					//增加新增
+					for i := c_2_diff; i > 0; i-- { //添加购买两个市数量
+						UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys, 2)
+					}
 
-                                        for i := c_1_diff; i > 0; i-- { //添加购买一个市数量
-                                                UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys, 1)
-                                        }
-                                } else {
-                                        //不需要升级
-                                        AreaNeedUpgrade = false
-                                }
-                        }
-                }
-                if BuyerclassUpgrade || AreaNeedUpgrade {
-                        return true
-                } else {
-                        return false
-                }
-        } else {
-                //return newBuySet.AreaCount == -1 || newBuySet.AreaCount > oldBuySet.AreaCount
-                if oldBuySet.AreaCount != -1 {
-                        return newBuySet.AreaCount == -1 || newBuySet.AreaCount > oldBuySet.AreaCount
-                } else {
-                        return false
-                }
-        }
+					for i := c_1_diff; i > 0; i-- { //添加购买一个市数量
+						UpgradeBuyset.NewCitys = append(UpgradeBuyset.NewCitys, 1)
+					}
+				} else {
+					//不需要升级
+					AreaNeedUpgrade = false
+				}
+			}
+		}
+		if BuyerclassUpgrade || AreaNeedUpgrade {
+			return true
+		} else {
+			return false
+		}
+	} else {
+		//return newBuySet.AreaCount == -1 || newBuySet.AreaCount > oldBuySet.AreaCount
+		if oldBuySet.AreaCount != -1 {
+			return newBuySet.AreaCount == -1 || newBuySet.AreaCount > oldBuySet.AreaCount
+		} else {
+			return false
+		}
+	}
 }
 
 //超级订阅 订阅修改
 func VipSubChange(userId string, oldVip, areaNew *map[string]interface{}, industryNew []string, session *httpsession.Session) bool {
-        updateOk := false
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if positionType == 1 {
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                updateOk = db.Mgo.Update("entniche_rule", query,
-                        map[string]interface{}{"$set": map[string]interface{}{
-                                "o_entniche.o_area":       areaNew,     //设置地区
-                                "o_entniche.a_buyerclass": industryNew, //设置行业
-                                "l_updatetime":            time.Now().Unix(),
-                        }}, true, false)
-        } else {
-                updateOk = db.Mgo.UpdateById("user", userId,
-                        map[string]interface{}{"$set": map[string]interface{}{
-                                "o_vipjy.o_area":       areaNew,     //设置地区
-                                "o_vipjy.a_buyerclass": industryNew, //设置行业
-                        }})
-        }
-        if !updateOk {
-                return false
-        } else {
-                //保存修改日志
-                go func() {
-                        db.Mgo_Log.Save("subvip_edit_log", map[string]interface{}{
-                                "s_userid":         userId,
-                                "o_area_old":       (*oldVip)["o_area"],
-                                "a_buyerclass_old": (*oldVip)["a_buyerclass"],
-                                "o_area":           areaNew,
-                                "a_buyerclass":     industryNew,
-                                "l_changeTime":     time.Now().Unix(),
-                        })
-                }()
-        }
-        return true
+	updateOk := false
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if positionType == 1 {
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		updateOk = db.Mgo.Update("entniche_rule", query,
+			map[string]interface{}{"$set": map[string]interface{}{
+				"o_entniche.o_area":       areaNew,     //设置地区
+				"o_entniche.a_buyerclass": industryNew, //设置行业
+				"l_updatetime":            time.Now().Unix(),
+			}}, true, false)
+	} else {
+		updateOk = db.Mgo.UpdateById("user", userId,
+			map[string]interface{}{"$set": map[string]interface{}{
+				"o_vipjy.o_area":       areaNew,     //设置地区
+				"o_vipjy.a_buyerclass": industryNew, //设置行业
+			}})
+	}
+	if !updateOk {
+		return false
+	} else {
+		//保存修改日志
+		go func() {
+			db.Mgo_Log.Save("subvip_edit_log", map[string]interface{}{
+				"s_userid":         userId,
+				"o_area_old":       (*oldVip)["o_area"],
+				"a_buyerclass_old": (*oldVip)["a_buyerclass"],
+				"o_area":           areaNew,
+				"a_buyerclass":     industryNew,
+				"l_changeTime":     time.Now().Unix(),
+			})
+		}()
+	}
+	return true
 }
 
 //超级订阅 订阅修改
 func MemberSubChange(userId string, areaNew *map[string]interface{}, industryNew []string, session *httpsession.Session) bool {
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if positionType == 1 {
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                if updateOk := db.Mgo.Update("entniche_rule", query,
-                        map[string]interface{}{"$set": map[string]interface{}{
-                                "o_entniche.o_area":       areaNew,     //设置地区
-                                "o_entniche.a_buyerclass": industryNew, //设置行业
-                                "l_updatetime":            time.Now().Unix(),
-                        }}, true, false); !updateOk {
-                        return false
-                }
-        } else {
-                if updateOk := db.Mgo.UpdateById("user", userId,
-                        map[string]interface{}{"$set": map[string]interface{}{
-                                "o_member_jy.o_area":       areaNew,     //设置地区
-                                "o_member_jy.a_buyerclass": industryNew, //设置行业
-                        }}); !updateOk {
-                        return false
-                }
-        }
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if positionType == 1 {
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		if updateOk := db.Mgo.Update("entniche_rule", query,
+			map[string]interface{}{"$set": map[string]interface{}{
+				"o_entniche.o_area":       areaNew,     //设置地区
+				"o_entniche.a_buyerclass": industryNew, //设置行业
+				"l_updatetime":            time.Now().Unix(),
+			}}, true, false); !updateOk {
+			return false
+		}
+	} else {
+		if updateOk := db.Mgo.UpdateById("user", userId,
+			map[string]interface{}{"$set": map[string]interface{}{
+				"o_member_jy.o_area":       areaNew,     //设置地区
+				"o_member_jy.a_buyerclass": industryNew, //设置行业
+			}}); !updateOk {
+			return false
+		}
+	}
 
-        return true
+	return true
 }

+ 2 - 2
src/jfw/modules/publicapply/src/subscribePush/service/subscribe.go

@@ -88,7 +88,7 @@ func (s *Subscribe) SetUserInfo() {
 			Power:         power,
 			EntUserId:     entUserId,
 			EntId:         entId,
-			Session:       s.session,
+			Session:       s.Session(),
 		}
 		r = sub.UpdateKeyWords()
 	} else {
@@ -105,7 +105,7 @@ func (s *Subscribe) SetUserInfo() {
 			OtherBuyerclass: other,
 			EntUserId:       entUserId,
 			EntId:           entId,
-			Session:         s.session,
+			Session:         s.Session(),
 		}
 		r = uo.UpdateOther()
 	}

+ 0 - 2
src/jfw/modules/subscribepay/src/service/dataexportPack.go

@@ -442,11 +442,9 @@ func (this *DataExportPack) RecordList() {
 	rData, errMsg := func() (interface{}, error) {
 		pageSize, _ := this.GetInteger("pageSize")
 		pageNum, _ := this.GetInteger("pageNum")
-
 		vipMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
 		entId := qutil.IntAll(this.GetSession("entId"))
 		entUserId := qutil.IntAll(this.GetSession("entUserId"))
-
 		returnList, total, err := entity.JyDataExportPack.GetDataExportRecordList(userId, vipMsg.Pid, entId, entUserId, pageNum, pageSize)
 		if err != nil {
 			return nil, err

+ 0 - 5
src/jfw/modules/subscribepay/src/service/orderDetails.go

@@ -120,11 +120,6 @@ func (o *OrderDetail) CommonDetail(bigm int, fields string) (data map[string]int
 				for _, n := range lastOrderMap {
 					if n == order_code {
 						data["lastbuy_code"] = n
-						/*if datas, ok := util.MQFW.FindById("user", userId, `{"i_vip_status":1,"o_jy":1}`); data != nil && ok && len(*datas) > 0 {
-							data["i_vip_status"] = qutil.Int64All((*datas)["i_vip_status"])
-							ojy := qutil.ObjToMap((*datas)["o_jy"])
-							data["i_pp_status"] = qutil.IntAllDef((*ojy)["i_ppstatus"], 0) //i_pp_status : -1 到期  0未购买 1已购买
-						}*/
 						datas := jy.GetBigVipUserBaseMsg(o.Session(), *config.Middleground)
 						data["i_vip_status"] = datas.Data.Vip.Status
 						ojy := jy.GetSubScribeInfo(o.Session(), util.MQFW, "f", "10000")

+ 0 - 6
src/jfw/modules/subscribepay/src/service/orderListDetails.go

@@ -545,7 +545,6 @@ func (o *OrderListDetails) SetRes(res []map[string]interface{}, userId string) {
 		}
 		product_type := v["product_type"]
 		if v["pay_time"] != nil && ((product_type == "VIP订阅") || (product_type == "省份订阅包")) {
-			//data, err := util.MQFW.FindOne("user", bson.M{"_id": StringTOBsonId(qutil.ObjToString(o.GetSession("userId")))})
 			data := jy.GetBigVipUserBaseMsg(o.Session(), *config.Middleground)
 			v["i_vip_status"] = data.VipStatus
 			ojy := jy.GetSubScribeInfo(o.Session(), util.MQFW, "f", "10000")
@@ -902,11 +901,6 @@ func CommonDetail(bigm int, fields, userId, order_code string, session *httpsess
 					for _, n := range lastOrderMap {
 						if n == order_code {
 							data["lastbuy_code"] = n
-							/* if datas, ok := util.MQFW.FindById("user", userId, `{"i_vip_status":1,"o_jy":1}`); data != nil && ok && len(*datas) > 0 {
-							        data["i_vip_status"] = qutil.Int64All((*datas)["i_vip_status"])
-							        ojy := qutil.ObjToMap((*datas)["o_jy"])
-							        data["i_pp_status"] = qutil.IntAllDef((*ojy)["i_ppstatus"], 0) //i_pp_status : -1 到期  0未购买 1已购买
-							}*/
 							datas := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
 							data["i_vip_status"] = datas.Data.Vip.Status
 							ojy := jy.GetSubScribeInfo(session, util.MQFW, "f", "10000")

+ 46 - 24
src/jfw/modules/subscribepay/src/service/userAccountInfo.go

@@ -78,7 +78,7 @@ func (this *UserAccount) GetSimpleData() {
 		}
 	}
 	this.ServeJson(map[string]interface{}{
-		"userId":    encrypt.EncodeArticleId(qutil.ObjToString(this.GetSession("userId"))),
+		"userId":    encrypt.EncodeArticleId(qutil.ObjToString(this.GetSession("mgoUserId"))),
 		"nickName":  qutil.If(phone != "", phone, name).(string),
 		"phone":     phone,
 		"name":      name,
@@ -90,9 +90,9 @@ func (this *UserAccount) GetSimpleData() {
 // 手机号 邮箱 头像 昵称 超级订阅 大会员 用户加密id
 func (this *UserAccount) GetAccountInfo() {
 	rData, errMsg := func() (interface{}, error) {
-		userId, _ := this.GetSession("userId").(string)
+		userId, _ := this.GetSession("mgoUserId").(string)
 		//由于超级订阅vip状态需要查库,无法从session中获取,所以直接所有字段从数据库中获取
-		userMsg, _ := util.MQFW.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1,"l_vip_starttime":1,"s_m_phone":1,"s_phone":1,"s_myemail":1,"s_nickname":1,"s_headimageurl":1,"s_password":1,"s_company":1,"s_unionid":1}`)
+		userMsg, _ := util.MQFW.FindById("user", userId, `{"s_m_phone":1,"s_phone":1,"s_myemail":1,"s_nickname":1,"s_headimageurl":1,"s_password":1,"s_company":1,"s_unionid":1}`)
 		if userMsg == nil || len(*userMsg) == 0 {
 			return nil, DBQUERY_ERROR
 		}
@@ -115,6 +115,7 @@ func (this *UserAccount) GetAccountInfo() {
 				breakRenewTip = 1
 			}
 		}
+		b := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
 		return map[string]interface{}{
 			"userId":        encrypt.EncodeArticleId(userId),
 			"email":         qutil.ObjToString((*userMsg)["s_myemail"]),
@@ -122,8 +123,8 @@ func (this *UserAccount) GetAccountInfo() {
 			"nickname":      nickname,
 			"jyname":        jyname,
 			"headimageurl":  strings.Replace(qutil.ObjToString((*userMsg)["s_headimageurl"]), "http://", "https://", 1),
-			"bigmemberVip":  qutil.IntAll((*userMsg)["i_member_status"]),
-			"subscribeVip":  qutil.IntAll((*userMsg)["i_vip_status"]),
+			"bigmemberVip":  b.Status,
+			"subscribeVip":  b.VipStatus,
 			"hasPwd":        qutil.ObjToString((*userMsg)["s_password"]) != "",
 			"company":       qutil.ObjToString((*userMsg)["s_company"]),
 			"isWx":          isWx, //是否是微信账号
@@ -135,7 +136,9 @@ func (this *UserAccount) GetAccountInfo() {
 
 // 推送我感兴趣开关
 func (this *UserAccount) Interested(doType string) {
-	userId, _ := this.GetSession("userId").(string)
+	sessVal := this.Session().GetMultiple()
+	userId, _ := sessVal["userId"].(string)
+	positionType := qutil.IntAll(sessVal["positionId"])
 	rData, errMsg := func() (interface{}, error) {
 		var defValue int = 1 //默认设置为开 1开 -1关
 		if doType == "switch" {
@@ -143,16 +146,35 @@ func (this *UserAccount) Interested(doType string) {
 			if !(setValue == -1 || setValue == 1) {
 				return nil, PARAM_ERROR
 			}
-			if !util.MQFW.UpdateById("user", userId, map[string]interface{}{
-				"$set": map[string]interface{}{
-					"i_interested": setValue,
-				},
-			}) {
+			updateOk := false
+			if positionType == 0 {
+				updateOk = util.MQFW.UpdateById("user", userId, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_interested": setValue,
+					},
+				})
+			} else {
+				updateOk = util.MQFW.Update("ent_user", map[string]interface{}{
+					"i_userid": qutil.IntAll(sessVal["entUserId"]),
+				}, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_interested": setValue,
+					},
+				}, false, false)
+			}
+			if !updateOk {
 				return nil, DBUPDATE_ERROR
 			}
 			defValue = setValue
 		} else if doType == "query" {
-			uData, _ := util.MQFW.FindById("user", userId, `{"i_interested":1}`)
+			var uData *map[string]interface{}
+			if positionType == 0 {
+				uData, _ = util.MQFW.FindById("user", userId, `{"i_interested":1}`)
+			} else {
+				uData, _ = util.MQFW.FindOneByField("ent_user", map[string]interface{}{
+					"i_userid": qutil.IntAll(sessVal["entUserId"]),
+				}, `{"i_interested":1}`)
+			}
 			if uData == nil || len(*uData) == 0 {
 				return nil, DBQUERY_ERROR
 			}
@@ -174,7 +196,7 @@ func (this *UserAccount) Interested(doType string) {
 
 // 绑定邮箱&更改邮箱【绑定邮箱和更改邮箱流程一样】
 func (this *UserAccount) MailSet(doType string) {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		step, _ := this.GetInteger("step")
 		mail := this.GetString("mail")
@@ -235,7 +257,7 @@ func (this *UserAccount) CompanyAssociation() {
 
 // 设置公司名称
 func (this *UserAccount) SetCompany() {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		companyName := strings.TrimSpace(this.GetString("name"))
 		if companyName == "" {
@@ -260,7 +282,7 @@ func (this *UserAccount) SetCompany() {
 
 // 获取图形验证码
 func (this *UserAccount) PhoneCaptcha() {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		rData := map[string]interface{}{}
 		if redis.GetInt("other", fmt.Sprintf(redisPhoneCaptchaFilter, userId, time.Now().Day())) < phoneSendNoImgFreeTime {
@@ -286,7 +308,7 @@ func (this *UserAccount) PhoneCaptcha() {
 
 // 我的页面身份验证【绑定、更改手机号之前需要先进行身份验证 15分钟内无须重复验证】
 func (this *UserAccount) Authentication(doType string) {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		step, _ := this.GetInteger("step")
 		code := this.GetString("code")
@@ -348,7 +370,7 @@ func (this *UserAccount) Authentication(doType string) {
 //       A账户已绑定微信,此微信必须与当前账户绑定的微信一致
 
 func (this *UserAccount) PhoneBind() {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		step, _ := this.GetInteger("step")
 		phone := this.GetString("phone")
@@ -483,7 +505,7 @@ func (this *UserAccount) PhoneBind() {
 //
 // 解绑完成后 需要解除关联关系
 func (this *UserAccount) PhoneChange() {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		step, _ := this.GetInteger("step")
 		phone := this.GetString("phone")
@@ -615,7 +637,7 @@ func (this *UserAccount) PhoneChange() {
 // 查询是否绑定微信
 // 仅手机号存在才能(绑定|解绑)微信
 func (this *UserAccount) WxBindCheck() {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		thisUser, _ := util.MQFW.FindById("user", userId, `{"s_unionid":1,"s_phone":1}`)
 		if thisUser == nil || len(*thisUser) == 0 {
@@ -649,7 +671,7 @@ func (this *UserAccount) WxBindCheck() {
 //	   A未绑定手机号(绑定后,此账户需要添加关联关系,即设置s_m_phone)
 //	   A账户已绑定手机号,此手机号必须与当前账户手机号一致
 func (this *UserAccount) WxBind() {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	rData, errMsg := func() (interface{}, error) {
 		//认证校验
 		//if pass, data := authenticationCheck(this.GetSession(phoneAuthPassSessionKey)); !pass {
@@ -714,7 +736,7 @@ func (this *UserAccount) WxBind() {
 //
 //	2.解绑的微信存在已绑定的手机号(存在关联关系),解绑后解除关联关系
 func (this *UserAccount) WxUnBind() {
-	userId, _ := this.GetSession("userId").(string)
+	userId, _ := this.GetSession("mgoUserId").(string)
 	ck, _ := this.GetCookie("SESSIONID")
 	rData, errMsg := func() (interface{}, error) {
 		//认证校验
@@ -856,7 +878,7 @@ func phoneStep(sess *httpsession.Session, step int, phone, code, sign string) (s
 		}
 		//校验是否试用过【绑定手机号特殊处理 存在合并】
 		if sign == "bind" {
-			unionid := getWxUnionId(qutil.ObjToString(sess.Get("userId")))
+			unionid := getWxUnionId(qutil.ObjToString(sess.Get("mgoUserId")))
 			if unionid == "" {
 				return "", fmt.Errorf("获取账户信息异常")
 			}
@@ -867,7 +889,7 @@ func phoneStep(sess *httpsession.Session, step int, phone, code, sign string) (s
 		if !jy.SendPhoneIdentCode(config.Config.SmsServiceRpc, phone, sess, fmt.Sprintf("%s_%s", customSendPhoneMsgSessionKey, sign)) {
 			return "", fmt.Errorf("验证码发送频繁")
 		}
-		incurKey := fmt.Sprintf(redisPhoneCaptchaFilter, qutil.ObjToString(sess.Get("userId")), time.Now().Day())
+		incurKey := fmt.Sprintf(redisPhoneCaptchaFilter, qutil.ObjToString(sess.Get("mgoUserId")), time.Now().Day())
 		times := qutil.IntAll(redis.Get("other", incurKey))
 		//发送次数加一
 		if times == 0 {
@@ -907,7 +929,7 @@ func mailStep(sess *httpsession.Session, step int, mail, code, doType string) (s
 			return "", fmt.Errorf("邮件已发出")
 		}
 		//限制每日发送次数
-		incurKey := fmt.Sprintf(redisMailSendTimes, qutil.ObjToString(sess.Get("userId")), time.Now().Day())
+		incurKey := fmt.Sprintf(redisMailSendTimes, qutil.ObjToString(sess.Get("mgoUserId")), time.Now().Day())
 		times := qutil.IntAll(redis.Get("other", incurKey))
 		if times >= 10 {
 			return "", fmt.Errorf("验证码发送次数已达到今日上限")

+ 0 - 5
src/jfw/modules/subscribepay/src/service/vipSubscribeChange.go

@@ -668,11 +668,6 @@ func (this *SubscribeChange) MergeIndustry() {
 
 //超级订阅优化,免费订阅判断新老用户  1:新用户 0:老用户
 func NewUserByVIP(userId string, session *httpsession.Session) int {
-	/*mData, ok := util.MQFW.FindById("user", userId, `{"o_jy":1,"l_registedate":1}`)
-	  if !ok || len(*mData) == 0 || mData == nil {
-	  	return 1
-	  }
-	  ojy, _ := (*mData)["o_jy"].(map[string]interface{})*/
 	mData := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
 	ojy := jy.GetSubScribeInfo(session, util.MQFW, "f", "10000")
 	if len(*ojy) > 0 {

+ 0 - 3
src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

@@ -53,9 +53,6 @@ func (this *SubVipPayOrder) GetSelectPrice() {
 	this.ServeJson(r.Format())
 }
 func CommonBilling(area *map[string]interface{}, timeRenew, userId, lotteryId string, orderType, useProduct int, session *httpsession.Session) *entity.FuncResult {
-	//area := qutil.ObjToMap(this.GetString("area")) //地区
-	//timeRenew := this.GetString("time")            //周期
-	//orderType, _ := this.GetInteger("orderType")   //1 购买;2 续费;3 升级
 	// 原价;订单价
 	original_price, order_price := 0, 0
 	userMsg := jy.GetBigVipUserBaseMsg(session, *config.Middleground)