浏览代码

权限校验添加

WH01243 2 年之前
父节点
当前提交
71014b3598
共有 44 个文件被更改,包括 9443 次插入9245 次删除
  1. 6 6
      src/go.mod
  2. 15 10
      src/go.sum
  3. 1 1
      src/jfw/filter/pcUserSalesFilter.go
  4. 2 1
      src/jfw/front/dataExport.go
  5. 52 15
      src/jfw/front/front.go
  6. 8 5
      src/jfw/front/supsearch.go
  7. 994 992
      src/jfw/front/swordfish.go
  8. 420 420
      src/jfw/front/vipsubscribe.go
  9. 2 1
      src/jfw/front/ws_dataExport.go
  10. 264 264
      src/jfw/front/wxMyOrder.go
  11. 367 367
      src/jfw/front/wxkeyset.go
  12. 617 615
      src/jfw/modules/app/src/app/front/front.go
  13. 8 8
      src/jfw/modules/app/src/app/front/login.go
  14. 508 509
      src/jfw/modules/app/src/app/front/swordfish.go
  15. 3 3
      src/jfw/modules/app/src/app/front/vipsubscribe.go
  16. 2 1
      src/jfw/modules/app/src/app/front/ws_dataExport.go
  17. 2 5
      src/jfw/modules/app/src/app/front/wxkeyset.go
  18. 25 14
      src/jfw/modules/app/src/go.mod
  19. 140 19
      src/jfw/modules/app/src/go.sum
  20. 15 14
      src/jfw/modules/bigmember/src/go.mod
  21. 33 22
      src/jfw/modules/bigmember/src/go.sum
  22. 539 543
      src/jfw/modules/bigmember/src/service/analysis/forecastproject.go
  23. 804 804
      src/jfw/modules/bigmember/src/service/analysis/potential.go
  24. 436 435
      src/jfw/modules/bigmember/src/service/push/push.go
  25. 534 533
      src/jfw/modules/bigmember/src/service/report/report.go
  26. 371 372
      src/jfw/modules/bigmember/src/service/subscribe/subscribe.go
  27. 248 248
      src/jfw/modules/bigmember/src/util/view.go
  28. 3 3
      src/jfw/modules/distribution/src/service/action/share.go
  29. 2 2
      src/jfw/modules/publicapply/src/attachmentdow/service/service.go
  30. 2 1
      src/jfw/modules/publicapply/src/dataexport/service/action.go
  31. 6 5
      src/jfw/modules/publicapply/src/go.mod
  32. 15 10
      src/jfw/modules/publicapply/src/go.sum
  33. 199 199
      src/jfw/modules/publicapply/src/me/me.go
  34. 1002 1002
      src/jfw/modules/publicapply/src/subscribePush/entity/keyWords.go
  35. 306 306
      src/jfw/modules/publicapply/src/subscribePush/service/pushList.go
  36. 3 2
      src/jfw/modules/publicapply/src/subscribePush/service/subscribe.go
  37. 2 2
      src/jfw/modules/publicapply/src/userbase/entity/entity.go
  38. 1 1
      src/jfw/modules/publicapply/src/userbase/service/service.go
  39. 1037 1037
      src/jfw/modules/subscribepay/src/entity/order.go
  40. 16 19
      src/jfw/modules/subscribepay/src/go.mod
  41. 3 3
      src/jfw/modules/subscribepay/src/report/report.go
  42. 427 423
      src/jfw/modules/subscribepay/src/service/dataexportPack.go
  43. 1 1
      src/jfw/modules/weixin/src/go.mod
  44. 2 2
      src/jfw/modules/weixin/src/go.sum

+ 6 - 6
src/go.mod

@@ -3,23 +3,21 @@ module jy/src
 go 1.18
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20230110071808-0c8ff7f798c6
-	app.yhyue.com/moapp/jypkg v0.0.0-20230110072459-b8e28d30c98d
-	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230109023014-2cd2a0b9b979
+	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
+	app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8
+	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230128064517-23fe8581b7f1
 	github.com/SKatiyar/qr v0.0.0-20151201054752-25b6bdf44e67
 	github.com/dchest/captcha v1.0.0
 	github.com/fsnotify/fsnotify v1.6.0
 	github.com/gogf/gf/v2 v2.2.6
 	github.com/robfig/cron v1.2.0
-	github.com/zeromicro/go-zero v1.4.3
 	go.mongodb.org/mongo-driver v1.11.1
 )
 
-
 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-20230106052936-bd3ab7edf7a4 // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c // 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
@@ -80,6 +78,7 @@ require (
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
+	github.com/zeromicro/go-zero v1.4.4 // indirect
 	github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb // indirect
 	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
@@ -89,6 +88,7 @@ require (
 	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
 	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
 	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
 	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
 	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
 	go.opentelemetry.io/otel/trace v1.11.0 // indirect

+ 15 - 10
src/go.sum

@@ -11,17 +11,17 @@ app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa/go.mod h1:FjBF25AYoBrPhVKTXGXWcmEAbBT0ATTK6KJMOA+I80Q=
 app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tcD9TcKb/HOP2BLbzppyDz2kpQSFhPMQTUgbQ=
 app.yhyue.com/moapp/jybase v0.0.0-20230109015757-aa3d5e19b196/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jybase v0.0.0-20230110071808-0c8ff7f798c6 h1:Szt9G37MxAN5xJXGGS87EtMdIKoucilK5inP3zRLUIE=
-app.yhyue.com/moapp/jybase v0.0.0-20230110071808-0c8ff7f798c6/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110072459-b8e28d30c98d h1:N/71mg7rkJnKNtxVGji0xID2PdRt4BnAj7uKpjA3ZO0=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110072459-b8e28d30c98d/go.mod h1:Arq5I8RsXJvV6i8K7f0ZG6MBt26MLhzuQswoU3SSqjc=
+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-20230131023215-ca51808c57b8 h1:bpCxm9zroB4vy4IF2PAlD+iIPc+GwC1YMquORPBWuLI=
+app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8/go.mod h1:MqJfBFTSfZhrNDEnE4e19BmaLkaMr+lYActLXm6lrpw=
 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-20230106052936-bd3ab7edf7a4 h1:Xv1D9avDKeaM5kQTisF/pIt8y7B7yQ/hAxuWEg75LMs=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
+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/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=
@@ -31,8 +31,8 @@ bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.4/go.mod h1:rRiGzKG4F/fmkN
 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=
 bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220905055615-8540037e1b06/go.mod h1:LS21iwbgP8i3ZHJ1n4yNpLXQ/nzEudUOk0klC6VM2dQ=
-bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230109023014-2cd2a0b9b979 h1:hC97JNmBonTAsnDH4XMWLXVqWdo85tCo0ge04cy0e4E=
-bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230109023014-2cd2a0b9b979/go.mod h1:m7/aZ1r1FapNT2h3gqmCFVb0EV+CaJaNKNPHMzLHx8Y=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230128064517-23fe8581b7f1 h1:LH/gm2iRShZ64FEuF7LTzF62iJhOVVD9AxGVHFd0ORI=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230128064517-23fe8581b7f1/go.mod h1:m7/aZ1r1FapNT2h3gqmCFVb0EV+CaJaNKNPHMzLHx8Y=
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
@@ -442,8 +442,9 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGn
 github.com/alicebob/miniredis/v2 v2.14.1/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg=
 github.com/alicebob/miniredis/v2 v2.17.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
 github.com/alicebob/miniredis/v2 v2.22.0/go.mod h1:XNqvJdQJv5mSuVMc0ynneafpnL/zv52acZ6kqeS0t88=
-github.com/alicebob/miniredis/v2 v2.23.1 h1:jR6wZggBxwWygeXcdNyguCOCIjPsZyNUNlAkTx2fu0U=
 github.com/alicebob/miniredis/v2 v2.23.1/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
+github.com/alicebob/miniredis/v2 v2.30.0 h1:uA3uhDbCxfO9+DI/DuGeAMr9qI+noVWwGPNTFuKID5M=
+github.com/alicebob/miniredis/v2 v2.30.0/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
 github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
 github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
 github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
@@ -811,6 +812,7 @@ github.com/jhump/protoreflect v1.10.3/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd
 github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E=
 github.com/jhump/protoreflect v1.12.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
 github.com/jhump/protoreflect v1.14.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
+github.com/jhump/protoreflect v1.14.1/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
 github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
@@ -1115,8 +1117,9 @@ github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ
 github.com/zeromicro/go-zero v1.3.2/go.mod h1:DEj3Fwj1Ui1ltsgf6YqwTL9nD4+tYzIRX0c1pWtQo1E=
 github.com/zeromicro/go-zero v1.3.5/go.mod h1:wh4o794b7Ul3W0k35Pw9nc3iB4O0OpaQTMQz/PJc1bc=
 github.com/zeromicro/go-zero v1.4.0/go.mod h1:1amLn98K7c6FLntb9f8hdmq26ajtolOg4DTFWnRt54o=
-github.com/zeromicro/go-zero v1.4.3 h1:sTQ++6fxQHJnpGCN7h2CUrhWmbvhBqEgE75cJl635SM=
 github.com/zeromicro/go-zero v1.4.3/go.mod h1:UmDjuW7LHd9j7+nnnPBcXF0HLNmjJw6OjHPTlSp7X7Y=
+github.com/zeromicro/go-zero v1.4.4 h1:J8M768EVFNtIQJ/GCEsoIQPanxbx2HHT0it7r69U76Y=
+github.com/zeromicro/go-zero v1.4.4/go.mod h1:5WSUwtJm0bYdDZ69GlckigcT6D0EyAPbDaX3unbSY/4=
 github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb h1:uWiILQloLUVdtPYr1ZZo2zqtlpzo4G8vUpglo/Fs2H8=
 github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb/go.mod h1:J3xKssoVdrwZ2E29fIox/EKxOZWimS7AZ4fOTCFkOLo=
 github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
@@ -1170,6 +1173,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0/go.mod h1:FnDp7XemjN3o
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0/go.mod h1:OfUCyyIiDvNXHWpcWgbF+MWvqPZiNa3YDEnivcnYsV0=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 h1:j2RFV0Qdt38XQ2Jvi4WIsQ56w8T7eSirYbMw19VXRDg=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0/go.mod h1:pILgiTEtrqvZpoiuGdblDgS5dbIaTgDrkIuKfEFkt+A=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 h1:S8DedULB3gp93Rh+9Z+7NTEv+6Id/KYS7LDyipZ9iCE=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0/go.mod h1:5WV40MLWwvWlGP7Xm8g3pMcg0pKOUY609qxJn8y7LmM=
 go.opentelemetry.io/otel/exporters/zipkin v1.3.0/go.mod h1:LxGGfHIYbvsFnrJtBcazb0yG24xHdDGrT/H6RB9r3+8=
 go.opentelemetry.io/otel/exporters/zipkin v1.8.0/go.mod h1:0uYAyCuGT67MFV9Z/Mmx93wGuugHw0FbxMc74fs3LNo=
 go.opentelemetry.io/otel/exporters/zipkin v1.9.0/go.mod h1:HyIvYIu37wV4Wx5azd7e05x9k/dOz9KB4x0plw2QNvs=

+ 1 - 1
src/jfw/filter/pcUserSalesFilter.go

@@ -1,8 +1,8 @@
 package filter
 
 import (
+	"app.yhyue.com/moapp/jypkg/public"
 	"jy/src/jfw/config"
-	"jy/src/jfw/public"
 	"net/http"
 	"strings"
 	"time"

+ 2 - 1
src/jfw/front/dataExport.go

@@ -413,7 +413,8 @@ func (d *DataExport) SuperSearchExport() error {
 		BidField:     d.GetString("bid_field"),                    // 领域数据类型 0101- 医疗行业
 
 	}
-	selectType := strings.Join(jy.GetVipState(public.Mysql, public.MQFW, userId).GetQueryItems(d.GetString("selectType"), util.Int64All(config.Sysconfig["bidSearchOldUserLimit"])), ",")
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	selectType := strings.Join(jy.GetVipState("10000", d.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]), userId).GetQueryItems(d.GetString("selectType"), util.Int64All(config.Sysconfig["bidSearchOldUserLimit"])), ",")
 	//数据回显
 	d.SetSession("Echo_timeslot", d.GetString("timeslot"))
 	d.SetSession("Echo_keywords", reqData.Keywords)

+ 52 - 15
src/jfw/front/front.go

@@ -1,6 +1,7 @@
 package front
 
 import (
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 	"fmt"
 	"jy/src/jfw/config"
 	"jy/src/jfw/jyutil"
@@ -25,10 +26,10 @@ import (
 	elastic "app.yhyue.com/moapp/jybase/esv1"
 	"app.yhyue.com/moapp/jybase/redis"
 
-	mgdb "app.yhyue.com/moapp/jybase/mongodb"
-
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	mgdb "app.yhyue.com/moapp/jybase/mongodb"
+	. "app.yhyue.com/moapp/jypkg/identity"
 	"github.com/SKatiyar/qr"
 	"go.mongodb.org/mongo-driver/bson"
 	"go.mongodb.org/mongo-driver/bson/primitive"
@@ -801,6 +802,14 @@ func FindUserAndCreateSess(openid string, sess *httpsession.Session, typ string,
 		"i_ispush":   1,
 	}, sess, typ, flag)
 }
+func FindUserAndCreateSessByBaseUserId(userId int64, sess *httpsession.Session, flag bool) (bool, *map[string]interface{}, map[string]interface{}) {
+
+	return CreateSession(map[string]interface{}{
+
+		"base_user_id": userId,
+	}, sess, "pc", flag)
+
+}
 
 func FindUserAndCreateSessById(userId primitive.ObjectID, sess *httpsession.Session, flag bool) (bool, *map[string]interface{}, map[string]interface{}) {
 	return CreateSession(map[string]interface{}{
@@ -858,13 +867,45 @@ func (m *Front) Sess(ostr string) error {
 	strs := strings.Split(ostr, "__")
 	str := strings.Split(sewx.DecodeString(strs[0]), ",")
 	if len(str) == 4 {
-		openid := str[0]
+		userFlag := str[0]
 		ok := false
-		if str[1] == "_id" {
-			ok, _, _ = FindUserAndCreateSessById(mgdb.StringTOBsonId(openid), m.Session(), false)
+		var identity *pb.Identity
+
+		if str[1] == "userId" || str[1] == "entUserId" || str[1] == "positionId" {
+
+			if str[1] == "userId" {
+
+				identity = config.Middleground.UserCenter.IdentityByUserId(util.Int64All(userFlag))
+
+			} else if str[1] == "entUserId" {
+
+				identity = config.Middleground.UserCenter.IdentityByEntUserId(util.Int64All(userFlag))
+
+			} else if str[1] == "positionId" {
+
+				identity = config.Middleground.UserCenter.IdentityByPositionId(util.Int64All(userFlag))
+
+			}
+
+			if identity != nil {
+
+				ok, _, _ = FindUserAndCreateSessByBaseUserId(identity.UserId, m.Session(), false)
+
+			}
 		} else {
-			ok, _, _ = FindUserAndCreateSess(openid, m.Session(), "wx", false)
+			if str[1] == "_id" {
+
+				ok, _, _ = FindUserAndCreateSessById(mgdb.StringTOBsonId(userFlag), m.Session(), false)
+
+			} else {
+
+				ok, _, _ = FindUserAndCreateSess(userFlag, m.Session(), "wx", false)
+
+			}
+
+			identity = config.Middleground.UserCenter.IdentityByUserId(util.Int64All(m.GetSession("base_user_id")))
 		}
+		ok = ok && NewIdentityInfo(identity).Switch(m.Session())
 		if ok {
 			actionurl := ""
 			if str[3] == "" {
@@ -875,18 +916,14 @@ func (m *Front) Sess(ostr string) error {
 				if len(strs) > 2 {
 					var entUserId int64
 					if strings.HasPrefix(strs[2], "V20221215-") {
-						entParams := strings.Split(sewx.Decode4HexByCheck(strings.TrimPrefix(strs[2], "V20221215-")), "_")
-						entUserId := util.Int64All(entParams[1])
-					} else {
 						entParams := strings.Split(sewx.DecodeString(strs[2]), "_")
-						entUserId := util.Int64All(entParams[1])
+						entUserId = util.Int64All(entParams[1])
+
 					}
+					if identity := config.Middleground.UserCenter.IdentityByEntUserId(entUserId); identity != nil {
+						NewIdentityInfo(identity).Switch(m.Session())
 					}
-					m.Session().SetMultiple(map[string]interface{}{
-						"entId":     util.Int64All(entParams[0]),
-						"entUserId": util.Int64All(entParams[1]),
-						"entName":   util.ObjToString(entParams[2]),
-					})
+
 				}
 			} else {
 				actionurl = util.ObjToString(urlMap[str[3]])

+ 8 - 5
src/jfw/front/supsearch.go

@@ -250,7 +250,8 @@ func (p *Pcsearch) GetNewBids() error {
 		if domainPageType, ok := DomainPageType[bidField]; ok {
 			pageType = domainPageType
 		}
-		vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		vipStatus := jy.GetVipState("10000", p.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]), userId)
 		if (vipStatus.BigMember <= 0 && vipStatus.VipState <= 0) || (!jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprint(util.Int64All(baseUserId)), MedicalFunctionCode)) {
 			p.ServeJson(map[string]interface{}{
 				"list":      []map[string]interface{}{},
@@ -350,7 +351,8 @@ 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)
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	isPayedUser, publishtime, queryItems, _, _ := bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0, pageSize, "10000", p.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
 	if isPayedUser {
 		buyerclass = p.GetString("buyerclass")
 		hasBuyerTel, hasWinnerTel = p.GetString("buyertel"), p.GetString("winnertel")
@@ -375,8 +377,8 @@ 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)
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		_, _, queryItems, _, _ = bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0, pageSize, "10000", p.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
 	}
 	keywordsLimit := util.IntAllDef(config.Sysconfig["keywordsLimit"], 35)
 	searchLimit := public.IsSearchLimit(queryItems)
@@ -402,7 +404,8 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	isSearch := true
 	if bidField != "" {
 		isSearch = false
-		vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		vipStatus := jy.GetVipState("10000", p.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]), userId)
 		if vipStatus.BigMember > 0 || vipStatus.VipState > 0 {
 			if jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprint(util.Int64All(baseUserId)), MedicalFunctionCode) {
 				isSearch = true

文件差异内容过多而无法显示
+ 994 - 992
src/jfw/front/swordfish.go


+ 420 - 420
src/jfw/front/vipsubscribe.go

@@ -1,556 +1,556 @@
 package front
 
 import (
-        "encoding/hex"
-        "fmt"
-        "jy/src/jfw/config"
-        "jy/src/jfw/wx"
-        "net/url"
-        "strings"
-        "time"
+	"encoding/hex"
+	"fmt"
+	"jy/src/jfw/config"
+	"jy/src/jfw/wx"
+	"net/url"
+	"strings"
+	"time"
 
-        "jy/src/jfw/jyutil"
+	"jy/src/jfw/jyutil"
 
-        "app.yhyue.com/moapp/jypkg/public"
+	"app.yhyue.com/moapp/jypkg/public"
 
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 
-        util "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/redis"
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/redis"
 
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 type Subscribepay struct {
-        *xweb.Action
-        introduce         xweb.Mapper `xweb:"/front/vipsubscribe/introducePage"`     //订阅收费介绍页
-        trialInfo         xweb.Mapper `xweb:"/front/vipsubscribe/trialInfo"`         //vip订阅服务-用户信息录入页面
-        toPurchasePage    xweb.Mapper `xweb:"/front/vipsubscribe/vipsubscribe_(.*)"` //订阅收费购买页面(试用用户)
-        toChooseArea      xweb.Mapper `xweb:"/front/vipsubscribe/toChooseArea"`      //订阅收费地区筛选
-        toChooseIndustry  xweb.Mapper `xweb:"/front/vipsubscribe/toChooseIndustry"`  //订阅收费行业筛选
-        toPaySuccessPage  xweb.Mapper `xweb:"/front/vipsubscribe/toPaySuccessPage"`  //订阅支付完成页面
-        toOrderDetailPage xweb.Mapper `xweb:"/front/vipsubscribe/toOrderDetailPage"` //订阅收费支付订单详情页面
-        toSetKeyWordPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetKeyWordPage"`  //订阅收费设置关键词
-
-        //toSetPageOld      xweb.Mapper `xweb:"/front/vipsubscribe/toSetPageOld"`      //订阅收费设置
-        toSetInfoTypePage xweb.Mapper `xweb:"/front/vipsubscribe/toSetInfoTypePage"` //订阅收费设置信息类型
-        toSetOtherKwsPage xweb.Mapper `xweb:"/front/vipsubscribe/toSet(.*)Page"`     //订阅收费附加词和排除词设置
-        toVIPViewPage     xweb.Mapper `xweb:"/front/vipsubscribe/toVIPViewPage"`     //订阅收费预览
-
-        //修改升级
-        toSetPage        xweb.Mapper `xweb:"/front/vipsubscribe/toSubVipSetPage"`  //订阅收费设置
-        toChangeArea     xweb.Mapper `xweb:"/front/vipsubscribe/toChangeArea"`     //修改区域
-        toChangeIndustry xweb.Mapper `xweb:"/front/vipsubscribe/toChangeIndustry"` //修改行业
-        toChangeTime     xweb.Mapper `xweb:"/front/vipsubscribe/toChangeTime"`     //修改时间
-        toSetPushSetPage xweb.Mapper `xweb:"/front/vipsubscribe/toSetPushSetPage"` //订阅收费推送设置
-
-        //续费
-        renewPage xweb.Mapper `xweb:"/front/vipsubscribe/renewPage/(.*)"` //订阅到期(will:即将到期,exprie:已到期)
-
-        //发票
-        openInvoice xweb.Mapper `xweb:"/front/vipsubscribe/openInvoice/(\\w+)"` //开发票
-
-        //预热活动链接跳转
-        preheatPoster xweb.Mapper `xweb:"/front/preheat/poster"` //预热活动链接跳转
-
-        upgradeDetail xweb.Mapper `xweb:"/front/vipsubscribe/upgradeDetail"` //新超级订阅介绍页
-        upgradePage   xweb.Mapper `xweb:"/front/vipsubscribe/upgradePage"`   //升级页面
-        //超级订阅企业搜索
-        entSearch xweb.Mapper `xweb:"/front/vipsubscribe/entSearch"` //企业搜索
-
-        //超级订阅改版公共url
-        pcViewPage xweb.Mapper `xweb:"/vipsubscribe/pc/page/(.*)"` //超级订阅pc
-        wxViewPage xweb.Mapper `xweb:"/vipsubscribe/wx/page/(.*)"` //超级订阅wx
-        //订阅付费消息提醒中转
-        msgremind xweb.Mapper `xweb:"/front/vipsubscribe/msgremind"`
+	*xweb.Action
+	introduce         xweb.Mapper `xweb:"/front/vipsubscribe/introducePage"`     //订阅收费介绍页
+	trialInfo         xweb.Mapper `xweb:"/front/vipsubscribe/trialInfo"`         //vip订阅服务-用户信息录入页面
+	toPurchasePage    xweb.Mapper `xweb:"/front/vipsubscribe/vipsubscribe_(.*)"` //订阅收费购买页面(试用用户)
+	toChooseArea      xweb.Mapper `xweb:"/front/vipsubscribe/toChooseArea"`      //订阅收费地区筛选
+	toChooseIndustry  xweb.Mapper `xweb:"/front/vipsubscribe/toChooseIndustry"`  //订阅收费行业筛选
+	toPaySuccessPage  xweb.Mapper `xweb:"/front/vipsubscribe/toPaySuccessPage"`  //订阅支付完成页面
+	toOrderDetailPage xweb.Mapper `xweb:"/front/vipsubscribe/toOrderDetailPage"` //订阅收费支付订单详情页面
+	toSetKeyWordPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetKeyWordPage"`  //订阅收费设置关键词
+
+	//toSetPageOld      xweb.Mapper `xweb:"/front/vipsubscribe/toSetPageOld"`      //订阅收费设置
+	toSetInfoTypePage xweb.Mapper `xweb:"/front/vipsubscribe/toSetInfoTypePage"` //订阅收费设置信息类型
+	toSetOtherKwsPage xweb.Mapper `xweb:"/front/vipsubscribe/toSet(.*)Page"`     //订阅收费附加词和排除词设置
+	toVIPViewPage     xweb.Mapper `xweb:"/front/vipsubscribe/toVIPViewPage"`     //订阅收费预览
+
+	//修改升级
+	toSetPage        xweb.Mapper `xweb:"/front/vipsubscribe/toSubVipSetPage"`  //订阅收费设置
+	toChangeArea     xweb.Mapper `xweb:"/front/vipsubscribe/toChangeArea"`     //修改区域
+	toChangeIndustry xweb.Mapper `xweb:"/front/vipsubscribe/toChangeIndustry"` //修改行业
+	toChangeTime     xweb.Mapper `xweb:"/front/vipsubscribe/toChangeTime"`     //修改时间
+	toSetPushSetPage xweb.Mapper `xweb:"/front/vipsubscribe/toSetPushSetPage"` //订阅收费推送设置
+
+	//续费
+	renewPage xweb.Mapper `xweb:"/front/vipsubscribe/renewPage/(.*)"` //订阅到期(will:即将到期,exprie:已到期)
+
+	//发票
+	openInvoice xweb.Mapper `xweb:"/front/vipsubscribe/openInvoice/(\\w+)"` //开发票
+
+	//预热活动链接跳转
+	preheatPoster xweb.Mapper `xweb:"/front/preheat/poster"` //预热活动链接跳转
+
+	upgradeDetail xweb.Mapper `xweb:"/front/vipsubscribe/upgradeDetail"` //新超级订阅介绍页
+	upgradePage   xweb.Mapper `xweb:"/front/vipsubscribe/upgradePage"`   //升级页面
+	//超级订阅企业搜索
+	entSearch xweb.Mapper `xweb:"/front/vipsubscribe/entSearch"` //企业搜索
+
+	//超级订阅改版公共url
+	pcViewPage xweb.Mapper `xweb:"/vipsubscribe/pc/page/(.*)"` //超级订阅pc
+	wxViewPage xweb.Mapper `xweb:"/vipsubscribe/wx/page/(.*)"` //超级订阅wx
+	//订阅付费消息提醒中转
+	msgremind xweb.Mapper `xweb:"/front/vipsubscribe/msgremind"`
 }
 
 func init() {
-        xweb.AddAction(&Subscribepay{})
+	xweb.AddAction(&Subscribepay{})
 }
 
 func (s *Subscribepay) EntSearch() {
-        s.Render("/weixin/vipsubscribe/vip_entSearch.html")
+	s.Render("/weixin/vipsubscribe/vip_entSearch.html")
 }
 
 func (s *Subscribepay) UpgradeDetail() {
-        s.Render("/weixin/vipsubscribe/vip_UpgradeDetail.html")
+	s.Render("/weixin/vipsubscribe/vip_UpgradeDetail.html")
 }
 
 func (s *Subscribepay) UpgradePage() {
-        s.Render("/weixin/vipsubscribe/vip_UpgradePage.html")
+	s.Render("/weixin/vipsubscribe/vip_UpgradePage.html")
 }
 
 var (
-        liveActiveStartTime = config.ActiveConfig.Live_Active_Start
-        liveActiveEndTime   = config.ActiveConfig.Live_Active_End
-        activeDiscount      = config.ActiveConfig.ActiveDiscount
+	liveActiveStartTime = config.ActiveConfig.Live_Active_Start
+	liveActiveEndTime   = config.ActiveConfig.Live_Active_End
+	activeDiscount      = config.ActiveConfig.ActiveDiscount
 )
 
 //推送设置
 func (s *Subscribepay) ToVIPViewPage() {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/vip_viewPage.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/vip_viewPage.html")
 }
 
 //附加词|排除词
 func (s *Subscribepay) ToSetOtherKwsPage(page string) {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/" + page + "Word.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/" + page + "Word.html")
 }
 
 //推送设置
 func (s *Subscribepay) ToSetPushSetPage() {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/vip_seniorset.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/vip_seniorset.html")
 }
 
 //信息类型
 func (s *Subscribepay) ToSetInfoTypePage() {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/messageType.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/messageType.html")
 }
 
 //订阅设置
 func (s *Subscribepay) ToSetPage() error {
-        userid := util.ObjToString(s.GetSession("userId"))
-        vSwitch := s.GetString("vSwitch")
-        if vSwitch != "" {
-                if vSwitch == jy.SwitchService.Vip {
-                        s.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
-                } else if vSwitch == jy.SwitchService.Member {
-                        s.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
-                }
-        }
-        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-        vipMsg := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-        if vipMsg.VipStatus <= 0 && vipMsg.Status <= 0 && isInTSguide(userid) { //仅免费用户跳转向导页面
-                return s.Redirect("/front/tenderSubscribe/guide?url=" + url.QueryEscape(s.Request.RequestURI))
-        } else if (vSwitch == "" || vSwitch == "v") && vipMsg.VipStatus <= 0 && !vipMsg.IsUpgrade {
-                if s.GetString("advertcode") != "" {
-                        return s.Redirect("/wxkeyset/keyset/index?advertcode=" + s.GetString("advertcode"))
-                }
-                return s.Redirect("/wxkeyset/keyset/index")
-        }
-        nowTime := time.Now().Unix()
-        if nowTime >= liveActiveStartTime && nowTime < liveActiveEndTime {
-                s.T["isLiveActive"] = true
-        }
-        s.T["liveActiveStartTime"] = liveActiveStartTime
-        s.T["liveActiveEndTime"] = liveActiveEndTime
-        s.T["activeDiscount"] = activeDiscount
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        return s.Render("/weixin/vipsubscribe/vip_index_new.html")
+	userid := util.ObjToString(s.GetSession("userId"))
+	vSwitch := s.GetString("vSwitch")
+	if vSwitch != "" {
+		if vSwitch == jy.SwitchService.Vip {
+			s.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
+		} else if vSwitch == jy.SwitchService.Member {
+			s.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
+		}
+	}
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	vipMsg := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	if vipMsg.VipStatus <= 0 && vipMsg.Status <= 0 && isInTSguide(userid) { //仅免费用户跳转向导页面
+		return s.Redirect("/front/tenderSubscribe/guide?url=" + url.QueryEscape(s.Request.RequestURI))
+	} else if (vSwitch == "" || vSwitch == "v") && vipMsg.VipStatus <= 0 && !vipMsg.IsUpgrade {
+		if s.GetString("advertcode") != "" {
+			return s.Redirect("/wxkeyset/keyset/index?advertcode=" + s.GetString("advertcode"))
+		}
+		return s.Redirect("/wxkeyset/keyset/index")
+	}
+	nowTime := time.Now().Unix()
+	if nowTime >= liveActiveStartTime && nowTime < liveActiveEndTime {
+		s.T["isLiveActive"] = true
+	}
+	s.T["liveActiveStartTime"] = liveActiveStartTime
+	s.T["liveActiveEndTime"] = liveActiveEndTime
+	s.T["activeDiscount"] = activeDiscount
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	return s.Render("/weixin/vipsubscribe/vip_index_new.html")
 }
 
 func (s *Subscribepay) ToSetPageOld() {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/vip_index.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/vip_index.html")
 }
 
 //修改升级 选择地区
 func (s *Subscribepay) ToChangeArea() {
-        s.Render("/weixin/vipsubscribe/change_area.html")
+	s.Render("/weixin/vipsubscribe/change_area.html")
 }
 
 //修改升级 选择行业
 func (s *Subscribepay) ToChangeIndustry() {
-        s.Render("/weixin/vipsubscribe/change_industry.html")
+	s.Render("/weixin/vipsubscribe/change_industry.html")
 }
 
 //修改升级 选择时间
 func (s *Subscribepay) ToChangeTime() {
-        s.Render("/weixin/vipsubscribe/change_time.html")
+	s.Render("/weixin/vipsubscribe/change_time.html")
 }
 
 //vip订阅介绍页
 func (s *Subscribepay) Introduce() error {
-        userId := util.ObjToString(s.GetSession("userId"))
-        if userId == "" {
-                if s.GetString("state") == "wx" {
-                        //微信跳回来的
-                        code := s.GetString("code")
-                        if code != "" {
-                                openid := jyutil.Getopenid(code)
-                                if openid != "" {
-                                        isSubscribe := CheckUserIsSubscribe(openid)
-                                        if isSubscribe {
-                                                FindUserAndCreateSess(openid, s.Session(), "wx", false)
-                                                userId = util.ObjToString(s.GetSession("userId"))
-                                        }
-                                }
-                        }
-                } else {
-                        if public.CheckWxBrowser(s.Request) {
-                                //所有参数都不再使用,跳到微信验证用户
-                                return s.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(s.Site()+s.Url()), "wx"), 302)
-                        }
-                        return s.Redirect("/swordfish/about?v=0")
-                }
-        }
-        if userId == "" {
-                return s.Redirect("/swordfish/about?v=1")
-        }
-        // m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
-        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-        m := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-        if m == nil {
-                return s.Redirect("/swordfish/about?v=2")
-        }
-        nowTime := time.Now().Unix()
-        if nowTime >= liveActiveStartTime && nowTime < liveActiveEndTime {
-                s.T["isLiveActive"] = true
-        }
-        //obj := util.ObjToMap((*m)["o_vipjy"])
-        from := s.GetString("type") //双十一活动 接受参数renew 跳转到介绍页(续费)
-        if m.VipStatus > 0 && from != "renew" {
-                if s.GetString("disWord") != "" {
-                        //分销识别 直接VIP续费
-                        if m.VipStatus == 1 { //试用用户
-                                return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&vSwitch=v&disWord=" + s.GetString("disWord") + "&advertcode=" + s.GetString("advertcode"))
-                        } else {
-                                return s.Redirect("/jy_mobile/common/order/create/svip?type=renew&vSwitch=v&disWord=" + s.GetString("disWord") + "&advertcode=" + s.GetString("advertcode"))
-                        }
-                }
-                return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + s.GetString("advertcode") + "&vSwitch=v")
-        }
-        // s.T["notShowTrial"] = util.IntAll((*obj)["i_trial"]) == -1 || (*m)["i_vip_status"] != nil
-        s.T["notShowTrial"] = m.VipStatus != 0
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        //直播活动和预热活动期间
-        if config.ActiveConfig.Live_Active_End > time.Now().Unix() && time.Now().Unix() > config.ActiveConfig.Live_Preheat_Start {
-                s.T["LiveState"] = true
-        }
-        s.T["disWord"] = s.GetString("disWord")
-        return s.Render("/weixin/vipsubscribe/vip_introduce.html")
+	userId := util.ObjToString(s.GetSession("userId"))
+	if userId == "" {
+		if s.GetString("state") == "wx" {
+			//微信跳回来的
+			code := s.GetString("code")
+			if code != "" {
+				openid := jyutil.Getopenid(code)
+				if openid != "" {
+					isSubscribe := CheckUserIsSubscribe(openid)
+					if isSubscribe {
+						FindUserAndCreateSess(openid, s.Session(), "wx", false)
+						userId = util.ObjToString(s.GetSession("userId"))
+					}
+				}
+			}
+		} else {
+			if public.CheckWxBrowser(s.Request) {
+				//所有参数都不再使用,跳到微信验证用户
+				return s.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(s.Site()+s.Url()), "wx"), 302)
+			}
+			return s.Redirect("/swordfish/about?v=0")
+		}
+	}
+	if userId == "" {
+		return s.Redirect("/swordfish/about?v=1")
+	}
+	// m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	m := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	if m == nil {
+		return s.Redirect("/swordfish/about?v=2")
+	}
+	nowTime := time.Now().Unix()
+	if nowTime >= liveActiveStartTime && nowTime < liveActiveEndTime {
+		s.T["isLiveActive"] = true
+	}
+	//obj := util.ObjToMap((*m)["o_vipjy"])
+	from := s.GetString("type") //双十一活动 接受参数renew 跳转到介绍页(续费)
+	if m.VipStatus > 0 && from != "renew" {
+		if s.GetString("disWord") != "" {
+			//分销识别 直接VIP续费
+			if m.VipStatus == 1 { //试用用户
+				return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&vSwitch=v&disWord=" + s.GetString("disWord") + "&advertcode=" + s.GetString("advertcode"))
+			} else {
+				return s.Redirect("/jy_mobile/common/order/create/svip?type=renew&vSwitch=v&disWord=" + s.GetString("disWord") + "&advertcode=" + s.GetString("advertcode"))
+			}
+		}
+		return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + s.GetString("advertcode") + "&vSwitch=v")
+	}
+	// s.T["notShowTrial"] = util.IntAll((*obj)["i_trial"]) == -1 || (*m)["i_vip_status"] != nil
+	s.T["notShowTrial"] = m.VipStatus != 0
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	//直播活动和预热活动期间
+	if config.ActiveConfig.Live_Active_End > time.Now().Unix() && time.Now().Unix() > config.ActiveConfig.Live_Preheat_Start {
+		s.T["LiveState"] = true
+	}
+	s.T["disWord"] = s.GetString("disWord")
+	return s.Render("/weixin/vipsubscribe/vip_introduce.html")
 }
 
 //试用完善信息
 func (s *Subscribepay) TrialInfo() error {
-        userId := util.ObjToString(s.GetSession("userId"))
-        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)
+	userId := util.ObjToString(s.GetSession("userId"))
+	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)
 }
 
 //订阅收费购买页面
 func (s *Subscribepay) ToPurchasePage(flag string) {
-        userId := util.ObjToString(s.GetSession("userId"))
-        if userId == "" {
-                return
-        }
-        //m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
-        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-        m := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-        if m == nil {
-                s.Redirect("/swordfish/about?v=2")
-                return
-        }
-        if m.VipStatus > 0 && flag == "new" {
-                s.Redirect("/front/vipsubscribe/introducePage")
-                return
-        }
-        //直播活动
-        nowTime := time.Now().Unix()
-        if nowTime >= liveActiveStartTime && nowTime < liveActiveEndTime {
-                s.T["isLiveActive"] = true
-                //虚拟人数
-                buyCount := redis.Get("other", "liveactiveRTB")
-                s.T["buyCount"] = buyCount
-        }
-        s.T["liveActiveStartTime"] = liveActiveStartTime
-        s.T["liveActiveEndTime"] = liveActiveEndTime
-        s.T["activeDiscount"] = activeDiscount
-        if flag == "trial" { //试用
-                s.T["isTrial"] = true
-                s.T["orderType"] = -1
-        } else { //付费
-                s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url()) //微信支付准备参数
-                if flag == "renew" {
-                        s.Render("/weixin/vipsubscribe/vip_renew.html")
-                        return
-                }
-                if flag == "renewOld" {
-                        s.T["orderType"] = 5
-                } else {
-                        s.T["orderType"] = 1
-                }
-                if s.GetString("orderCode") != "" && s.GetString("orderCode") != "undefined" {
-                        s.T["again"] = 1 //再次购买
-                }
-        }
-        s.Render("/weixin/vipsubscribe/vip_purchase.html")
+	userId := util.ObjToString(s.GetSession("userId"))
+	if userId == "" {
+		return
+	}
+	//m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	m := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	if m == nil {
+		s.Redirect("/swordfish/about?v=2")
+		return
+	}
+	if m.VipStatus > 0 && flag == "new" {
+		s.Redirect("/front/vipsubscribe/introducePage")
+		return
+	}
+	//直播活动
+	nowTime := time.Now().Unix()
+	if nowTime >= liveActiveStartTime && nowTime < liveActiveEndTime {
+		s.T["isLiveActive"] = true
+		//虚拟人数
+		buyCount := redis.Get("other", "liveactiveRTB")
+		s.T["buyCount"] = buyCount
+	}
+	s.T["liveActiveStartTime"] = liveActiveStartTime
+	s.T["liveActiveEndTime"] = liveActiveEndTime
+	s.T["activeDiscount"] = activeDiscount
+	if flag == "trial" { //试用
+		s.T["isTrial"] = true
+		s.T["orderType"] = -1
+	} else { //付费
+		s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url()) //微信支付准备参数
+		if flag == "renew" {
+			s.Render("/weixin/vipsubscribe/vip_renew.html")
+			return
+		}
+		if flag == "renewOld" {
+			s.T["orderType"] = 5
+		} else {
+			s.T["orderType"] = 1
+		}
+		if s.GetString("orderCode") != "" && s.GetString("orderCode") != "undefined" {
+			s.T["again"] = 1 //再次购买
+		}
+	}
+	s.Render("/weixin/vipsubscribe/vip_purchase.html")
 }
 
 //订阅收费地区筛选
 func (s *Subscribepay) ToChooseArea() {
-        s.Render("/weixin/vipsubscribe/choose_area.html", &s.T)
+	s.Render("/weixin/vipsubscribe/choose_area.html", &s.T)
 }
 
 //订阅收费地区筛选
 func (s *Subscribepay) ToChooseIndustry() {
-        s.Render("/weixin/vipsubscribe/choose_industry.html", &s.T)
+	s.Render("/weixin/vipsubscribe/choose_industry.html", &s.T)
 }
 
 //订阅收费支付订单详情页面
 func (s *Subscribepay) ToOrderDetailPage() {
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url()) //微信支付准备参数
-        s.T["liveActiveStartTime"] = liveActiveStartTime
-        s.T["liveActiveEndTime"] = liveActiveEndTime
-        s.T["activeDiscount"] = activeDiscount
-        s.Render("/weixin/vipsubscribe/vip_order_detail.html")
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url()) //微信支付准备参数
+	s.T["liveActiveStartTime"] = liveActiveStartTime
+	s.T["liveActiveEndTime"] = liveActiveEndTime
+	s.T["activeDiscount"] = activeDiscount
+	s.Render("/weixin/vipsubscribe/vip_order_detail.html")
 }
 
 //订阅收费设置关键词
 func (s *Subscribepay) ToSetKeyWordPage() {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/keyWord.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/keyWord.html")
 }
 
 //修改订阅页面
 func (s *Subscribepay) ToEditSubPage() {
-        s.Render("/weixin/vipsubscribe/edit_subscribe.html")
+	s.Render("/weixin/vipsubscribe/edit_subscribe.html")
 }
 
 //合并后修改地区
 func (s *Subscribepay) ToEditSubAreaPage() {
-        s.Render("/weixin/vipsubscribe/edit_city_new.html")
+	s.Render("/weixin/vipsubscribe/edit_city_new.html")
 }
 
 //修改订阅行业
 func (s *Subscribepay) ToEditSubInduPage() {
-        s.Render("/weixin/vipsubscribe/edit_subscribe_industry.html")
+	s.Render("/weixin/vipsubscribe/edit_subscribe_industry.html")
 }
 
 //提交订阅修改
 func (s *Subscribepay) SubmitEditSubFinish() {
-        s.Render("/weixin/vipsubscribe/edit_subscribe_success.html")
+	s.Render("/weixin/vipsubscribe/edit_subscribe_success.html")
 }
 
 //升级订阅新增区域
 func (s *Subscribepay) AddArea() {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/choose_area_upgrade.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/choose_area_upgrade.html")
 }
 
 //升级订阅新增行业
 func (s *Subscribepay) AddIndustry() {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.Render("/weixin/vipsubscribe/choose_industry_upgrade.html")
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.Render("/weixin/vipsubscribe/choose_industry_upgrade.html")
 }
 
 //服务续费(will:即将到期,exprie:已到期)
 func (s *Subscribepay) RenewPage(sign string) {
-        myopenid := util.ObjToString(s.GetSession("s_m_openid"))
-        mynickname, _ := s.Session().Get("s_nickname").(string)
-        myavatar, _ := s.Session().Get("s_avatar").(string)
-        startTime := util.Int64All(s.GetString("startTime"))
-        endTime := util.Int64All(s.GetString("endTime"))
-        orderId := s.GetString("orderId")
-        startTimes := time.Unix(startTime, 0).Format("2006-01-02")
-        endTimes := time.Unix(endTime, 0).Format("2006-01-02")
-        s.T["orderId"] = orderId
-        s.T["startTime"] = startTimes
-        s.T["endTime"] = endTimes
-        s.T["nickname"] = mynickname
-        s.T["avatar"] = myavatar
-        s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
-        s.T["openid"] = se.EncodeString(myopenid)
-        s.T["exprie"] = sign //是否已到期
-        s.Render("/weixin/vipsubscribe/renew_notice.html", &s.T)
+	myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	mynickname, _ := s.Session().Get("s_nickname").(string)
+	myavatar, _ := s.Session().Get("s_avatar").(string)
+	startTime := util.Int64All(s.GetString("startTime"))
+	endTime := util.Int64All(s.GetString("endTime"))
+	orderId := s.GetString("orderId")
+	startTimes := time.Unix(startTime, 0).Format("2006-01-02")
+	endTimes := time.Unix(endTime, 0).Format("2006-01-02")
+	s.T["orderId"] = orderId
+	s.T["startTime"] = startTimes
+	s.T["endTime"] = endTimes
+	s.T["nickname"] = mynickname
+	s.T["avatar"] = myavatar
+	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
+	s.T["openid"] = se.EncodeString(myopenid)
+	s.T["exprie"] = sign //是否已到期
+	s.Render("/weixin/vipsubscribe/renew_notice.html", &s.T)
 }
 
 //开发票
 func (s *Subscribepay) OpenInvoice(order_code string) {
-        s.T["order_code"] = order_code
-        s.Render("/weixin/dataExport/dataExport_applyInvoice.html", &s.T)
+	s.T["order_code"] = order_code
+	s.Render("/weixin/dataExport/dataExport_applyInvoice.html", &s.T)
 }
 
 //预热活动链接跳转
 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+`"}}`)
-        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-        u := jy.GetBigVipUserBaseMsg("10000", s.Session(), qutil.InterfaceToStr(etcdMap["hosts"]), qutil.InterfaceToStr(etcdMap["key"]))
-        if u != nil {
-                if u.VipStatus == 1 || u.VipStatus == 2 {
-                        s.Redirect("/front/vipsubscribe/toSubVipSetPage")
-                } else {
-                        s.Redirect("/front/vipsubscribe/introducePage")
-                }
-        }
+	//myopenid := util.ObjToString(s.GetSession("s_m_openid"))
+	// u, ok := public.MQFW.FindOne("user", `{"s_m_openid":"`+myopenid+`","s_unionid":{"$ne":"`+myopenid+`"}}`)
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	u := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	if u != nil {
+		if u.VipStatus == 1 || u.VipStatus == 2 {
+			s.Redirect("/front/vipsubscribe/toSubVipSetPage")
+		} else {
+			s.Redirect("/front/vipsubscribe/introducePage")
+		}
+	}
 }
 
 func (this *Subscribepay) PcViewPage(htmlName string) error {
-        this.T["logid"] = config.Seoconfig["bigmember"].(string)
-        return this.Render("/vipsubscribe/pc/page_"+htmlName+".html", &this.T)
+	this.T["logid"] = config.Seoconfig["bigmember"].(string)
+	return this.Render("/vipsubscribe/pc/page_"+htmlName+".html", &this.T)
 }
 
 func (this *Subscribepay) WxViewPage(htmlName string) error {
-        this.T["logid"] = config.Seoconfig["bigmember"].(string)
-        return this.Render("/vipsubscribe/wx/page_"+htmlName+".html", &this.T)
+	this.T["logid"] = config.Seoconfig["bigmember"].(string)
+	return this.Render("/vipsubscribe/wx/page_"+htmlName+".html", &this.T)
 }
 
 //
 func (s *Subscribepay) Msgremind() error {
-        param := map[string]string{}
-        if array := strings.Split(s.Url(), "?"); len(array) == 2 {
-                decode, _ := hex.DecodeString(array[1])
-                for _, v := range strings.Split(string(decode), "&") {
-                        if vv := strings.Split(v, "="); len(vv) == 2 {
-                                param[vv[0]] = vv[1]
-                        }
-                }
-        }
-        t := param["type"]
-        advertcode := param["advertcode"]
-        if t == "unpaid" { //未支付 已支付
-                return s.Redirect("/front/vipsubscribe/toOrderDetailPage?orderCode=" + param["ordercode"] + "&advertcode=" + advertcode)
-        } else if t == "bigmember_unpaid" {
-                return s.Redirect("/front/wxMyOrder/memberDetail/" + param["ordercode"] + "?advertcode=" + advertcode)
-        } else if t == "unknow_unpaid" {
-                return s.Redirect("/weixin/pay/toMyWxOrder")
-        }
-        userId, _ := s.GetSession("userId").(string)
-        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}`)
-        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-        user := jy.GetBigVipUserBaseMsg("10000", s.Session(), qutil.InterfaceToStr(etcdMap["hosts"]), qutil.InterfaceToStr(etcdMap["key"]))
-        if user == nil {
-                return s.Render("_error.html")
-        }
-        myLastOrderCode := func(user_id string) string {
-                order := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
-                        "user_id":      user_id,
-                        "order_status": 1,
-                        "product_type": "VIP订阅",
-                }, "id,order_code", "pay_time desc")
-                if order != nil && len(*order) > 0 {
-                        return util.ObjToString((*order)["order_code"])
-                } else {
-                        return ""
-                }
-        }
-        i_vip_status := user.VipStatus
-        if t == "bigmember_soonexprie" || t == "bigmember_expried" { //大会员即将到期、已到期
-                now_unix := time.Now().Unix()
-                i_member_endtime := user.EndTime
-                if now_unix < i_member_endtime-259200 {
-                        //已续费
-                        return s.Redirect("/big/wx/page/landingPage?advertcode=" + advertcode)
-                } else {
-                        if now_unix > i_member_endtime {
-                                //未续费已到期,跳转到再次购买页面
-                                return s.Redirect("/jy_mobile/common/order/create/bigmember?advertcode=" + advertcode)
-                        } else {
-                                //未续费未到期,跳转到续费页面
-                                return s.Redirect("/big/wx/page/landingPage?advertcode=" + advertcode)
-                        }
-                }
-        } else if t == "paid" {
-                if i_vip_status > 0 {
-                        return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
-                } else {
-                        return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&orderCode=" + myLastOrderCode(userId) + "&advertcode=" + advertcode)
-                }
-        } else if t == "bigmember_paid" {
-                if user.Status > 0 {
-                        return s.Redirect("/big/wx/page/open_app?type=1&advertcode=" + advertcode)
-                } else {
-                        return s.Redirect("/big/wx/page/landingPage?advertcode=" + advertcode)
-                }
-        } else if t == "soonexprie" || t == "expried" { //即将到期 已到期
-                now_unix := time.Now().Unix()
-                l_vip_endtime := user.Data.Vip.EndTime
-                if now_unix < l_vip_endtime-259200 {
-                        //已续费
-                        return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
-                } else {
-                        if now_unix > l_vip_endtime {
-                                //未续费已到期,跳转到再次购买页面
-                                return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&orderCode=" + myLastOrderCode(userId) + "&advertcode=" + advertcode)
-                        } else {
-                                //未续费未到期,跳转到续费页面
-                                return s.Redirect("/jy_mobile/common/order/create/svip?type=renew&advertcode=" + advertcode)
-                        }
-                }
-        } else if t == "ontrial_soonexprie" || t == "ontrial_expried" { //试用即将到期 试用已到期
-                if i_vip_status == 2 {
-                        return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
-                } else {
-                        return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&advertcode=" + advertcode)
-                }
-        } else if t == "buyerclass" { //公共资源交易提醒
-                if i_vip_status > 0 { //vip未到期
-                        return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
-                } else if i_vip_status < 0 { //vip已到期
-                        return s.Redirect("/front/vipsubscribe/introducePage?advertcode=" + advertcode)
-                }
-        }
-        return s.Render("_error.html")
+	param := map[string]string{}
+	if array := strings.Split(s.Url(), "?"); len(array) == 2 {
+		decode, _ := hex.DecodeString(array[1])
+		for _, v := range strings.Split(string(decode), "&") {
+			if vv := strings.Split(v, "="); len(vv) == 2 {
+				param[vv[0]] = vv[1]
+			}
+		}
+	}
+	t := param["type"]
+	advertcode := param["advertcode"]
+	if t == "unpaid" { //未支付 已支付
+		return s.Redirect("/front/vipsubscribe/toOrderDetailPage?orderCode=" + param["ordercode"] + "&advertcode=" + advertcode)
+	} else if t == "bigmember_unpaid" {
+		return s.Redirect("/front/wxMyOrder/memberDetail/" + param["ordercode"] + "?advertcode=" + advertcode)
+	} else if t == "unknow_unpaid" {
+		return s.Redirect("/weixin/pay/toMyWxOrder")
+	}
+	userId, _ := s.GetSession("userId").(string)
+	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}`)
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	user := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	if user == nil {
+		return s.Render("_error.html")
+	}
+	myLastOrderCode := func(user_id string) string {
+		order := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
+			"user_id":      user_id,
+			"order_status": 1,
+			"product_type": "VIP订阅",
+		}, "id,order_code", "pay_time desc")
+		if order != nil && len(*order) > 0 {
+			return util.ObjToString((*order)["order_code"])
+		} else {
+			return ""
+		}
+	}
+	i_vip_status := user.VipStatus
+	if t == "bigmember_soonexprie" || t == "bigmember_expried" { //大会员即将到期、已到期
+		now_unix := time.Now().Unix()
+		i_member_endtime := user.EndTime
+		if now_unix < i_member_endtime-259200 {
+			//已续费
+			return s.Redirect("/big/wx/page/landingPage?advertcode=" + advertcode)
+		} else {
+			if now_unix > i_member_endtime {
+				//未续费已到期,跳转到再次购买页面
+				return s.Redirect("/jy_mobile/common/order/create/bigmember?advertcode=" + advertcode)
+			} else {
+				//未续费未到期,跳转到续费页面
+				return s.Redirect("/big/wx/page/landingPage?advertcode=" + advertcode)
+			}
+		}
+	} else if t == "paid" {
+		if i_vip_status > 0 {
+			return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
+		} else {
+			return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&orderCode=" + myLastOrderCode(userId) + "&advertcode=" + advertcode)
+		}
+	} else if t == "bigmember_paid" {
+		if user.Status > 0 {
+			return s.Redirect("/big/wx/page/open_app?type=1&advertcode=" + advertcode)
+		} else {
+			return s.Redirect("/big/wx/page/landingPage?advertcode=" + advertcode)
+		}
+	} else if t == "soonexprie" || t == "expried" { //即将到期 已到期
+		now_unix := time.Now().Unix()
+		l_vip_endtime := user.Data.Vip.EndTime
+		if now_unix < l_vip_endtime-259200 {
+			//已续费
+			return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
+		} else {
+			if now_unix > l_vip_endtime {
+				//未续费已到期,跳转到再次购买页面
+				return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&orderCode=" + myLastOrderCode(userId) + "&advertcode=" + advertcode)
+			} else {
+				//未续费未到期,跳转到续费页面
+				return s.Redirect("/jy_mobile/common/order/create/svip?type=renew&advertcode=" + advertcode)
+			}
+		}
+	} else if t == "ontrial_soonexprie" || t == "ontrial_expried" { //试用即将到期 试用已到期
+		if i_vip_status == 2 {
+			return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
+		} else {
+			return s.Redirect("/jy_mobile/common/order/create/svip?type=buy&advertcode=" + advertcode)
+		}
+	} else if t == "buyerclass" { //公共资源交易提醒
+		if i_vip_status > 0 { //vip未到期
+			return s.Redirect("/front/vipsubscribe/toSubVipSetPage?advertcode=" + advertcode)
+		} else if i_vip_status < 0 { //vip已到期
+			return s.Redirect("/front/vipsubscribe/introducePage?advertcode=" + advertcode)
+		}
+	}
+	return s.Render("_error.html")
 }

+ 2 - 1
src/jfw/front/ws_dataExport.go

@@ -375,7 +375,8 @@ func (wd *WsDataExport) SearchExport() error {
 		FileExists:   wd.GetString("fileExists"),                   //有无附件
 	}
 	saveData := reqData.PassBidSearchExport(config.Sysconfig)
-	saveData["selectType"] = strings.Join(jy.GetVipState(public.Mysql, public.MQFW, userId).
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	saveData["selectType"] = strings.Join(jy.GetVipState("10000", wd.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]), userId).
 		GetQueryItems(wd.GetString("selectType"), util.Int64All(config.Sysconfig["bidSearchOldUserLimit"])), ",")
 	saveData["s_openid"] = openid
 	saveData["s_userid"] = userId

+ 264 - 264
src/jfw/front/wxMyOrder.go

@@ -1,345 +1,345 @@
 package front
 
 import (
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "errors"
-        "fmt"
-        "jy/src/jfw/config"
-        "jy/src/jfw/wx"
-        "net/url"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"errors"
+	"fmt"
+	"jy/src/jfw/config"
+	"jy/src/jfw/wx"
+	"net/url"
 
-        "jy/src/jfw/jyutil"
+	"jy/src/jfw/jyutil"
 
-        "app.yhyue.com/moapp/jypkg/public"
+	"app.yhyue.com/moapp/jypkg/public"
 
-        util "app.yhyue.com/moapp/jybase/common"
+	util "app.yhyue.com/moapp/jybase/common"
 
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 type WxMyOrder struct {
-        *xweb.Action
-        myMenu         xweb.Mapper `xweb:"/front/wxMyOrder/myMenu"`                //微信我的目录
-        myEmail        xweb.Mapper `xweb:"/front/wxMyOrder/myEmail"`               //微信我的邮箱
-        myPhone        xweb.Mapper `xweb:"/front/wxMyOrder/myPhone"`               //微信我的手机
-        setSuccess     xweb.Mapper `xweb:"/front/wxMyOrder/setSuccess"`            //查询订单
-        wxGetOrderCode xweb.Mapper `xweb:"/front/wxMyOrder/wxGetOrderCode/(\\w+)"` //申请发票获取订单编号
-        wxPaySuccess   xweb.Mapper `xweb:"/front/wxMyorder/wxPaySuccess/(\\w+)"`
-
-        getValuationList xweb.Mapper `xweb:"/front/wxMyOrder/getValuationList/(\\w+)"` //计价清单
-        myset            xweb.Mapper `xweb:"/front/wxMyOrder/myset"`                   //设置页面
-
-        getpage              xweb.Mapper `xweb:"/front/invoice/showpage"`           //开发票
-        check_invoice        xweb.Mapper `xweb:"/front/invoice/check_invoice.html"` //查看发票
-        cantInvoice          xweb.Mapper `xweb:"/front/invoice/cantInvoice"`
-        memberDetail         xweb.Mapper `xweb:"/front/wxMyOrder/memberDetail/(\\w+)"`         //大会员订单详情页面
-        aiForecastPackdetail xweb.Mapper `xweb:"/front/wxMyOrder/aiForecastPackdetail/(\\w+)"` //大会员订单详情页面
-        subAccountDetail     xweb.Mapper `xweb:"/front/wxMyOrder/subAccountDetail/(\\w+)"`     //子账号订单详情
-        bidfileDetail        xweb.Mapper `xweb:"/front/wxMyOrder/bidfileDetail/(\\w+)"`        //招标文件解读订单详情
-        integralDetail       xweb.Mapper `xweb:"/front/wxMyOrder/integralDetail/(\\w+)"`       //剑鱼币订单详情
-
-        //创建订单
-        wxFilePackCreateOrder xweb.Mapper `xweb:"/swordfish/filePack/createOrder"` //附件下载包 wx
-        pcFilePackCreateOrder xweb.Mapper `xweb:"/front/filepack/createOrder"`     //pc
-        pcfilePackDetail      xweb.Mapper `xweb:"/front/file/packDetail"`
+	*xweb.Action
+	myMenu         xweb.Mapper `xweb:"/front/wxMyOrder/myMenu"`                //微信我的目录
+	myEmail        xweb.Mapper `xweb:"/front/wxMyOrder/myEmail"`               //微信我的邮箱
+	myPhone        xweb.Mapper `xweb:"/front/wxMyOrder/myPhone"`               //微信我的手机
+	setSuccess     xweb.Mapper `xweb:"/front/wxMyOrder/setSuccess"`            //查询订单
+	wxGetOrderCode xweb.Mapper `xweb:"/front/wxMyOrder/wxGetOrderCode/(\\w+)"` //申请发票获取订单编号
+	wxPaySuccess   xweb.Mapper `xweb:"/front/wxMyorder/wxPaySuccess/(\\w+)"`
+
+	getValuationList xweb.Mapper `xweb:"/front/wxMyOrder/getValuationList/(\\w+)"` //计价清单
+	myset            xweb.Mapper `xweb:"/front/wxMyOrder/myset"`                   //设置页面
+
+	getpage              xweb.Mapper `xweb:"/front/invoice/showpage"`           //开发票
+	check_invoice        xweb.Mapper `xweb:"/front/invoice/check_invoice.html"` //查看发票
+	cantInvoice          xweb.Mapper `xweb:"/front/invoice/cantInvoice"`
+	memberDetail         xweb.Mapper `xweb:"/front/wxMyOrder/memberDetail/(\\w+)"`         //大会员订单详情页面
+	aiForecastPackdetail xweb.Mapper `xweb:"/front/wxMyOrder/aiForecastPackdetail/(\\w+)"` //大会员订单详情页面
+	subAccountDetail     xweb.Mapper `xweb:"/front/wxMyOrder/subAccountDetail/(\\w+)"`     //子账号订单详情
+	bidfileDetail        xweb.Mapper `xweb:"/front/wxMyOrder/bidfileDetail/(\\w+)"`        //招标文件解读订单详情
+	integralDetail       xweb.Mapper `xweb:"/front/wxMyOrder/integralDetail/(\\w+)"`       //剑鱼币订单详情
+
+	//创建订单
+	wxFilePackCreateOrder xweb.Mapper `xweb:"/swordfish/filePack/createOrder"` //附件下载包 wx
+	pcFilePackCreateOrder xweb.Mapper `xweb:"/front/filepack/createOrder"`     //pc
+	pcfilePackDetail      xweb.Mapper `xweb:"/front/file/packDetail"`
 }
 
 func init() {
-        xweb.AddAction(&WxMyOrder{})
+	xweb.AddAction(&WxMyOrder{})
 }
 
 var (
-        pagesize_max int = 10
+	pagesize_max int = 10
 )
 
 //
 func (w *WxMyOrder) MyMenu() error {
-        if w.Session().Get("userId") == nil {
-
-                if w.GetString("state") == "wx" {
-                        //微信跳回来的
-                        code := w.GetString("code")
-                        if code != "" {
-                                openid := jyutil.Getopenid(code)
-                                if openid != "" {
-                                        FindUserAndCreateSess(openid, w.Session(), "wx", false)
-                                }
-                        }
-                } else {
-                        if public.CheckWxBrowser(w.Request) {
-                                //所有参数都不再使用,跳到微信验证用户
-                                return w.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(w.Site()+w.Url()), "wx"), 302)
-                        }
-                }
-                userid := util.ObjToString(w.GetSession("userId"))
-                if userid == "" {
-                        return errors.New("未登录")
-                }
-        }
-        //分享
-        w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
-        w.T["nickname"], _ = w.Session().Get("s_nickname").(string)
-        myopenid, _ := w.Session().Get("s_m_openid").(string)
-        w.T["openid"] = se.EncodeString(myopenid)
-        w.T["avatar"], _ = w.Session().Get("s_avatar").(string)
-        return w.Render("weixin/my.html", &w.T)
+	if w.Session().Get("userId") == nil {
+
+		if w.GetString("state") == "wx" {
+			//微信跳回来的
+			code := w.GetString("code")
+			if code != "" {
+				openid := jyutil.Getopenid(code)
+				if openid != "" {
+					FindUserAndCreateSess(openid, w.Session(), "wx", false)
+				}
+			}
+		} else {
+			if public.CheckWxBrowser(w.Request) {
+				//所有参数都不再使用,跳到微信验证用户
+				return w.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(w.Site()+w.Url()), "wx"), 302)
+			}
+		}
+		userid := util.ObjToString(w.GetSession("userId"))
+		if userid == "" {
+			return errors.New("未登录")
+		}
+	}
+	//分享
+	w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
+	w.T["nickname"], _ = w.Session().Get("s_nickname").(string)
+	myopenid, _ := w.Session().Get("s_m_openid").(string)
+	w.T["openid"] = se.EncodeString(myopenid)
+	w.T["avatar"], _ = w.Session().Get("s_avatar").(string)
+	return w.Render("weixin/my.html", &w.T)
 }
 
 func (w *WxMyOrder) MyEmail() {
-        //分享
-        w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
-        myopenid, _ := w.Session().Get("s_m_openid").(string)
-        w.T["openid"] = se.EncodeString(myopenid)
-        mynickname, _ := w.Session().Get("s_nickname").(string)
-        myavatar, _ := w.Session().Get("s_avatar").(string)
-        w.T["nickname"] = mynickname
-        w.T["avatar"] = myavatar
-        w.T["userId"] = util.ObjToString(w.GetSession("userId"))
-
-        name := w.GetString("name") //
-        //检测用户是否绑定邮箱
-        if util.ObjToString(w.GetSession("userId")) != "" {
-                w.T["userId"] = util.ObjToString(w.GetSession("userId"))
-        }
-        res, err := mongodb.FindById("user", util.ObjToString(w.GetSession("userId")), nil)
-        if len(*res) > 0 && err {
-                if util.ObjToString((*res)["s_myemail"]) == "" || name != "" {
-                        //未绑定邮箱 进入绑定邮箱界面
-                        if name != "" && util.ObjToString((*res)["s_myemail"]) != "" {
-                                w.T["text_email"] = util.ObjToString((*res)["s_myemail"])
-                                //invoice 是从开发票跳转过来的
-                                if name == "invoice" {
-                                        orderCode := w.GetString("orderCode")
-                                        if orderCode != "" {
-                                                w.T["orderCode"] = orderCode
-                                        }
-                                }
-                        }
-                        w.Render("/weixin/email/bind_email.html", &w.T)
-                } else {
-                        //绑定邮箱进入 更换解绑邮箱界面
-                        if util.ObjToString((*res)["s_myemail"]) != "" {
-                                w.T["text_email"] = util.ObjToString((*res)["s_myemail"])
-                        }
-                        w.Render("/weixin/email/unbind_email.html", &w.T)
-                }
-        }
+	//分享
+	w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
+	myopenid, _ := w.Session().Get("s_m_openid").(string)
+	w.T["openid"] = se.EncodeString(myopenid)
+	mynickname, _ := w.Session().Get("s_nickname").(string)
+	myavatar, _ := w.Session().Get("s_avatar").(string)
+	w.T["nickname"] = mynickname
+	w.T["avatar"] = myavatar
+	w.T["userId"] = util.ObjToString(w.GetSession("userId"))
+
+	name := w.GetString("name") //
+	//检测用户是否绑定邮箱
+	if util.ObjToString(w.GetSession("userId")) != "" {
+		w.T["userId"] = util.ObjToString(w.GetSession("userId"))
+	}
+	res, err := mongodb.FindById("user", util.ObjToString(w.GetSession("userId")), nil)
+	if len(*res) > 0 && err {
+		if util.ObjToString((*res)["s_myemail"]) == "" || name != "" {
+			//未绑定邮箱 进入绑定邮箱界面
+			if name != "" && util.ObjToString((*res)["s_myemail"]) != "" {
+				w.T["text_email"] = util.ObjToString((*res)["s_myemail"])
+				//invoice 是从开发票跳转过来的
+				if name == "invoice" {
+					orderCode := w.GetString("orderCode")
+					if orderCode != "" {
+						w.T["orderCode"] = orderCode
+					}
+				}
+			}
+			w.Render("/weixin/email/bind_email.html", &w.T)
+		} else {
+			//绑定邮箱进入 更换解绑邮箱界面
+			if util.ObjToString((*res)["s_myemail"]) != "" {
+				w.T["text_email"] = util.ObjToString((*res)["s_myemail"])
+			}
+			w.Render("/weixin/email/unbind_email.html", &w.T)
+		}
+	}
 }
 
 func (w *WxMyOrder) SetSuccess() {
-        //分享
-        w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
-        myopenid, _ := w.Session().Get("s_m_openid").(string)
-        w.T["openid"] = se.EncodeString(myopenid)
-        mynickname, _ := w.Session().Get("s_nickname").(string)
-        myavatar, _ := w.Session().Get("s_avatar").(string)
-        w.T["nickname"] = mynickname
-        w.T["avatar"] = myavatar
-        w.T["userId"] = util.ObjToString(w.GetSession("userId"))
-
-        w.Render("/weixin/email/bind_success.html", &w.T)
+	//分享
+	w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
+	myopenid, _ := w.Session().Get("s_m_openid").(string)
+	w.T["openid"] = se.EncodeString(myopenid)
+	mynickname, _ := w.Session().Get("s_nickname").(string)
+	myavatar, _ := w.Session().Get("s_avatar").(string)
+	w.T["nickname"] = mynickname
+	w.T["avatar"] = myavatar
+	w.T["userId"] = util.ObjToString(w.GetSession("userId"))
+
+	w.Render("/weixin/email/bind_success.html", &w.T)
 }
 
 func (w *WxMyOrder) WxGetOrderCode(order_code string) error {
-        myOpenid := ""
-        if openid := w.GetSession("s_m_openid"); openid != nil {
-                myOpenid = openid.(string)
-        } else {
-                return errors.New("未登录")
-        }
-        //分享
-        w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
-        w.T["openid"] = se.EncodeString(myOpenid)
-        mynickname, _ := w.Session().Get("s_nickname").(string)
-        myavatar, _ := w.Session().Get("s_avatar").(string)
-        w.T["nickname"] = mynickname
-        w.T["avatar"] = myavatar
-        //-----------------------
-        var status, order_status int64
-        queryMap := map[string]interface{}{
-                "order_code": order_code,
-        }
-        oDate := public.Mysql.FindOne(tableName_order, queryMap, "", "")
-        status = (*oDate)["applybill_status"].(int64)
-        order_status = (*oDate)["order_status"].(int64)
-        w.T["order_code"] = order_code
-        //是否申请发票 支付状态
-        if status == 1 || order_status == 0 {
-                w.Redirect("/front/wx_dataExport/wxToOrderDetail?orderCode=" + order_code)
-        } else {
-                w.Render("/weixin/dataExport/dataExport_applyInvoice.html", &w.T)
-        }
-        return nil
+	myOpenid := ""
+	if openid := w.GetSession("s_m_openid"); openid != nil {
+		myOpenid = openid.(string)
+	} else {
+		return errors.New("未登录")
+	}
+	//分享
+	w.T["signature"] = wx.SignJSSDK(w.Site() + w.Url())
+	w.T["openid"] = se.EncodeString(myOpenid)
+	mynickname, _ := w.Session().Get("s_nickname").(string)
+	myavatar, _ := w.Session().Get("s_avatar").(string)
+	w.T["nickname"] = mynickname
+	w.T["avatar"] = myavatar
+	//-----------------------
+	var status, order_status int64
+	queryMap := map[string]interface{}{
+		"order_code": order_code,
+	}
+	oDate := public.Mysql.FindOne(tableName_order, queryMap, "", "")
+	status = (*oDate)["applybill_status"].(int64)
+	order_status = (*oDate)["order_status"].(int64)
+	w.T["order_code"] = order_code
+	//是否申请发票 支付状态
+	if status == 1 || order_status == 0 {
+		w.Redirect("/front/wx_dataExport/wxToOrderDetail?orderCode=" + order_code)
+	} else {
+		w.Render("/weixin/dataExport/dataExport_applyInvoice.html", &w.T)
+	}
+	return nil
 }
 
 func (w *WxMyOrder) WxPaySuccess(order_code string) error {
-        userId := w.Session().Get("userId")
-        openid := w.Session().Get("s_m_openid")
-        if userId == nil || openid == nil {
-                return errors.New("未登录")
-        }
-        w.T["order_code"] = order_code
-        return w.Render("/weixin/dataExport/dataExport_invoiceSuccess.html", &w.T)
+	userId := w.Session().Get("userId")
+	openid := w.Session().Get("s_m_openid")
+	if userId == nil || openid == nil {
+		return errors.New("未登录")
+	}
+	w.T["order_code"] = order_code
+	return w.Render("/weixin/dataExport/dataExport_invoiceSuccess.html", &w.T)
 }
 
 //设置页面
 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}`)
-                etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-                user := jy.GetBigVipUserBaseMsg("10000", s.Session(), qutil.InterfaceToStr(etcdMap["hosts"]), qutil.InterfaceToStr(etcdMap["key"]))
-                if user != nil {
-                        if user.VipStatus == 1 || user.VipStatus == 2 {
-                                isVip = true
-                        }
-                }
-
-        }
-        w.T["isVip"] = isVip
-        return w.Render("/weixin/setpage.html")
+	userid := util.ObjToString(w.GetSession("userId"))
+	isVip := false
+	if userid != "" {
+		//user, ok := mongodb.FindById("user", userid, `{"i_vip_status":1}`)
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		user := jy.GetBigVipUserBaseMsg("10000", w.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+		if user != nil {
+			if user.VipStatus == 1 || user.VipStatus == 2 {
+				isVip = true
+			}
+		}
+
+	}
+	w.T["isVip"] = isVip
+	return w.Render("/weixin/setpage.html")
 }
 
 //设置页面
 func (w *WxMyOrder) MyPhone() error {
-        return w.Render("/weixin/setphone.html")
+	return w.Render("/weixin/setphone.html")
 }
 
 func (w *WxMyOrder) GetValuationList(order_code string) error {
-        w.T["order_code"] = order_code
-        return w.Render("/weixin/vipsubscribe/valuation_list.html", &w.T)
+	w.T["order_code"] = order_code
+	return w.Render("/weixin/vipsubscribe/valuation_list.html", &w.T)
 }
 func (w *WxMyOrder) Datas(queryM map[string]interface{}, pageNum int) (haveNextPage bool, result []map[string]interface{}, err error) {
-        res := *public.Mysql.Find(tableName_order, queryM, "id,order_code,filter_publishtime,create_time,data_spec,filter_id,filter_keys,order_money,data_count,order_status,pay_way", "create_time desc", -1, 0)
-        if len(res) > 0 {
-                start := (pageNum - 1) * pagesize_max
-                end := pageNum * pagesize_max
-                if end > len(res) {
-                        end = len(res)
-                }
-                if start < len(res) {
-                        result = res[start:end]
-                }
-        }
-        haveNextPage = len(result) >= pagesize_max
-        return
+	res := *public.Mysql.Find(tableName_order, queryM, "id,order_code,filter_publishtime,create_time,data_spec,filter_id,filter_keys,order_money,data_count,order_status,pay_way", "create_time desc", -1, 0)
+	if len(res) > 0 {
+		start := (pageNum - 1) * pagesize_max
+		end := pageNum * pagesize_max
+		if end > len(res) {
+			end = len(res)
+		}
+		if start < len(res) {
+			result = res[start:end]
+		}
+	}
+	haveNextPage = len(result) >= pagesize_max
+	return
 }
 
 func (t *WxMyOrder) Getpage() {
-        order_code := t.GetString("order_code")
-        c := t.GetString("c") //重开发票
-        if order_code != "" {
-                res := public.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": order_code}, "order_money,product_type,user_mail,user_phone,applybill_status", "")
-                if res != nil {
-                        price := (*res)["order_money"]
-                        product_name := (*res)["product_type"].(string)
-                        if product_name == "历史数据" {
-                                t.T["e_mail"] = (*res)["user_mail"]
-                                t.T["phone"] = (*res)["user_phone"]
-                        }
-                        t.T["order_code"] = order_code
-                        t.T["price"] = price
-                        t.T["product_name"] = product_name
-                        t.T["applybill_status"] = (*res)["applybill_status"]
-
-                }
-                t.T["c"] = c
-                _ = t.Render("/weixin/invoice/invoicing.html", &t.T)
-        }
+	order_code := t.GetString("order_code")
+	c := t.GetString("c") //重开发票
+	if order_code != "" {
+		res := public.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": order_code}, "order_money,product_type,user_mail,user_phone,applybill_status", "")
+		if res != nil {
+			price := (*res)["order_money"]
+			product_name := (*res)["product_type"].(string)
+			if product_name == "历史数据" {
+				t.T["e_mail"] = (*res)["user_mail"]
+				t.T["phone"] = (*res)["user_phone"]
+			}
+			t.T["order_code"] = order_code
+			t.T["price"] = price
+			t.T["product_name"] = product_name
+			t.T["applybill_status"] = (*res)["applybill_status"]
+
+		}
+		t.T["c"] = c
+		_ = t.Render("/weixin/invoice/invoicing.html", &t.T)
+	}
 }
 
 func (t *WxMyOrder) Check_invoice() {
-        order_code := t.GetString("order_code")
-        t.T["order_code"] = order_code
-        t.Render("/weixin/invoice/check_invoice.html", &t.T)
+	order_code := t.GetString("order_code")
+	t.T["order_code"] = order_code
+	t.Render("/weixin/invoice/check_invoice.html", &t.T)
 }
 
 func (t *WxMyOrder) CantInvoice() {
-        t.Render("/weixin/invoice/cantInvocie.html")
+	t.Render("/weixin/invoice/cantInvocie.html")
 }
 
 func (t *WxMyOrder) MemberDetail(order_code string) {
-        //分享
-        myOpenid, _ := t.GetSession("s_m_openid").(string)
-        t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
-        t.T["openid"] = se.EncodeString(myOpenid)
-        mynickname, _ := t.Session().Get("s_nickname").(string)
-        myavatar, _ := t.Session().Get("s_avatar").(string)
-        t.T["nickname"] = mynickname
-        t.T["avatar"] = myavatar
-        t.T["order_code"] = order_code
-        t.Render("/weixin/member/memberdetail.html", &t.T)
+	//分享
+	myOpenid, _ := t.GetSession("s_m_openid").(string)
+	t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
+	t.T["openid"] = se.EncodeString(myOpenid)
+	mynickname, _ := t.Session().Get("s_nickname").(string)
+	myavatar, _ := t.Session().Get("s_avatar").(string)
+	t.T["nickname"] = mynickname
+	t.T["avatar"] = myavatar
+	t.T["order_code"] = order_code
+	t.Render("/weixin/member/memberdetail.html", &t.T)
 }
 
 func (t *WxMyOrder) AiForecastPackdetail(order_code string) {
-        //分享
-        myOpenid, _ := t.GetSession("s_m_openid").(string)
-        t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
-        t.T["openid"] = se.EncodeString(myOpenid)
-        mynickname, _ := t.Session().Get("s_nickname").(string)
-        myavatar, _ := t.Session().Get("s_avatar").(string)
-        t.T["nickname"] = mynickname
-        t.T["avatar"] = myavatar
-        t.T["order_code"] = order_code
-        t.Render("/weixin/member/aiForecastPackdetail.html", &t.T)
+	//分享
+	myOpenid, _ := t.GetSession("s_m_openid").(string)
+	t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
+	t.T["openid"] = se.EncodeString(myOpenid)
+	mynickname, _ := t.Session().Get("s_nickname").(string)
+	myavatar, _ := t.Session().Get("s_avatar").(string)
+	t.T["nickname"] = mynickname
+	t.T["avatar"] = myavatar
+	t.T["order_code"] = order_code
+	t.Render("/weixin/member/aiForecastPackdetail.html", &t.T)
 }
 
 func (t *WxMyOrder) SubAccountDetail(order_code string) {
-        //分享
-        myOpenid, _ := t.GetSession("s_m_openid").(string)
-        t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
-        t.T["openid"] = se.EncodeString(myOpenid)
-        mynickname, _ := t.Session().Get("s_nickname").(string)
-        myavatar, _ := t.Session().Get("s_avatar").(string)
-        t.T["nickname"] = mynickname
-        t.T["avatar"] = myavatar
-        t.T["order_code"] = order_code
-        t.Render("/weixin/member/subAccountDetail.html", &t.T)
+	//分享
+	myOpenid, _ := t.GetSession("s_m_openid").(string)
+	t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
+	t.T["openid"] = se.EncodeString(myOpenid)
+	mynickname, _ := t.Session().Get("s_nickname").(string)
+	myavatar, _ := t.Session().Get("s_avatar").(string)
+	t.T["nickname"] = mynickname
+	t.T["avatar"] = myavatar
+	t.T["order_code"] = order_code
+	t.Render("/weixin/member/subAccountDetail.html", &t.T)
 }
 
 func (t *WxMyOrder) BidfileDetail(order_code string) {
-        myOpenid, _ := t.GetSession("s_m_openid").(string)
-        t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
-        t.T["openid"] = se.EncodeString(myOpenid)
-        mynickname, _ := t.Session().Get("s_nickname").(string)
-        myavatar, _ := t.Session().Get("s_avatar").(string)
-        t.T["nickname"] = mynickname
-        t.T["avatar"] = myavatar
-        t.T["order_code"] = order_code
-        t.Render("/weixin/commonPay/bidfile/bidfiledetail.html", &t.T)
+	myOpenid, _ := t.GetSession("s_m_openid").(string)
+	t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
+	t.T["openid"] = se.EncodeString(myOpenid)
+	mynickname, _ := t.Session().Get("s_nickname").(string)
+	myavatar, _ := t.Session().Get("s_avatar").(string)
+	t.T["nickname"] = mynickname
+	t.T["avatar"] = myavatar
+	t.T["order_code"] = order_code
+	t.Render("/weixin/commonPay/bidfile/bidfiledetail.html", &t.T)
 }
 
 func (t *WxMyOrder) IntegralDetail(order_code string) {
-        myOpenid, _ := t.GetSession("s_m_openid").(string)
-        t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
-        t.T["openid"] = se.EncodeString(myOpenid)
-        mynickname, _ := t.Session().Get("s_nickname").(string)
-        myavatar, _ := t.Session().Get("s_avatar").(string)
-        t.T["nickname"] = mynickname
-        t.T["avatar"] = myavatar
-        t.T["order_code"] = order_code
-        t.Render("/weixin/commonPay/integral/integralDetail.html", &t.T)
+	myOpenid, _ := t.GetSession("s_m_openid").(string)
+	t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
+	t.T["openid"] = se.EncodeString(myOpenid)
+	mynickname, _ := t.Session().Get("s_nickname").(string)
+	myavatar, _ := t.Session().Get("s_avatar").(string)
+	t.T["nickname"] = mynickname
+	t.T["avatar"] = myavatar
+	t.T["order_code"] = order_code
+	t.Render("/weixin/commonPay/integral/integralDetail.html", &t.T)
 }
 
 //
 func (t *WxMyOrder) WxFilePackCreateOrder() {
-        t.Render("/weixin/commonPay/filePack/createorder.html")
+	t.Render("/weixin/commonPay/filePack/createorder.html")
 }
 
 //
 func (t *WxMyOrder) PcFilePackCreateOrder() {
-        t.Render("/pc/filePack/createorder.html")
+	t.Render("/pc/filePack/createorder.html")
 }
 
 func (t *WxMyOrder) PcfilePackDetail() {
-        myOpenid, _ := t.GetSession("s_m_openid").(string)
-        t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
-        t.T["openid"] = se.EncodeString(myOpenid)
-        mynickname, _ := t.Session().Get("s_nickname").(string)
-        myavatar, _ := t.Session().Get("s_avatar").(string)
-        t.T["nickname"] = mynickname
-        t.T["avatar"] = myavatar
-        t.T["order_code"] = t.GetString("order_code")
-        t.Render("/order/pc/filePack/detail.html", &t.T)
+	myOpenid, _ := t.GetSession("s_m_openid").(string)
+	t.T["signature"] = wx.SignJSSDK(t.Site() + t.Url())
+	t.T["openid"] = se.EncodeString(myOpenid)
+	mynickname, _ := t.Session().Get("s_nickname").(string)
+	myavatar, _ := t.Session().Get("s_avatar").(string)
+	t.T["nickname"] = mynickname
+	t.T["avatar"] = myavatar
+	t.T["order_code"] = t.GetString("order_code")
+	t.Render("/order/pc/filePack/detail.html", &t.T)
 }

+ 367 - 367
src/jfw/front/wxkeyset.go

@@ -1,404 +1,404 @@
 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",
-                })
-        }
-        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-        vipMsg := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-        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}`)
-                etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-                data := jy.GetBigVipUserBaseMsg("10000",  m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	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",
+		})
+	}
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	vipMsg := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	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}`)
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		data := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
 
-                if data != nil {
-                        if data.Data.Free.FreeHasKey {
-                                m.T["haskeyword"] = true
-                        }
+		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" {
+		//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)
 }
 
 //ajax各种请求
 func (m *Front) WxKeysetAjaxReq() {
-        defer util.Catch()
-        userId, _ := m.GetSession("userId").(string)
-        positionType := qutil.Int64All(session.Get("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")
-                etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-                m := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-                if o_jy != nil {
-                        //o_jy, _ = (*data)["o_jy"].(map[string]interface{})
-                        (*o_jy)["i_new"] = NewUserByVIP(o_jy, m.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")
-                        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-                        data := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-                        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(a.GetSession("entUserId")),
-                        "i_entid":  util.Int64All(a.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" { //获取高级设置
+		//data, ok := mongodb.FindById("user", userId, `{"o_jy":1,"l_registedate":1}`)
+		o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		data := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+		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")
+			etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+			data := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+			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
 }

+ 617 - 615
src/jfw/modules/app/src/app/front/front.go

@@ -1,85 +1,85 @@
 package front
 
 import (
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "fmt"
-        "jy/src/jfw/modules/app/src/app/jylabutil"
-        "jy/src/jfw/modules/app/src/jfw/config"
-        "log"
-        "strings"
-        "sync"
-        "time"
-
-        . "jy/src/jfw/modules/app/src/app/jyutil"
-
-        util "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/encrypt"
-        elastic "app.yhyue.com/moapp/jybase/esv1"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "app.yhyue.com/moapp/jypkg/public"
-
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
-        "github.com/SKatiyar/qr"
-        "github.com/dchest/captcha"
-        "go.mongodb.org/mongo-driver/bson"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"fmt"
+	"jy/src/jfw/modules/app/src/app/jylabutil"
+	"jy/src/jfw/modules/app/src/jfw/config"
+	"log"
+	"strings"
+	"sync"
+	"time"
+
+	. "jy/src/jfw/modules/app/src/app/jyutil"
+
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	elastic "app.yhyue.com/moapp/jybase/esv1"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"app.yhyue.com/moapp/jypkg/public"
+
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"github.com/SKatiyar/qr"
+	"github.com/dchest/captcha"
+	"go.mongodb.org/mongo-driver/bson"
 )
 
 type Front struct {
-        *xweb.Action
-        feedback           xweb.Mapper `xweb:"/jyapp/swordfish/feedback"` //意见反馈
-        praise             xweb.Mapper `xweb:"/jyapp/swordfish/praise"`
-        myFeedbacks        xweb.Mapper `xweb:"/jyapp/swordfish/myFeedbacks"`
-        ajaxReq            xweb.Mapper `xweb:"/jyapp/member/swordfish/ajaxReq"`
-        wxsearchlistPaging xweb.Mapper `xweb:"/jyapp/swordfish/searchlist/paging"`  //剑鱼标讯微信查询结果展示--分页
-        wxKeyset           xweb.Mapper `xweb:"/jyapp/wxkeyset/keyset/(\\w+)"`       //订阅词设置
-        wxKeysetAjaxReq    xweb.Mapper `xweb:"/jyapp/wxkeyset/ajaxReq"`             //订阅词ajax请求
-        wxpushView         xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview"`            //推送结果预览
-        wxpushViewPaging   xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview/paging"`     //推送结果预览--分页
-        historypush        xweb.Mapper `xweb:"/jyapp/swordfish/historypush"`        //历时推送记录
-        historypushPaging  xweb.Mapper `xweb:"/jyapp/swordfish/historypush/paging"` //历时推送记录--分页
-        tSGuide            xweb.Mapper `xweb:"/jyapp/tenderSubscribe/guide"`        //引导页
-        getRecomKWs        xweb.Mapper `xweb:"/jyapp/member/getRecomKWs"`           //获取推荐关键词
-        behaviorRecord     xweb.Mapper `xweb:"/jyapp/member/behaviorRecord"`        //记录用户点击的关键词
-        wxpushAjaxReq      xweb.Mapper `xweb:"/jyapp/wxpush/bid/ajaxReq"`
-        delWxHistorySearch xweb.Mapper `xweb:"/jyapp/swordfish/delWxHistorySearch"` //剑鱼标讯微信删除历史搜索
-        delOL              xweb.Mapper `xweb:"/jyapp/swordfish/delovertimelist"`    //手动删除30天无更新数据
-        wxpushListInfo     xweb.Mapper `xweb:"/jyapp/wxpush/bidinfo/(.*)"`          //推送列表
-        /*不需要登录*/
-        wxerr              xweb.Mapper `xweb:"/jyapp/free/mob/err"`
-        about              xweb.Mapper `xweb:"/jyapp/free/swordfish/about"`
-        transfer           xweb.Mapper `xweb:"/jyapp/free/transfer"` //原文链接中转
-        captcha            xweb.Mapper `xweb:"/jyapp/free/captcha"`  //生成验证码图片
-        getIndexData       xweb.Mapper `xweb:"/jyapp/free/front/getIndexData"`
-        limitSearchText    xweb.Mapper `xweb:"/jyapp/front/limitSearchText"`
-        index              xweb.Mapper `xweb:"/jyapp/free/index"`  //打开app跳转
-        kicked             xweb.Mapper `xweb:"/jyapp/free/kicked"` //被踢人之后跳转
-        setSeoVersion      xweb.Mapper `xweb:"/jyapp/free/setSeoVersion"`
-        receive            xweb.Mapper `xweb:"/jyapp/free/message/receive"`
-        jylabShareTimeline xweb.Mapper `xweb:"/jyapp/jylabShareTimeline"`
-        //修改强制分享主动分享状态和时间
-        updateShareStatus xweb.Mapper `xweb:"/jyapp/share/updateShareStatus"`
-        changePro         xweb.Mapper `xweb:"/jyapp/jylab/changePro"` //修改提示信息状态
-        hasPushHistory    xweb.Mapper `xweb:"/jyapp/front/hasPushHistory"`
-        showRedSpotOnMenu xweb.Mapper `xweb:"/jyapp/free/showRedSpotOnMenu"`
-        goToUpdate        xweb.Mapper `xweb:"/jyapp/free/goToUpdate"`
-        //许可协议及隐私政策 v2.9.4新增
-        policy          xweb.Mapper `xweb:"/jyapp/free/policy"`
-        pushMsgCallback xweb.Mapper `xweb:"/jyapp/pushmessage/callback"` //app客户端收到消息回调服务端地址
-
-        //静态页面通用地址
-        staticPage xweb.Mapper `xweb:"/jyapp/front/staticPage/(.+)"`
-        //商机管理推送
-        entnichePushList xweb.Mapper `xweb:"/jyapp/entniche/pushlist"`
-        entnichePush     xweb.Mapper `xweb:"/jyapp/entniche/push"`
-        delc             xweb.Mapper `xweb:"/jyapp/free/delcache/(.+)"` //删除模板缓存
-        iosExam          xweb.Mapper `xweb:"/jyapp/free/iosexam"`       //ios审核
-
-        downloadJyAppQrOther xweb.Mapper `xweb:"/jyapp/front/downloadJyApp/qrOther"` //扫码下载
-
-        qRCodePage xweb.Mapper `xweb:"/jyapp/free/qRCodePage"` //二维码页面
-
-        appConfig   xweb.Mapper `xweb:"/jyapp/free/config"`      //app配置项
-        shareDomain xweb.Mapper `xweb:"/jyapp/free/shareDomain"` //app分享 域名配置项
+	*xweb.Action
+	feedback           xweb.Mapper `xweb:"/jyapp/swordfish/feedback"` //意见反馈
+	praise             xweb.Mapper `xweb:"/jyapp/swordfish/praise"`
+	myFeedbacks        xweb.Mapper `xweb:"/jyapp/swordfish/myFeedbacks"`
+	ajaxReq            xweb.Mapper `xweb:"/jyapp/member/swordfish/ajaxReq"`
+	wxsearchlistPaging xweb.Mapper `xweb:"/jyapp/swordfish/searchlist/paging"`  //剑鱼标讯微信查询结果展示--分页
+	wxKeyset           xweb.Mapper `xweb:"/jyapp/wxkeyset/keyset/(\\w+)"`       //订阅词设置
+	wxKeysetAjaxReq    xweb.Mapper `xweb:"/jyapp/wxkeyset/ajaxReq"`             //订阅词ajax请求
+	wxpushView         xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview"`            //推送结果预览
+	wxpushViewPaging   xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview/paging"`     //推送结果预览--分页
+	historypush        xweb.Mapper `xweb:"/jyapp/swordfish/historypush"`        //历时推送记录
+	historypushPaging  xweb.Mapper `xweb:"/jyapp/swordfish/historypush/paging"` //历时推送记录--分页
+	tSGuide            xweb.Mapper `xweb:"/jyapp/tenderSubscribe/guide"`        //引导页
+	getRecomKWs        xweb.Mapper `xweb:"/jyapp/member/getRecomKWs"`           //获取推荐关键词
+	behaviorRecord     xweb.Mapper `xweb:"/jyapp/member/behaviorRecord"`        //记录用户点击的关键词
+	wxpushAjaxReq      xweb.Mapper `xweb:"/jyapp/wxpush/bid/ajaxReq"`
+	delWxHistorySearch xweb.Mapper `xweb:"/jyapp/swordfish/delWxHistorySearch"` //剑鱼标讯微信删除历史搜索
+	delOL              xweb.Mapper `xweb:"/jyapp/swordfish/delovertimelist"`    //手动删除30天无更新数据
+	wxpushListInfo     xweb.Mapper `xweb:"/jyapp/wxpush/bidinfo/(.*)"`          //推送列表
+	/*不需要登录*/
+	wxerr              xweb.Mapper `xweb:"/jyapp/free/mob/err"`
+	about              xweb.Mapper `xweb:"/jyapp/free/swordfish/about"`
+	transfer           xweb.Mapper `xweb:"/jyapp/free/transfer"` //原文链接中转
+	captcha            xweb.Mapper `xweb:"/jyapp/free/captcha"`  //生成验证码图片
+	getIndexData       xweb.Mapper `xweb:"/jyapp/free/front/getIndexData"`
+	limitSearchText    xweb.Mapper `xweb:"/jyapp/front/limitSearchText"`
+	index              xweb.Mapper `xweb:"/jyapp/free/index"`  //打开app跳转
+	kicked             xweb.Mapper `xweb:"/jyapp/free/kicked"` //被踢人之后跳转
+	setSeoVersion      xweb.Mapper `xweb:"/jyapp/free/setSeoVersion"`
+	receive            xweb.Mapper `xweb:"/jyapp/free/message/receive"`
+	jylabShareTimeline xweb.Mapper `xweb:"/jyapp/jylabShareTimeline"`
+	//修改强制分享主动分享状态和时间
+	updateShareStatus xweb.Mapper `xweb:"/jyapp/share/updateShareStatus"`
+	changePro         xweb.Mapper `xweb:"/jyapp/jylab/changePro"` //修改提示信息状态
+	hasPushHistory    xweb.Mapper `xweb:"/jyapp/front/hasPushHistory"`
+	showRedSpotOnMenu xweb.Mapper `xweb:"/jyapp/free/showRedSpotOnMenu"`
+	goToUpdate        xweb.Mapper `xweb:"/jyapp/free/goToUpdate"`
+	//许可协议及隐私政策 v2.9.4新增
+	policy          xweb.Mapper `xweb:"/jyapp/free/policy"`
+	pushMsgCallback xweb.Mapper `xweb:"/jyapp/pushmessage/callback"` //app客户端收到消息回调服务端地址
+
+	//静态页面通用地址
+	staticPage xweb.Mapper `xweb:"/jyapp/front/staticPage/(.+)"`
+	//商机管理推送
+	entnichePushList xweb.Mapper `xweb:"/jyapp/entniche/pushlist"`
+	entnichePush     xweb.Mapper `xweb:"/jyapp/entniche/push"`
+	delc             xweb.Mapper `xweb:"/jyapp/free/delcache/(.+)"` //删除模板缓存
+	iosExam          xweb.Mapper `xweb:"/jyapp/free/iosexam"`       //ios审核
+
+	downloadJyAppQrOther xweb.Mapper `xweb:"/jyapp/front/downloadJyApp/qrOther"` //扫码下载
+
+	qRCodePage xweb.Mapper `xweb:"/jyapp/free/qRCodePage"` //二维码页面
+
+	appConfig   xweb.Mapper `xweb:"/jyapp/free/config"`      //app配置项
+	shareDomain xweb.Mapper `xweb:"/jyapp/free/shareDomain"` //app分享 域名配置项
 }
 
 var sewx encrypt.SimpleEncrypt //微信的加密方法
@@ -90,427 +90,427 @@ var sortArray []string
 var mLock *sync.Mutex
 
 func init() {
-        mLock = new(sync.Mutex)
-        sewx = encrypt.SimpleEncrypt{Key: "topnet"}
-        xweb.AddAction(&Front{})
-        industrylist, sortArray = jy.Getindustrys(util.ObjToString(config.Sysconfig["industry"]), mongodb)
+	mLock = new(sync.Mutex)
+	sewx = encrypt.SimpleEncrypt{Key: "topnet"}
+	xweb.AddAction(&Front{})
+	industrylist, sortArray = jy.Getindustrys(util.ObjToString(config.Sysconfig["industry"]), mongodb)
 }
 
 func (f *Front) PushMsgCallback() {
-        f.ServeJson(map[string]interface{}{})
+	f.ServeJson(map[string]interface{}{})
 }
 
 // Policy 许可协议及隐私政策
 func (f *Front) Policy() {
-        status := 0
-        data := map[string]interface{}{}
-        policy := util.ObjToMap(config.Sysconfig["policy"])
-        title := util.ObjToString((*policy)["title"])
-        content := util.ObjToString((*policy)["content"])
-        href := util.ObjArrToStringArr((*policy)["href"].([]interface{}))
-        name := util.ObjArrToStringArr((*policy)["name"].([]interface{}))
-        if content != "" && title != "" {
-                status = 1
-                data = map[string]interface{}{
-                        "title":   title,
-                        "content": content,
-                        "href":    href,
-                        "name":    name,
-                }
-        }
-        //转义
-        f.ServeJson(map[string]interface{}{
-                "status": status,
-                "data":   data,
-        })
+	status := 0
+	data := map[string]interface{}{}
+	policy := util.ObjToMap(config.Sysconfig["policy"])
+	title := util.ObjToString((*policy)["title"])
+	content := util.ObjToString((*policy)["content"])
+	href := util.ObjArrToStringArr((*policy)["href"].([]interface{}))
+	name := util.ObjArrToStringArr((*policy)["name"].([]interface{}))
+	if content != "" && title != "" {
+		status = 1
+		data = map[string]interface{}{
+			"title":   title,
+			"content": content,
+			"href":    href,
+			"name":    name,
+		}
+	}
+	//转义
+	f.ServeJson(map[string]interface{}{
+		"status": status,
+		"data":   data,
+	})
 }
 
 func (m *Front) Receive() error {
-        defer util.Catch()
-        url_mid := m.GetString("url")
-        mid := ""
-        url := ""
-        if len(strings.Split(url_mid, "==")) > 1 {
-                mid = strings.Split(url_mid, "==")[1]
-                url = strings.Split(url_mid, "==")[0]
-        } else {
-                log.Println("非message消息通知")
-                return nil
-        }
-        recType := m.GetString("rectype")
-        //这是客户端发的请求,之前是openid,后来改成userid了,参数名没变还是openid,但值是userid
-        userId := m.GetString("openid")
-        if userId == "" {
-                userId, _ = m.GetSession("userId").(string)
-        }
-        defer mLock.Unlock()
-        mLock.Lock()
-        var ok = false
-        if recType == "D" && mid != "" && len([]rune(mid)) > 12 {
-                field := "i_delivery"
-                ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
-        } else if recType == "C" && mid != "" && len([]rune(mid)) > 12 {
-                field := "i_click"
-                //打开计算一次 是否已经打开过
-                if c := mongodb.Count("jyapp_notice", map[string]interface{}{
-                        "s_id":     mid, //信息id
-                        "s_userid": userId,
-                        "i_unread": 1, //1:未打开;0:已打开
-                }); c == 1 {
-                        //更新信息为已读状态
-                        mongodb.Update("jyapp_notice", map[string]interface{}{
-                                "s_id":     mid, //信息id
-                                "s_userid": userId,
-                        }, map[string]interface{}{
-                                "$set": map[string]interface{}{
-                                        "i_unread":    0,
-                                        "l_timestamp": time.Now().Unix(),
-                                },
-                        }, false, false)
-                        //信息总量打开率+1
-                        ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
-                }
-        } else if recType == "A" && mid != "" && len([]rune(mid)) > 12 {
-                field := "i_delivery"
-                field1 := "i_click"
-                //打开计算一次 是否已经打开过
-                if c := mongodb.Count("jyapp_notice", map[string]interface{}{
-                        "s_id":     mid, //信息id
-                        "s_userid": userId,
-                        "i_unread": 1, //1:未打开;0:已打开
-                }); c == 1 {
-                        ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1, field1: 1}})
-                        mongodb.Update("jyapp_notice", map[string]interface{}{
-                                "s_id":     mid, //信息id
-                                "s_userid": userId,
-                        }, map[string]interface{}{
-                                "$set": map[string]interface{}{
-                                        "i_unread":    0,
-                                        "l_timestamp": time.Now().Unix(),
-                                },
-                        }, false, false)
-                }
-        }
-        if ok {
-                go mesCaLog(mid, url, userId, recType)
-        } else {
-                log.Println(recType, "--err: $inc")
-        }
-        m.ServeJson(map[string]interface{}{
-                "flag": ok,
-        })
-        return nil
+	defer util.Catch()
+	url_mid := m.GetString("url")
+	mid := ""
+	url := ""
+	if len(strings.Split(url_mid, "==")) > 1 {
+		mid = strings.Split(url_mid, "==")[1]
+		url = strings.Split(url_mid, "==")[0]
+	} else {
+		log.Println("非message消息通知")
+		return nil
+	}
+	recType := m.GetString("rectype")
+	//这是客户端发的请求,之前是openid,后来改成userid了,参数名没变还是openid,但值是userid
+	userId := m.GetString("openid")
+	if userId == "" {
+		userId, _ = m.GetSession("userId").(string)
+	}
+	defer mLock.Unlock()
+	mLock.Lock()
+	var ok = false
+	if recType == "D" && mid != "" && len([]rune(mid)) > 12 {
+		field := "i_delivery"
+		ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
+	} else if recType == "C" && mid != "" && len([]rune(mid)) > 12 {
+		field := "i_click"
+		//打开计算一次 是否已经打开过
+		if c := mongodb.Count("jyapp_notice", map[string]interface{}{
+			"s_id":     mid, //信息id
+			"s_userid": userId,
+			"i_unread": 1, //1:未打开;0:已打开
+		}); c == 1 {
+			//更新信息为已读状态
+			mongodb.Update("jyapp_notice", map[string]interface{}{
+				"s_id":     mid, //信息id
+				"s_userid": userId,
+			}, map[string]interface{}{
+				"$set": map[string]interface{}{
+					"i_unread":    0,
+					"l_timestamp": time.Now().Unix(),
+				},
+			}, false, false)
+			//信息总量打开率+1
+			ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
+		}
+	} else if recType == "A" && mid != "" && len([]rune(mid)) > 12 {
+		field := "i_delivery"
+		field1 := "i_click"
+		//打开计算一次 是否已经打开过
+		if c := mongodb.Count("jyapp_notice", map[string]interface{}{
+			"s_id":     mid, //信息id
+			"s_userid": userId,
+			"i_unread": 1, //1:未打开;0:已打开
+		}); c == 1 {
+			ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1, field1: 1}})
+			mongodb.Update("jyapp_notice", map[string]interface{}{
+				"s_id":     mid, //信息id
+				"s_userid": userId,
+			}, map[string]interface{}{
+				"$set": map[string]interface{}{
+					"i_unread":    0,
+					"l_timestamp": time.Now().Unix(),
+				},
+			}, false, false)
+		}
+	}
+	if ok {
+		go mesCaLog(mid, url, userId, recType)
+	} else {
+		log.Println(recType, "--err: $inc")
+	}
+	m.ServeJson(map[string]interface{}{
+		"flag": ok,
+	})
+	return nil
 }
 
 func mesCaLog(mid, url, userId, recType string) {
-        defer util.Catch()
-        userData, ok1 := mongodb.FindById("user", userId, `{"s_province":1,"s_city":1,"s_nickname":1}`)
-        mesData, ok2 := mongodb.FindById("message_app", mid, `{"s_title":1,"s_subtitle":1}`)
-        if ok1 && ok2 && *mesData != nil && *userData != nil {
-                public.Mgo_Log.Save("jy_message", map[string]interface{}{
-                        "openid":   userId, //之前存的是openid,用户合并以后存的是userid
-                        "mid":      mid,
-                        "title":    util.ObjToString((*mesData)["s_title"]),
-                        "subtitle": util.ObjToString((*mesData)["s_subtitle"]),
-                        "province": util.ObjToString((*userData)["s_province"]),
-                        "city":     util.ObjToString((*userData)["s_city"]),
-                        "nickname": util.ObjToString((*userData)["s_nickname"]),
-                        "action":   recType, //S:发送 D:送达 C:打开
-                        "date":     time.Now().Unix(),
-                        "url":      url,
-                })
-        } else {
-                log.Println(mid, "-", userId, "mongodb 保存报错")
-        }
+	defer util.Catch()
+	userData, ok1 := mongodb.FindById("user", userId, `{"s_province":1,"s_city":1,"s_nickname":1}`)
+	mesData, ok2 := mongodb.FindById("message_app", mid, `{"s_title":1,"s_subtitle":1}`)
+	if ok1 && ok2 && *mesData != nil && *userData != nil {
+		public.Mgo_Log.Save("jy_message", map[string]interface{}{
+			"openid":   userId, //之前存的是openid,用户合并以后存的是userid
+			"mid":      mid,
+			"title":    util.ObjToString((*mesData)["s_title"]),
+			"subtitle": util.ObjToString((*mesData)["s_subtitle"]),
+			"province": util.ObjToString((*userData)["s_province"]),
+			"city":     util.ObjToString((*userData)["s_city"]),
+			"nickname": util.ObjToString((*userData)["s_nickname"]),
+			"action":   recType, //S:发送 D:送达 C:打开
+			"date":     time.Now().Unix(),
+			"url":      url,
+		})
+	} else {
+		log.Println(mid, "-", userId, "mongodb 保存报错")
+	}
 }
 
 func (m *Front) Wxerr() error {
-        return m.Render("/_err.html")
+	return m.Render("/_err.html")
 }
 func isInTSguide(userid string, session *httpsession.Session) bool {
-        if userid == "" {
-                return false
-        }
-        etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-        //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("10000", session, util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-        //付费用户无免费订阅,不进入订阅向导页面
-        if data.Data.Vip.Status > 0 || data.Data.Vip.Status > 0 {
-                return false
-        }
-        i_ts_guide := data.Data.Free.TsGuide
-        if i_ts_guide == 2 || (i_ts_guide == 0 && !data.Data.Free.FreeHasKey) {
-                return true
-        }
-        return false
+	if userid == "" {
+		return false
+	}
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	//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("10000", session, util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+	//付费用户无免费订阅,不进入订阅向导页面
+	if data.Data.Vip.Status > 0 || data.Data.Vip.Status > 0 {
+		return false
+	}
+	i_ts_guide := data.Data.Free.TsGuide
+	if i_ts_guide == 2 || (i_ts_guide == 0 && !data.Data.Free.FreeHasKey) {
+		return true
+	}
+	return false
 }
 func (m *Front) Feedback() error {
-        defer util.Catch()
-        userId, _ := m.GetSession("userId").(string)
-        list, _ := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
-        m.T["list"] = list
-        fkid := m.GetString("fkid")
-        if fkid != "" {
-                fkid = encrypt.DecodeArticleId2ByCheck(fkid)[0]
-        }
-        fromName := m.GetString("fromName")
-        if fromName != "" {
-                if fromName == "zndy" {
-                        fromName = "剑鱼标讯实验室-智能订阅"
-                } else if fromName == "sjdc" {
-                        fromName = "剑鱼标讯实验室-数据导出"
-                } else if fromName == "cjss" {
-                        fromName = "剑鱼标讯实验室-超级搜索"
-                } else if fromName == "zbqy" {
-                        fromName = "剑鱼标讯实验室-中标企业"
-                } else if fromName == "gzqy" {
-                        fromName = "剑鱼标讯实验室-关注企业"
-                }
-        }
-        _, m.T["advertText"] = getRewardText()
-        m.T["advertImg"] = config.Sysconfig["advertImg"]
-        m.T["advertName"] = config.Sysconfig["advertName"]
-        m.T["advertUrl"] = config.Sysconfig["advertUrl"]
-        m.T["fkid"] = fkid
-        m.T["fromName"] = fromName
-        return m.Render("/weixin/feedback.html", &m.T)
+	defer util.Catch()
+	userId, _ := m.GetSession("userId").(string)
+	list, _ := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
+	m.T["list"] = list
+	fkid := m.GetString("fkid")
+	if fkid != "" {
+		fkid = encrypt.DecodeArticleId2ByCheck(fkid)[0]
+	}
+	fromName := m.GetString("fromName")
+	if fromName != "" {
+		if fromName == "zndy" {
+			fromName = "剑鱼标讯实验室-智能订阅"
+		} else if fromName == "sjdc" {
+			fromName = "剑鱼标讯实验室-数据导出"
+		} else if fromName == "cjss" {
+			fromName = "剑鱼标讯实验室-超级搜索"
+		} else if fromName == "zbqy" {
+			fromName = "剑鱼标讯实验室-中标企业"
+		} else if fromName == "gzqy" {
+			fromName = "剑鱼标讯实验室-关注企业"
+		}
+	}
+	_, m.T["advertText"] = getRewardText()
+	m.T["advertImg"] = config.Sysconfig["advertImg"]
+	m.T["advertName"] = config.Sysconfig["advertName"]
+	m.T["advertUrl"] = config.Sysconfig["advertUrl"]
+	m.T["fkid"] = fkid
+	m.T["fromName"] = fromName
+	return m.Render("/weixin/feedback.html", &m.T)
 }
 
 // 招标订阅向导
 func (f *Front) TSGuide() error {
-        defer util.Catch()
-        userid := util.ObjToString(f.GetSession("userId"))
-        positionType := util.Int64All(f.GetSession("positionType"))
-        if f.Method() == "GET" {
-                if !isInTSguide(userid) {
-                        return f.Redirect("/jyapp/wxkeyset/keyset/index")
-                }
-                return f.Render("/weixin/wxtsguide.html")
-        } else {
-                reqType := f.GetString("reqType")
-                // index, _ := f.GetInteger("index")
-                result := make(bson.M)
-                if reqType == "save" {
-                        var keyMaps []map[string]interface{}
-                        keyWord := f.GetSlice("keyWord")
-                        area := f.GetString("area")
-                        if area == "" {
-                                result["flag"] = false
-                        } else { //20210930增加免费用户必须选择一个地区
-                                for _, v := range keyWord {
-                                        vs := processKeyword(v)
-                                        if vs == nil {
-                                                continue
-                                        }
-                                        //多个词合并成一个
-                                        key := ""
-                                        for _, vkeys := range vs {
-                                                key += vkeys
-                                        }
-                                        keyMaps = append(keyMaps, map[string]interface{}{
-                                                "key":      []string{key},
-                                                "infotype": []string{},
-                                                "notkey":   []string{},
-                                                "from":     1, //用于记录是否可以选择全国
-                                        })
-                                        if len(keyMaps) >= 10 {
-                                                break
-                                        }
-                                }
-                                areas := map[string]interface{}{
-                                        area: []string{},
-                                }
-                                saveData := bson.M{}
-                                if positionType == 0 {
-                                        saveData = bson.M{
-                                                "o_jy.o_area":       areas,
-                                                "o_jy.a_key":        keyMaps,
-                                                "o_jy.l_modifydate": time.Now().Unix(),
-                                                "i_ts_guide":        2,
-                                                "o_jy.i_newfree":    1,
-                                        }
-                                        result["flag"] = mongodb.UpdateById("user", userid, bson.M{"$set": saveData})
-                                } else {
-                                        saveData = bson.M{
-                                                "o_entniche.o_area":       areas,
-                                                "o_entniche.a_key":        keyMaps,
-                                                "o_entniche.l_modifydate": time.Now().Unix(),
-                                                "i_ts_guide":              2,
-                                                "o_entniche.i_newfree":    1,
-                                        }
-                                        query := map[string]interface{}{
-                                                "i_userid": util.Int64All(f.GetSession("entUserId")),
-                                                "i_entid":  util.Int64All(f.GetSession("entId")),
-                                                "i_type":   2,
-                                        }
-                                        result["flag"] = mongodb.Update("entniche_rule", query, map[string]interface{}{"$set": saveData}, true, false)
-                                }
-
-                        }
-                } else if reqType == "over" {
-                        saveData := bson.M{
-                                "i_ts_guide": 1,
-                        }
-                        if positionType == 0 {
-                                result["flag"] = mongodb.UpdateById("user", userid, bson.M{"$set": saveData})
-                        } else {
-                                query := map[string]interface{}{
-                                        "i_userid": util.Int64All(f.GetSession("entUserId")),
-                                        "i_entid":  util.Int64All(f.GetSession("entId")),
-                                        "i_type":   2,
-                                }
-                                result["flag"] = mongodb.Update("entniche_rule", query, map[string]interface{}{"$set": saveData}, true, false)
-                        }
-
-                } else if reqType == "preview" {
-                        rlt := elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
-                        if *rlt != nil && len(*rlt) > 0 {
-                                for _, v := range *rlt {
-                                        v["_id"] = encrypt.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
-                                }
-                        }
-                        result["data"] = rlt
-                }
-                if result["flag"] != nil && result["flag"].(bool) {
-                        jy.ClearBigVipUserPower(userid)
-                }
-                f.ServeJson(result)
-        }
-        return nil
+	defer util.Catch()
+	userid := util.ObjToString(f.GetSession("userId"))
+	positionType := util.Int64All(f.GetSession("positionType"))
+	if f.Method() == "GET" {
+		if !isInTSguide(userid, f.Session()) {
+			return f.Redirect("/jyapp/wxkeyset/keyset/index")
+		}
+		return f.Render("/weixin/wxtsguide.html")
+	} else {
+		reqType := f.GetString("reqType")
+		// index, _ := f.GetInteger("index")
+		result := make(bson.M)
+		if reqType == "save" {
+			var keyMaps []map[string]interface{}
+			keyWord := f.GetSlice("keyWord")
+			area := f.GetString("area")
+			if area == "" {
+				result["flag"] = false
+			} else { //20210930增加免费用户必须选择一个地区
+				for _, v := range keyWord {
+					vs := processKeyword(v)
+					if vs == nil {
+						continue
+					}
+					//多个词合并成一个
+					key := ""
+					for _, vkeys := range vs {
+						key += vkeys
+					}
+					keyMaps = append(keyMaps, map[string]interface{}{
+						"key":      []string{key},
+						"infotype": []string{},
+						"notkey":   []string{},
+						"from":     1, //用于记录是否可以选择全国
+					})
+					if len(keyMaps) >= 10 {
+						break
+					}
+				}
+				areas := map[string]interface{}{
+					area: []string{},
+				}
+				saveData := bson.M{}
+				if positionType == 0 {
+					saveData = bson.M{
+						"o_jy.o_area":       areas,
+						"o_jy.a_key":        keyMaps,
+						"o_jy.l_modifydate": time.Now().Unix(),
+						"i_ts_guide":        2,
+						"o_jy.i_newfree":    1,
+					}
+					result["flag"] = mongodb.UpdateById("user", userid, bson.M{"$set": saveData})
+				} else {
+					saveData = bson.M{
+						"o_entniche.o_area":       areas,
+						"o_entniche.a_key":        keyMaps,
+						"o_entniche.l_modifydate": time.Now().Unix(),
+						"i_ts_guide":              2,
+						"o_entniche.i_newfree":    1,
+					}
+					query := map[string]interface{}{
+						"i_userid": util.Int64All(f.GetSession("entUserId")),
+						"i_entid":  util.Int64All(f.GetSession("entId")),
+						"i_type":   2,
+					}
+					result["flag"] = mongodb.Update("entniche_rule", query, map[string]interface{}{"$set": saveData}, true, false)
+				}
+
+			}
+		} else if reqType == "over" {
+			saveData := bson.M{
+				"i_ts_guide": 1,
+			}
+			if positionType == 0 {
+				result["flag"] = mongodb.UpdateById("user", userid, bson.M{"$set": saveData})
+			} else {
+				query := map[string]interface{}{
+					"i_userid": util.Int64All(f.GetSession("entUserId")),
+					"i_entid":  util.Int64All(f.GetSession("entId")),
+					"i_type":   2,
+				}
+				result["flag"] = mongodb.Update("entniche_rule", query, map[string]interface{}{"$set": saveData}, true, false)
+			}
+
+		} else if reqType == "preview" {
+			rlt := elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
+			if *rlt != nil && len(*rlt) > 0 {
+				for _, v := range *rlt {
+					v["_id"] = encrypt.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
+				}
+			}
+			result["data"] = rlt
+		}
+		if result["flag"] != nil && result["flag"].(bool) {
+			jy.ClearBigVipUserPower(userid)
+		}
+		f.ServeJson(result)
+	}
+	return nil
 }
 
 // 查看原文中转
 func (f *Front) Transfer() error {
-        return f.Redirect(f.GetString("url"))
+	return f.Redirect(f.GetString("url"))
 }
 func (c *Front) Captcha() error {
-        id := captcha.NewLen(4) //此id为生成验证码的ID,并不是实际显示的数字,在提交校验时,需要根据此ID进行查询。
-        c.SetSession("CheckCodeId", id)
-        //校验时调用以下代码
-        //ccid,_:=c.GetSession("CheckCodeId").(string)
-        //captcha.VerifyString(ccid,"用户输入的校验码")//返回bool
-        w := c.ResponseWriter
-        w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-        w.Header().Set("Pragma", "no-cache")
-        w.Header().Set("Expires", "0")
-        w.Header().Set("Content-Type", "image/png")
-        return captcha.WriteImage(w, id, 90, 30)
+	id := captcha.NewLen(4) //此id为生成验证码的ID,并不是实际显示的数字,在提交校验时,需要根据此ID进行查询。
+	c.SetSession("CheckCodeId", id)
+	//校验时调用以下代码
+	//ccid,_:=c.GetSession("CheckCodeId").(string)
+	//captcha.VerifyString(ccid,"用户输入的校验码")//返回bool
+	w := c.ResponseWriter
+	w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+	w.Header().Set("Pragma", "no-cache")
+	w.Header().Set("Expires", "0")
+	w.Header().Set("Content-Type", "image/png")
+	return captcha.WriteImage(w, id, 90, 30)
 }
 
 func (m *Front) WxpushListInfo(_id string) error {
-        defer util.Catch()
-        return m.Redirect("/jyapp/swordfish/historypush")
+	defer util.Catch()
+	return m.Redirect("/jyapp/swordfish/historypush")
 }
 
 func (f *Front) LimitSearchText() {
-        userId, _ := f.GetSession("userId").(string)
-        if userId == "" || !public.Lst.IsCanLogin(userId) {
-                f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">需要登录!")
-                return
-        }
-        timeout, _ := f.GetInteger("t")
-        if timeout > 0 || timeout == -1 {
-                public.Lst.TimeOut = timeout
-        }
-        count, _ := f.GetInteger("c")
-        if (count > 0 || count == -1 || count == -2) && count != public.Lst.Count && public.Lst.Flag {
-                public.Lst.Count = count
-                public.Lst.Init()
-        }
-        flag, _ := f.GetInteger("f")
-        status := ""
-        if flag == -2 { //重置
-                status = "重置"
-                public.InitLimitSearchText(true, config.Sysconfig)
-        } else if flag == -1 && public.Lst.Flag { //关闭
-                status = "关闭"
-                public.Lst.Flag = false
-                public.Lst.Clear()
-        } else if flag == 1 && !public.Lst.Flag { //打开
-                status = "打开"
-                public.Lst.Flag = true
-                public.Lst.Init()
-        } else {
-                if public.Lst.Flag {
-                        status = "打开"
-                } else {
-                        status = "关闭"
-                }
-        }
-        totalPage, _ := f.GetInteger("p")
-        if totalPage > 0 && public.Lst.Flag {
-                public.Lst.TotalPage = totalPage
-        }
-        f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">" + fmt.Sprintf(public.Lst.Msg, status, public.Lst.Count, public.Lst.TimeOut, public.Lst.TotalPage))
+	userId, _ := f.GetSession("userId").(string)
+	if userId == "" || !public.Lst.IsCanLogin(userId) {
+		f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">需要登录!")
+		return
+	}
+	timeout, _ := f.GetInteger("t")
+	if timeout > 0 || timeout == -1 {
+		public.Lst.TimeOut = timeout
+	}
+	count, _ := f.GetInteger("c")
+	if (count > 0 || count == -1 || count == -2) && count != public.Lst.Count && public.Lst.Flag {
+		public.Lst.Count = count
+		public.Lst.Init()
+	}
+	flag, _ := f.GetInteger("f")
+	status := ""
+	if flag == -2 { //重置
+		status = "重置"
+		public.InitLimitSearchText(true, config.Sysconfig)
+	} else if flag == -1 && public.Lst.Flag { //关闭
+		status = "关闭"
+		public.Lst.Flag = false
+		public.Lst.Clear()
+	} else if flag == 1 && !public.Lst.Flag { //打开
+		status = "打开"
+		public.Lst.Flag = true
+		public.Lst.Init()
+	} else {
+		if public.Lst.Flag {
+			status = "打开"
+		} else {
+			status = "关闭"
+		}
+	}
+	totalPage, _ := f.GetInteger("p")
+	if totalPage > 0 && public.Lst.Flag {
+		public.Lst.TotalPage = totalPage
+	}
+	f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">" + fmt.Sprintf(public.Lst.Msg, status, public.Lst.Count, public.Lst.TimeOut, public.Lst.TotalPage))
 }
 
 func (f *Front) Index() error {
-        url := f.Url()
-        redirect := "/jyapp/jylab/mainSearch"
-        if strings.Contains(url, "sign=") && strings.Contains(url, "url=") && strings.Contains(url, "from=") {
-                wh := strings.Split(url, "?")
-                redirect = "/jyapp/free/login?" + wh[len(wh)-1]
-        }
-        return f.Redirect(redirect)
+	url := f.Url()
+	redirect := "/jyapp/jylab/mainSearch"
+	if strings.Contains(url, "sign=") && strings.Contains(url, "url=") && strings.Contains(url, "from=") {
+		wh := strings.Split(url, "?")
+		redirect = "/jyapp/free/login?" + wh[len(wh)-1]
+	}
+	return f.Redirect(redirect)
 }
 
 func (f *Front) Kicked() error {
-        return f.Redirect("/jyapp/free/login?back=index")
+	return f.Redirect("/jyapp/free/login?back=index")
 }
 
 // 设置js css 版本号,修改以后记得同步更新seo.json中的值
 func (f *Front) SetSeoVersion() {
-        //!@111qqq@! md5=51a3b7b4ed3cf140
-        if f.GetString("p") != "51a3b7b4ed3cf140" {
-                return
-        }
-        version := ""
-        if f.GetString("v") == "" {
-                version = config.Seoconfig_Version
-                if version == "" {
-                        version, _ = config.Seoconfig["version"].(string)
-                }
-        } else {
-                version = f.GetString("v")
-                config.Seoconfig_Version = version
-        }
-        //新的版本号 version作为固定版本号,非大版本不更改,mod_version 作为小版本号 经常变动;
-        mod_version := ""
-        if f.GetString("mv") == "" {
-                mod_version = config.Seoconfig_Mod_Version
-                if mod_version == "" {
-                        mod_version, _ = config.Seoconfig["mod_version"].(string)
-                }
-        } else {
-                mod_version = f.GetString("mv")
-                config.Seoconfig_Mod_Version = mod_version
-        }
-        f.Write("当前版本号:" + mod_version + "-固定版本号:" + version)
+	//!@111qqq@! md5=51a3b7b4ed3cf140
+	if f.GetString("p") != "51a3b7b4ed3cf140" {
+		return
+	}
+	version := ""
+	if f.GetString("v") == "" {
+		version = config.Seoconfig_Version
+		if version == "" {
+			version, _ = config.Seoconfig["version"].(string)
+		}
+	} else {
+		version = f.GetString("v")
+		config.Seoconfig_Version = version
+	}
+	//新的版本号 version作为固定版本号,非大版本不更改,mod_version 作为小版本号 经常变动;
+	mod_version := ""
+	if f.GetString("mv") == "" {
+		mod_version = config.Seoconfig_Mod_Version
+		if mod_version == "" {
+			mod_version, _ = config.Seoconfig["mod_version"].(string)
+		}
+	} else {
+		mod_version = f.GetString("mv")
+		config.Seoconfig_Mod_Version = mod_version
+	}
+	f.Write("当前版本号:" + mod_version + "-固定版本号:" + version)
 }
 
 func (f *Front) JylabShareTimeline() {
-        userId, _ := f.GetSession("userId").(string)
-        if userId == "" {
-                f.ServeJson(map[string]interface{}{
-                        "status": false,
-                })
-                return
-        }
-        reqType := f.GetString("reqType")
-        if reqType == "update" {
-                public.UpdateShareStatus(userId, "app", 3, 1, 0, false, config.Sysconfig)
-                f.ServeJson(map[string]interface{}{
-                        "status": true,
-                })
-        } else {
-                jylabsharetimeline := 1
-                if public.CheckUserNeedForceShare(userId, public.ShareType_lab, config.Sysconfig) {
-                        jylabsharetimeline = 0
-                }
-                f.ServeJson(map[string]interface{}{
-                        "jylabsharetimeline": jylabsharetimeline,
-                })
-        }
+	userId, _ := f.GetSession("userId").(string)
+	if userId == "" {
+		f.ServeJson(map[string]interface{}{
+			"status": false,
+		})
+		return
+	}
+	reqType := f.GetString("reqType")
+	if reqType == "update" {
+		public.UpdateShareStatus(userId, "app", 3, 1, 0, false, config.Sysconfig)
+		f.ServeJson(map[string]interface{}{
+			"status": true,
+		})
+	} else {
+		jylabsharetimeline := 1
+		if public.CheckUserNeedForceShare(userId, public.ShareType_lab, config.Sysconfig) {
+			jylabsharetimeline = 0
+		}
+		f.ServeJson(map[string]interface{}{
+			"jylabsharetimeline": jylabsharetimeline,
+		})
+	}
 }
 
 /*
@@ -521,212 +521,214 @@ shareType - 分享类型 1-详情页 2-推送列表 3-实验室
 shareProperty - 分享性质 1-被动分享 2-主动分享
 */
 func (s *Front) UpdateShareStatus() error {
-        userId, _ := s.GetSession("userId").(string)
-        shareType, _ := s.GetInt("shareType")
-        shareProperty, _ := s.GetInt("shareProperty")
-        public.UpdateShareStatus(userId, "app", shareType, shareProperty, 0, false, config.Sysconfig)
-        s.ServeJson(map[string]interface{}{})
-        return nil
+	userId, _ := s.GetSession("userId").(string)
+	shareType, _ := s.GetInt("shareType")
+	shareProperty, _ := s.GetInt("shareProperty")
+	public.UpdateShareStatus(userId, "app", shareType, shareProperty, 0, false, config.Sysconfig)
+	s.ServeJson(map[string]interface{}{})
+	return nil
 }
 func (s *Front) ChangePro() {
-        defer util.Catch()
-        userid := util.ObjToString(s.GetSession("userId"))
-        if userid != "" {
-                jylabutil.UpdateAuthory(userid, "i_tablepro", 1)
-        }
+	defer util.Catch()
+	userid := util.ObjToString(s.GetSession("userId"))
+	if userid != "" {
+		jylabutil.UpdateAuthory(userid, "i_tablepro", 1)
+	}
 }
 
 func (s *Front) ShowRedSpotOnMenu() {
-        defer util.Catch()
-        userid := util.ObjToString(s.GetSession("userId"))
-        if userid == "" {
-                token := s.GetString("token")
-                if token != "" {
-                        sign, status := analySign("显示小红点", token)
-                        if status == 1 {
-                                userid = sign.UserId //xxxxx
-                        }
-                }
-        }
-        subscribe, project, ent, notice := 0, 0, 0, 0
-        if userid != "" {
-                //user, 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}`)
-                etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-                user := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-                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 jy.SwitchService.IsMember(s.Session(), mongodb, public.Mysql) {
-                        subscribe = util.IntAll((*user)["i_member_apppushunread"])
-                } else if isNew {
-                        subscribe = 0
-                } else {
-                        subscribe = util.IntAll((*user)["i_apppushunread"])
-                }
-                memberStatus := user.Data.Member.Status
-                /* if s_member_mainid := util.ObjToString((*user)["s_member_mainid"]); s_member_mainid != "" && util.IntAll((*user)["i_member_sub_status"]) == 1 && memberStatus > 0 {
-                           uid = s_member_mainid
-                   } else {
-                           uid = userid
-                   }*/
-                if user.Data.Member.Pid != "" {
-                        uid = user.Data.Member.Pid
-                } else {
-                        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,
-                                "s_userid":        uid,
-                        }))
-                }
-                if memberStatus > 0 && powerMap[14] {
-                        project = util.IntAll(public.BaseMysql.Count("follow_project_monitor", map[string]interface{}{
-                                "i_apppushunread": 1,
-                                "s_userid":        uid,
-                        }))
-                }
-                notice = mongodb.Count("jyapp_notice", map[string]interface{}{
-                        "i_unread": 1,
-                        "s_userid": userid,
-                })
-        }
-        s.ServeJson(map[string]interface{}{
-                "subscribe":      subscribe,
-                "my":             project + ent + notice,
-                "notice":         notice,
-                "follow_project": project,
-                "follow_ent":     ent,
-        })
+	defer util.Catch()
+	userid := util.ObjToString(s.GetSession("userId"))
+	if userid == "" {
+		token := s.GetString("token")
+		if token != "" {
+			sign, status := analySign("显示小红点", token)
+			if status == 1 {
+				userid = sign.UserId //xxxxx
+			}
+		}
+	}
+	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}`)
+
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		user := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+		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(), "10000", util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"])) {
+				subscribe = util.IntAll((*users)["i_member_apppushunread"])
+			} else if isNew {
+				subscribe = 0
+			} else {
+				subscribe = util.IntAll((*users)["i_apppushunread"])
+			}
+		}
+		memberStatus := user.Data.Member.Status
+		/* if s_member_mainid := util.ObjToString((*user)["s_member_mainid"]); s_member_mainid != "" && util.IntAll((*user)["i_member_sub_status"]) == 1 && memberStatus > 0 {
+		           uid = s_member_mainid
+		   } else {
+		           uid = userid
+		   }*/
+		if user.Data.Member.Pid != "" {
+			uid = user.Data.Member.Pid
+		} else {
+			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,
+				"s_userid":        uid,
+			}))
+		}
+		if memberStatus > 0 && powerMap[14] {
+			project = util.IntAll(public.BaseMysql.Count("follow_project_monitor", map[string]interface{}{
+				"i_apppushunread": 1,
+				"s_userid":        uid,
+			}))
+		}
+		notice = mongodb.Count("jyapp_notice", map[string]interface{}{
+			"i_unread": 1,
+			"s_userid": userid,
+		})
+	}
+	s.ServeJson(map[string]interface{}{
+		"subscribe":      subscribe,
+		"my":             project + ent + notice,
+		"notice":         notice,
+		"follow_project": project,
+		"follow_ent":     ent,
+	})
 }
 
 func (s *Front) GoToUpdate() {
-        mustupdate := false
-        updateflag, _ := s.GetInt("mustupdate")
-        if updateflag == 1 {
-                mustupdate = true
-        }
-        s.T["update"] = config.Sysconfig["update"]
-        s.T["mustupdate"] = mustupdate
-        s.Render("/app/update.html")
+	mustupdate := false
+	updateflag, _ := s.GetInt("mustupdate")
+	if updateflag == 1 {
+		mustupdate = true
+	}
+	s.T["update"] = config.Sysconfig["update"]
+	s.T["mustupdate"] = mustupdate
+	s.Render("/app/update.html")
 }
 
 // 静态页面
 func (s *Front) StaticPage(pagename string) error {
-        return s.Render("/staticpage/" + pagename)
+	return s.Render("/staticpage/" + pagename)
 }
 
 // 商机管理推送列表 --- 下个版本删除
 func (s *Front) EntnichePushList() error {
-        pi := s.GetString("pi")
-        pn := s.GetString("pn")
-        if pi != "" && pn != "" {
-                d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
-                if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
-                        entId := util.IntAll(d_pn_s[1])
-                        entUserId := util.IntAll(d_pn_s[2])
-                        entName := encrypt.SE.Decode4HexByCheck(pn)
-                        s.SetSession("entId", entId)
-                        s.SetSession("entName", entName)
-                        s.SetSession("entUserId", entUserId)
-                }
-        }
-        return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("selectTime"))
+	pi := s.GetString("pi")
+	pn := s.GetString("pn")
+	if pi != "" && pn != "" {
+		d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
+		if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
+			entId := util.IntAll(d_pn_s[1])
+			entUserId := util.IntAll(d_pn_s[2])
+			entName := encrypt.SE.Decode4HexByCheck(pn)
+			s.SetSession("entId", entId)
+			s.SetSession("entName", entName)
+			s.SetSession("entUserId", entUserId)
+		}
+	}
+	return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("selectTime"))
 }
 
 // 商机管理推送
 func (s *Front) EntnichePush() error {
-        pi := s.GetString("pi")
-        pn := s.GetString("pn")
-        if pi != "" && pn != "" {
-                d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
-                if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
-                        entId := util.IntAll(d_pn_s[1])
-                        entUserId := util.IntAll(d_pn_s[2])
-                        entName := encrypt.SE.Decode4HexByCheck(pn)
-                        s.SetSession("entId", entId)
-                        s.SetSession("entName", entName)
-                        s.SetSession("entUserId", entUserId)
-                }
-        }
-        if s.GetString("type") == "nomsgtip" {
-                return s.Redirect("/page_entniche/page/subsetting/sub_entrance.html")
-        } else if s.GetString("type") == "subscribepush" {
-                return s.Redirect("/jyapp/swordfish/historypush?f=push&t=entniche&pushtime=" + s.GetString("time"))
-        } else if s.GetString("type") == "old_subscribepush" {
-                return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("time"))
-        }
-        return nil
+	pi := s.GetString("pi")
+	pn := s.GetString("pn")
+	if pi != "" && pn != "" {
+		d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
+		if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
+			entId := util.IntAll(d_pn_s[1])
+			entUserId := util.IntAll(d_pn_s[2])
+			entName := encrypt.SE.Decode4HexByCheck(pn)
+			s.SetSession("entId", entId)
+			s.SetSession("entName", entName)
+			s.SetSession("entUserId", entUserId)
+		}
+	}
+	if s.GetString("type") == "nomsgtip" {
+		return s.Redirect("/page_entniche/page/subsetting/sub_entrance.html")
+	} else if s.GetString("type") == "subscribepush" {
+		return s.Redirect("/jyapp/swordfish/historypush?f=push&t=entniche&pushtime=" + s.GetString("time"))
+	} else if s.GetString("type") == "old_subscribepush" {
+		return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("time"))
+	}
+	return nil
 }
 
 // 删除模板缓存
 func (f *Front) Delc(url string) {
-        f.App.TemplateMgr.CacheDelete(strings.Replace(url, "GG", "/", 1))
-        f.WriteBytes([]byte("清除路径:" + url))
+	f.App.TemplateMgr.CacheDelete(strings.Replace(url, "GG", "/", 1))
+	f.WriteBytes([]byte("清除路径:" + url))
 }
 
 func (f *Front) IosExam() {
-        isIosExam, isIosExamPhone, isVip, isEnt := IosExamInfo(f.Action, true, true)
-        showVip, showEnt := true, true
-        if isIosExam || isIosExamPhone {
-                if !isVip {
-                        showVip = false
-                }
-                if !isEnt {
-                        showEnt = false
-                }
-        }
-        f.ServeJson(map[string]interface{}{
-                "error_code": 0,
-                "data": map[string]interface{}{
-                        "showVip": showVip,
-                        "showEnt": showEnt,
-                },
-        })
+	isIosExam, isIosExamPhone, isVip, isEnt := IosExamInfo(f.Action, true, true)
+	showVip, showEnt := true, true
+	if isIosExam || isIosExamPhone {
+		if !isVip {
+			showVip = false
+		}
+		if !isEnt {
+			showEnt = false
+		}
+	}
+	f.ServeJson(map[string]interface{}{
+		"error_code": 0,
+		"data": map[string]interface{}{
+			"showVip": showVip,
+			"showEnt": showEnt,
+		},
+	})
 }
 
 func (f *Front) DownloadJyAppQrOther() error {
-        w := f.ResponseWriter
-        w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-        w.Header().Set("Pragma", "no-cache")
-        w.Header().Set("Expires", "0")
-        w.Header().Set("Content-Type", "image/png")
-        discored := f.GetString("discored")
-        data := config.Seoconfig["jyDomain"].(string) + "/X/" + discored
-        r, _ := qr.Encode(data, qr.M)
-        pngdat := r.PNG()
-        _, err := w.Write(pngdat)
-        return err
+	w := f.ResponseWriter
+	w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+	w.Header().Set("Pragma", "no-cache")
+	w.Header().Set("Expires", "0")
+	w.Header().Set("Content-Type", "image/png")
+	discored := f.GetString("discored")
+	data := config.Seoconfig["jyDomain"].(string) + "/X/" + discored
+	r, _ := qr.Encode(data, qr.M)
+	pngdat := r.PNG()
+	_, err := w.Write(pngdat)
+	return err
 }
 
 // QRCodePage 静态页面
 func (s *Front) QRCodePage() error {
-        s.T["path"] = s.GetString("path")
-        return s.Render("/weixin/sharePic.html")
+	s.T["path"] = s.GetString("path")
+	return s.Render("/weixin/sharePic.html")
 }
 
 func (s *Front) AppConfig() {
-        s.ServeJson(config.Sysconfig["appConfig"])
+	s.ServeJson(config.Sysconfig["appConfig"])
 }
 
 // app微信分享域名
 func (s *Front) ShareDomain() {
-        s.ServeJson(config.Seoconfig["wxDomain"].(string))
+	s.ServeJson(config.Seoconfig["wxDomain"].(string))
 }

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

@@ -286,11 +286,11 @@ func (l *Login) Sess(ostr string) error {
 			var identity *pb.Identity
 			if str[1] == "userId" || str[1] == "entUserId" || str[1] == "positionId" {
 				if str[1] == "userId" {
-					identity = config.Middleground.UserCenter.IdentityByUserId(util.Int64All(loginId))
+					identity = config.Middleground.UserCenter.IdentityByUserId(qutil.Int64All(loginId))
 				} else if str[1] == "entUserId" {
-					identity = config.Middleground.UserCenter.IdentityByEntUserId(util.Int64All(loginId))
+					identity = config.Middleground.UserCenter.IdentityByEntUserId(qutil.Int64All(loginId))
 				} else if str[1] == "positionId" {
-					identity = config.Middleground.UserCenter.IdentityByPositionId(util.Int64All(loginId))
+					identity = config.Middleground.UserCenter.IdentityByPositionId(qutil.Int64All(loginId))
 				}
 				if identity != nil {
 					if createSession(l.Session(), nil, fmt.Sprint(identity.UserId), 3, l.ResponseWriter) {
@@ -309,13 +309,13 @@ func (l *Login) Sess(ostr string) error {
 				}
 				if createSession(l.Session(), nil, loginId, loginType, l.ResponseWriter) {
 					hasSession = true
-					identity = config.Middleground.UserCenter.IdentityByUserId(util.Int64All(m.GetSession("base_user_id")))
+					identity = config.Middleground.UserCenter.IdentityByUserId(qutil.Int64All(l.GetSession("base_user_id")))
 				} else {
 					log.Println("创建session失败", str)
 				}
 			}
 			if identity != nil {
-				hasSession = hasSession && NewIdentityInfo(identity).Switch(m.Session())
+				hasSession = hasSession && NewIdentityInfo(identity).Switch(l.Session())
 			} else {
 				log.Println("获取用户身份信息失败", str)
 			}
@@ -331,13 +331,13 @@ func (l *Login) Sess(ostr string) error {
 					var entUserId int64
 					if strings.HasPrefix(strs[2], "V20221215-") {
 						entParams := strings.Split(sewx.Decode4HexByCheck(strings.TrimPrefix(strs[2], "V20221215-")), "_")
-						entUserId := qutil.Int64All(entParams[1])
+						entUserId = qutil.Int64All(entParams[1])
 					} else {
 						entParams := strings.Split(sewx.DecodeString(strs[2]), "_")
-						entUserId := qutil.Int64All(entParams[1])
+						entUserId = qutil.Int64All(entParams[1])
 					}
 					if identity := config.Middleground.UserCenter.IdentityByEntUserId(entUserId); identity != nil {
-						NewIdentityInfo(identity).Switch(m.Session())
+						NewIdentityInfo(identity).Switch(l.Session())
 					}
 				}
 			} else {

+ 508 - 509
src/jfw/modules/app/src/app/front/swordfish.go

@@ -1,381 +1,380 @@
 package front
 
 import (
-        "fmt"
-        _ "jy/src/jfw/modules/app/src/app/filter"
-        . "jy/src/jfw/modules/app/src/app/jyutil"
-        "jy/src/jfw/modules/app/src/jfw/config"
-        "log"
-        "math/rand"
-        "strings"
-        "time"
+	"fmt"
+	_ "jy/src/jfw/modules/app/src/app/filter"
+	. "jy/src/jfw/modules/app/src/app/jyutil"
+	"jy/src/jfw/modules/app/src/jfw/config"
+	"log"
+	"math/rand"
+	"strings"
+	"time"
 
-        . "app.yhyue.com/moapp/jybase/date"
+	. "app.yhyue.com/moapp/jybase/date"
 
-        util "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/encrypt"
-        . "app.yhyue.com/moapp/jybase/mongodb"
-        "app.yhyue.com/moapp/jybase/redis"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "app.yhyue.com/moapp/jypkg/public"
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	. "app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"app.yhyue.com/moapp/jypkg/public"
 
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/bidsearch"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/bidsearch"
 
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "go.mongodb.org/mongo-driver/bson"
-        "go.mongodb.org/mongo-driver/bson/primitive"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 
 const (
-        INDEX             = "bidding"
-        TYPE              = "bidding"
-        FINDF             = `"title"`
-        bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","s_subscopeclass","buyerclass","bidamount","budget","spidercode","site"`
-        bidSearch_field   = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
+	INDEX             = "bidding"
+	TYPE              = "bidding"
+	FINDF             = `"title"`
+	bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","s_subscopeclass","buyerclass","bidamount","budget","spidercode","site"`
+	bidSearch_field   = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
 )
 
 // 剑鱼标讯推送三级页点赞暂弃 改成剑鱼标讯实验室点赞功能
 func (m *Front) Praise() error {
-        defer util.Catch()
-        var flag = "F"
-        var praiseflag = true
-        thistype := m.GetString("type")
-        uod := m.GetString("uod")
-        util.Try(func() {
-                pdata, _ := mongodb.FindOneByField("praise", `{"s_type":"`+thistype+`"}`, `{"s_no":1}`)
-                if len(*pdata) != 0 {
-                        if uod == "U" {
-                                praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : 1 }}`, false, false)
-                        } else {
-                                praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : -1 }}`, false, false)
-                        }
-                        if praiseflag {
-                                flag = "T"
-                        }
-                }
-        }, func(e interface{}) {
-                log.Println("剑鱼标讯实验室点赞出错", e)
-        })
-        m.ServeJson(map[string]interface{}{
-                "flag": flag,
-        })
-        return nil
+	defer util.Catch()
+	var flag = "F"
+	var praiseflag = true
+	thistype := m.GetString("type")
+	uod := m.GetString("uod")
+	util.Try(func() {
+		pdata, _ := mongodb.FindOneByField("praise", `{"s_type":"`+thistype+`"}`, `{"s_no":1}`)
+		if len(*pdata) != 0 {
+			if uod == "U" {
+				praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : 1 }}`, false, false)
+			} else {
+				praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : -1 }}`, false, false)
+			}
+			if praiseflag {
+				flag = "T"
+			}
+		}
+	}, func(e interface{}) {
+		log.Println("剑鱼标讯实验室点赞出错", e)
+	})
+	m.ServeJson(map[string]interface{}{
+		"flag": flag,
+	})
+	return nil
 }
 
 // 剑鱼标讯保存
 func (m *Front) AjaxReq() error {
-        defer util.Catch()
-        reqType := m.GetString("reqType")
-        var flag = "n"
-        switch reqType {
-        case "feedback": //意见反馈
-                data := make(map[string]interface{})
-                userId, ok := m.GetSession("userId").(string)
-                if !ok || userId == "" {
-                        break
-                }
-                userInfo, ok := mongodb.FindById("user", userId, nil)
-                if !ok {
-                        break
-                }
-                data["i_type"] = 8
-                data["s_fromName"] = m.GetString("fromName")
-                value := m.GetString("value")
-                if len([]rune(value)) > 200 {
-                        value = util.SubString(value, 0, 200)
-                }
-                data["s_remark"] = value
-                //
-                s_name := ""
-                if (*userInfo)["s_name"] != nil {
-                        s_name, _ = (*userInfo)["s_name"].(string)
-                }
-                s_nickname := ""
-                if (*userInfo)["s_nickname"] != nil {
-                        s_nickname, _ = (*userInfo)["s_nickname"].(string)
-                }
-                s_phone, _ := (*userInfo)["s_phone"].(string)
-                if s_name != "" {
-                        data["s_submitname"] = s_name
-                } else if s_nickname != "" {
-                        data["s_submitname"] = s_nickname
-                } else if s_phone != "" {
-                        data["s_submitname"] = s_phone
-                } else {
-                        data["s_submitname"] = userId
-                }
-                //
-                if s_nickname != "" { //昵称
-                        data["s_username"] = s_nickname
-                } else if s_name != "" { //s_name
-                        data["s_username"] = s_name
-                } else if s_phone != "" {
-                        data["s_username"] = s_phone
-                } else { //userId
-                        data["s_username"] = userId
-                }
-                //
-                data["s_submitid"] = userId
-                data["s_title"] = m.GetString("title")
-                data["i_status"] = 0
-                data["l_submitdate"] = time.Now().Unix()
-                data["s_source"] = m.GetString("source")
-                data["s_fkid"] = m.GetString("fkid")
-                data["s_from"] = "app"
-                if len(mongodb.Save("interaction", data)) > 0 {
-                        flag = "y"
-                }
-                break
-        case "subscribe": //直接订阅
-                if userid := util.ObjToString(m.GetSession("userId")); userid != "" {
-                        r, _ := mongodb.FindById("user", userid, `{"o_jy":1}`)
-                        o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
-                        //o_jy, _ := (*r)["o_jy"].(map[string]interface{})
-                        a_key, _ := (*o_jy)["a_key"].([]interface{})
-                        keysArray := processKeyword(m.GetString("keys"))
-                        if keysArray == nil {
-                                break
-                        }
-                        var isExists bool
-                        for _, v := range a_key {
-                                //count := 0
-                                //for _, kay := range keysArray {
-                                keyMap, _ := v.(map[string]interface{})
-                                key, _ := keyMap["key"].([]interface{})
-                                kystr := ""
-                                for _, ky := range key {
-                                        kystr = kystr + " " + ky.(string)
-                                }
-                                if strings.TrimSpace(m.GetString("keys")) == strings.TrimSpace(kystr) {
-                                        isExists = true
-                                        flag = "y"
-                                        break
-                                }
-                        }
-                        positionType := util.Int64All(m.GetSession("positionType"))
-                        //如果不存在
-                        ok := false
-                        if !isExists {
-                                if len(a_key) >= 10 {
-                                        flag = "o"
-                                } else {
+	defer util.Catch()
+	reqType := m.GetString("reqType")
+	var flag = "n"
+	switch reqType {
+	case "feedback": //意见反馈
+		data := make(map[string]interface{})
+		userId, ok := m.GetSession("userId").(string)
+		if !ok || userId == "" {
+			break
+		}
+		userInfo, ok := mongodb.FindById("user", userId, nil)
+		if !ok {
+			break
+		}
+		data["i_type"] = 8
+		data["s_fromName"] = m.GetString("fromName")
+		value := m.GetString("value")
+		if len([]rune(value)) > 200 {
+			value = util.SubString(value, 0, 200)
+		}
+		data["s_remark"] = value
+		//
+		s_name := ""
+		if (*userInfo)["s_name"] != nil {
+			s_name, _ = (*userInfo)["s_name"].(string)
+		}
+		s_nickname := ""
+		if (*userInfo)["s_nickname"] != nil {
+			s_nickname, _ = (*userInfo)["s_nickname"].(string)
+		}
+		s_phone, _ := (*userInfo)["s_phone"].(string)
+		if s_name != "" {
+			data["s_submitname"] = s_name
+		} else if s_nickname != "" {
+			data["s_submitname"] = s_nickname
+		} else if s_phone != "" {
+			data["s_submitname"] = s_phone
+		} else {
+			data["s_submitname"] = userId
+		}
+		//
+		if s_nickname != "" { //昵称
+			data["s_username"] = s_nickname
+		} else if s_name != "" { //s_name
+			data["s_username"] = s_name
+		} else if s_phone != "" {
+			data["s_username"] = s_phone
+		} else { //userId
+			data["s_username"] = userId
+		}
+		//
+		data["s_submitid"] = userId
+		data["s_title"] = m.GetString("title")
+		data["i_status"] = 0
+		data["l_submitdate"] = time.Now().Unix()
+		data["s_source"] = m.GetString("source")
+		data["s_fkid"] = m.GetString("fkid")
+		data["s_from"] = "app"
+		if len(mongodb.Save("interaction", data)) > 0 {
+			flag = "y"
+		}
+		break
+	case "subscribe": //直接订阅
+		if userid := util.ObjToString(m.GetSession("userId")); userid != "" {
+			//r, _ := mongodb.FindById("user", userid, `{"o_jy":1}`)
+			o_jy := jy.GetSubScribeInfo(m.Session(), mongodb, "f", "10000")
+			//o_jy, _ := (*r)["o_jy"].(map[string]interface{})
+			a_key, _ := (*o_jy)["a_key"].([]interface{})
+			keysArray := processKeyword(m.GetString("keys"))
+			if keysArray == nil {
+				break
+			}
+			var isExists bool
+			for _, v := range a_key {
+				//count := 0
+				//for _, kay := range keysArray {
+				keyMap, _ := v.(map[string]interface{})
+				key, _ := keyMap["key"].([]interface{})
+				kystr := ""
+				for _, ky := range key {
+					kystr = kystr + " " + ky.(string)
+				}
+				if strings.TrimSpace(m.GetString("keys")) == strings.TrimSpace(kystr) {
+					isExists = true
+					flag = "y"
+					break
+				}
+			}
+			positionType := util.Int64All(m.GetSession("positionType"))
+			//如果不存在
+			ok := false
+			if !isExists {
+				if len(a_key) >= 10 {
+					flag = "o"
+				} else {
 
-                                        if positionType == 0 {
-                                                ok = mongodb.UpdateById("user", userid,
-                                                        bson.M{
-                                                                "$push": bson.M{"o_jy.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
-                                                                "$set":  bson.M{"i_ts_guide": 1, "o_jy.l_modifydate": time.Now().Unix()},
-                                                        })
-                                        } else {
-                                                query := map[string]interface{}{
-                                                        "i_userid": util.Int64All(m.GetSession("entUserId")),
-                                                        "i_entid":  util.Int64All(m.GetSession("entId")),
-                                                        "i_type":   2,
-                                                }
-                                                if mongodb.Update("entniche_rule", query, bson.M{
-                                                        "$push": bson.M{"o_entniche.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
-                                                        "$set":  bson.M{"i_ts_guide": 1, "o_entniche.l_modifydate": time.Now().Unix()},
-                                                }, true, false) {
-                                                        ok = true
-                                                }
-                                        }
-                                        if ok {
-                                                flag = "y"
-                                        }
-                                }
-                        } else {
-                                /* if mongodb.UpdateById("user", userid,
-                                        bson.M{
-                                                "$set": bson.M{"i_ts_guide": 1},
-                                        }) {
-                                        flag = "y"
-                                }*/
-                                query := map[string]interface{}{
-                                        "i_userid": util.Int64All(m.GetSession("entUserId")),
-                                        "i_entid":  util.Int64All(m.GetSession("entId")),
-                                        "i_type":   2,
-                                }
-                                if mongodb.Update("entniche_rule", query, bson.M{
-                                        "$push": bson.M{"o_entniche.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
-                                        "$set":  bson.M{"i_ts_guide": 1, "o_entniche.l_modifydate": time.Now().Unix()},
-                                }, true, false) {
-                                        flag = "y"
-                                }
-                        }
-                }
-                break
-        }
-        m.ServeJson(map[string]interface{}{
-                "flag": flag,
-        })
-        return nil
+					if positionType == 0 {
+						ok = mongodb.UpdateById("user", userid,
+							bson.M{
+								"$push": bson.M{"o_jy.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
+								"$set":  bson.M{"i_ts_guide": 1, "o_jy.l_modifydate": time.Now().Unix()},
+							})
+					} else {
+						query := map[string]interface{}{
+							"i_userid": util.Int64All(m.GetSession("entUserId")),
+							"i_entid":  util.Int64All(m.GetSession("entId")),
+							"i_type":   2,
+						}
+						if mongodb.Update("entniche_rule", query, bson.M{
+							"$push": bson.M{"o_entniche.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
+							"$set":  bson.M{"i_ts_guide": 1, "o_entniche.l_modifydate": time.Now().Unix()},
+						}, true, false) {
+							ok = true
+						}
+					}
+					if ok {
+						flag = "y"
+					}
+				}
+			} else {
+				/* if mongodb.UpdateById("user", userid,
+				        bson.M{
+				                "$set": bson.M{"i_ts_guide": 1},
+				        }) {
+				        flag = "y"
+				}*/
+				query := map[string]interface{}{
+					"i_userid": util.Int64All(m.GetSession("entUserId")),
+					"i_entid":  util.Int64All(m.GetSession("entId")),
+					"i_type":   2,
+				}
+				if mongodb.Update("entniche_rule", query, bson.M{
+					"$push": bson.M{"o_entniche.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
+					"$set":  bson.M{"i_ts_guide": 1, "o_entniche.l_modifydate": time.Now().Unix()},
+				}, true, false) {
+					flag = "y"
+				}
+			}
+		}
+		break
+	}
+	m.ServeJson(map[string]interface{}{
+		"flag": flag,
+	})
+	return nil
 }
 
 // 获取我的反馈列表
 func (f *Front) MyFeedbacks() error {
-        userId, _ := f.GetSession("userId").(string)
-        if userId == "" {
-                return f.Redirect("/jyapp/free/mob/err")
-        }
-        list, ok := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
-        if !ok {
-                return f.Redirect("/jyapp/free/mob/err")
-        }
-        mongodb.Update("jyapp_notice", map[string]interface{}{
-                "s_userid": util.ObjToString(f.GetSession("userId")),
-                "s_type":   "feedback",
-        }, map[string]interface{}{
-                "$set": map[string]interface{}{
-                        "i_unread":    0,
-                        "l_timestamp": time.Now().Unix(),
-                },
-        }, false, true)
-        if f.Method() == "GET" {
-                f.T["list"] = list
-                f.T["flag"] = true
-                return f.Render("/weixin/feedback.html")
-        }
-        f.ServeJson(map[string]interface{}{
-                "list": list,
-        })
-        return nil
+	userId, _ := f.GetSession("userId").(string)
+	if userId == "" {
+		return f.Redirect("/jyapp/free/mob/err")
+	}
+	list, ok := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
+	if !ok {
+		return f.Redirect("/jyapp/free/mob/err")
+	}
+	mongodb.Update("jyapp_notice", map[string]interface{}{
+		"s_userid": util.ObjToString(f.GetSession("userId")),
+		"s_type":   "feedback",
+	}, map[string]interface{}{
+		"$set": map[string]interface{}{
+			"i_unread":    0,
+			"l_timestamp": time.Now().Unix(),
+		},
+	}, false, true)
+	if f.Method() == "GET" {
+		f.T["list"] = list
+		f.T["flag"] = true
+		return f.Render("/weixin/feedback.html")
+	}
+	f.ServeJson(map[string]interface{}{
+		"list": list,
+	})
+	return nil
 }
 
 func getRewardText() (string, string) {
-        rewardText, _ := config.Sysconfig["rewardText"].([]interface{})
-        advertText, _ := config.Sysconfig["advertText"].([]interface{})
-        randVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(rewardText))
-        if len(advertText) != 0 {
-                advVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(advertText))
-                return util.ObjToString(rewardText[randVal]), util.ObjToString(advertText[advVal])
-        } else {
-                return util.ObjToString(rewardText[randVal]), ""
-        }
+	rewardText, _ := config.Sysconfig["rewardText"].([]interface{})
+	advertText, _ := config.Sysconfig["advertText"].([]interface{})
+	randVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(rewardText))
+	if len(advertText) != 0 {
+		advVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(advertText))
+		return util.ObjToString(rewardText[randVal]), util.ObjToString(advertText[advVal])
+	} else {
+		return util.ObjToString(rewardText[randVal]), ""
+	}
 }
 func (m *Front) About() error {
-        return m.Render("/weixin/about.html")
+	return m.Render("/weixin/about.html")
 }
 func (m *Front) WxsearchlistPaging() {
-        defer util.Catch()
-        var list *[]map[string]interface{}
-
-        pageNum, _ := m.GetInteger("pageNum")
-        searchvalue := strings.TrimSpace(m.GetString("searchvalue"))
-        userid := util.ObjToString(m.GetSession("userId"))
-        if userid != "" {
-                //历史记录
-                history := redis.GetStr("other", "s_"+userid)
-                arrs := bidsearch.AddHistory(history, searchvalue)
-                redis.Del("other", "s_"+userid)
-                redis.Put("other", "s_"+userid, strings.Join(arrs, ","), -1)
-                m.T["history"] = arrs
-        }
+	defer util.Catch()
+	var list *[]map[string]interface{}
 
-        isLimit := 1
-        var (
-                b_word, a_word string
-                secondKWS      = ""
-                secondFlag     = ""
-                queryItems     []string
-                isPayedUser    bool
-                hasNextPage    bool
-                secondList     []map[string]interface{}
-                fileExists     = ""
-                city           = ""
-        )
+	pageNum, _ := m.GetInteger("pageNum")
+	searchvalue := strings.TrimSpace(m.GetString("searchvalue"))
+	userid := util.ObjToString(m.GetSession("userId"))
+	if userid != "" {
+		//历史记录
+		history := redis.GetStr("other", "s_"+userid)
+		arrs := bidsearch.AddHistory(history, searchvalue)
+		redis.Del("other", "s_"+userid)
+		redis.Put("other", "s_"+userid, strings.Join(arrs, ","), -1)
+		m.T["history"] = arrs
+	}
 
-        if searchvalue != "" {
-                selectType := m.GetString("selectType")
-                subtype := m.GetString("subtype")
-                scope := m.GetString("scope")
-                publishtime := m.GetString("publishtime")
-                industry := strings.TrimSpace(m.GetString("industry"))
-                minprice := m.GetString("minprice")
-                maxprice := m.GetString("maxprice")
-                winner := "" //仅大会员用户可以查询中标企业
-                //高级筛选 仅vip用户可查询
-                var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
-                buyerclass := ""                              //采购单位类别
-                var notkey string = ""                        //排除词
-                fileExists = m.GetString("fileExists")        //是否有附件--所有用户都可用此功能 0:全部;1:有附件;-1:无附件
+	isLimit := 1
+	var (
+		b_word, a_word string
+		secondKWS      = ""
+		secondFlag     = ""
+		queryItems     []string
+		isPayedUser    bool
+		hasNextPage    bool
+		secondList     []map[string]interface{}
+		fileExists     = ""
+		city           = ""
+	)
 
-                isPayedUser, publishtime, queryItems, pageNum, _ = bidsearch.PublicSearch(userid, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), pageNum, 50)
-                if isPayedUser {
-                        buyerclass = m.GetString("buyerclass")
-                        hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
-                        notkey = m.GetString("notkey")
-                        city = m.GetString("city")
-                }
-                //校验是否有大会员中标企业查询权限
-                etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
-                bigBaseMsg := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
-                if bigBaseMsg.CheckBigVipBackPower("search") {
-                        winner = m.GetString("winner")
-                }
-                //全文检索限制
-                searchLimit := public.IsSearchLimit(queryItems)
-                if searchLimit {
-                        //limitFlag = public.Lst.Flag
-                        isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session(), isPayedUser)
-                        if isLimit == 1 { //没有被限制
-                                defer public.Lst.Limit()
-                        }
-                }
-                //第一页数据展示多字段(table表格需要)
-                filed := bidSearch_field_1
-                if pageNum == 1 {
-                        filed = bidSearch_field
-                }
-                if isLimit == 1 {
-                        secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("app", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, pageNum, true, queryItems, filed, notkey, isPayedUser, false, "", bidsearch.SearchPageSize_APP, config.Sysconfig)
-                }
-        }
+	if searchvalue != "" {
+		selectType := m.GetString("selectType")
+		subtype := m.GetString("subtype")
+		scope := m.GetString("scope")
+		publishtime := m.GetString("publishtime")
+		industry := strings.TrimSpace(m.GetString("industry"))
+		minprice := m.GetString("minprice")
+		maxprice := m.GetString("maxprice")
+		winner := "" //仅大会员用户可以查询中标企业
+		//高级筛选 仅vip用户可查询
+		var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
+		buyerclass := ""                              //采购单位类别
+		var notkey string = ""                        //排除词
+		fileExists = m.GetString("fileExists")        //是否有附件--所有用户都可用此功能 0:全部;1:有附件;-1:无附件
+		etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+		isPayedUser, publishtime, queryItems, pageNum, _ = bidsearch.PublicSearch(userid, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), pageNum, 50, "10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+		if isPayedUser {
+			buyerclass = m.GetString("buyerclass")
+			hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
+			notkey = m.GetString("notkey")
+			city = m.GetString("city")
+		}
+		//校验是否有大会员中标企业查询权限
+		bigBaseMsg := jy.GetBigVipUserBaseMsg("10000", m.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
+		if bigBaseMsg.CheckBigVipBackPower("search") {
+			winner = m.GetString("winner")
+		}
+		//全文检索限制
+		searchLimit := public.IsSearchLimit(queryItems)
+		if searchLimit {
+			//limitFlag = public.Lst.Flag
+			isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session(), isPayedUser)
+			if isLimit == 1 { //没有被限制
+				defer public.Lst.Limit()
+			}
+		}
+		//第一页数据展示多字段(table表格需要)
+		filed := bidSearch_field_1
+		if pageNum == 1 {
+			filed = bidSearch_field
+		}
+		if isLimit == 1 {
+			secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("app", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, pageNum, true, queryItems, filed, notkey, isPayedUser, false, "", bidsearch.SearchPageSize_APP, config.Sysconfig)
+		}
+	}
 
-        secondList, _, hasNextPage = bidsearch.LisetData(3, pageNum, list, secondFlag, config.Seoconfig, isPayedUser, 50, userid)
-        m.ServeJson(map[string]interface{}{
-                "limitFlag":     false,
-                "status":        isLimit,
-                "list":          list,
-                "hasNextPage":   hasNextPage,
-                "history":       m.T["history"],
-                "msgset":        m.T["msgset"],
-                "interceptWord": a_word,
-                "keyWord":       b_word,
-                "isLogin":       m.GetSession("userId") != nil,
-                "secondFlag":    secondFlag,
-                "secondList":    secondList,
-                "secondKWS":     secondKWS,
-        })
+	secondList, _, hasNextPage = bidsearch.LisetData(3, pageNum, list, secondFlag, config.Seoconfig, isPayedUser, 50, userid)
+	m.ServeJson(map[string]interface{}{
+		"limitFlag":     false,
+		"status":        isLimit,
+		"list":          list,
+		"hasNextPage":   hasNextPage,
+		"history":       m.T["history"],
+		"msgset":        m.T["msgset"],
+		"interceptWord": a_word,
+		"keyWord":       b_word,
+		"isLogin":       m.GetSession("userId") != nil,
+		"secondFlag":    secondFlag,
+		"secondList":    secondList,
+		"secondKWS":     secondKWS,
+	})
 
 }
 
 // 预览结果
 func (m *Front) WxpushView() error {
-        defer util.Catch()
-        userid := util.ObjToString(m.GetSession("userId"))
-        if userid == "" {
-                return m.Redirect("/jyapp/login")
-        }
-        a_key, list := public.PushViewDatas(userid, "", bidSearch_field_1, 1, bidsearch.SearchPageSize_APP)
-        public.BidListConvert("", list)
-        m.T["firstPage"] = list
-        m.T["hasNextPage"] = list != nil && len(*list) == bidsearch.SearchPageSize_APP
-        m.T["pageSize"] = bidsearch.SearchPageSize_APP
-        m.T["a_key"] = a_key
-        return m.Render("/weixin/resultpreview.html", &m.T)
+	defer util.Catch()
+	userid := util.ObjToString(m.GetSession("userId"))
+	if userid == "" {
+		return m.Redirect("/jyapp/login")
+	}
+	a_key, list := public.PushViewDatas(userid, "", bidSearch_field_1, 1, bidsearch.SearchPageSize_APP)
+	public.BidListConvert("", list)
+	m.T["firstPage"] = list
+	m.T["hasNextPage"] = list != nil && len(*list) == bidsearch.SearchPageSize_APP
+	m.T["pageSize"] = bidsearch.SearchPageSize_APP
+	m.T["a_key"] = a_key
+	return m.Render("/weixin/resultpreview.html", &m.T)
 }
 func (m *Front) WxpushViewPaging() {
-        defer util.Catch()
-        var list *[]map[string]interface{}
-        pageNum, _ := m.GetInteger("pageNum")
-        if userid := util.ObjToString(m.GetSession("userId")); userid != "" && pageNum <= bidsearch.SearchMaxPageNum_APP {
-                _, list = public.PushViewDatas(userid, "", bidSearch_field_1, pageNum, bidsearch.SearchPageSize_APP)
-        }
-        public.BidListConvert("", list)
-        m.ServeJson(map[string]interface{}{
-                "list":        list,
-                "hasNextPage": list != nil && len(*list) == bidsearch.SearchPageSize_APP && pageNum < bidsearch.SearchMaxPageNum_APP,
-        })
+	defer util.Catch()
+	var list *[]map[string]interface{}
+	pageNum, _ := m.GetInteger("pageNum")
+	if userid := util.ObjToString(m.GetSession("userId")); userid != "" && pageNum <= bidsearch.SearchMaxPageNum_APP {
+		_, list = public.PushViewDatas(userid, "", bidSearch_field_1, pageNum, bidsearch.SearchPageSize_APP)
+	}
+	public.BidListConvert("", list)
+	m.ServeJson(map[string]interface{}{
+		"list":        list,
+		"hasNextPage": list != nil && len(*list) == bidsearch.SearchPageSize_APP && pageNum < bidsearch.SearchMaxPageNum_APP,
+	})
 }
 
 /*func (f *Front) HasPushHistory() {
@@ -469,126 +468,126 @@ func (m *Front) WxpushViewPaging() {
 
 // 历史推送
 func (f *Front) Historypush() error {
-        if f.GetString("f") == "push" {
-                if f.GetString("t") == "member" {
-                        f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
-                } else if f.GetString("t") == "entniche" {
-                        f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Entniche)
-                } else {
-                        f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
-                }
-        }
-        userId, _ := f.GetSession("userId").(string)
-        if userId != "" {
-                vipSubtips := 1
-                // 打开推送
-                data, ok := mongodb.FindById("user", userId, `{"i_vip_subtips":1,"isread":1}`)
-                if ok && data != nil && len(*data) > 0 {
-                        //VIP服务到期
-                        i_vip_subtips := (*data)["i_vip_subtips"]
-                        if i_vip_subtips == 0 {
-                                if mongodb.UpdateById("user", userId, bson.M{"$set": bson.M{"i_vip_subtips": 1}}) {
-                                        vipSubtips = 0
-                                }
-                        }
-                }
-                f.T["isread"] = (*data)["isread"]
-                f.T["vipSubtips"] = vipSubtips
-                f.T["userId"] = userId
-                f.T["isIosExam"], f.T["isIosExamPhone"], f.T["isVip"], _ = IosExamInfo(f.Action, true, false)
-        }
-        return f.Render("/weixin/historypush.html", &f.T)
+	if f.GetString("f") == "push" {
+		if f.GetString("t") == "member" {
+			f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
+		} else if f.GetString("t") == "entniche" {
+			f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Entniche)
+		} else {
+			f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
+		}
+	}
+	userId, _ := f.GetSession("userId").(string)
+	if userId != "" {
+		vipSubtips := 1
+		// 打开推送
+		data, ok := mongodb.FindById("user", userId, `{"i_vip_subtips":1,"isread":1}`)
+		if ok && data != nil && len(*data) > 0 {
+			//VIP服务到期
+			i_vip_subtips := (*data)["i_vip_subtips"]
+			if i_vip_subtips == 0 {
+				if mongodb.UpdateById("user", userId, bson.M{"$set": bson.M{"i_vip_subtips": 1}}) {
+					vipSubtips = 0
+				}
+			}
+		}
+		f.T["isread"] = (*data)["isread"]
+		f.T["vipSubtips"] = vipSubtips
+		f.T["userId"] = userId
+		f.T["isIosExam"], f.T["isIosExamPhone"], f.T["isVip"], _ = IosExamInfo(f.Action, true, false)
+	}
+	return f.Render("/weixin/historypush.html", &f.T)
 }
 
 func MFollow(userId, sid string) (bool, string) {
-        defer util.Catch()
-        var followId string
-        followFlag := false
-        follows := public.BaseMysql.FindOne("follow_project_monitor", map[string]interface{}{"s_userid": userId, "s_id": sid}, "id", "")
-        if follows != nil && len(*follows) > 0 {
-                followId = encrypt.EncodeArticleId2ByCheck(util.InterfaceToStr((*follows)["id"]))
-                followFlag = true
-        }
-        return followFlag, followId
+	defer util.Catch()
+	var followId string
+	followFlag := false
+	follows := public.BaseMysql.FindOne("follow_project_monitor", map[string]interface{}{"s_userid": userId, "s_id": sid}, "id", "")
+	if follows != nil && len(*follows) > 0 {
+		followId = encrypt.EncodeArticleId2ByCheck(util.InterfaceToStr((*follows)["id"]))
+		followFlag = true
+	}
+	return followFlag, followId
 }
 func wxvisitD(sid, userId string, isPayUser bool) (objdata map[string]interface{}) {
-        defer util.Catch()
-        var obj map[string]interface{}
-        if len(sid) > 5 {
-                aobj, ok := public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection, sid, public.MgoBiddingFields)
-                if ok && (aobj == nil || *aobj == nil || len(*aobj) == 0) {
-                        aobj, ok = public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection_back, sid, public.MgoBiddingFields)
-                }
-                //aobj, ok := elastic.GetByIdField("bidding", "bidding", sid, ""), true
-                obj = *aobj
-                if ok && obj != nil && len(obj) >= 3 {
-                        if !isPayUser && (util.ObjToString(obj["subtype"]) == "拟建" || util.ObjToString(obj["subtype"]) == "采购意向") {
-                                for k, _ := range obj {
-                                        if k != "title" && k != "area" && k != "subtype" && k != "toptype" && k != "publishtime" && k != "budget" && k != "bidamount" && k != "site" && k != "spidercode" && k != "recommended_service" &&
-                                                k != "owner" && k != "total_investment" && k != "projectaddr" && k != "projectperiod" && k != "approvedept" && k != "approvecontent" && k != "approvecode" && k != "approvenumber" && k != "approvetime" && k != "approvestatus" && k != "project_scale" && k != "projectname" {
-                                                delete(obj, k)
-                                        }
-                                }
-                        }
-                        obj["_id"] = encrypt.EncodeArticleId2ByCheck(sid)
-                        // obj["url"] = obj["href"]
-                        pt := obj["publishtime"]
-                        obj["l_publishtime"] = pt
-                        obj["publishtime"] = FormatDateWithObj(&pt, Date_Full_Layout)
-                        //查询是否关注
-                        obj["followFlag"] = false
-                        obj["hasSession"] = false
-                        var infoformat = util.IntAllDef(obj["infoformat"], 1)
-                        obj["infoformat"] = infoformat
-                        //精准字段(竞争对手的地址) 或  拟建项目
-                        if obj["competehref"] != nil || infoformat == 2 {
-                                delete(obj, "href")
-                        }
-                        if userId != "" {
-                                //pcode, _ := obj["projectcode"].(string)
-                                //pname, _ := obj["projectname"].(string)
-                                titleTmp := util.ObjToString(obj["title"])
-                                obj["followFlag"], obj["followId"] = MFollow(userId, sid)
-                                if len([]rune(titleTmp)) > 100 {
-                                        titleTmp = string([]rune(titleTmp)[:100]) + "..."
-                                }
-                                titleTmp = public.ClearHtml.ReplaceAllString(titleTmp, "")
-                                obj["title"] = titleTmp
-                                obj["hasSession"] = true
+	defer util.Catch()
+	var obj map[string]interface{}
+	if len(sid) > 5 {
+		aobj, ok := public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection, sid, public.MgoBiddingFields)
+		if ok && (aobj == nil || *aobj == nil || len(*aobj) == 0) {
+			aobj, ok = public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection_back, sid, public.MgoBiddingFields)
+		}
+		//aobj, ok := elastic.GetByIdField("bidding", "bidding", sid, ""), true
+		obj = *aobj
+		if ok && obj != nil && len(obj) >= 3 {
+			if !isPayUser && (util.ObjToString(obj["subtype"]) == "拟建" || util.ObjToString(obj["subtype"]) == "采购意向") {
+				for k, _ := range obj {
+					if k != "title" && k != "area" && k != "subtype" && k != "toptype" && k != "publishtime" && k != "budget" && k != "bidamount" && k != "site" && k != "spidercode" && k != "recommended_service" &&
+						k != "owner" && k != "total_investment" && k != "projectaddr" && k != "projectperiod" && k != "approvedept" && k != "approvecontent" && k != "approvecode" && k != "approvenumber" && k != "approvetime" && k != "approvestatus" && k != "project_scale" && k != "projectname" {
+						delete(obj, k)
+					}
+				}
+			}
+			obj["_id"] = encrypt.EncodeArticleId2ByCheck(sid)
+			// obj["url"] = obj["href"]
+			pt := obj["publishtime"]
+			obj["l_publishtime"] = pt
+			obj["publishtime"] = FormatDateWithObj(&pt, Date_Full_Layout)
+			//查询是否关注
+			obj["followFlag"] = false
+			obj["hasSession"] = false
+			var infoformat = util.IntAllDef(obj["infoformat"], 1)
+			obj["infoformat"] = infoformat
+			//精准字段(竞争对手的地址) 或  拟建项目
+			if obj["competehref"] != nil || infoformat == 2 {
+				delete(obj, "href")
+			}
+			if userId != "" {
+				//pcode, _ := obj["projectcode"].(string)
+				//pname, _ := obj["projectname"].(string)
+				titleTmp := util.ObjToString(obj["title"])
+				obj["followFlag"], obj["followId"] = MFollow(userId, sid)
+				if len([]rune(titleTmp)) > 100 {
+					titleTmp = string([]rune(titleTmp)[:100]) + "..."
+				}
+				titleTmp = public.ClearHtml.ReplaceAllString(titleTmp, "")
+				obj["title"] = titleTmp
+				obj["hasSession"] = true
 
-                                //obj["title"] = util.If(len([]rune(titleTmp)) > 100, string([]rune(titleTmp)[:100])+"...", string(titleTmp)).(string)
-                        }
-                        if strings.Trim(util.ObjToString(obj["detail"]), " ") == "" {
-                                obj["detail"] = ""
-                        }
-                }
-        }
-        return obj
+				//obj["title"] = util.If(len([]rune(titleTmp)) > 100, string([]rune(titleTmp)[:100])+"...", string(titleTmp)).(string)
+			}
+			if strings.Trim(util.ObjToString(obj["detail"]), " ") == "" {
+				obj["detail"] = ""
+			}
+		}
+	}
+	return obj
 }
 func (f *Front) GetRecomKWs() {
-        count, _ := f.GetInteger("count")
-        f.ServeJson(public.RecomKws.GetRecomKws(f.GetString("value"), count, float32(config.Sysconfig["recommendThreshold"].(float64))))
+	count, _ := f.GetInteger("count")
+	f.ServeJson(public.RecomKws.GetRecomKws(f.GetString("value"), count, float32(config.Sysconfig["recommendThreshold"].(float64))))
 }
 
 // 记录用户行为--推荐关键词
 func (f *Front) BehaviorRecord() {
-        flag := saveBehaviorRecord(f.Session(),
-                bson.M{
-                        "s_word":   f.GetString("value"),
-                        "s_type":   f.GetString("type"),
-                        "s_source": f.GetString("source"),
-                })
-        f.ServeJson(bson.M{"flag": flag})
+	flag := saveBehaviorRecord(f.Session(),
+		bson.M{
+			"s_word":   f.GetString("value"),
+			"s_type":   f.GetString("type"),
+			"s_source": f.GetString("source"),
+		})
+	f.ServeJson(bson.M{"flag": flag})
 }
 
 // 记录用户行为
 func saveBehaviorRecord(sess *httpsession.Session, data bson.M) bool {
-        userId, _ := sess.Get("userId").(string)
-        nickName, _ := sess.Get("s_nickname").(string)
-        data["s_userid"] = userId
-        data["s_nickname"] = nickName
-        data["l_createtime"] = time.Now().Unix()
-        return len(mongodb.Save("behavior", data)) > 0
+	userId, _ := sess.Get("userId").(string)
+	nickName, _ := sess.Get("s_nickname").(string)
+	data["s_userid"] = userId
+	data["s_nickname"] = nickName
+	data["l_createtime"] = time.Now().Unix()
+	return len(mongodb.Save("behavior", data)) > 0
 }
 
 /*
@@ -606,80 +605,80 @@ func saveBehaviorRecord(sess *httpsession.Session, data bson.M) bool {
 	}
 */
 func (m *Front) DelWxHistorySearch() {
-        defer util.Catch()
-        //定义一个无用参数作为返回值
-        var rt string = "rt"
-        userId := m.GetSession("userId")
-        history := redis.GetStr("other", "s_"+userId.(string))
-        if len(history) > 0 || history != "" {
-                redis.Del("other", "s_"+userId.(string))
-        }
-        m.ServeJson(map[string]interface{}{
-                "rt": rt,
-        })
+	defer util.Catch()
+	//定义一个无用参数作为返回值
+	var rt string = "rt"
+	userId := m.GetSession("userId")
+	history := redis.GetStr("other", "s_"+userId.(string))
+	if len(history) > 0 || history != "" {
+		redis.Del("other", "s_"+userId.(string))
+	}
+	m.ServeJson(map[string]interface{}{
+		"rt": rt,
+	})
 }
 func (m *Front) GetIndexData() {
-        defer util.Catch()
-        redis_obj := redis.Get("other", "sw_index")
-        var one map[string]interface{}
-        if redis_obj != nil {
-                one = redis_obj.(map[string]interface{})
-                log.Println("newpage from the cache...")
-        } else {
-                rs, err := mongodb.Find("swordfish_index", nil, `{"_id":-1}`, nil, false, 0, 1)
-                if err {
-                        one = (*rs)[0]
-                        one["i_site"] = util.IntAll(one["i_entsite"]) + util.IntAll(one["i_govsite"])
-                        avg := util.IntAll(one["i_bidmonth"])/21 + util.IntAll(one["i_bidmonth"])%21
-                        one["i_avg"] = avg
-                        one["i_my"] = util.IntAll(one["i_entsite"]) * 35 / 100
-                        one["i_hy"] = util.IntAll(one["i_entsite"]) * 15 / 100
-                        one["i_zb"] = util.IntAll(one["i_entsite"]) - util.IntAll(one["i_my"]) - util.IntAll(one["i_hy"])
-                        redis.Put("other", "sw_index", one, 60*60*2)
-                } else {
-                        m.ServeJson("n")
-                }
-        }
-        m.ServeJson(one)
+	defer util.Catch()
+	redis_obj := redis.Get("other", "sw_index")
+	var one map[string]interface{}
+	if redis_obj != nil {
+		one = redis_obj.(map[string]interface{})
+		log.Println("newpage from the cache...")
+	} else {
+		rs, err := mongodb.Find("swordfish_index", nil, `{"_id":-1}`, nil, false, 0, 1)
+		if err {
+			one = (*rs)[0]
+			one["i_site"] = util.IntAll(one["i_entsite"]) + util.IntAll(one["i_govsite"])
+			avg := util.IntAll(one["i_bidmonth"])/21 + util.IntAll(one["i_bidmonth"])%21
+			one["i_avg"] = avg
+			one["i_my"] = util.IntAll(one["i_entsite"]) * 35 / 100
+			one["i_hy"] = util.IntAll(one["i_entsite"]) * 15 / 100
+			one["i_zb"] = util.IntAll(one["i_entsite"]) - util.IntAll(one["i_my"]) - util.IntAll(one["i_hy"])
+			redis.Put("other", "sw_index", one, 60*60*2)
+		} else {
+			m.ServeJson("n")
+		}
+	}
+	m.ServeJson(one)
 }
 
 // 手动删除30天无更新数据
 func (m *Front) DelOL() error {
-        defer util.Catch()
-        var ids []primitive.ObjectID
-        var flag = "F"
-        var arrid = strings.Split(m.GetString("arrid"), ",")
-        log.Println("---->", arrid)
+	defer util.Catch()
+	var ids []primitive.ObjectID
+	var flag = "F"
+	var arrid = strings.Split(m.GetString("arrid"), ",")
+	log.Println("---->", arrid)
 
-        userId, ok := m.GetSession("userId").(string)
-        log.Println("sss", ids)
-        if !ok || userId == "" || len(ids) < 1 {
-                m.ServeJson(map[string]interface{}{
-                        "flag": flag,
-                })
-                return nil
-        }
-        arrStr := []string{}
-        for _, v := range arrid {
-                arrStr = append(arrStr, fmt.Sprintf(`"%s"`, v))
-        }
-        idStr := fmt.Sprintf(`SELECT * FROM follow_project_monitor WHERE s_userid ="%s" and id in (%s)`, userId, strings.Join(arrStr, ","))
+	userId, ok := m.GetSession("userId").(string)
+	log.Println("sss", ids)
+	if !ok || userId == "" || len(ids) < 1 {
+		m.ServeJson(map[string]interface{}{
+			"flag": flag,
+		})
+		return nil
+	}
+	arrStr := []string{}
+	for _, v := range arrid {
+		arrStr = append(arrStr, fmt.Sprintf(`"%s"`, v))
+	}
+	idStr := fmt.Sprintf(`SELECT * FROM follow_project_monitor WHERE s_userid ="%s" and id in (%s)`, userId, strings.Join(arrStr, ","))
 
-        if datas := public.BaseMysql.SelectBySql(idStr); datas != nil {
-                for _, v := range *datas {
-                        relation := []interface{}{v["s_id"]}
-                        go delRelRedis(v["s_userid"], relation)
-                        v["s_followid"] = BsonIdToSId(v["id"])
-                        delete(v, "id")
-                        v["i_status"] = 2
-                        mongodb.Save("follow_project_monitor_back", v)
-                }
-        }
-        delIdStr := fmt.Sprintf(`delete FROM follow_project_monitor WHERE s_userid ="%s" and id in (%s)`, userId, strings.Join(arrStr, ","))
-        public.BaseMysql.SelectBySql(delIdStr)
-        flag = "T"
-        m.ServeJson(map[string]interface{}{
-                "flag": flag,
-        })
-        return nil
+	if datas := public.BaseMysql.SelectBySql(idStr); datas != nil {
+		for _, v := range *datas {
+			relation := []interface{}{v["s_id"]}
+			go delRelRedis(v["s_userid"], relation)
+			v["s_followid"] = BsonIdToSId(v["id"])
+			delete(v, "id")
+			v["i_status"] = 2
+			mongodb.Save("follow_project_monitor_back", v)
+		}
+	}
+	delIdStr := fmt.Sprintf(`delete FROM follow_project_monitor WHERE s_userid ="%s" and id in (%s)`, userId, strings.Join(arrStr, ","))
+	public.BaseMysql.SelectBySql(delIdStr)
+	flag = "T"
+	m.ServeJson(map[string]interface{}{
+		"flag": flag,
+	})
+	return nil
 }

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

@@ -112,8 +112,8 @@ func (s *Subscribepay) ToSetPage() {
 			s.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
 		}
 	}
-	vSwitch = jy.SwitchService.GetEntniche(s.Session(), public.MQFW, public.Mysql) //v:vip m:member
 	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	vSwitch = jy.SwitchService.GetEntniche(s.Session(), "10000", util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"])) //v:vip m:member
 	bigBaseMsg := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
 	//bigBaseMsg := jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW)
 	if (vSwitch == "" || vSwitch == "v") && bigBaseMsg.VipStatus <= 0 && !bigBaseMsg.IsUpgrade {
@@ -125,7 +125,7 @@ func (s *Subscribepay) ToSetPage() {
 		return
 	}
 	//仅免费用户跳转向导页面
-	if bigBaseMsg.Status <= 0 && bigBaseMsg.VipStatus <= 0 && isInTSguide(userid) {
+	if bigBaseMsg.Status <= 0 && bigBaseMsg.VipStatus <= 0 && isInTSguide(userid, s.Session()) {
 		s.Redirect("/jyapp/tenderSubscribe/guide?url=" + url.QueryEscape(s.Request.RequestURI))
 	}
 	s.Render("/vipsubscribe/vip_index_new.html")
@@ -248,8 +248,8 @@ func (s *Subscribepay) ToSetKeyWordPage() {
 			s.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
 		}
 	}
-	vSwitch = jy.SwitchService.GetEntniche(s.Session(), public.MQFW, public.Mysql) //v:vip m:member
 	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	vSwitch = jy.SwitchService.GetEntniche(s.Session(), "10000", util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"])) //v:vip m:member
 	bigBaseMsg := jy.GetBigVipUserBaseMsg("10000", s.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]))
 	//bigBaseMsg := jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW)
 	//如果没有首次使用

+ 2 - 1
src/jfw/modules/app/src/app/front/ws_dataExport.go

@@ -353,7 +353,8 @@ func (wd *WsDataExport) SearchExport() error {
 	}
 
 	saveData := reqData.PassBidSearchExport(config.Sysconfig)
-	saveData["selectType"] = strings.Join(jy.GetVipState(public.Mysql, public.MQFW, userId).
+	etcdMap := config.Sysconfig["etcd"].(map[string]interface{})
+	saveData["selectType"] = strings.Join(jy.GetVipState("10000", wd.Session(), util.InterfaceToStr(etcdMap["hosts"]), util.InterfaceToStr(etcdMap["key"]), userId).
 		GetQueryItems(wd.GetString("selectType"), util.Int64All(config.Sysconfig["bidSearchOldUserLimit"])), ",")
 	saveData["s_openid"] = openid
 	saveData["s_userid"] = userId

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

@@ -23,7 +23,7 @@ func (m *Front) WxKeyset(tpl string) error {
 	defer util.Catch()
 	userid := util.ObjToString(m.GetSession("userId"))
 	surprise := m.GetSession("surprise")
-	if tpl == "index" && isInTSguide(userid) { //仅免费用户跳转向导页面
+	if tpl == "index" && isInTSguide(userid, m.Session()) { //仅免费用户跳转向导页面
 		return m.Redirect("/jyapp/tenderSubscribe/guide?url=" + url.QueryEscape(m.Request.RequestURI))
 	}
 	//到新订阅设置
@@ -35,11 +35,8 @@ func (m *Front) WxKeyset(tpl string) error {
 	}
 	if tpl == "seniorset" {
 		/*data, ok := mongodb.FindById("user", userid, `{"o_jy":1}`)*/
-vipMsg
+		m.T["haskeyword"] = vipMsg.Data.Free.FreeHasKey
 
-				m.T["haskeyword"] = true
-
-		}
 	}
 	userId, _ := m.GetSession("userId").(string)
 	s_surprise := ""

+ 25 - 14
src/jfw/modules/app/src/go.mod

@@ -3,21 +3,25 @@ module jy/src/jfw/modules/app/src
 go 1.18
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20221230025810-b88f2a62c467
-	app.yhyue.com/moapp/jypkg v0.0.0-20230110033535-d6c3e4b755cf
+	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
+	app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8
+	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
+	github.com/gogf/gf/v2 v2.0.6
 	github.com/pkg/errors v0.9.1
 	go.mongodb.org/mongo-driver v1.11.1
 )
 
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
-	app.yhyue.com/moapp/message v0.0.0-20221202072401-d825fc65512c // indirect
-	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4 // indirect
+	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c // indirect
+	github.com/BurntSushi/toml v0.4.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
 	github.com/cespare/xxhash/v2 v2.1.2 // indirect
+	github.com/clbanning/mxj/v2 v2.5.5 // indirect
 	github.com/coreos/go-semver v0.3.0 // indirect
 	github.com/coreos/go-systemd/v22 v22.3.2 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
@@ -40,19 +44,24 @@ require (
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
 	github.com/googleapis/gnostic v0.5.5 // indirect
+	github.com/gorilla/websocket v1.5.0 // indirect
+	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
 	github.com/howeyc/fsnotify v0.9.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/klauspost/compress v1.13.6 // indirect
+	github.com/longbridgeapp/sqlparser v0.3.1 // indirect
 	github.com/mattn/go-colorable v0.1.9 // indirect
 	github.com/mattn/go-isatty v0.0.14 // indirect
+	github.com/mattn/go-runewidth v0.0.13 // indirect
 	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
 	github.com/nsqio/go-nsq v1.1.0 // indirect
+	github.com/olekukonko/tablewriter v0.0.5 // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/openzipkin/zipkin-go v0.4.0 // indirect
 	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
@@ -60,6 +69,7 @@ require (
 	github.com/prometheus/client_model v0.2.0 // indirect
 	github.com/prometheus/common v0.37.0 // indirect
 	github.com/prometheus/procfs v0.8.0 // indirect
+	github.com/rivo/uniseg v0.2.0 // indirect
 	github.com/robfig/cron v1.2.0 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/tealeg/xlsx v1.0.5 // indirect
@@ -68,19 +78,20 @@ require (
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	github.com/zeromicro/go-zero v1.4.3 // indirect
+	github.com/zeromicro/go-zero v1.4.4 // indirect
 	github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb // indirect
 	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
-	go.opentelemetry.io/otel v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
-	go.opentelemetry.io/otel/sdk v1.10.0 // indirect
-	go.opentelemetry.io/otel/trace v1.10.0 // indirect
+	go.opentelemetry.io/otel v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
+	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
+	go.opentelemetry.io/otel/trace v1.11.0 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
 	go.uber.org/atomic v1.9.0 // indirect
 	go.uber.org/automaxprocs v1.5.1 // indirect
@@ -90,7 +101,7 @@ require (
 	golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
 	golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
 	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
+	golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
 	golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
 	golang.org/x/text v0.4.0 // indirect
 	golang.org/x/time v0.3.0 // indirect

+ 140 - 19
src/jfw/modules/app/src/go.sum

@@ -1,15 +1,38 @@
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+jPzpnsDe/OvcshDUUtOTZPYGSJ8=
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
+app.yhyue.com/moapp/jyInfo v1.0.0/go.mod h1:+RjyGNvk7PT1P8cglkVlaj1lLlBXuPB+f5LipoOtgPs=
 app.yhyue.com/moapp/jyPoints v1.1.1/go.mod h1:SvP8p5L3jGrejHiH2LXfgCg/NPlFiKBC5Yd0gsI12FU=
+app.yhyue.com/moapp/jybase v0.0.0-20220415064050-37ce64b3e2d4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20220419023055-f406279ff7e3/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20221230025810-b88f2a62c467 h1:MTZBSIzrqrwieb1gLhls3Wjz0Q2u75n+O2jfPw40iEA=
-app.yhyue.com/moapp/jybase v0.0.0-20221230025810-b88f2a62c467/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110033535-d6c3e4b755cf h1:NMVZDXa4yZtL2BTM8gJLpRU4fSN9a1cj7mTVYa1RUZY=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110033535-d6c3e4b755cf/go.mod h1:7D6zNxrg+Tma3VC43TLu7XPczubl4uJavua89kaFS1Q=
-app.yhyue.com/moapp/message v0.0.0-20221202072401-d825fc65512c h1:CrcvbsXZ4aQkNikBi7FUUQZNnY8hKsNo2LLe/SqeXs8=
-app.yhyue.com/moapp/message v0.0.0-20221202072401-d825fc65512c/go.mod h1:b0zZHev3gmJao1Fo+2Z2KPVjsuLOJVvVxf+kCnu9WkA=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4 h1:Xv1D9avDKeaM5kQTisF/pIt8y7B7yQ/hAxuWEg75LMs=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
+app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa/go.mod h1:FjBF25AYoBrPhVKTXGXWcmEAbBT0ATTK6KJMOA+I80Q=
+app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tcD9TcKb/HOP2BLbzppyDz2kpQSFhPMQTUgbQ=
+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-20230131023215-ca51808c57b8 h1:bpCxm9zroB4vy4IF2PAlD+iIPc+GwC1YMquORPBWuLI=
+app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8/go.mod h1:MqJfBFTSfZhrNDEnE4e19BmaLkaMr+lYActLXm6lrpw=
+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/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/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=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220905055615-8540037e1b06/go.mod h1:LS21iwbgP8i3ZHJ1n4yNpLXQ/nzEudUOk0klC6VM2dQ=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230129060002-f69424aa14ba h1:WATZdho/2XJ8DP3EuaSo10WiFrXRgxeLpmYoGEcSdMw=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230129060002-f69424aa14ba/go.mod h1:m7/aZ1r1FapNT2h3gqmCFVb0EV+CaJaNKNPHMzLHx8Y=
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
@@ -374,16 +397,23 @@ cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vf
 cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA=
 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
 github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
+github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
 github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA=
+github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
+github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
 github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
 github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
+github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
 github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
+github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
 github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
 github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
 github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
 github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
+github.com/ClickHouse/clickhouse-go v1.5.1/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
 github.com/ClickHouse/clickhouse-go v1.5.4/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
 github.com/ClickHouse/clickhouse-go/v2 v2.0.14/go.mod h1:iq2DUGgpA4BBki2CVwrF8x43zqBjdgHtbexkFkh5a6M=
 github.com/ClickHouse/clickhouse-go/v2 v2.2.0/go.mod h1:8f2XZUi7XoeU+uPIytSi1cvx8fmJxi7vIgqpvYTF1+o=
@@ -391,6 +421,7 @@ github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q
 github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
 github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
+github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
 github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
 github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
 github.com/SKatiyar/qr v0.0.0-20151201054752-25b6bdf44e67 h1:x98/gnpyNAiuvg/gX3KgdfKxnZj3t9pIl3BCVJg3qwg=
@@ -408,9 +439,13 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
 github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk=
 github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
 github.com/alicebob/miniredis/v2 v2.14.1/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg=
+github.com/alicebob/miniredis/v2 v2.17.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
 github.com/alicebob/miniredis/v2 v2.22.0/go.mod h1:XNqvJdQJv5mSuVMc0ynneafpnL/zv52acZ6kqeS0t88=
-github.com/alicebob/miniredis/v2 v2.23.1 h1:jR6wZggBxwWygeXcdNyguCOCIjPsZyNUNlAkTx2fu0U=
 github.com/alicebob/miniredis/v2 v2.23.1/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
+github.com/alicebob/miniredis/v2 v2.30.0 h1:uA3uhDbCxfO9+DI/DuGeAMr9qI+noVWwGPNTFuKID5M=
+github.com/alicebob/miniredis/v2 v2.30.0/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
+github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
+github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
 github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
 github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
 github.com/antlr/antlr4 v0.0.0-20210105212045-464bcbc32de2/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y=
@@ -419,6 +454,7 @@ github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb
 github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
 github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
 github.com/aws/aws-sdk-go v1.35.20/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
+github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
 github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
 github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@@ -437,6 +473,7 @@ github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
 github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
 github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
 github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
+github.com/clbanning/mxj/v2 v2.5.5 h1:oT81vUeEiQQ/DcHbzSytRngP6Ky9O+L+0Bw0zSJag9E=
 github.com/clbanning/mxj/v2 v2.5.5/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
@@ -469,9 +506,11 @@ github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f/go.mod h1:QGrK8vMWW
 github.com/dchest/captcha v1.0.0 h1:vw+bm/qMFvTgcjQlYVTuQBJkarm5R0YSsDKhm1HZI2o=
 github.com/dchest/captcha v1.0.0/go.mod h1:7zoElIawLp7GUMLcj54K9kbw+jEyvz2K0FDdRRYhvWo=
 github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
+github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
 github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
+github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
 github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
 github.com/donnie4w/go-logger v0.0.0-20170827050443-4740c51383f4/go.mod h1:L7S4x0R7vv3xoOhGuyAJyCO2MYzWOpccM4Isn8jIUgY=
 github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@@ -493,9 +532,12 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
 github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
 github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
 github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
+github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
 github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
 github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
+github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
 github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
 github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
 github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
@@ -510,9 +552,11 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
 github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
 github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
+github.com/fullstorydev/grpcurl v1.8.6/go.mod h1:WhP7fRQdhxz2TkL97u+TCb505sxfH78W1usyoB3tepw=
 github.com/fullstorydev/grpcurl v1.8.7/go.mod h1:pVtM4qe3CMoLaIzYS8uvTuDj2jVYmXqMUkZeijnXp/E=
 github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM=
 github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
+github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
 github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
@@ -527,6 +571,7 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
 github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
 github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
 github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
+github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
 github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
 github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
 github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -538,8 +583,12 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
 github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
 github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
 github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
+github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
 github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
+github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
 github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
+github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
+github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
 github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
 github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
 github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w=
@@ -553,6 +602,7 @@ github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ
 github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
 github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
 github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
+github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
 github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
 github.com/go-xorm/builder v0.3.4/go.mod h1:KxkQkNN1DpPKTedxXyTQcmH+rXfvk4LZ9SOOBoZBAxw=
 github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM=
@@ -584,6 +634,7 @@ github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY9
 github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/gogf/gf/v2 v2.0.6 h1:2etb4FMpbQKWIJO+UjtIWrZUp01HUsFb6Po8pgizAWk=
 github.com/gogf/gf/v2 v2.0.6/go.mod h1:8uYzw7qNzuq8vrhVlWke1b1925FFqOJIgmyYW1sr/0M=
 github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
 github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
@@ -591,9 +642,11 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
 github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
 github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
 github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
 github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
 github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU=
 github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
+github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
 github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
 github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
@@ -699,10 +752,12 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99
 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c=
 github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=
 github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
+github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
 github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
 github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw=
 github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA=
 github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
+github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
 github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
 github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
 github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
@@ -712,8 +767,10 @@ github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/z
 github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
 github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
 github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
 github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
 github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
+github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q/MOnCQxKMo0=
 github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
 github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
@@ -748,11 +805,15 @@ github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJk
 github.com/jhump/gopoet v0.0.0-20190322174617-17282ff210b3/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
 github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
 github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ=
+github.com/jhump/protoreflect v1.10.3/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
 github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E=
 github.com/jhump/protoreflect v1.12.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
 github.com/jhump/protoreflect v1.14.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
+github.com/jhump/protoreflect v1.14.1/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
+github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
+github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E=
 github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
@@ -793,14 +854,18 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
 github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
 github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
 github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
 github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
+github.com/longbridgeapp/sqlparser v0.3.1 h1:iWOZWGIFgQrJRgobLXUNJdvqGRpbVXkyKUKUA5CNJBE=
 github.com/longbridgeapp/sqlparser v0.3.1/go.mod h1:GIHaUq8zvYyHLCLMJJykx1CdM6LHtkUih/QaJXySSx4=
 github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -812,6 +877,7 @@ github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kN
 github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
 github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
 github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
 github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
@@ -823,9 +889,11 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
 github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
 github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
 github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
+github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
 github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
 github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
 github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
@@ -847,6 +915,7 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW
 github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
 github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
+github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso=
 github.com/nsqio/go-nsq v1.1.0 h1:PQg+xxiUjA7V+TLdXw7nVrJ5Jbl3sN86EhGCQj4+FYE=
 github.com/nsqio/go-nsq v1.1.0/go.mod h1:vKq36oyeVXgsS5Q8YEO7WghqidAVXQlcFxzQbQTuDEY=
 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
@@ -854,6 +923,7 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
 github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
 github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
 github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
+github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
 github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
 github.com/olivere/elastic v6.2.37+incompatible h1:UfSGJem5czY+x/LqxgeCBgjDn6St+z8OnsCuxwD3L0U=
 github.com/olivere/elastic v6.2.37+incompatible/go.mod h1:J+q1zQJTgAz9woqsbVRqGeB5G1iqDKVBWLNSYW8yfJ8=
@@ -861,6 +931,7 @@ github.com/olivere/elastic/v7 v7.0.22/go.mod h1:VDexNy9NjmtAkrjNoI7tImv7FR4tf5zU
 github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
 github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
 github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
@@ -870,6 +941,7 @@ github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3
 github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
 github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
 github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
 github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
 github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
@@ -878,6 +950,7 @@ github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
 github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
 github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
 github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
+github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
 github.com/openzipkin/zipkin-go v0.4.0 h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfUuBUUw=
 github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
 github.com/paulmach/orb v0.5.0/go.mod h1:FWRlTgl88VI1RBx/MkrwWDRhQ96ctqMCh8boXhmqB/A=
@@ -923,6 +996,7 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
 github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
 github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
+github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
 github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
 github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
 github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
@@ -938,6 +1012,7 @@ github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0ua
 github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM=
 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
+github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
 github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
@@ -948,6 +1023,7 @@ github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
 github.com/shirou/gopsutil v2.19.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
 github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
 github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
@@ -977,6 +1053,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
 github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
 github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
 github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
 github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -1028,29 +1105,37 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
 github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
 github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
+github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
 github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
 github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 h1:5mLPGnFdSsevFRFc9q3yYbBkB6tsm4aCwwQV/j1JQAQ=
 github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
 github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
+github.com/zeromicro/go-zero v1.3.2/go.mod h1:DEj3Fwj1Ui1ltsgf6YqwTL9nD4+tYzIRX0c1pWtQo1E=
 github.com/zeromicro/go-zero v1.3.5/go.mod h1:wh4o794b7Ul3W0k35Pw9nc3iB4O0OpaQTMQz/PJc1bc=
-github.com/zeromicro/go-zero v1.4.3 h1:sTQ++6fxQHJnpGCN7h2CUrhWmbvhBqEgE75cJl635SM=
+github.com/zeromicro/go-zero v1.4.0/go.mod h1:1amLn98K7c6FLntb9f8hdmq26ajtolOg4DTFWnRt54o=
 github.com/zeromicro/go-zero v1.4.3/go.mod h1:UmDjuW7LHd9j7+nnnPBcXF0HLNmjJw6OjHPTlSp7X7Y=
+github.com/zeromicro/go-zero v1.4.4 h1:J8M768EVFNtIQJ/GCEsoIQPanxbx2HHT0it7r69U76Y=
+github.com/zeromicro/go-zero v1.4.4/go.mod h1:5WSUwtJm0bYdDZ69GlckigcT6D0EyAPbDaX3unbSY/4=
 github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb h1:uWiILQloLUVdtPYr1ZZo2zqtlpzo4G8vUpglo/Fs2H8=
 github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb/go.mod h1:J3xKssoVdrwZ2E29fIox/EKxOZWimS7AZ4fOTCFkOLo=
 github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
 go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
 go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM=
+go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
 go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
 go.etcd.io/etcd/api/v3 v3.5.5 h1:BX4JIbQ7hl7+jL+g+2j5UAr0o1bctCm6/Ct+ArBGkf0=
 go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8=
+go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
 go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
 go.etcd.io/etcd/client/pkg/v3 v3.5.5 h1:9S0JUVvmrVl7wCF39iTQthdaaNIiAaQbmK75ogO6GU8=
 go.etcd.io/etcd/client/pkg/v3 v3.5.5/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ=
+go.etcd.io/etcd/client/v3 v3.5.2/go.mod h1:kOOaWFFgHygyT0WlSmL8TJiXmMysO/nNUlEsSsN6W4o=
 go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY=
 go.etcd.io/etcd/client/v3 v3.5.5 h1:q++2WTJbUgpQu4B6hCuT7VkdwaTP7Qz6Daak3WzbrlI=
 go.etcd.io/etcd/client/v3 v3.5.5/go.mod h1:aApjR4WGlSumpnJ2kloS75h6aHUmAyaPLjHMxpc7E7c=
 go.mongodb.org/mongo-driver v1.5.0/go.mod h1:boiGPFqyBs5R0R5qf2ErokGRekMfwn+MqKaUyHs7wy0=
 go.mongodb.org/mongo-driver v1.9.1/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY=
+go.mongodb.org/mongo-driver v1.10.1/go.mod h1:z4XpeoU6w+9Vht+jAFyLgVrD+jGSQQe0+CBWFHNiHt8=
 go.mongodb.org/mongo-driver v1.11.1 h1:QP0znIRTuL0jf1oBQoAoM0C6ZJfBK4kx0Uumtv1A7w8=
 go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8=
 go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
@@ -1065,31 +1150,48 @@ go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnf
 go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
 go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
 go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM=
-go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4=
+go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo=
 go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ=
+go.opentelemetry.io/otel v1.11.0 h1:kfToEGMDq6TrVrJ9Vht84Y8y9enykSZzDDZglV0kIEk=
+go.opentelemetry.io/otel v1.11.0/go.mod h1:H2KtuEphyMvlhZ+F7tg9GRhAOe60moNx61Ex+WmiKkk=
+go.opentelemetry.io/otel/exporters/jaeger v1.3.0/go.mod h1:KoYHi1BtkUPncGSRtCe/eh1ijsnePhSkxwzz07vU0Fc=
 go.opentelemetry.io/otel/exporters/jaeger v1.8.0/go.mod h1:GbWg+ng88rDtx+id26C34QLqw2erqJeAjsCx9AFeHfE=
-go.opentelemetry.io/otel/exporters/jaeger v1.10.0 h1:7W3aVVjEYayu/GOqOVF4mbTvnCuxF1wWu3eRxFGQXvw=
+go.opentelemetry.io/otel/exporters/jaeger v1.9.0/go.mod h1:hquezOLVAybNW6vanIxkdLXTXvzlj2Vn3wevSP15RYs=
 go.opentelemetry.io/otel/exporters/jaeger v1.10.0/go.mod h1:n9IGyx0fgyXXZ/i0foLHNxtET9CzXHzZeKCucvRBFgA=
-go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 h1:TaB+1rQhddO1sF71MpZOZAuSPW1klK2M8XxfrBMfK7Y=
+go.opentelemetry.io/otel/exporters/jaeger v1.11.0 h1:Sv2valcFfMlfu6g8USSS+ZUN5vwbuGj1aY/CFtMG33w=
+go.opentelemetry.io/otel/exporters/jaeger v1.11.0/go.mod h1:nRgyJbgJ0hmaUdHwyDpTTfBYz61cTTeeGhVzfQc+FsI=
 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 h1:pDDYmo0QadUPal5fwXoY1pmMpFcdyhXOmL5drCrI3vU=
+go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 h1:0dly5et1i/6Th3WHn0M6kYiJfFNzhhxanrJ0bOfnjEo=
+go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0/go.mod h1:+Lq4/WkdCkjbGcBMVHHg2apTbv8oMBf29QCnyCCJjNQ=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0/go.mod h1:Krqnjl22jUJ0HgMzw5eveuCvFDXY4nSYb4F8t5gdrag=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 h1:KtiUEhQmj/Pa874bVYKGNVdq8NPKiacPbaRRtgXi+t4=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 h1:eyJ6njZmH16h9dOKCi7lMswAnGsSOwgTqWzfxqcuNr8=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0/go.mod h1:FnDp7XemjN3oZ3xGunnfOUTVwd2XcvLbtRAuOSU3oc8=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0/go.mod h1:OfUCyyIiDvNXHWpcWgbF+MWvqPZiNa3YDEnivcnYsV0=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 h1:j2RFV0Qdt38XQ2Jvi4WIsQ56w8T7eSirYbMw19VXRDg=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0/go.mod h1:pILgiTEtrqvZpoiuGdblDgS5dbIaTgDrkIuKfEFkt+A=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 h1:S8DedULB3gp93Rh+9Z+7NTEv+6Id/KYS7LDyipZ9iCE=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0/go.mod h1:5WV40MLWwvWlGP7Xm8g3pMcg0pKOUY609qxJn8y7LmM=
+go.opentelemetry.io/otel/exporters/zipkin v1.3.0/go.mod h1:LxGGfHIYbvsFnrJtBcazb0yG24xHdDGrT/H6RB9r3+8=
 go.opentelemetry.io/otel/exporters/zipkin v1.8.0/go.mod h1:0uYAyCuGT67MFV9Z/Mmx93wGuugHw0FbxMc74fs3LNo=
-go.opentelemetry.io/otel/exporters/zipkin v1.10.0 h1:HcPAFsFpEBKF+G5NIOA+gBsxifd3Ej+wb+KsdBLa15E=
+go.opentelemetry.io/otel/exporters/zipkin v1.9.0/go.mod h1:HyIvYIu37wV4Wx5azd7e05x9k/dOz9KB4x0plw2QNvs=
 go.opentelemetry.io/otel/exporters/zipkin v1.10.0/go.mod h1:HdfvgwcOoCB0+zzrTHycW6btjK0zNpkz2oTGO815SCI=
+go.opentelemetry.io/otel/exporters/zipkin v1.11.0 h1:v/Abo5REOWrCj4zcEIUHFZtXpsCVjrwZj28iyX2rHXE=
+go.opentelemetry.io/otel/exporters/zipkin v1.11.0/go.mod h1:unWnsLCMYfINP8ue0aXVrB/GYHoXNn/lbTnupvLekGQ=
 go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM=
 go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs=
 go.opentelemetry.io/otel/sdk v1.8.0/go.mod h1:uPSfc+yfDH2StDM/Rm35WE8gXSNdvCg023J6HeGNO0c=
-go.opentelemetry.io/otel/sdk v1.10.0 h1:jZ6K7sVn04kk/3DNUdJ4mqRlGDiXAVuIG+MMENpTNdY=
+go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4=
 go.opentelemetry.io/otel/sdk v1.10.0/go.mod h1:vO06iKzD5baltJz1zarxMCNHFpUlUiOy4s65ECtn6kE=
+go.opentelemetry.io/otel/sdk v1.11.0 h1:ZnKIL9V9Ztaq+ME43IUi/eo22mNsb6a7tGfzaOWB5fo=
+go.opentelemetry.io/otel/sdk v1.11.0/go.mod h1:REusa8RsyKaq0OlyangWXaw97t2VogoO4SSEeKkSTAk=
 go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
 go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
 go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
 go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4=
-go.opentelemetry.io/otel/trace v1.10.0 h1:npQMbR8o7mum8uF95yFbOEJffhs1sbCOfDh8zAJiH5E=
+go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo=
 go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM=
+go.opentelemetry.io/otel/trace v1.11.0 h1:20U/Vj42SX+mASlXLmSGBg6jpI1jQtv682lZtTAOVFI=
+go.opentelemetry.io/otel/trace v1.11.0/go.mod h1:nyYjis9jy0gytE9LXGU+/m1sHTKbRY0fX0hulNNDP1U=
 go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
 go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
 go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
@@ -1120,8 +1222,10 @@ golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACk
 golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
 golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -1168,6 +1272,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1293,6 +1398,7 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1325,6 +1431,7 @@ golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1368,8 +1475,9 @@ golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
 golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
+golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -1392,7 +1500,9 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
 golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -1413,6 +1523,7 @@ golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBn
 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
 golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
 golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
 golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
 golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
 golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
@@ -1442,8 +1553,10 @@ golang.org/x/tools v0.0.0-20200410132612-ae9902aceb98/go.mod h1:EkVYQZoAsY45+roY
 golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
@@ -1692,6 +1805,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
 google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
 google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
@@ -1748,19 +1862,25 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
 honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
 honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
+k8s.io/api v0.20.12/go.mod h1:A2brwyEkVLM3wQGNnzoAa5JsQRzHK0uoOQ+bsnv7V68=
 k8s.io/api v0.22.9 h1:PidjRtgd0zDa6SvyooBLH/SP62uOhEBY0kx0UYRGr1o=
 k8s.io/api v0.22.9/go.mod h1:rcjO/FPOuvc3x7nQWx29UcDrFJMx82RxDob71ntNH4A=
+k8s.io/apimachinery v0.20.12/go.mod h1:uM7hCI0NyBymUwgshMgZyte475lxhr+QH6h3cvdnzEc=
 k8s.io/apimachinery v0.22.9 h1:5qjnpBk6eC9me0SAzokCUMI0KVF2PENK1PnykF8/Gjo=
 k8s.io/apimachinery v0.22.9/go.mod h1:ZvVLP5iLhwVFg2Yx9Gh5W0um0DUauExbRhe+2Z8I1EU=
+k8s.io/client-go v0.20.12/go.mod h1:NBJj6Evp73Xy/4v/O/RDRaH0+3JoxNfjRxkyRgrdbsA=
 k8s.io/client-go v0.22.9 h1:5p2R2LsoBfaE6QnXfWFmyyvxrFXtfegUGRMZSpTI+Q8=
 k8s.io/client-go v0.22.9/go.mod h1:IoH7exYnoH/zgvHOuVxh2c4yJepcCBt72FzCTisOc4k=
 k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
 k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
+k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
 k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
 k8s.io/klog/v2 v2.40.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
 k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
 k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
+k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM=
 k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw=
+k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20220706174534-f6158b442e7c/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8=
@@ -1769,6 +1889,7 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
 rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
 rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
 sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
+sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
 sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y=
 sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
 sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

+ 15 - 14
src/jfw/modules/bigmember/src/go.mod

@@ -4,15 +4,15 @@ go 1.18
 
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d
-	app.yhyue.com/moapp/jybase v0.0.0-20221229074840-790b25997170
-	app.yhyue.com/moapp/jypkg v0.0.0-20230110033535-d6c3e4b755cf
+	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
+	app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8
 	github.com/donnie4w/go-logger v0.0.0-20170827050443-4740c51383f4
 	go.mongodb.org/mongo-driver v1.11.1
 )
 
 require (
-	app.yhyue.com/moapp/message v0.0.0-20221202072401-d825fc65512c // indirect
-	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4 // indirect
+	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
 	github.com/cespare/xxhash/v2 v2.1.2 // indirect
@@ -65,18 +65,19 @@ require (
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	github.com/zeromicro/go-zero v1.4.3 // indirect
+	github.com/zeromicro/go-zero v1.4.4 // indirect
 	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
-	go.opentelemetry.io/otel v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
-	go.opentelemetry.io/otel/sdk v1.10.0 // indirect
-	go.opentelemetry.io/otel/trace v1.10.0 // indirect
+	go.opentelemetry.io/otel v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
+	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
+	go.opentelemetry.io/otel/trace v1.11.0 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
 	go.uber.org/atomic v1.9.0 // indirect
 	go.uber.org/automaxprocs v1.5.1 // indirect
@@ -86,7 +87,7 @@ require (
 	golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
 	golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
 	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
+	golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
 	golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
 	golang.org/x/text v0.4.0 // indirect
 	golang.org/x/time v0.3.0 // indirect

+ 33 - 22
src/jfw/modules/bigmember/src/go.sum

@@ -2,14 +2,14 @@ app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+j
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/jyPoints v1.1.1/go.mod h1:SvP8p5L3jGrejHiH2LXfgCg/NPlFiKBC5Yd0gsI12FU=
 app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20221229074840-790b25997170 h1:gjx6+x7P1Vp/++OyfuEdR3Bcjj4/HrgIaRnE1cMTP3k=
-app.yhyue.com/moapp/jybase v0.0.0-20221229074840-790b25997170/go.mod h1:efAeRPDpJ13JuNODuqtfLlKQSQgCbnUcwGPzhFU5krY=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110033535-d6c3e4b755cf h1:NMVZDXa4yZtL2BTM8gJLpRU4fSN9a1cj7mTVYa1RUZY=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110033535-d6c3e4b755cf/go.mod h1:7D6zNxrg+Tma3VC43TLu7XPczubl4uJavua89kaFS1Q=
-app.yhyue.com/moapp/message v0.0.0-20221202072401-d825fc65512c h1:CrcvbsXZ4aQkNikBi7FUUQZNnY8hKsNo2LLe/SqeXs8=
-app.yhyue.com/moapp/message v0.0.0-20221202072401-d825fc65512c/go.mod h1:b0zZHev3gmJao1Fo+2Z2KPVjsuLOJVvVxf+kCnu9WkA=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4 h1:Xv1D9avDKeaM5kQTisF/pIt8y7B7yQ/hAxuWEg75LMs=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
+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-20230131023215-ca51808c57b8 h1:bpCxm9zroB4vy4IF2PAlD+iIPc+GwC1YMquORPBWuLI=
+app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8/go.mod h1:MqJfBFTSfZhrNDEnE4e19BmaLkaMr+lYActLXm6lrpw=
+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/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c h1:g49jOlhZlBCJ3IgJA0rotfNf2Gh22pISffUtqxB8XtY=
+bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
@@ -407,8 +407,8 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZp
 github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
 github.com/alicebob/miniredis/v2 v2.14.1/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg=
 github.com/alicebob/miniredis/v2 v2.22.0/go.mod h1:XNqvJdQJv5mSuVMc0ynneafpnL/zv52acZ6kqeS0t88=
-github.com/alicebob/miniredis/v2 v2.23.1 h1:jR6wZggBxwWygeXcdNyguCOCIjPsZyNUNlAkTx2fu0U=
-github.com/alicebob/miniredis/v2 v2.23.1/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
+github.com/alicebob/miniredis/v2 v2.30.0 h1:uA3uhDbCxfO9+DI/DuGeAMr9qI+noVWwGPNTFuKID5M=
+github.com/alicebob/miniredis/v2 v2.30.0/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
 github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
 github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
 github.com/antlr/antlr4 v0.0.0-20210105212045-464bcbc32de2/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y=
@@ -748,7 +748,7 @@ github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+
 github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ=
 github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E=
 github.com/jhump/protoreflect v1.12.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
-github.com/jhump/protoreflect v1.14.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
+github.com/jhump/protoreflect v1.14.1/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
 github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E=
@@ -1027,8 +1027,8 @@ github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 h1:5mLPGnFdSsevFRF
 github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
 github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
 github.com/zeromicro/go-zero v1.3.5/go.mod h1:wh4o794b7Ul3W0k35Pw9nc3iB4O0OpaQTMQz/PJc1bc=
-github.com/zeromicro/go-zero v1.4.3 h1:sTQ++6fxQHJnpGCN7h2CUrhWmbvhBqEgE75cJl635SM=
-github.com/zeromicro/go-zero v1.4.3/go.mod h1:UmDjuW7LHd9j7+nnnPBcXF0HLNmjJw6OjHPTlSp7X7Y=
+github.com/zeromicro/go-zero v1.4.4 h1:J8M768EVFNtIQJ/GCEsoIQPanxbx2HHT0it7r69U76Y=
+github.com/zeromicro/go-zero v1.4.4/go.mod h1:5WSUwtJm0bYdDZ69GlckigcT6D0EyAPbDaX3unbSY/4=
 github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
 go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
 go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM=
@@ -1057,31 +1057,41 @@ go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnf
 go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
 go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
 go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM=
-go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4=
 go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ=
+go.opentelemetry.io/otel v1.11.0 h1:kfToEGMDq6TrVrJ9Vht84Y8y9enykSZzDDZglV0kIEk=
+go.opentelemetry.io/otel v1.11.0/go.mod h1:H2KtuEphyMvlhZ+F7tg9GRhAOe60moNx61Ex+WmiKkk=
 go.opentelemetry.io/otel/exporters/jaeger v1.8.0/go.mod h1:GbWg+ng88rDtx+id26C34QLqw2erqJeAjsCx9AFeHfE=
-go.opentelemetry.io/otel/exporters/jaeger v1.10.0 h1:7W3aVVjEYayu/GOqOVF4mbTvnCuxF1wWu3eRxFGQXvw=
 go.opentelemetry.io/otel/exporters/jaeger v1.10.0/go.mod h1:n9IGyx0fgyXXZ/i0foLHNxtET9CzXHzZeKCucvRBFgA=
-go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 h1:TaB+1rQhddO1sF71MpZOZAuSPW1klK2M8XxfrBMfK7Y=
+go.opentelemetry.io/otel/exporters/jaeger v1.11.0 h1:Sv2valcFfMlfu6g8USSS+ZUN5vwbuGj1aY/CFtMG33w=
+go.opentelemetry.io/otel/exporters/jaeger v1.11.0/go.mod h1:nRgyJbgJ0hmaUdHwyDpTTfBYz61cTTeeGhVzfQc+FsI=
 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 h1:pDDYmo0QadUPal5fwXoY1pmMpFcdyhXOmL5drCrI3vU=
+go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 h1:0dly5et1i/6Th3WHn0M6kYiJfFNzhhxanrJ0bOfnjEo=
+go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0/go.mod h1:+Lq4/WkdCkjbGcBMVHHg2apTbv8oMBf29QCnyCCJjNQ=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0/go.mod h1:Krqnjl22jUJ0HgMzw5eveuCvFDXY4nSYb4F8t5gdrag=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 h1:KtiUEhQmj/Pa874bVYKGNVdq8NPKiacPbaRRtgXi+t4=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 h1:eyJ6njZmH16h9dOKCi7lMswAnGsSOwgTqWzfxqcuNr8=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0/go.mod h1:FnDp7XemjN3oZ3xGunnfOUTVwd2XcvLbtRAuOSU3oc8=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0/go.mod h1:OfUCyyIiDvNXHWpcWgbF+MWvqPZiNa3YDEnivcnYsV0=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 h1:j2RFV0Qdt38XQ2Jvi4WIsQ56w8T7eSirYbMw19VXRDg=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0/go.mod h1:pILgiTEtrqvZpoiuGdblDgS5dbIaTgDrkIuKfEFkt+A=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 h1:S8DedULB3gp93Rh+9Z+7NTEv+6Id/KYS7LDyipZ9iCE=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0/go.mod h1:5WV40MLWwvWlGP7Xm8g3pMcg0pKOUY609qxJn8y7LmM=
 go.opentelemetry.io/otel/exporters/zipkin v1.8.0/go.mod h1:0uYAyCuGT67MFV9Z/Mmx93wGuugHw0FbxMc74fs3LNo=
-go.opentelemetry.io/otel/exporters/zipkin v1.10.0 h1:HcPAFsFpEBKF+G5NIOA+gBsxifd3Ej+wb+KsdBLa15E=
 go.opentelemetry.io/otel/exporters/zipkin v1.10.0/go.mod h1:HdfvgwcOoCB0+zzrTHycW6btjK0zNpkz2oTGO815SCI=
+go.opentelemetry.io/otel/exporters/zipkin v1.11.0 h1:v/Abo5REOWrCj4zcEIUHFZtXpsCVjrwZj28iyX2rHXE=
+go.opentelemetry.io/otel/exporters/zipkin v1.11.0/go.mod h1:unWnsLCMYfINP8ue0aXVrB/GYHoXNn/lbTnupvLekGQ=
 go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM=
 go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs=
 go.opentelemetry.io/otel/sdk v1.8.0/go.mod h1:uPSfc+yfDH2StDM/Rm35WE8gXSNdvCg023J6HeGNO0c=
-go.opentelemetry.io/otel/sdk v1.10.0 h1:jZ6K7sVn04kk/3DNUdJ4mqRlGDiXAVuIG+MMENpTNdY=
 go.opentelemetry.io/otel/sdk v1.10.0/go.mod h1:vO06iKzD5baltJz1zarxMCNHFpUlUiOy4s65ECtn6kE=
+go.opentelemetry.io/otel/sdk v1.11.0 h1:ZnKIL9V9Ztaq+ME43IUi/eo22mNsb6a7tGfzaOWB5fo=
+go.opentelemetry.io/otel/sdk v1.11.0/go.mod h1:REusa8RsyKaq0OlyangWXaw97t2VogoO4SSEeKkSTAk=
 go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
 go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
 go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
 go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4=
-go.opentelemetry.io/otel/trace v1.10.0 h1:npQMbR8o7mum8uF95yFbOEJffhs1sbCOfDh8zAJiH5E=
 go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM=
+go.opentelemetry.io/otel/trace v1.11.0 h1:20U/Vj42SX+mASlXLmSGBg6jpI1jQtv682lZtTAOVFI=
+go.opentelemetry.io/otel/trace v1.11.0/go.mod h1:nyYjis9jy0gytE9LXGU+/m1sHTKbRY0fX0hulNNDP1U=
 go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
 go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
 go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
@@ -1360,8 +1370,9 @@ golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
 golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
+golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

+ 539 - 543
src/jfw/modules/bigmember/src/service/analysis/forecastproject.go

@@ -2,40 +2,40 @@
 package analysis
 
 import (
-        "encoding/json"
-        "fmt"
-        "jy/src/jfw/modules/bigmember/src/config"
-        "jy/src/jfw/modules/bigmember/src/db"
-        "jy/src/jfw/modules/bigmember/src/util"
-
-        . "app.yhyue.com/moapp/jybase/api"
-        . "app.yhyue.com/moapp/jybase/date"
-
-        "log"
-
-        qutil "app.yhyue.com/moapp/jybase/common"
-        dfa "app.yhyue.com/moapp/jybase/dfa"
-        elastic "app.yhyue.com/moapp/jybase/esv1"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-
-        "sort"
-        "strconv"
-        "strings"
-        "time"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/bigmember/src/config"
+	"jy/src/jfw/modules/bigmember/src/db"
+	"jy/src/jfw/modules/bigmember/src/util"
+
+	. "app.yhyue.com/moapp/jybase/api"
+	. "app.yhyue.com/moapp/jybase/date"
+
+	"log"
+
+	qutil "app.yhyue.com/moapp/jybase/common"
+	dfa "app.yhyue.com/moapp/jybase/dfa"
+	elastic "app.yhyue.com/moapp/jybase/esv1"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+
+	"sort"
+	"strconv"
+	"strings"
+	"time"
 )
 
 const (
-        INDEX           = "forecast"
-        TYPE            = "forecast"
-        bidSearch_sort  = `{"yucetime":-1}`
-        findfields      = `"title"`
-        bidSearch_field = ``
-
-        forecastQuery            = `{"query":{"filtered":{"filter":{"bool":{"must":[%s]}},"query":{"bool":{"should":[%s],"minimum_should_match":1}}}}}`
-        filter_must_time         = `{"bool":{"should":[{"bool":{"must":[{"missing":{"field":"yuceendtime"}},{"range":{"yucetime":{"gte":%d}}}]}},{"bool":{"must":[{"exists":{"field":"yuceendtime"}},{"range":{"yuceendtime":{"gte":%d}}}]}}]}}`
-        filter_must_area_city    = `{"bool":{"should":[%s]}}`
-        query_should_keys        = `{"bool":{"must":[%s],"must_not":[%s]}}`
-        query_should_multi_match = `{"multi_match":{"query":"%s","type":"phrase","fields":["results.purchasing.mypurchasing"]}}`
+	INDEX           = "forecast"
+	TYPE            = "forecast"
+	bidSearch_sort  = `{"yucetime":-1}`
+	findfields      = `"title"`
+	bidSearch_field = ``
+
+	forecastQuery            = `{"query":{"filtered":{"filter":{"bool":{"must":[%s]}},"query":{"bool":{"should":[%s],"minimum_should_match":1}}}}}`
+	filter_must_time         = `{"bool":{"should":[{"bool":{"must":[{"missing":{"field":"yuceendtime"}},{"range":{"yucetime":{"gte":%d}}}]}},{"bool":{"must":[{"exists":{"field":"yuceendtime"}},{"range":{"yuceendtime":{"gte":%d}}}]}}]}}`
+	filter_must_area_city    = `{"bool":{"should":[%s]}}`
+	query_should_keys        = `{"bool":{"must":[%s],"must_not":[%s]}}`
+	query_should_multi_match = `{"multi_match":{"query":"%s","type":"phrase","fields":["results.purchasing.mypurchasing"]}}`
 )
 
 /**
@@ -47,552 +47,548 @@ const (
 	另有省份、城市、采购单位类型等;from 赵龙玥
 **/
 func getForecastProjectSql(scd *util.ViewCondition) string {
-        musts := []string{}
-        bools := []string{}
-        musts = append(musts, fmt.Sprintf(filter_must_time, time.Now().AddDate(0, -3, 0).Unix(), time.Now().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(filter_must_area_city, strings.Join(areaCity, ",")))
-        }
-
-        //采购单位类型
-        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)
-        }
-
-        //should
-        if len(scd.Keyword) > 0 {
-                multi_match := query_should_multi_match
-                for _, v := range scd.Keyword {
-                        bool_must := []string{}
-                        bool_must_not := []string{}
-                        //附加词
-                        for _, vv := range v.Keyword {
-                                bool_must = append(bool_must, fmt.Sprintf(multi_match, vv))
-                        }
-
-                        for _, vv := range v.Appended {
-                                bool_must = append(bool_must, fmt.Sprintf(multi_match, vv))
-                        }
-
-                        //排除词
-                        for _, vv := range v.Exclude {
-                                bool_must_not = append(bool_must_not, fmt.Sprintf(multi_match, vv))
-                        }
-
-                        //添加
-                        if len(bool_must) > 0 {
-                                bools = append(bools, fmt.Sprintf(query_should_keys, strings.Join(bool_must, ","), strings.Join(bool_must_not, ",")))
-                        }
-                }
-        }
-
-        qstr := fmt.Sprintf(forecastQuery, strings.Join(musts, ","), strings.Join(bools, ","))
-        log.Println("qstr:", qstr)
-        return qstr
+	musts := []string{}
+	bools := []string{}
+	musts = append(musts, fmt.Sprintf(filter_must_time, time.Now().AddDate(0, -3, 0).Unix(), time.Now().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(filter_must_area_city, strings.Join(areaCity, ",")))
+	}
+
+	//采购单位类型
+	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)
+	}
+
+	//should
+	if len(scd.Keyword) > 0 {
+		multi_match := query_should_multi_match
+		for _, v := range scd.Keyword {
+			bool_must := []string{}
+			bool_must_not := []string{}
+			//附加词
+			for _, vv := range v.Keyword {
+				bool_must = append(bool_must, fmt.Sprintf(multi_match, vv))
+			}
+
+			for _, vv := range v.Appended {
+				bool_must = append(bool_must, fmt.Sprintf(multi_match, vv))
+			}
+
+			//排除词
+			for _, vv := range v.Exclude {
+				bool_must_not = append(bool_must_not, fmt.Sprintf(multi_match, vv))
+			}
+
+			//添加
+			if len(bool_must) > 0 {
+				bools = append(bools, fmt.Sprintf(query_should_keys, strings.Join(bool_must, ","), strings.Join(bool_must_not, ",")))
+			}
+		}
+	}
+
+	qstr := fmt.Sprintf(forecastQuery, strings.Join(musts, ","), strings.Join(bools, ","))
+	log.Println("qstr:", qstr)
+	return qstr
 }
 
 // ForPContent 预测详情页
 func (this *Analysis) ForPContent() {
-        defer qutil.Catch()
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                id := this.GetString("id")     //项目预测id
-                keys := this.GetString("keys") //关键词
-                if id == "" || keys == "" {
-                        return -1, nil
-                }
-                id = util.DecodeId(id)
-                data, ok := db.Mgo_Ent.FindById(C_FPContent, id, nil)
-                if ok && data != nil && (*data)["results"] != nil {
-                        yucetime := (*data)["yucetime"]
-                        (*data)["yucetime"] = FormatDateWithObj(&yucetime, "2006/01/02")
-                        results := qutil.ObjArrToMapArr((*data)["results"].([]interface{}))
-                        resultsArr := []map[string]interface{}{}
-                        resultsMap := map[string]interface{}{}
-                        if len(results) > 0 {
-                                for _, rv := range results {
-                                        if rv["p_projects"] == nil {
-                                                continue
-                                        }
-                                        p_projects := qutil.ObjArrToMapArr(rv["p_projects"].([]interface{}))
-                                        for _, pv := range p_projects {
-                                                if pv["p_id"] == nil || pv["p_purchasing"] == nil {
-                                                        continue
-                                                }
-                                                pv_key := qutil.ObjToString(pv["p_purchasing"])
-                                                for _, kv := range strings.Split(keys, "、") {
-                                                        if strings.Contains(pv_key, kv) {
-                                                                if resultsMap[pv["p_id"].(string)] != nil {
-                                                                        rmp := qutil.ObjToMap(resultsMap[pv["p_id"].(string)])
-                                                                        if qutil.ObjToString((*rmp)["p_purchasing"]) == pv_key {
-                                                                                continue
-                                                                        }
-                                                                        pv_key = qutil.ObjToString((*rmp)["p_purchasing"]) + "、" + pv["p_purchasing"].(string)
-                                                                        if pv["p_person"] == nil && (*rmp)["p_purchasing"] != nil {
-                                                                                pv["p_person"] = (*rmp)["p_person"]
-                                                                        }
-                                                                        if pv["p_phone"] == nil && (*rmp)["p_phone"] != nil {
-                                                                                pv["p_phone"] = (*rmp)["p_phone"]
-                                                                        }
-                                                                }
-                                                                resultsMap[pv["p_id"].(string)] = map[string]interface{}{
-                                                                        "p_purchasing": pv_key,
-                                                                        "p_phone":      pv["p_phone"],
-                                                                        "p_person":     pv["p_person"],
-                                                                        "p_id":         util.EncodeId(pv["p_id"].(string)),
-                                                                        "p_orther":     pv["p_orther"],
-                                                                }
-                                                        }
-                                                }
-                                        }
-                                }
-                                if resultsMap != nil {
-                                        for _, rmv := range resultsMap {
-                                                resultsArr = append(resultsArr, *qutil.ObjToMap(rmv))
-                                        }
-                                }
-                        }
-                        power := []int{}
-                        powerMap := jy.GetBigVipUserBaseMsg("10000", this.Session(), config.Config.Etcd.Key, config.Config.Etcd.Key).PowerMap
-                        for k, _ := range powerMap {
-                                power = append(power, k)
-                        }
-                        (*data)["power"] = power
-                        (*data)["results"] = []map[string]interface{}{}
-                        if len(resultsArr) > 0 {
-                                (*data)["results"] = resultsArr
-                        }
-                        delete(*data, "_id")
-                        delete(*data, "infoid")
-                        return *data, nil
-                }
-                return 0, nil
-        }()
-        if errMsg != nil {
-                log.Printf("%s   获取此预测项目信息出错-%s", userId, errMsg)
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+	defer qutil.Catch()
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		id := this.GetString("id")     //项目预测id
+		keys := this.GetString("keys") //关键词
+		if id == "" || keys == "" {
+			return -1, nil
+		}
+		id = util.DecodeId(id)
+		data, ok := db.Mgo_Ent.FindById(C_FPContent, id, nil)
+		if ok && data != nil && (*data)["results"] != nil {
+			yucetime := (*data)["yucetime"]
+			(*data)["yucetime"] = FormatDateWithObj(&yucetime, "2006/01/02")
+			results := qutil.ObjArrToMapArr((*data)["results"].([]interface{}))
+			resultsArr := []map[string]interface{}{}
+			resultsMap := map[string]interface{}{}
+			if len(results) > 0 {
+				for _, rv := range results {
+					if rv["p_projects"] == nil {
+						continue
+					}
+					p_projects := qutil.ObjArrToMapArr(rv["p_projects"].([]interface{}))
+					for _, pv := range p_projects {
+						if pv["p_id"] == nil || pv["p_purchasing"] == nil {
+							continue
+						}
+						pv_key := qutil.ObjToString(pv["p_purchasing"])
+						for _, kv := range strings.Split(keys, "、") {
+							if strings.Contains(pv_key, kv) {
+								if resultsMap[pv["p_id"].(string)] != nil {
+									rmp := qutil.ObjToMap(resultsMap[pv["p_id"].(string)])
+									if qutil.ObjToString((*rmp)["p_purchasing"]) == pv_key {
+										continue
+									}
+									pv_key = qutil.ObjToString((*rmp)["p_purchasing"]) + "、" + pv["p_purchasing"].(string)
+									if pv["p_person"] == nil && (*rmp)["p_purchasing"] != nil {
+										pv["p_person"] = (*rmp)["p_person"]
+									}
+									if pv["p_phone"] == nil && (*rmp)["p_phone"] != nil {
+										pv["p_phone"] = (*rmp)["p_phone"]
+									}
+								}
+								resultsMap[pv["p_id"].(string)] = map[string]interface{}{
+									"p_purchasing": pv_key,
+									"p_phone":      pv["p_phone"],
+									"p_person":     pv["p_person"],
+									"p_id":         util.EncodeId(pv["p_id"].(string)),
+									"p_orther":     pv["p_orther"],
+								}
+							}
+						}
+					}
+				}
+				if resultsMap != nil {
+					for _, rmv := range resultsMap {
+						resultsArr = append(resultsArr, *qutil.ObjToMap(rmv))
+					}
+				}
+			}
+			power := []int{}
+			powerMap := jy.GetBigVipUserBaseMsg("10000", this.Session(), config.Config.Etcd.Key, config.Config.Etcd.Key).PowerMap
+			for k, _ := range powerMap {
+				power = append(power, k)
+			}
+			(*data)["power"] = power
+			(*data)["results"] = []map[string]interface{}{}
+			if len(resultsArr) > 0 {
+				(*data)["results"] = resultsArr
+			}
+			delete(*data, "_id")
+			delete(*data, "infoid")
+			return *data, nil
+		}
+		return 0, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s   获取此预测项目信息出错-%s", userId, errMsg)
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 
 func (this *Analysis) ForPList() {
-        defer qutil.Catch()
-        var regMap = Result{
-                Data:       []map[string]interface{}{},
-                Error_code: Error_code,
-                Error_msg:  "",
-        }
-        if this.Method() == METHOD {
-                msg := ""
-                code := 0
-                list := []map[string]interface{}{}
-                flist := []map[string]interface{}{}
-                count := 0
-                var fcount int64 = 0
-                userId, _ := this.GetSession("userId").(string)
-                main_userId, _, _ := util.MainUserId(this.Session())
-                isSubCount := false
-                //子账号
-                if userId != main_userId {
-                        isSubCount = true
-                }
-                pageNum, _ := this.GetInteger("pageNum")
-                pageSize, _ := this.GetInteger("pageSize")
-                if pageSize == 0 {
-                        pageSize = 10
-                }
-                o_member_jy := &map[string]interface{}{}
-                //查库获得大会员用户的信息
-                //ao_mb, ok := db.Mgo.FindById(C_User, main_userId, `{"o_member_jy":1}`)
-                o_mb := jy.GetSubScribeInfo(this.Session(), db.Mgo, "m", "10000")
-                if o_mb != nil && (*o_mb) != nil {
-                        if (*o_mb)["o_member_jy"] != nil {
-                                // list, count = getNewProjects(main_userId, pageNum)
-                                o_member_jy = qutil.ObjToMap((*o_mb)["o_member_jy"])
-                                //项目预测检索库
-                                flist, fcount = getNewForecast(main_userId, pageNum, *o_member_jy, pageSize)
-                                if pageNum == 1 {
-                                        if (*o_member_jy)["a_items"] != nil {
-                                                a_items := qutil.ObjArrToMapArr((*o_member_jy)["a_items"].([]interface{}))
-                                                if len(a_items) == 0 || a_items[0]["a_key"] == nil || len(a_items[0]["a_key"].([]interface{})) == 0 {
-                                                        msg = "暂无设置订阅关键词,无法进行预测"
-                                                        code = 1
-                                                } else if (list == nil || len(list) == 0) && len(flist) == 0 {
-                                                        msg = "您设置的订阅关键词无法进行预测"
-                                                        code = 2
-                                                }
-                                        } else {
-                                                msg = "暂无设置订阅关键词,无法进行预测"
-                                                code = 1
-                                        }
-                                }
-                        } else {
-                                //PC端大会员 没有进行初始化
-                                msg = "暂无设置订阅关键词,无法进行预测"
-                                code = 1
-                        }
-                }
-                regMap.Data = map[string]interface{}{
-                        "msg":        msg,
-                        "code":       code,
-                        "list":       forecastMerge(list, flist),
-                        "count":      int64(count) + fcount,
-                        "isSubCount": isSubCount,
-                }
-        } else {
-                regMap.Error_code = Error_code_1005
-                regMap.Error_msg = Error_msg_1005
-        }
-        this.ServeJson(regMap)
+	defer qutil.Catch()
+	var regMap = Result{
+		Data:       []map[string]interface{}{},
+		Error_code: Error_code,
+		Error_msg:  "",
+	}
+	if this.Method() == METHOD {
+		msg := ""
+		code := 0
+		list := []map[string]interface{}{}
+		flist := []map[string]interface{}{}
+		count := 0
+		var fcount int64 = 0
+		userId, _ := this.GetSession("userId").(string)
+		main_userId, _, _ := util.MainUserId(this.Session())
+		isSubCount := false
+		//子账号
+		if userId != main_userId {
+			isSubCount = true
+		}
+		pageNum, _ := this.GetInteger("pageNum")
+		pageSize, _ := this.GetInteger("pageSize")
+		if pageSize == 0 {
+			pageSize = 10
+		}
+		//查库获得大会员用户的信息
+		//ao_mb, ok := db.Mgo.FindById(C_User, main_userId, `{"o_member_jy":1}`)
+		o_member_jy := jy.GetSubScribeInfo(this.Session(), db.Mgo, "m", "10000")
+		if o_member_jy != nil {
+			// list, count = getNewProjects(main_userId, pageNum)
+			//项目预测检索库
+			flist, fcount = getNewForecast(main_userId, pageNum, *o_member_jy, pageSize)
+			if pageNum == 1 {
+				if (*o_member_jy)["a_items"] != nil {
+					a_items := qutil.ObjArrToMapArr((*o_member_jy)["a_items"].([]interface{}))
+					if len(a_items) == 0 || a_items[0]["a_key"] == nil || len(a_items[0]["a_key"].([]interface{})) == 0 {
+						msg = "暂无设置订阅关键词,无法进行预测"
+						code = 1
+					} else if (list == nil || len(list) == 0) && len(flist) == 0 {
+						msg = "您设置的订阅关键词无法进行预测"
+						code = 2
+					}
+				} else {
+					msg = "暂无设置订阅关键词,无法进行预测"
+					code = 1
+				}
+			}
+		} else {
+			//PC端大会员 没有进行初始化
+			msg = "暂无设置订阅关键词,无法进行预测"
+			code = 1
+		}
+		regMap.Data = map[string]interface{}{
+			"msg":        msg,
+			"code":       code,
+			"list":       forecastMerge(list, flist),
+			"count":      int64(count) + fcount,
+			"isSubCount": isSubCount,
+		}
+	} else {
+		regMap.Error_code = Error_code_1005
+		regMap.Error_msg = Error_msg_1005
+	}
+	this.ServeJson(regMap)
 }
 
 type ForecastInfo struct {
-        Buyer      string   `json:"buyer"`
-        Id         string   `json:"id"`
-        Purchasing []string `json:"purchasing"`
-        Title      string   `json:"title"`
-        Createtime int64    `json:"createtime"`
-        Keys       string   `json:"keys"`
-        Jyhref     string   `json:"jyhref"`
+	Buyer      string   `json:"buyer"`
+	Id         string   `json:"id"`
+	Purchasing []string `json:"purchasing"`
+	Title      string   `json:"title"`
+	Createtime int64    `json:"createtime"`
+	Keys       string   `json:"keys"`
+	Jyhref     string   `json:"jyhref"`
 }
 
 //合并去重
 func forecastMerge(r, f []map[string]interface{}) []*ForecastInfo {
-        var idMap = map[string]bool{}
-        var res = []*ForecastInfo{}
-        var isSort = 0
-        if len(r) > 0 {
-                isSort = isSort + 1
-                for _, rv := range r {
-                        idMap[qutil.ObjToString(rv["id"])] = true
-                        res = append(res, &ForecastInfo{
-                                Buyer:      qutil.ObjToString(rv["buyer"]),
-                                Id:         util.EncodeId(qutil.ObjToString(rv["id"])),
-                                Purchasing: rv["results"].([]string),
-                                Title:      qutil.ObjToString(rv["title"]),
-                                Createtime: qutil.Int64All(rv["createtime"]),
-                                Keys:       "",
-                        })
-                }
-        }
-        if len(f) > 0 {
-                isSort = isSort + 1
-                for _, fv := range f {
-                        if idMap[qutil.ObjToString(fv["id"])] {
-                                continue
-                        }
-                        res = append(res, &ForecastInfo{
-                                Buyer:      qutil.ObjToString(fv["buyer"]),
-                                Id:         util.EncodeId(qutil.ObjToString(fv["id"])),
-                                Purchasing: fv["results"].([]string),
-                                Title:      qutil.ObjToString(fv["title"]),
-                                Createtime: qutil.Int64All(fv["yucetime"]),
-                                Jyhref:     qutil.ObjToString(fv["jyhref"]),
-                                Keys:       "",
-                        })
-                }
-        }
-        //
-        if isSort > 1 {
-                sort.Slice(res, func(i, j int) bool {
-                        return res[i].Createtime > res[j].Createtime
-                })
-        }
-        return res
+	var idMap = map[string]bool{}
+	var res = []*ForecastInfo{}
+	var isSort = 0
+	if len(r) > 0 {
+		isSort = isSort + 1
+		for _, rv := range r {
+			idMap[qutil.ObjToString(rv["id"])] = true
+			res = append(res, &ForecastInfo{
+				Buyer:      qutil.ObjToString(rv["buyer"]),
+				Id:         util.EncodeId(qutil.ObjToString(rv["id"])),
+				Purchasing: rv["results"].([]string),
+				Title:      qutil.ObjToString(rv["title"]),
+				Createtime: qutil.Int64All(rv["createtime"]),
+				Keys:       "",
+			})
+		}
+	}
+	if len(f) > 0 {
+		isSort = isSort + 1
+		for _, fv := range f {
+			if idMap[qutil.ObjToString(fv["id"])] {
+				continue
+			}
+			res = append(res, &ForecastInfo{
+				Buyer:      qutil.ObjToString(fv["buyer"]),
+				Id:         util.EncodeId(qutil.ObjToString(fv["id"])),
+				Purchasing: fv["results"].([]string),
+				Title:      qutil.ObjToString(fv["title"]),
+				Createtime: qutil.Int64All(fv["yucetime"]),
+				Jyhref:     qutil.ObjToString(fv["jyhref"]),
+				Keys:       "",
+			})
+		}
+	}
+	//
+	if isSort > 1 {
+		sort.Slice(res, func(i, j int) bool {
+			return res[i].Createtime > res[j].Createtime
+		})
+	}
+	return res
 }
 
 var d = &dfa.DFA{}
 
 //
 func getNewForecast(userId string, pageNum int, o_member_jy map[string]interface{}, pageSize int) (list []map[string]interface{}, count int64) {
-        if userId == "" {
-                return
-        }
-        sql := getSqlObjFromId(o_member_jy)
-        if sql == nil {
-                return
-        }
-        keys := []string{}
-        keyIsexists := map[string]bool{}
-        for _, v := range sql.Keyword {
-                var keys_one []string
-                for _, k := range v.Keyword {
-                        keys_one = append(keys_one, k)
-                }
-                for _, k := range v.Appended {
-                        keys_one = append(keys_one, k)
-                }
-                if keyIsexists[strings.Join(keys_one, "+")] {
-                        continue
-                }
-                keyIsexists[strings.Join(keys_one, "+")] = true
-                keys = append(keys, strings.Join(keys_one, "+"))
-        }
-        if len(keys) == 0 {
-                return
-        }
-        // qstr := GetMemberForecastSql(sql)
-        qstr := getForecastProjectSql(sql)
-        count = elastic.Count(INDEX, TYPE, qstr)
-        list = *elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, (pageNum-1)*pageSize, pageSize, 0, false)
-        if list != nil {
-                d.AddWord(keys...)
-                for _, v := range list {
-                        var rsArr = []string{}
-                        var rsArrRes = []string{}
-                        if v["results"] != nil {
-                                results := qutil.ObjArrToMapArr(v["results"].([]interface{}))
-                                rsvMap := map[string]bool{}
-                                for _, rsv := range results {
-                                        rsArr = append(rsArr, d.Analy(rsv["purchasing"].(string))...)
-                                }
-                                for _, rv := range rsArr {
-                                        if rsvMap[strings.Join(rsArr, "+")] {
-                                                continue
-                                        }
-                                        rsArrRes = append(rsArrRes, rv)
-                                        rsvMap[strings.Join(rsArr, "+")] = true
-                                }
-                        }
-                        v["results"] = rsArrRes
-                        v["id"] = qutil.ObjToString(v["_id"])
-                        v["yucetime"] = qutil.Int64All(v["yucetime"].(float64))
-                }
-                d.Clear()
-        }
-        return
+	if userId == "" {
+		return
+	}
+	sql := getSqlObjFromId(o_member_jy)
+	if sql == nil {
+		return
+	}
+	keys := []string{}
+	keyIsexists := map[string]bool{}
+	for _, v := range sql.Keyword {
+		var keys_one []string
+		for _, k := range v.Keyword {
+			keys_one = append(keys_one, k)
+		}
+		for _, k := range v.Appended {
+			keys_one = append(keys_one, k)
+		}
+		if keyIsexists[strings.Join(keys_one, "+")] {
+			continue
+		}
+		keyIsexists[strings.Join(keys_one, "+")] = true
+		keys = append(keys, strings.Join(keys_one, "+"))
+	}
+	if len(keys) == 0 {
+		return
+	}
+	// qstr := GetMemberForecastSql(sql)
+	qstr := getForecastProjectSql(sql)
+	count = elastic.Count(INDEX, TYPE, qstr)
+	list = *elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, (pageNum-1)*pageSize, pageSize, 0, false)
+	if list != nil {
+		d.AddWord(keys...)
+		for _, v := range list {
+			var rsArr = []string{}
+			var rsArrRes = []string{}
+			if v["results"] != nil {
+				results := qutil.ObjArrToMapArr(v["results"].([]interface{}))
+				rsvMap := map[string]bool{}
+				for _, rsv := range results {
+					rsArr = append(rsArr, d.Analy(rsv["purchasing"].(string))...)
+				}
+				for _, rv := range rsArr {
+					if rsvMap[strings.Join(rsArr, "+")] {
+						continue
+					}
+					rsArrRes = append(rsArrRes, rv)
+					rsvMap[strings.Join(rsArr, "+")] = true
+				}
+			}
+			v["results"] = rsArrRes
+			v["id"] = qutil.ObjToString(v["_id"])
+			v["yucetime"] = qutil.Int64All(v["yucetime"].(float64))
+		}
+		d.Clear()
+	}
+	return
 }
 
 //获取大会员forecast 检索库查询语句 - 查询逻辑有调整 dev4.6.8 -ws 新方法:getForecastProjectSql()
 func GetMemberForecastSql(scd *util.ViewCondition) 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_must_exists := `{"bool":{"should":{"filtered":{"filter":{"bool":{"must":[{"exists":{"field":"yuceendtime"}},{"range":{"yuceendtime":{"lte":%d}}}]}}}}}}`
-
-        bools := []string{}
-        musts := []string{}
-        //预测时间最新三个月
-        musts = append(musts, fmt.Sprintf(`{"range":{"yucetime":{"gte":%d}}}`, time.Now().AddDate(-2, 0, 0).Unix()), fmt.Sprintf(query_must_exists, time.Now().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
-                multi_match = fmt.Sprintf(multi_match, "%s", `"results.purchasing.mypurchasing"`)
-
-                for _, v := range scd.Keyword {
-                        shoulds := []string{}
-                        must_not := []string{}
-                        //附加词
-                        for _, vv := range v.Keyword {
-                                shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
-
-                        for _, vv := range v.Appended {
-                                shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
-
-                        //排除词
-                        for _, vv := range v.Exclude {
-                                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))
-                        }
-                }
-        }
-
-        qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
-        return qstr
+	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_must_exists := `{"bool":{"should":{"filtered":{"filter":{"bool":{"must":[{"exists":{"field":"yuceendtime"}},{"range":{"yuceendtime":{"lte":%d}}}]}}}}}}`
+
+	bools := []string{}
+	musts := []string{}
+	//预测时间最新三个月
+	musts = append(musts, fmt.Sprintf(`{"range":{"yucetime":{"gte":%d}}}`, time.Now().AddDate(-2, 0, 0).Unix()), fmt.Sprintf(query_must_exists, time.Now().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
+		multi_match = fmt.Sprintf(multi_match, "%s", `"results.purchasing.mypurchasing"`)
+
+		for _, v := range scd.Keyword {
+			shoulds := []string{}
+			must_not := []string{}
+			//附加词
+			for _, vv := range v.Keyword {
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			for _, vv := range v.Appended {
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			//排除词
+			for _, vv := range v.Exclude {
+				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))
+			}
+		}
+	}
+
+	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
+	return qstr
 }
 
 //member_jy
 func getSqlObjFromId(o_member_jy map[string]interface{}) *util.ViewCondition {
-        if o_member_jy["a_items"] == nil {
-                return nil
-        }
-        a_items := []interface{}{}
-        if o_member_jy["a_items"] != nil {
-                a_items = o_member_jy["a_items"].([]interface{})
-        }
-        a_buyerclass := []interface{}{}
-        if o_member_jy["a_buyerclass"] != nil {
-                a_buyerclass = o_member_jy["a_buyerclass"].([]interface{})
-        }
-        if len(a_buyerclass) > 0 && qutil.IntAllDef(o_member_jy["i_matchbuyerclass_other"], 1) == 1 && len(a_items) > 0 {
-                a_buyerclass = append(a_buyerclass, "其它")
-        }
-        a_infotype := []interface{}{}
-        if o_member_jy["a_infotype"] != nil {
-                a_infotype = o_member_jy["a_infotype"].([]interface{})
-        }
-        o_area := map[string]interface{}{}
-        if o_member_jy["o_area"] != nil {
-                o_area = o_member_jy["o_area"].(map[string]interface{})
-        }
-        return &util.ViewCondition{
-                Keyword:    getKeyWordArr(a_items, "", -1),
-                Buyerclass: qutil.ObjArrToStringArr(a_buyerclass),
-                Subtype:    qutil.ObjArrToStringArr(a_infotype),
-                Area:       getStringArrFromDbResult(o_area, 1),
-                City:       getStringArrFromDbResult(o_area, 2),
-                SelectType: strconv.Itoa(qutil.IntAll(o_member_jy["i_matchway"])),
-        }
+	if o_member_jy["a_items"] == nil {
+		return nil
+	}
+	a_items := []interface{}{}
+	if o_member_jy["a_items"] != nil {
+		a_items = o_member_jy["a_items"].([]interface{})
+	}
+	a_buyerclass := []interface{}{}
+	if o_member_jy["a_buyerclass"] != nil {
+		a_buyerclass = o_member_jy["a_buyerclass"].([]interface{})
+	}
+	if len(a_buyerclass) > 0 && qutil.IntAllDef(o_member_jy["i_matchbuyerclass_other"], 1) == 1 && len(a_items) > 0 {
+		a_buyerclass = append(a_buyerclass, "其它")
+	}
+	a_infotype := []interface{}{}
+	if o_member_jy["a_infotype"] != nil {
+		a_infotype = o_member_jy["a_infotype"].([]interface{})
+	}
+	o_area := map[string]interface{}{}
+	if o_member_jy["o_area"] != nil {
+		o_area = o_member_jy["o_area"].(map[string]interface{})
+	}
+	return &util.ViewCondition{
+		Keyword:    getKeyWordArr(a_items, "", -1),
+		Buyerclass: qutil.ObjArrToStringArr(a_buyerclass),
+		Subtype:    qutil.ObjArrToStringArr(a_infotype),
+		Area:       getStringArrFromDbResult(o_area, 1),
+		City:       getStringArrFromDbResult(o_area, 2),
+		SelectType: strconv.Itoa(qutil.IntAll(o_member_jy["i_matchway"])),
+	}
 }
 
 //关键词 附加词 排除词
 func getKeyWordArr(a_items []interface{}, item string, index int) (arr []util.ViewKeyWord) {
-        if a_items == nil {
-                return
-        }
-        for _, v := range a_items {
-                vm, _ := v.(map[string]interface{})
-                if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
-                        continue
-                }
-                if vm["a_key"] == nil {
-                        continue
-                }
-                kwsArr := vm["a_key"]
-                for i, k := range kwsArr.([]interface{}) {
-                        if item != "" && index >= 0 && i != index {
-                                continue
-                        }
-                        kw := util.ViewKeyWord{}
-                        b, e := json.Marshal(k)
-                        if e != nil {
-                                log.Println(e.Error())
-                        }
-                        json.Unmarshal(b, &kw)
-                        if kw.MatchWay == 1 {
-                                for _, kk := range kw.Keyword {
-                                        arr = append(arr, util.ViewKeyWord{
-                                                Keyword: []string{kk},
-                                                Exclude: kw.Exclude,
-                                        })
-                                }
-                                for _, kk := range kw.Appended {
-                                        arr = append(arr, util.ViewKeyWord{
-                                                Keyword: []string{kk},
-                                                Exclude: kw.Exclude,
-                                        })
-                                }
-                        } else {
-                                arr = append(arr, kw)
-                        }
-                }
-        }
-        return
+	if a_items == nil {
+		return
+	}
+	for _, v := range a_items {
+		vm, _ := v.(map[string]interface{})
+		if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
+			continue
+		}
+		if vm["a_key"] == nil {
+			continue
+		}
+		kwsArr := vm["a_key"]
+		for i, k := range kwsArr.([]interface{}) {
+			if item != "" && index >= 0 && i != index {
+				continue
+			}
+			kw := util.ViewKeyWord{}
+			b, e := json.Marshal(k)
+			if e != nil {
+				log.Println(e.Error())
+			}
+			json.Unmarshal(b, &kw)
+			if kw.MatchWay == 1 {
+				for _, kk := range kw.Keyword {
+					arr = append(arr, util.ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+				for _, kk := range kw.Appended {
+					arr = append(arr, util.ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+			} else {
+				arr = append(arr, kw)
+			}
+		}
+	}
+	return
 }
 
 //
 func getStringArrFromDbResult(area map[string]interface{}, i int) (arr []string) {
-        if area == nil {
-                return
-        }
-        var eareArr []string
-        var cityArr []string
-        for k, v := range area {
-                if len(v.([]interface{})) > 0 {
-                        cityArr = append(cityArr, qutil.ObjArrToStringArr(v.([]interface{}))...)
-                } else {
-                        eareArr = append(eareArr, k)
-                }
-        }
-        if i == 1 {
-                arr = eareArr
-        } else {
-                arr = cityArr
-        }
-        return
+	if area == nil {
+		return
+	}
+	var eareArr []string
+	var cityArr []string
+	for k, v := range area {
+		if len(v.([]interface{})) > 0 {
+			cityArr = append(cityArr, qutil.ObjArrToStringArr(v.([]interface{}))...)
+		} else {
+			eareArr = append(eareArr, k)
+		}
+	}
+	if i == 1 {
+		arr = eareArr
+	} else {
+		arr = cityArr
+	}
+	return
 }

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

@@ -2,886 +2,886 @@
 package analysis
 
 import (
-        . "app.yhyue.com/moapp/jybase/api"
-        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"
-        "encoding/json"
-        "fmt"
-        "jy/src/jfw/modules/bigmember/src/config"
-        "jy/src/jfw/modules/bigmember/src/db"
-        "jy/src/jfw/modules/bigmember/src/entity"
-        "log"
-        "sort"
-        "strings"
-        "sync"
-        "time"
+	. "app.yhyue.com/moapp/jybase/api"
+	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"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/bigmember/src/config"
+	"jy/src/jfw/modules/bigmember/src/db"
+	"jy/src/jfw/modules/bigmember/src/entity"
+	"log"
+	"sort"
+	"strings"
+	"sync"
+	"time"
 
-        "jy/src/jfw/modules/bigmember/src/util"
+	"jy/src/jfw/modules/bigmember/src/util"
 
-        "go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson"
 )
 
 // 大会员首页
 func (this *Analysis) PotIndex() {
-        userId, _ := this.GetSession("userId").(string)
-        defer qutil.Catch()
-        r := func() Result {
-                if this.Method() != "POST" {
-                        return Result{Data: nil, Error_msg: Error_msg_1005}
-                }
-                //接受前端参数
-                ptst := new(SelectC)
-                if string(this.Body()) != "" {
-                        //接收参数
-                        json.Unmarshal(this.Body(), &ptst)
-                }
-                ptst.UserId = userId
-                ptst.Session = this.Session()
-                if !ptst.UserStatusChecked() {
-                        return Result{Data: nil, Error_msg: Error_msg_1004}
-                }
-                if ptst.PCOR != "" && ptst.IsIndex {
-                        list := []*PTComs{}
-                        ok, _ := redis.Exists("other", "CRIndex_"+ptst.PCOR+"_"+ptst.UserId)
-                        redis_baseKeys := "CRIndex_new_" + ptst.UserId + "_" + ptst.Base64Keys()
-                        _res := redis.Get("other", redis_baseKeys)
-                        if ok && _res != nil {
-                                b, e := json.Marshal(_res)
-                                if e != nil {
-                                        log.Println(e.Error())
-                                }
-                                json.Unmarshal(b, &list)
-                        } else {
-                                //客户
-                                if ptst.PCOR == "C" {
-                                        potComQ := PCQuery(ptst.Area, ptst.Industry, ptst.BuyerClass, ptst.Business_scope, ptst.Sort_no, ptst.PCOR)
-                                        list = getPCostomers(ptst.UserId, ptst.EntName, potComQ, ptst.PCOR)
+	userId, _ := this.GetSession("userId").(string)
+	defer qutil.Catch()
+	r := func() Result {
+		if this.Method() != "POST" {
+			return Result{Data: nil, Error_msg: Error_msg_1005}
+		}
+		//接受前端参数
+		ptst := new(SelectC)
+		if string(this.Body()) != "" {
+			//接收参数
+			json.Unmarshal(this.Body(), &ptst)
+		}
+		ptst.UserId = userId
+		ptst.Session = this.Session()
+		if !ptst.UserStatusChecked() {
+			return Result{Data: nil, Error_msg: Error_msg_1004}
+		}
+		if ptst.PCOR != "" && ptst.IsIndex {
+			list := []*PTComs{}
+			ok, _ := redis.Exists("other", "CRIndex_"+ptst.PCOR+"_"+ptst.UserId)
+			redis_baseKeys := "CRIndex_new_" + ptst.UserId + "_" + ptst.Base64Keys()
+			_res := redis.Get("other", redis_baseKeys)
+			if ok && _res != nil {
+				b, e := json.Marshal(_res)
+				if e != nil {
+					log.Println(e.Error())
+				}
+				json.Unmarshal(b, &list)
+			} else {
+				//客户
+				if ptst.PCOR == "C" {
+					potComQ := PCQuery(ptst.Area, ptst.Industry, ptst.BuyerClass, ptst.Business_scope, ptst.Sort_no, ptst.PCOR)
+					list = getPCostomers(ptst.UserId, ptst.EntName, potComQ, ptst.PCOR)
 
-                                } else if ptst.PCOR == "R" {
-                                        potRivQ := PCQuery(ptst.Area, ptst.Industry, ptst.BuyerClass, ptst.Business_scope, ptst.Sort_no, ptst.PCOR)
-                                        list = getPRivals(ptst.UserId, potRivQ, ptst.PCOR)
-                                }
-                        }
-                        if len(list) > 20 {
-                                list = list[:20]
-                        }
-                        if len(list) > 0 {
-                                redis.Put("other", redis_baseKeys, list, 8*60*60)
-                                redis.Put("other", "CRIndex_"+ptst.PCOR+"_"+ptst.UserId, "CR", 8*60*60)
-                        }
-                        return Result{Data: map[string]interface{}{
-                                "list": list,
-                        }}
-                }
-                return Result{Data: nil}
-        }()
-        this.ServeJson(r)
+				} else if ptst.PCOR == "R" {
+					potRivQ := PCQuery(ptst.Area, ptst.Industry, ptst.BuyerClass, ptst.Business_scope, ptst.Sort_no, ptst.PCOR)
+					list = getPRivals(ptst.UserId, potRivQ, ptst.PCOR)
+				}
+			}
+			if len(list) > 20 {
+				list = list[:20]
+			}
+			if len(list) > 0 {
+				redis.Put("other", redis_baseKeys, list, 8*60*60)
+				redis.Put("other", "CRIndex_"+ptst.PCOR+"_"+ptst.UserId, "CR", 8*60*60)
+			}
+			return Result{Data: map[string]interface{}{
+				"list": list,
+			}}
+		}
+		return Result{Data: nil}
+	}()
+	this.ServeJson(r)
 }
 
 // 移除我的潜在对手
 func (this *Analysis) RMyRivals() {
-        defer qutil.Catch()
-        var regMap = Result{
-                Data:       []map[string]interface{}{},
-                Error_code: Error_code,
-                Error_msg:  "",
-        }
-        if this.Method() == METHOD {
-                entId := util.DecodeId(this.GetString("entId"))
-                userId, _ := this.GetSession("userId").(string)
-                if userId != "" {
-                        main_userId, _, _ := util.MainUserId(this.Session())
-                        if entId != "" && main_userId != "" {
-                                ok := db.Mgo.Update(C_Member, `{"userid":"`+main_userId+`"}`, bson.M{
-                                        "$addToSet": bson.M{
-                                                "outMyRivalIds": entId,
-                                        },
-                                }, true, false)
-                                regMap.Data = map[string]interface{}{
-                                        "success": ok,
-                                }
-                                go func(userId string) {
-                                        //首页潜在竞争对手缓存
-                                        redis.Del("other", fmt.Sprintf("CRIndex_R_%s", userId))
-                                }(main_userId)
-                        }
-                } else {
-                        regMap.Error_code = Error_code_1002
-                        regMap.Error_msg = Error_msg_1002
-                }
-        } else {
-                regMap.Error_code = Error_code_1005
-                regMap.Error_msg = Error_msg_1005
-        }
-        this.ServeJson(regMap)
+	defer qutil.Catch()
+	var regMap = Result{
+		Data:       []map[string]interface{}{},
+		Error_code: Error_code,
+		Error_msg:  "",
+	}
+	if this.Method() == METHOD {
+		entId := util.DecodeId(this.GetString("entId"))
+		userId, _ := this.GetSession("userId").(string)
+		if userId != "" {
+			main_userId, _, _ := util.MainUserId(this.Session())
+			if entId != "" && main_userId != "" {
+				ok := db.Mgo.Update(C_Member, `{"userid":"`+main_userId+`"}`, bson.M{
+					"$addToSet": bson.M{
+						"outMyRivalIds": entId,
+					},
+				}, true, false)
+				regMap.Data = map[string]interface{}{
+					"success": ok,
+				}
+				go func(userId string) {
+					//首页潜在竞争对手缓存
+					redis.Del("other", fmt.Sprintf("CRIndex_R_%s", userId))
+				}(main_userId)
+			}
+		} else {
+			regMap.Error_code = Error_code_1002
+			regMap.Error_msg = Error_msg_1002
+		}
+	} else {
+		regMap.Error_code = Error_code_1005
+		regMap.Error_msg = Error_msg_1005
+	}
+	this.ServeJson(regMap)
 }
 
 // 潜在客户
 func (this *Analysis) CsORRsList() {
-        defer qutil.Catch()
-        var regMap = Result{
-                Data:       []map[string]interface{}{},
-                Error_code: Error_code,
-                Error_msg:  "",
-        }
-        if this.Method() == METHOD {
-                userId, _ := this.GetSession("userId").(string)
-                var entName = "" //企业名称
-                //接受前端参数
-                getRes := new(SelectC)
-                if string(this.Body()) != "" {
-                        //接收参数
-                        json.Unmarshal(this.Body(), &getRes)
-                }
-                if getRes.PCOR != "" {
-                        main_userId, _, _ := util.MainUserId(this.Session())
-                        // getRes.Searchbool -- 0:默认查询 1:条件查询
-                        // log.Println(len(getRes.Area), "----", getRes.BuyerClass, "----", getRes.Business_scope, "--", getRes.Searchbool)
-                        if getRes.Searchbool == 0 && (len(getRes.Area) == 0 || len(getRes.BuyerClass) == 0 || len(getRes.Business_scope) == 0) {
-                                //查库获得大会员用户的信息
-                                getRes.Area, getRes.BuyerClass, getRes.Business_scope = GetUserInfo(this.Session())
-                        } else {
-                                getRes.Business_scope = BuyerContentStruct(getRes.Business_scope)
-                        }
-                        //查库获得大会员用户的行业信息
-                        entInfo, ok := db.Mgo.FindOneByField(C_Member, `{"userid":"`+main_userId+`"}`, `{"entname":1,"industry":1}`)
-                        if ok && entInfo != nil {
-                                if (*entInfo)["entname"] != nil {
-                                        entName = (*entInfo)["entname"].(string)
-                                }
-                                if len(getRes.Industry) == 0 && (*entInfo)["industry"] != nil {
-                                        industryMap := *qutil.ObjToMap((*entInfo)["industry"].(map[string]interface{})) //行业
-                                        for k, v := range industryMap {
-                                                idst := qutil.ObjArrToStringArr(v.([]interface{}))
-                                                if len(idst) > 0 {
-                                                        for _, vv := range idst {
-                                                                getRes.Industry = append(getRes.Industry, k+"_"+vv)
-                                                        }
-                                                }
-                                        }
-                                }
-                        }
-                        //
-                        if entName == "" {
-                                log.Println("大会员初始化 企业名称有误-", userId, main_userId)
-                        }
-                        //userInfo, ok := db.Mgo.FindById(C_User, main_userId, nil)
-                        userInfo := jy.GetBigVipUserBaseMsg("10000", this.Session(), config.Config.Etcd.Key, config.Config.Etcd.Key)
+	defer qutil.Catch()
+	var regMap = Result{
+		Data:       []map[string]interface{}{},
+		Error_code: Error_code,
+		Error_msg:  "",
+	}
+	if this.Method() == METHOD {
+		userId, _ := this.GetSession("userId").(string)
+		var entName = "" //企业名称
+		//接受前端参数
+		getRes := new(SelectC)
+		if string(this.Body()) != "" {
+			//接收参数
+			json.Unmarshal(this.Body(), &getRes)
+		}
+		if getRes.PCOR != "" {
+			main_userId, _, _ := util.MainUserId(this.Session())
+			// getRes.Searchbool -- 0:默认查询 1:条件查询
+			// log.Println(len(getRes.Area), "----", getRes.BuyerClass, "----", getRes.Business_scope, "--", getRes.Searchbool)
+			if getRes.Searchbool == 0 && (len(getRes.Area) == 0 || len(getRes.BuyerClass) == 0 || len(getRes.Business_scope) == 0) {
+				//查库获得大会员用户的信息
+				getRes.Area, getRes.BuyerClass, getRes.Business_scope = GetUserInfo(this.Session())
+			} else {
+				getRes.Business_scope = BuyerContentStruct(getRes.Business_scope)
+			}
+			//查库获得大会员用户的行业信息
+			entInfo, ok := db.Mgo.FindOneByField(C_Member, `{"userid":"`+main_userId+`"}`, `{"entname":1,"industry":1}`)
+			if ok && entInfo != nil {
+				if (*entInfo)["entname"] != nil {
+					entName = (*entInfo)["entname"].(string)
+				}
+				if len(getRes.Industry) == 0 && (*entInfo)["industry"] != nil {
+					industryMap := *qutil.ObjToMap((*entInfo)["industry"].(map[string]interface{})) //行业
+					for k, v := range industryMap {
+						idst := qutil.ObjArrToStringArr(v.([]interface{}))
+						if len(idst) > 0 {
+							for _, vv := range idst {
+								getRes.Industry = append(getRes.Industry, k+"_"+vv)
+							}
+						}
+					}
+				}
+			}
+			//
+			if entName == "" {
+				log.Println("大会员初始化 企业名称有误-", userId, main_userId)
+			}
+			//userInfo, ok := db.Mgo.FindById(C_User, main_userId, nil)
+			userInfo := jy.GetBigVipUserBaseMsg("10000", this.Session(), config.Config.Etcd.Key, config.Config.Etcd.Key)
 
-                        if userInfo != nil {
-                                var isTrial = userInfo.Status == 4
-                                var c_limitcount = 5
-                                var r_limitcount = 5
-                                if getRes.ServiceId == 0 {
-                                        getRes.ServiceId = 7 //潜在客户-潜在伙伴/竞争对手
-                                }
-                                //客户
-                                if getRes.PCOR == "C" {
-                                        potComQ := PCQuery(getRes.Area, getRes.Industry, getRes.BuyerClass, getRes.Business_scope, getRes.Sort_no, getRes.PCOR)
-                                        var list []*PTComs
-                                        if config.Config.PotentialSwitch {
-                                                list = CustomersInfo(main_userId, entName, potComQ, getRes.PCOR)
-                                        } else {
-                                                list = getPCostomers(main_userId, entName, potComQ, getRes.PCOR)
-                                        }
-                                        surpluscount := -1
-                                        //排序
-                                        if len(list) > 0 && config.Config.PotentialSwitch {
-                                                if getRes.Sort_no == 0 {
-                                                        sort.Slice(list, func(i, j int) bool {
-                                                                return list[i].PNCount > list[j].PNCount
-                                                        })
-                                                } else {
-                                                        sort.Slice(list, func(i, j int) bool {
-                                                                return list[i].Budget > list[j].Budget
-                                                        })
-                                                }
-                                        } //剩余数量
-                                        if isTrial {
-                                                c_limitcount = getBAmountInfo(main_userId, getRes.ServiceId)
-                                                if len(list) > c_limitcount {
-                                                        surpluscount = len(list) - c_limitcount
-                                                        list = list[:c_limitcount]
-                                                }
-                                        }
-                                        if len(list) > 100 {
-                                                list = list[:100]
-                                        }
-                                        regMap.Data = map[string]interface{}{
-                                                "list":         list,
-                                                "surpluscount": surpluscount,
-                                                "param": map[string]interface{}{
-                                                        "area":           getRes.Area,
-                                                        "industry":       getRes.Industry,
-                                                        "buyerClass":     getRes.BuyerClass,
-                                                        "business_scope": getRes.Business_scope,
-                                                },
-                                        }
-                                } else if getRes.PCOR == "R" {
-                                        potRivQ := PCQuery(getRes.Area, getRes.Industry, getRes.BuyerClass, getRes.Business_scope, getRes.Sort_no, getRes.PCOR)
-                                        var list []*PTComs
-                                        if config.Config.PotentialSwitch {
-                                                list = PRivals(main_userId, potRivQ, getRes.PCOR)
-                                        } else {
-                                                list = getPRivals(main_userId, potRivQ, getRes.PCOR)
-                                        }
-                                        //排序
-                                        if len(list) > 0 && config.Config.PotentialSwitch {
-                                                if getRes.Sort_no == 0 {
-                                                        sort.Slice(list, func(i, j int) bool {
-                                                                return list[i].PNCount > list[j].PNCount
-                                                        })
-                                                } else {
-                                                        sort.Slice(list, func(i, j int) bool {
-                                                                return list[i].Budget > list[j].Budget
-                                                        })
-                                                }
-                                        }
-                                        surpluscount := -1 //剩余数量
-                                        if isTrial {
-                                                r_limitcount = getBAmountInfo(main_userId, getRes.ServiceId)
-                                                if len(list) > r_limitcount {
-                                                        surpluscount = len(list) - r_limitcount
-                                                        list = list[:r_limitcount]
-                                                }
-                                        }
+			if userInfo != nil {
+				var isTrial = userInfo.Status == 4
+				var c_limitcount = 5
+				var r_limitcount = 5
+				if getRes.ServiceId == 0 {
+					getRes.ServiceId = 7 //潜在客户-潜在伙伴/竞争对手
+				}
+				//客户
+				if getRes.PCOR == "C" {
+					potComQ := PCQuery(getRes.Area, getRes.Industry, getRes.BuyerClass, getRes.Business_scope, getRes.Sort_no, getRes.PCOR)
+					var list []*PTComs
+					if config.Config.PotentialSwitch {
+						list = CustomersInfo(main_userId, entName, potComQ, getRes.PCOR)
+					} else {
+						list = getPCostomers(main_userId, entName, potComQ, getRes.PCOR)
+					}
+					surpluscount := -1
+					//排序
+					if len(list) > 0 && config.Config.PotentialSwitch {
+						if getRes.Sort_no == 0 {
+							sort.Slice(list, func(i, j int) bool {
+								return list[i].PNCount > list[j].PNCount
+							})
+						} else {
+							sort.Slice(list, func(i, j int) bool {
+								return list[i].Budget > list[j].Budget
+							})
+						}
+					} //剩余数量
+					if isTrial {
+						c_limitcount = getBAmountInfo(main_userId, getRes.ServiceId)
+						if len(list) > c_limitcount {
+							surpluscount = len(list) - c_limitcount
+							list = list[:c_limitcount]
+						}
+					}
+					if len(list) > 100 {
+						list = list[:100]
+					}
+					regMap.Data = map[string]interface{}{
+						"list":         list,
+						"surpluscount": surpluscount,
+						"param": map[string]interface{}{
+							"area":           getRes.Area,
+							"industry":       getRes.Industry,
+							"buyerClass":     getRes.BuyerClass,
+							"business_scope": getRes.Business_scope,
+						},
+					}
+				} else if getRes.PCOR == "R" {
+					potRivQ := PCQuery(getRes.Area, getRes.Industry, getRes.BuyerClass, getRes.Business_scope, getRes.Sort_no, getRes.PCOR)
+					var list []*PTComs
+					if config.Config.PotentialSwitch {
+						list = PRivals(main_userId, potRivQ, getRes.PCOR)
+					} else {
+						list = getPRivals(main_userId, potRivQ, getRes.PCOR)
+					}
+					//排序
+					if len(list) > 0 && config.Config.PotentialSwitch {
+						if getRes.Sort_no == 0 {
+							sort.Slice(list, func(i, j int) bool {
+								return list[i].PNCount > list[j].PNCount
+							})
+						} else {
+							sort.Slice(list, func(i, j int) bool {
+								return list[i].Budget > list[j].Budget
+							})
+						}
+					}
+					surpluscount := -1 //剩余数量
+					if isTrial {
+						r_limitcount = getBAmountInfo(main_userId, getRes.ServiceId)
+						if len(list) > r_limitcount {
+							surpluscount = len(list) - r_limitcount
+							list = list[:r_limitcount]
+						}
+					}
 
-                                        if len(list) > 100 {
-                                                list = list[:100]
-                                        }
-                                        regMap.Data = map[string]interface{}{
-                                                "list":         list,
-                                                "surpluscount": surpluscount,
-                                                "param": map[string]interface{}{
-                                                        "area":           getRes.Area,
-                                                        "industry":       getRes.Industry,
-                                                        "buyerClass":     getRes.BuyerClass,
-                                                        "business_scope": getRes.Business_scope,
-                                                },
-                                        }
-                                }
-                        } else {
-                                regMap.Error_code = Error_code_1003
-                                regMap.Error_msg = Error_msg_1003
-                        }
-                        //记录查询日志
-                        go savePOTLogs(userId, main_userId, entName, getRes.Area, getRes.BuyerClass, getRes.Industry, getRes.Business_scope, getRes.Sort_no, getRes.PCOR, regMap)
+					if len(list) > 100 {
+						list = list[:100]
+					}
+					regMap.Data = map[string]interface{}{
+						"list":         list,
+						"surpluscount": surpluscount,
+						"param": map[string]interface{}{
+							"area":           getRes.Area,
+							"industry":       getRes.Industry,
+							"buyerClass":     getRes.BuyerClass,
+							"business_scope": getRes.Business_scope,
+						},
+					}
+				}
+			} else {
+				regMap.Error_code = Error_code_1003
+				regMap.Error_msg = Error_msg_1003
+			}
+			//记录查询日志
+			go savePOTLogs(userId, main_userId, entName, getRes.Area, getRes.BuyerClass, getRes.Industry, getRes.Business_scope, getRes.Sort_no, getRes.PCOR, regMap)
 
-                } else {
-                        regMap.Error_code = Error_code_1002
-                        regMap.Error_msg = Error_msg_1002
-                }
-        } else {
-                regMap.Error_code = Error_code_1005
-                regMap.Error_msg = Error_msg_1005
-        }
-        this.ServeJson(regMap)
+		} else {
+			regMap.Error_code = Error_code_1002
+			regMap.Error_msg = Error_msg_1002
+		}
+	} else {
+		regMap.Error_code = Error_code_1005
+		regMap.Error_msg = Error_msg_1005
+	}
+	this.ServeJson(regMap)
 }
 
 func GetUserInfo(session *httpsession.Session) (map[string]interface{}, []string, []ViewKeyWord) {
-        var (
-                query *map[string]interface{}
-        )
-        if query := jy.GetSubScribeInfo(session, db.Mgo, "m", "10000"); query == nil {
-                return nil, []string{}, nil
-        }
-        o_member_jy, _ := (*query)["o_member_jy"].(map[string]interface{})
-        if o_member_jy["a_items"] == nil && o_member_jy["a_buyerclass"] == nil && o_member_jy["a_infotype"] == nil && o_member_jy["o_area"] == nil {
-                return nil, []string{}, nil
-        }
-        a_items := []interface{}{}
-        if o_member_jy["a_items"] != nil {
-                a_items = o_member_jy["a_items"].([]interface{})
-        }
-        a_buyerclass := []interface{}{}
-        if o_member_jy["a_buyerclass"] != nil {
-                a_buyerclass = o_member_jy["a_buyerclass"].([]interface{})
-        }
-        if len(a_buyerclass) > 0 && qutil.IntAllDef(o_member_jy["i_matchbuyerclass_other"], 1) == 1 && len(a_items) > 0 {
-                a_buyerclass = append(a_buyerclass, "其它")
-        }
-        o_area := map[string]interface{}{}
-        if o_member_jy["o_area"] != nil {
-                o_area = o_member_jy["o_area"].(map[string]interface{})
-        }
-        return o_area, qutil.ObjArrToStringArr(a_buyerclass), getKeyWordArrFromDbResult(a_items, "", -1)
+	var (
+		o_member_jy *map[string]interface{}
+	)
+	o_member_jy = jy.GetSubScribeInfo(session, db.Mgo, "m", "10000")
+	if (*o_member_jy) == nil {
+		return nil, []string{}, nil
+	}
+	if (*o_member_jy)["a_items"] == nil && (*o_member_jy)["a_buyerclass"] == nil && (*o_member_jy)["a_infotype"] == nil && (*o_member_jy)["o_area"] == nil {
+		return nil, []string{}, nil
+	}
+	a_items := []interface{}{}
+	if (*o_member_jy)["a_items"] != nil {
+		a_items = (*o_member_jy)["a_items"].([]interface{})
+	}
+	a_buyerclass := []interface{}{}
+	if (*o_member_jy)["a_buyerclass"] != nil {
+		a_buyerclass = (*o_member_jy)["a_buyerclass"].([]interface{})
+	}
+	if len(a_buyerclass) > 0 && qutil.IntAllDef((*o_member_jy)["i_matchbuyerclass_other"], 1) == 1 && len(a_items) > 0 {
+		a_buyerclass = append(a_buyerclass, "其它")
+	}
+	o_area := map[string]interface{}{}
+	if (*o_member_jy)["o_area"] != nil {
+		o_area = (*o_member_jy)["o_area"].(map[string]interface{})
+	}
+	return o_area, qutil.ObjArrToStringArr(a_buyerclass), getKeyWordArrFromDbResult(a_items, "", -1)
 }
 
 // 关键词 附加词 排除词
 func getKeyWordArrFromDbResult(a_items []interface{}, item string, index int) (arr []ViewKeyWord) {
-        if a_items == nil {
-                return
-        }
-        for _, v := range a_items {
-                vm, _ := v.(map[string]interface{})
-                if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
-                        continue
-                }
-                kwsArr := vm["a_key"]
-                for i, k := range kwsArr.([]interface{}) {
-                        if item != "" && index >= 0 && i != index {
-                                continue
-                        }
-                        kw := ViewKeyWord{}
-                        b, e := json.Marshal(k)
-                        if e != nil {
-                                log.Println(e.Error())
-                        }
-                        json.Unmarshal(b, &kw)
-                        if kw.MatchWay == 1 {
-                                for _, kk := range kw.Keyword {
-                                        arr = append(arr, ViewKeyWord{
-                                                Keyword: []string{kk},
-                                                Exclude: kw.Exclude,
-                                        })
-                                }
-                                for _, kk := range kw.Appended {
-                                        arr = append(arr, ViewKeyWord{
-                                                Keyword: []string{kk},
-                                                Exclude: kw.Exclude,
-                                        })
-                                }
-                        } else {
-                                arr = append(arr, kw)
-                        }
-                }
-        }
-        return
+	if a_items == nil {
+		return
+	}
+	for _, v := range a_items {
+		vm, _ := v.(map[string]interface{})
+		if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
+			continue
+		}
+		kwsArr := vm["a_key"]
+		for i, k := range kwsArr.([]interface{}) {
+			if item != "" && index >= 0 && i != index {
+				continue
+			}
+			kw := ViewKeyWord{}
+			b, e := json.Marshal(k)
+			if e != nil {
+				log.Println(e.Error())
+			}
+			json.Unmarshal(b, &kw)
+			if kw.MatchWay == 1 {
+				for _, kk := range kw.Keyword {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+				for _, kk := range kw.Appended {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+			} else {
+				arr = append(arr, kw)
+			}
+		}
+	}
+	return
 }
 
 // 记录查询日志
 func savePOTLogs(userId, main_userId, entName string, area map[string]interface{}, buyerClass, industry []string, business_scope []ViewKeyWord, sort_no int, pcor string, regMap Result) {
-        var saveData = map[string]interface{}{
-                "userId":         userId,
-                "main_userId":    main_userId,
-                "entName":        entName,
-                "area":           area,
-                "buyerclass":     buyerClass,
-                "industry":       industry,
-                "business_scope": business_scope,
-                "sort_no":        sort_no,
-                "pcor":           pcor,
-                "regMap":         regMap,
-                "createdate":     time.Now().Unix(),
-        }
-        db.Mgo_Log.Save(C_PTLog, saveData)
+	var saveData = map[string]interface{}{
+		"userId":         userId,
+		"main_userId":    main_userId,
+		"entName":        entName,
+		"area":           area,
+		"buyerclass":     buyerClass,
+		"industry":       industry,
+		"business_scope": business_scope,
+		"sort_no":        sort_no,
+		"pcor":           pcor,
+		"regMap":         regMap,
+		"createdate":     time.Now().Unix(),
+	}
+	db.Mgo_Log.Save(C_PTLog, saveData)
 }
 
 // 潜在竞争对手
 func getPRivals(userId string, potRivQ, pcor string) []*PTComs {
-        var regMap = []*PTComs{}
-        //我关注的企业
-        MyFollowEnts := getMyFollowEnts(userId)
-        //非我的潜在竞争对手
-        OutLMyRivals := gerOutLMyRivals(userId)
-        aggs, _ := GetAggs(P_INDEX, P_TYPE, potRivQ)
-        if aggs != nil {
-                if aggsMap_g, ok := aggs.Children("group_field"); ok {
-                        var aggsMap []map[string]interface{}
-                        bs, _ := aggsMap_g.Aggregations["buckets"].MarshalJSON()
-                        if len(bs) > 0 {
-                                json.Unmarshal(bs, &aggsMap)
-                                if len(aggsMap) > 0 {
-                                        regMap = analysisDataByWinner(aggsMap, MyFollowEnts, OutLMyRivals, pcor)
-                                }
-                        }
-                }
-        }
-        return regMap
+	var regMap = []*PTComs{}
+	//我关注的企业
+	MyFollowEnts := getMyFollowEnts(userId)
+	//非我的潜在竞争对手
+	OutLMyRivals := gerOutLMyRivals(userId)
+	aggs, _ := GetAggs(P_INDEX, P_TYPE, potRivQ)
+	if aggs != nil {
+		if aggsMap_g, ok := aggs.Children("group_field"); ok {
+			var aggsMap []map[string]interface{}
+			bs, _ := aggsMap_g.Aggregations["buckets"].MarshalJSON()
+			if len(bs) > 0 {
+				json.Unmarshal(bs, &aggsMap)
+				if len(aggsMap) > 0 {
+					regMap = analysisDataByWinner(aggsMap, MyFollowEnts, OutLMyRivals, pcor)
+				}
+			}
+		}
+	}
+	return regMap
 }
 
 // 非我的潜在竞争对手
 func gerOutLMyRivals(userId string) map[string]interface{} {
-        var OutLMyRivals = map[string]interface{}{}
-        entData, ok := db.Mgo.FindOne(C_Member, `{"userid":"`+userId+`"}`)
-        if ok && entData != nil && (*entData)["outMyRivalIds"] != nil {
-                for _, v := range qutil.ObjArrToStringArr((*entData)["outMyRivalIds"].([]interface{})) {
-                        if v != "" {
-                                if v != "" {
-                                        OutLMyRivals[v] = true
-                                }
-                        }
-                }
-        }
-        return OutLMyRivals
+	var OutLMyRivals = map[string]interface{}{}
+	entData, ok := db.Mgo.FindOne(C_Member, `{"userid":"`+userId+`"}`)
+	if ok && entData != nil && (*entData)["outMyRivalIds"] != nil {
+		for _, v := range qutil.ObjArrToStringArr((*entData)["outMyRivalIds"].([]interface{})) {
+			if v != "" {
+				if v != "" {
+					OutLMyRivals[v] = true
+				}
+			}
+		}
+	}
+	return OutLMyRivals
 }
 
 // 获取我关注的企业
 func getMyFollowEnts(userId string) map[string]interface{} {
-        var MyEntInfo = map[string]interface{}{}
-        entData := db.Base.Find(C_FEnt, map[string]interface{}{
-                "s_userid": userId,
-        }, "s_entId", "", 0, 500)
-        if entData != nil && len(*entData) > 0 {
-                for _, v := range *entData {
-                        s_entId := qutil.ObjToString(v["s_entId"])
-                        if s_entId != "" {
-                                MyEntInfo[s_entId] = true
-                        }
-                }
-        }
-        return MyEntInfo
+	var MyEntInfo = map[string]interface{}{}
+	entData := db.Base.Find(C_FEnt, map[string]interface{}{
+		"s_userid": userId,
+	}, "s_entId", "", 0, 500)
+	if entData != nil && len(*entData) > 0 {
+		for _, v := range *entData {
+			s_entId := qutil.ObjToString(v["s_entId"])
+			if s_entId != "" {
+				MyEntInfo[s_entId] = true
+			}
+		}
+	}
+	return MyEntInfo
 }
 
 type AggregationsBucket struct {
-        Key       string `json:"key"`
-        Doc_count int    `json:"doc_count"`
-        Count     struct {
-                Value float64 `json:value`
-        } `json:"count"`
+	Key       string `json:"key"`
+	Doc_count int    `json:"doc_count"`
+	Count     struct {
+		Value float64 `json:value`
+	} `json:"count"`
 }
 
 // 潜在竞争对手--new
 func PRivals(userId string, potRivQ, pcor string) []*PTComs {
-        var regMap = []*PTComs{}
-        //我关注的企业
-        MyFollowEnts := getMyFollowEnts(userId)
-        //非我的潜在竞争对手
-        OutLMyRivals := gerOutLMyRivals(userId)
-        aggs, _ := GetAggs(P_INDEX, P_TYPE, potRivQ)
-        if aggs != nil {
-                if aggsMap_g, ok := aggs.Children("group_field"); ok {
-                        var aggsMap []*AggregationsBucket
-                        bs, _ := aggsMap_g.Aggregations["buckets"].MarshalJSON()
-                        if len(bs) > 0 {
-                                json.Unmarshal(bs, &aggsMap)
-                                if len(aggsMap) > 0 {
-                                        regMap = analysisData(aggsMap, MyFollowEnts, OutLMyRivals, pcor)
-                                        //regMap = analysisDataByWinner(aggsMap, MyFollowEnts, OutLMyRivals, pcor)
-                                }
-                        }
-                }
-        }
-        return regMap
+	var regMap = []*PTComs{}
+	//我关注的企业
+	MyFollowEnts := getMyFollowEnts(userId)
+	//非我的潜在竞争对手
+	OutLMyRivals := gerOutLMyRivals(userId)
+	aggs, _ := GetAggs(P_INDEX, P_TYPE, potRivQ)
+	if aggs != nil {
+		if aggsMap_g, ok := aggs.Children("group_field"); ok {
+			var aggsMap []*AggregationsBucket
+			bs, _ := aggsMap_g.Aggregations["buckets"].MarshalJSON()
+			if len(bs) > 0 {
+				json.Unmarshal(bs, &aggsMap)
+				if len(aggsMap) > 0 {
+					regMap = analysisData(aggsMap, MyFollowEnts, OutLMyRivals, pcor)
+					//regMap = analysisDataByWinner(aggsMap, MyFollowEnts, OutLMyRivals, pcor)
+				}
+			}
+		}
+	}
+	return regMap
 }
 
 // 潜在客户--new
 func CustomersInfo(userId, entName string, potComQ, pcor string) []*PTComs {
-        var regMap = []*PTComs{}
-        //获取用户默认企业的客户信息+手动关注的企业信息+不是我的客户信息 此三项都不展示在我的客户列表
-        MyCustomers := getMyCostomers(userId, entName)
-        // log.Println("MyCustomers:", MyCustomers)
-        aggs, _ := GetAggs(P_INDEX, P_TYPE, potComQ)
-        if aggs != nil {
-                if aggs_g, ok := aggs.Children("group_field"); ok {
-                        var aggsMap = []*AggregationsBucket{}
-                        bs, _ := aggs_g.Aggregations["buckets"].MarshalJSON()
-                        if len(bs) > 0 {
-                                json.Unmarshal(bs, &aggsMap)
-                                if len(aggsMap) > 0 {
-                                        regMap = analysisData(aggsMap, MyCustomers, nil, pcor)
-                                }
-                        }
-                }
-        }
-        return regMap
+	var regMap = []*PTComs{}
+	//获取用户默认企业的客户信息+手动关注的企业信息+不是我的客户信息 此三项都不展示在我的客户列表
+	MyCustomers := getMyCostomers(userId, entName)
+	// log.Println("MyCustomers:", MyCustomers)
+	aggs, _ := GetAggs(P_INDEX, P_TYPE, potComQ)
+	if aggs != nil {
+		if aggs_g, ok := aggs.Children("group_field"); ok {
+			var aggsMap = []*AggregationsBucket{}
+			bs, _ := aggs_g.Aggregations["buckets"].MarshalJSON()
+			if len(bs) > 0 {
+				json.Unmarshal(bs, &aggsMap)
+				if len(aggsMap) > 0 {
+					regMap = analysisData(aggsMap, MyCustomers, nil, pcor)
+				}
+			}
+		}
+	}
+	return regMap
 }
 
 // 潜在客户
 func getPCostomers(userId, entName string, potComQ, pcor string) []*PTComs {
-        var regMap = []*PTComs{}
-        //获取用户默认企业的客户信息+手动关注的企业信息+不是我的客户信息 此三项都不展示在我的客户列表
-        MyCustomers := getMyCostomers(userId, entName)
-        // log.Println("MyCustomers:", MyCustomers)
-        aggs, _ := GetAggs(P_INDEX, P_TYPE, potComQ)
-        if aggs != nil {
-                if aggs_g, ok := aggs.Children("group_field"); ok {
-                        var aggsMap []map[string]interface{}
-                        bs, _ := aggs_g.Aggregations["buckets"].MarshalJSON()
-                        if len(bs) > 0 {
-                                json.Unmarshal(bs, &aggsMap)
-                                if len(aggsMap) > 0 {
-                                        regMap = analysisDataByBuyer(aggsMap, MyCustomers)
-                                }
-                        }
-                }
-        }
-        return regMap
+	var regMap = []*PTComs{}
+	//获取用户默认企业的客户信息+手动关注的企业信息+不是我的客户信息 此三项都不展示在我的客户列表
+	MyCustomers := getMyCostomers(userId, entName)
+	// log.Println("MyCustomers:", MyCustomers)
+	aggs, _ := GetAggs(P_INDEX, P_TYPE, potComQ)
+	if aggs != nil {
+		if aggs_g, ok := aggs.Children("group_field"); ok {
+			var aggsMap []map[string]interface{}
+			bs, _ := aggs_g.Aggregations["buckets"].MarshalJSON()
+			if len(bs) > 0 {
+				json.Unmarshal(bs, &aggsMap)
+				if len(aggsMap) > 0 {
+					regMap = analysisDataByBuyer(aggsMap, MyCustomers)
+				}
+			}
+		}
+	}
+	return regMap
 }
 
 // 获取当前我的客户信息(大会员初始化的企业名称+关注的客户名称)
 func getMyCostomers(userId, entName string) map[string]interface{} {
-        MyCS := map[string]interface{}{}
-        r_MyCS := redis.Get("other", "mycostomer_"+userId)
-        if r_MyCS == nil {
-                query_str := getQueryByEntName(entName)
-                aggs, _ := GetAggs(P_INDEX, P_TYPE, query_str)
-                if aggs != nil {
-                        if aggs_g, ok := aggs.Children("group_buyer"); ok {
-                                var aggsMap []map[string]interface{}
-                                bs, _ := aggs_g.Aggregations["buckets"].MarshalJSON()
-                                if len(bs) > 0 {
-                                        json.Unmarshal(bs, &aggsMap)
-                                        if len(aggsMap) > 0 {
-                                                for _, v := range aggsMap {
-                                                        if v["key"] != nil {
-                                                                key, _ := v["key"].(string)
-                                                                if key != "" {
-                                                                        MyCS[key] = true
-                                                                }
-                                                        }
-                                                }
-                                        }
-                                }
-                        }
-                }
-                if MyCS != nil {
-                        redis.Put("other", "mycostomer_"+userId, MyCS, P_redis_time)
-                }
-        } else {
-                MyCS = r_MyCS.(map[string]interface{})
-        }
-        //我关注的客户
-        r_ATTCS := redis.GetStr("other", "customer_list_"+userId)
-        if r_ATTCS == "" {
-                clist, ok := db.Mgo.Find("follow_customer", map[string]interface{}{
-                        "userId": userId,
-                }, nil, `{"name":1}`, false, -1, -1)
-                if ok && clist != nil && len(*clist) > 0 {
-                        names := []string{}
-                        for _, v := range *clist {
-                                names = append(names, v["name"].(string))
-                        }
-                        r_ATTCS = strings.Join(names, ",")
-                        redis.Put("other", "customer_list_"+userId, r_ATTCS, 2*60*60)
-                }
-        }
-        for _, v := range strings.Split(r_ATTCS, ",") {
-                if v != "" {
-                        MyCS[v] = true
-                }
-        }
-        //不是我的客户
-        r_EXCCS := redis.GetStr("other", "customer_exclude_"+userId)
-        if r_EXCCS == "" {
-                clist, ok := db.Mgo.Find("exclude_customer", map[string]interface{}{
-                        "userId": userId,
-                }, nil, `{"name":1}`, false, -1, -1)
-                if ok && clist != nil && len(*clist) > 0 {
-                        names := []string{}
-                        for _, v := range *clist {
-                                names = append(names, v["name"].(string))
-                        }
-                        r_EXCCS = strings.Join(names, ",")
-                        redis.Put("other", "customer_exclude_"+userId, r_EXCCS, 2*60*60)
-                }
-        }
-        for _, v := range strings.Split(r_EXCCS, ",") {
-                if v != "" {
-                        MyCS[v] = true
-                }
-        }
-        // log.Println(userId, "---", MyCS)
-        return MyCS
+	MyCS := map[string]interface{}{}
+	r_MyCS := redis.Get("other", "mycostomer_"+userId)
+	if r_MyCS == nil {
+		query_str := getQueryByEntName(entName)
+		aggs, _ := GetAggs(P_INDEX, P_TYPE, query_str)
+		if aggs != nil {
+			if aggs_g, ok := aggs.Children("group_buyer"); ok {
+				var aggsMap []map[string]interface{}
+				bs, _ := aggs_g.Aggregations["buckets"].MarshalJSON()
+				if len(bs) > 0 {
+					json.Unmarshal(bs, &aggsMap)
+					if len(aggsMap) > 0 {
+						for _, v := range aggsMap {
+							if v["key"] != nil {
+								key, _ := v["key"].(string)
+								if key != "" {
+									MyCS[key] = true
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		if MyCS != nil {
+			redis.Put("other", "mycostomer_"+userId, MyCS, P_redis_time)
+		}
+	} else {
+		MyCS = r_MyCS.(map[string]interface{})
+	}
+	//我关注的客户
+	r_ATTCS := redis.GetStr("other", "customer_list_"+userId)
+	if r_ATTCS == "" {
+		clist, ok := db.Mgo.Find("follow_customer", map[string]interface{}{
+			"userId": userId,
+		}, nil, `{"name":1}`, false, -1, -1)
+		if ok && clist != nil && len(*clist) > 0 {
+			names := []string{}
+			for _, v := range *clist {
+				names = append(names, v["name"].(string))
+			}
+			r_ATTCS = strings.Join(names, ",")
+			redis.Put("other", "customer_list_"+userId, r_ATTCS, 2*60*60)
+		}
+	}
+	for _, v := range strings.Split(r_ATTCS, ",") {
+		if v != "" {
+			MyCS[v] = true
+		}
+	}
+	//不是我的客户
+	r_EXCCS := redis.GetStr("other", "customer_exclude_"+userId)
+	if r_EXCCS == "" {
+		clist, ok := db.Mgo.Find("exclude_customer", map[string]interface{}{
+			"userId": userId,
+		}, nil, `{"name":1}`, false, -1, -1)
+		if ok && clist != nil && len(*clist) > 0 {
+			names := []string{}
+			for _, v := range *clist {
+				names = append(names, v["name"].(string))
+			}
+			r_EXCCS = strings.Join(names, ",")
+			redis.Put("other", "customer_exclude_"+userId, r_EXCCS, 2*60*60)
+		}
+	}
+	for _, v := range strings.Split(r_EXCCS, ",") {
+		if v != "" {
+			MyCS[v] = true
+		}
+	}
+	// log.Println(userId, "---", MyCS)
+	return MyCS
 }
 
 type PTComs struct {
-        Buyer     string
-        Budget    float64
-        PNCount   int
-        WCity     string
-        WProvince string
-        EntId     string `json:"entId"`
+	Buyer     string
+	Budget    float64
+	PNCount   int
+	WCity     string
+	WProvince string
+	EntId     string `json:"entId"`
 }
 
 type PCInfo struct {
-        Province string //省份
-        City     string //城市
+	Province string //省份
+	City     string //城市
 }
 
 // 采购单位||中标单位
 func analysisData(res []*AggregationsBucket, mycs map[string]interface{}, omyr map[string]interface{}, pcor string) []*PTComs {
-        defer qutil.Catch()
-        var (
-                ADRes_r     []*PTComs
-                entersFifty []string
-                entInfos    []*entity.EnterQYXYInfo
-                wg          = sync.WaitGroup{}
-                wc          = make(chan bool, 10)
-                entMap      = map[string]*AggregationsBucket{}
-                lock        = &sync.Mutex{}
-        )
-        for ak, av := range res {
-                var isContinue = false
-                //清洗无效数据
-                if av.Key == "" || av.Key == "null" {
-                        isContinue = true
-                }
-                //清洗无效客户
-                if mycs != nil && mycs[av.Key] != nil {
-                        isContinue = true
-                }
-                //排除移除的我的潜在竞争对手
-                if omyr != nil && omyr[av.Key] != nil {
-                        isContinue = true
-                }
-                if isContinue {
-                        //防止最后一个企业不匹配  直接跳出
-                        if len(res) != ak+1 {
-                                continue
-                        }
-                } else {
-                        entMap[av.Key] = av
-                        //并发查询企业库是否包含此企业信息
-                        entersFifty = append(entersFifty, av.Key)
-                }
-                if len(entersFifty)%50 == 0 || (len(res) == ak+1 && len(entersFifty) > 0) {
-                        wg.Add(1)
-                        wc <- true
-                        go func(entersFifty []string) {
-                                defer qutil.Catch()
-                                defer func() {
-                                        wg.Done()
-                                        <-wc
-                                }()
-                                entInfo := entity.GetEntInfo(entersFifty, pcor)
-                                lock.Lock()
-                                defer lock.Unlock()
-                                entInfos = append(entInfos, entInfo...)
-                        }(entersFifty)
-                        entersFifty = []string{}
-                }
-                wg.Wait()
-        }
-        if len(entInfos) > 0 {
-                for _, ev := range entInfos {
-                        if (ev.Name != "" && entMap[ev.Name] != nil) || (len([]rune(ev.Id)) > 12 && entMap[ev.Id] != nil) {
-                                var budget float64 = 0
-                                pnCount := 0
-                                if entMap[ev.Name] != nil {
-                                        budget = entMap[ev.Name].Count.Value
-                                        pnCount = entMap[ev.Name].Doc_count
-                                }
-                                if entMap[ev.Id] != nil {
-                                        budget = entMap[ev.Id].Count.Value
-                                        pnCount = entMap[ev.Id].Doc_count
-                                }
-                                ADRes_r = append(ADRes_r, &PTComs{
-                                        Budget:    budget,
-                                        PNCount:   pnCount,
-                                        Buyer:     ev.Name,
-                                        WCity:     ev.City,
-                                        WProvince: ev.Area,
-                                        EntId:     util.EncodeId(ev.Id),
-                                })
-                        }
-                }
-        }
-        return ADRes_r
+	defer qutil.Catch()
+	var (
+		ADRes_r     []*PTComs
+		entersFifty []string
+		entInfos    []*entity.EnterQYXYInfo
+		wg          = sync.WaitGroup{}
+		wc          = make(chan bool, 10)
+		entMap      = map[string]*AggregationsBucket{}
+		lock        = &sync.Mutex{}
+	)
+	for ak, av := range res {
+		var isContinue = false
+		//清洗无效数据
+		if av.Key == "" || av.Key == "null" {
+			isContinue = true
+		}
+		//清洗无效客户
+		if mycs != nil && mycs[av.Key] != nil {
+			isContinue = true
+		}
+		//排除移除的我的潜在竞争对手
+		if omyr != nil && omyr[av.Key] != nil {
+			isContinue = true
+		}
+		if isContinue {
+			//防止最后一个企业不匹配  直接跳出
+			if len(res) != ak+1 {
+				continue
+			}
+		} else {
+			entMap[av.Key] = av
+			//并发查询企业库是否包含此企业信息
+			entersFifty = append(entersFifty, av.Key)
+		}
+		if len(entersFifty)%50 == 0 || (len(res) == ak+1 && len(entersFifty) > 0) {
+			wg.Add(1)
+			wc <- true
+			go func(entersFifty []string) {
+				defer qutil.Catch()
+				defer func() {
+					wg.Done()
+					<-wc
+				}()
+				entInfo := entity.GetEntInfo(entersFifty, pcor)
+				lock.Lock()
+				defer lock.Unlock()
+				entInfos = append(entInfos, entInfo...)
+			}(entersFifty)
+			entersFifty = []string{}
+		}
+		wg.Wait()
+	}
+	if len(entInfos) > 0 {
+		for _, ev := range entInfos {
+			if (ev.Name != "" && entMap[ev.Name] != nil) || (len([]rune(ev.Id)) > 12 && entMap[ev.Id] != nil) {
+				var budget float64 = 0
+				pnCount := 0
+				if entMap[ev.Name] != nil {
+					budget = entMap[ev.Name].Count.Value
+					pnCount = entMap[ev.Name].Doc_count
+				}
+				if entMap[ev.Id] != nil {
+					budget = entMap[ev.Id].Count.Value
+					pnCount = entMap[ev.Id].Doc_count
+				}
+				ADRes_r = append(ADRes_r, &PTComs{
+					Budget:    budget,
+					PNCount:   pnCount,
+					Buyer:     ev.Name,
+					WCity:     ev.City,
+					WProvince: ev.Area,
+					EntId:     util.EncodeId(ev.Id),
+				})
+			}
+		}
+	}
+	return ADRes_r
 }
 
 // 采购单位
 func analysisDataByBuyer(res []map[string]interface{}, mycs map[string]interface{}) []*PTComs {
-        defer qutil.Catch()
-        var ADRes = []*PTComs{}
-        var ADRes_r = []*PTComs{}
-        var enters = []string{}
-        var EnterPOC = map[string]PCInfo{}
-        var EnterQYXY = []*entity.EnterQYXYInfo{} //企业信用是否有此企业数据
-        var EnterQYXY_map = map[string]string{}   //企业信用是否有此企业数据
-        var wg sync.WaitGroup
-        var wc = make(chan bool, 10)
-        var wl = &sync.Mutex{}
-        var entersFifty = []string{}
-        for k, v := range res {
-                var isContinue = false
-                var key_val = qutil.ObjToString(v["key"]) //采购单位
-                if key_val == "" || key_val == "null" {
-                        isContinue = true
-                }
-                //排除我的客户 和 我的企业情报数据
-                if !isContinue && mycs != nil && mycs[key_val] != nil {
-                        isContinue = true
-                }
-                if isContinue {
-                        //防止最后一个企业不匹配  直接跳出
-                        if len(res) == k+1 && len(entersFifty) > 0 {
-                                wg.Add(1)
-                                wc <- true
-                                go func(entersFifty []string) {
-                                        defer qutil.Catch()
-                                        defer func() {
-                                                wg.Done()
-                                                <-wc
-                                        }()
-                                        entInfo := entity.GetEntInfoByQYXY(entersFifty, "C")
-                                        wl.Lock()
-                                        defer wl.Unlock()
-                                        EnterQYXY = append(EnterQYXY, entInfo...)
-                                }(entersFifty)
-                                entersFifty = []string{}
-                        }
-                        continue
-                }
-                var budget_val = qutil.ObjToMap(v["count"])  //预算总金额
-                var pname_val = qutil.IntAll(v["doc_count"]) //项目总数
-                var ptcs = &PTComs{}
-                ptcs.Buyer = key_val
-                ptcs.PNCount = pname_val
-                ptcs.Budget = qutil.Float64All((*budget_val)["value"])
-                ADRes = append(ADRes, ptcs)
-                enters = append(enters, key_val)
-                if (k+1)%20 == 0 || len(res) == k+1 {
-                        //获取企业或者采购单位的省份和城市
-                        var pcData = entity.GetEntPC(enters) //采购单位
-                        if pcData != nil && len(pcData) > 0 {
-                                for _, v := range pcData {
-                                        province := ""
-                                        city := ""
-                                        if v["province"] != nil {
-                                                province = qutil.ObjToString(v["province"])
-                                        }
-                                        //排除全国
-                                        if strings.Contains(province, "全国") {
-                                                continue
-                                        }
-                                        if v["city"] != nil {
-                                                city = qutil.ObjToString(v["city"])
-                                        }
-                                        EnterPOC[v["name"].(string)] = PCInfo{
-                                                Province: province,
-                                                City:     city,
-                                        }
-                                }
-                        }
-                        enters = []string{}
-                }
-                //并发查询企业库是否包含此企业信息
-                entersFifty = append(entersFifty, key_val)
-                if (k+1)%50 == 0 || len(res) == k+1 {
-                        wg.Add(1)
-                        wc <- true
-                        go func(entersFifty []string) {
-                                defer func() {
-                                        wg.Done()
-                                        <-wc
-                                        qutil.Catch()
-                                }()
-                                entInfo := entity.GetEntInfoByQYXY(entersFifty, "C")
-                                wl.Lock()
-                                defer wl.Unlock()
-                                EnterQYXY = append(EnterQYXY, entInfo...)
-                        }(entersFifty)
-                        entersFifty = []string{}
-                }
-        }
-        wg.Wait()
-        for _, ev := range EnterQYXY {
-                if (*ev).Name != "" {
-                        EnterQYXY_map[(*ev).Name] = (*ev).Id
-                }
-        }
-        for _, vv := range ADRes {
-                if EnterQYXY_map[vv.Buyer] != "" {
-                        ADRes_r = append(ADRes_r, &PTComs{
-                                Budget:    vv.Budget,
-                                Buyer:     vv.Buyer,
-                                PNCount:   vv.PNCount,
-                                WCity:     EnterPOC[vv.Buyer].City,
-                                WProvince: EnterPOC[vv.Buyer].Province,
-                        })
-                }
-        }
-        return ADRes_r
+	defer qutil.Catch()
+	var ADRes = []*PTComs{}
+	var ADRes_r = []*PTComs{}
+	var enters = []string{}
+	var EnterPOC = map[string]PCInfo{}
+	var EnterQYXY = []*entity.EnterQYXYInfo{} //企业信用是否有此企业数据
+	var EnterQYXY_map = map[string]string{}   //企业信用是否有此企业数据
+	var wg sync.WaitGroup
+	var wc = make(chan bool, 10)
+	var wl = &sync.Mutex{}
+	var entersFifty = []string{}
+	for k, v := range res {
+		var isContinue = false
+		var key_val = qutil.ObjToString(v["key"]) //采购单位
+		if key_val == "" || key_val == "null" {
+			isContinue = true
+		}
+		//排除我的客户 和 我的企业情报数据
+		if !isContinue && mycs != nil && mycs[key_val] != nil {
+			isContinue = true
+		}
+		if isContinue {
+			//防止最后一个企业不匹配  直接跳出
+			if len(res) == k+1 && len(entersFifty) > 0 {
+				wg.Add(1)
+				wc <- true
+				go func(entersFifty []string) {
+					defer qutil.Catch()
+					defer func() {
+						wg.Done()
+						<-wc
+					}()
+					entInfo := entity.GetEntInfoByQYXY(entersFifty, "C")
+					wl.Lock()
+					defer wl.Unlock()
+					EnterQYXY = append(EnterQYXY, entInfo...)
+				}(entersFifty)
+				entersFifty = []string{}
+			}
+			continue
+		}
+		var budget_val = qutil.ObjToMap(v["count"])  //预算总金额
+		var pname_val = qutil.IntAll(v["doc_count"]) //项目总数
+		var ptcs = &PTComs{}
+		ptcs.Buyer = key_val
+		ptcs.PNCount = pname_val
+		ptcs.Budget = qutil.Float64All((*budget_val)["value"])
+		ADRes = append(ADRes, ptcs)
+		enters = append(enters, key_val)
+		if (k+1)%20 == 0 || len(res) == k+1 {
+			//获取企业或者采购单位的省份和城市
+			var pcData = entity.GetEntPC(enters) //采购单位
+			if pcData != nil && len(pcData) > 0 {
+				for _, v := range pcData {
+					province := ""
+					city := ""
+					if v["province"] != nil {
+						province = qutil.ObjToString(v["province"])
+					}
+					//排除全国
+					if strings.Contains(province, "全国") {
+						continue
+					}
+					if v["city"] != nil {
+						city = qutil.ObjToString(v["city"])
+					}
+					EnterPOC[v["name"].(string)] = PCInfo{
+						Province: province,
+						City:     city,
+					}
+				}
+			}
+			enters = []string{}
+		}
+		//并发查询企业库是否包含此企业信息
+		entersFifty = append(entersFifty, key_val)
+		if (k+1)%50 == 0 || len(res) == k+1 {
+			wg.Add(1)
+			wc <- true
+			go func(entersFifty []string) {
+				defer func() {
+					wg.Done()
+					<-wc
+					qutil.Catch()
+				}()
+				entInfo := entity.GetEntInfoByQYXY(entersFifty, "C")
+				wl.Lock()
+				defer wl.Unlock()
+				EnterQYXY = append(EnterQYXY, entInfo...)
+			}(entersFifty)
+			entersFifty = []string{}
+		}
+	}
+	wg.Wait()
+	for _, ev := range EnterQYXY {
+		if (*ev).Name != "" {
+			EnterQYXY_map[(*ev).Name] = (*ev).Id
+		}
+	}
+	for _, vv := range ADRes {
+		if EnterQYXY_map[vv.Buyer] != "" {
+			ADRes_r = append(ADRes_r, &PTComs{
+				Budget:    vv.Budget,
+				Buyer:     vv.Buyer,
+				PNCount:   vv.PNCount,
+				WCity:     EnterPOC[vv.Buyer].City,
+				WProvince: EnterPOC[vv.Buyer].Province,
+			})
+		}
+	}
+	return ADRes_r
 }
 
 // 中标单位
 func analysisDataByWinner(res []map[string]interface{}, mycs map[string]interface{}, omyr map[string]interface{}, pcor string) []*PTComs {
-        defer qutil.Catch()
-        var ADRes = []*PTComs{}
-        var ADRes_r = []*PTComs{}
-        var enters = []string{}
-        var EnterQYXY = []*entity.EnterQYXYInfo{}             //企业信用是否有此企业数据
-        var EnterQYXY_map = map[string]entity.EnterQYXYInfo{} //企业信用是否有此企业数据
-        var wg sync.WaitGroup
-        var wc = make(chan bool, 10)
-        var wl = &sync.Mutex{}
-        var entersFifty = []string{}
-        for k, v := range res {
-                var isContinue = false
-                var key_val = qutil.ObjToString(v["key"]) //中标单位
-                if key_val == "" || key_val == "null" {
-                        isContinue = true
-                }
-                //排除我的客户 和 我的企业情报数据
-                if !isContinue && mycs != nil && mycs[key_val] != nil {
-                        isContinue = true
-                }
-                //排除移除的我的潜在竞争对手
-                if !isContinue && omyr != nil && omyr[key_val] != nil {
-                        isContinue = true
-                }
-                if isContinue {
-                        //防止最后一个企业不匹配  直接跳出
-                        if len(res) == k+1 && len(entersFifty) > 0 {
-                                wg.Add(1)
-                                wc <- true
-                                go func(entersFifty []string, pcor string) {
-                                        defer qutil.Catch()
-                                        defer func() {
-                                                wg.Done()
-                                                <-wc
-                                        }()
-                                        entInfo := entity.GetEntInfoByQYXY(entersFifty, pcor)
-                                        wl.Lock()
-                                        defer wl.Unlock()
-                                        EnterQYXY = append(EnterQYXY, entInfo...)
-                                }(entersFifty, pcor)
-                                entersFifty = []string{}
-                        }
-                        continue
-                }
-                var budget_val = qutil.ObjToMap(v["count"])  //预算总金额
-                var pname_val = qutil.IntAll(v["doc_count"]) //项目总数
-                var ptcs = &PTComs{}
-                ptcs.EntId = key_val
-                ptcs.PNCount = pname_val
-                ptcs.Budget = qutil.Float64All((*budget_val)["value"])
-                ADRes = append(ADRes, ptcs)
-                enters = append(enters, key_val)
-                //并发查询企业库是否包含此企业信息
-                entersFifty = append(entersFifty, key_val)
-                if (k+1)%50 == 0 || len(res) == k+1 {
-                        wg.Add(1)
-                        wc <- true
-                        go func(entersFifty []string, pcor string) {
-                                defer qutil.Catch()
-                                defer func() {
-                                        wg.Done()
-                                        <-wc
-                                }()
-                                entInfo := entity.GetEntInfoByQYXY(entersFifty, pcor)
-                                wl.Lock()
-                                defer wl.Unlock()
-                                EnterQYXY = append(EnterQYXY, entInfo...)
-                        }(entersFifty, pcor)
-                        entersFifty = []string{}
-                }
-        }
-        wg.Wait()
-        for _, ev := range EnterQYXY {
-                if (*ev).Name != "" {
-                        EnterQYXY_map[ev.Id] = entity.EnterQYXYInfo{
-                                Id:   (*ev).Id,
-                                Name: (*ev).Name,
-                                Area: (*ev).Area,
-                                City: (*ev).City,
-                        }
-                }
-        }
-        for _, vv := range ADRes {
-                if EnterQYXY_map[vv.EntId].Name != "" {
-                        ADRes_r = append(ADRes_r, &PTComs{
-                                Budget:    vv.Budget,
-                                Buyer:     EnterQYXY_map[vv.EntId].Name,
-                                PNCount:   vv.PNCount,
-                                WCity:     EnterQYXY_map[vv.EntId].City,
-                                WProvince: EnterQYXY_map[vv.EntId].Area,
-                                EntId:     util.EncodeId(vv.EntId),
-                        })
-                }
-        }
-        return ADRes_r
+	defer qutil.Catch()
+	var ADRes = []*PTComs{}
+	var ADRes_r = []*PTComs{}
+	var enters = []string{}
+	var EnterQYXY = []*entity.EnterQYXYInfo{}             //企业信用是否有此企业数据
+	var EnterQYXY_map = map[string]entity.EnterQYXYInfo{} //企业信用是否有此企业数据
+	var wg sync.WaitGroup
+	var wc = make(chan bool, 10)
+	var wl = &sync.Mutex{}
+	var entersFifty = []string{}
+	for k, v := range res {
+		var isContinue = false
+		var key_val = qutil.ObjToString(v["key"]) //中标单位
+		if key_val == "" || key_val == "null" {
+			isContinue = true
+		}
+		//排除我的客户 和 我的企业情报数据
+		if !isContinue && mycs != nil && mycs[key_val] != nil {
+			isContinue = true
+		}
+		//排除移除的我的潜在竞争对手
+		if !isContinue && omyr != nil && omyr[key_val] != nil {
+			isContinue = true
+		}
+		if isContinue {
+			//防止最后一个企业不匹配  直接跳出
+			if len(res) == k+1 && len(entersFifty) > 0 {
+				wg.Add(1)
+				wc <- true
+				go func(entersFifty []string, pcor string) {
+					defer qutil.Catch()
+					defer func() {
+						wg.Done()
+						<-wc
+					}()
+					entInfo := entity.GetEntInfoByQYXY(entersFifty, pcor)
+					wl.Lock()
+					defer wl.Unlock()
+					EnterQYXY = append(EnterQYXY, entInfo...)
+				}(entersFifty, pcor)
+				entersFifty = []string{}
+			}
+			continue
+		}
+		var budget_val = qutil.ObjToMap(v["count"])  //预算总金额
+		var pname_val = qutil.IntAll(v["doc_count"]) //项目总数
+		var ptcs = &PTComs{}
+		ptcs.EntId = key_val
+		ptcs.PNCount = pname_val
+		ptcs.Budget = qutil.Float64All((*budget_val)["value"])
+		ADRes = append(ADRes, ptcs)
+		enters = append(enters, key_val)
+		//并发查询企业库是否包含此企业信息
+		entersFifty = append(entersFifty, key_val)
+		if (k+1)%50 == 0 || len(res) == k+1 {
+			wg.Add(1)
+			wc <- true
+			go func(entersFifty []string, pcor string) {
+				defer qutil.Catch()
+				defer func() {
+					wg.Done()
+					<-wc
+				}()
+				entInfo := entity.GetEntInfoByQYXY(entersFifty, pcor)
+				wl.Lock()
+				defer wl.Unlock()
+				EnterQYXY = append(EnterQYXY, entInfo...)
+			}(entersFifty, pcor)
+			entersFifty = []string{}
+		}
+	}
+	wg.Wait()
+	for _, ev := range EnterQYXY {
+		if (*ev).Name != "" {
+			EnterQYXY_map[ev.Id] = entity.EnterQYXYInfo{
+				Id:   (*ev).Id,
+				Name: (*ev).Name,
+				Area: (*ev).Area,
+				City: (*ev).City,
+			}
+		}
+	}
+	for _, vv := range ADRes {
+		if EnterQYXY_map[vv.EntId].Name != "" {
+			ADRes_r = append(ADRes_r, &PTComs{
+				Budget:    vv.Budget,
+				Buyer:     EnterQYXY_map[vv.EntId].Name,
+				PNCount:   vv.PNCount,
+				WCity:     EnterQYXY_map[vv.EntId].City,
+				WProvince: EnterQYXY_map[vv.EntId].Area,
+				EntId:     util.EncodeId(vv.EntId),
+			})
+		}
+	}
+	return ADRes_r
 }

+ 436 - 435
src/jfw/modules/bigmember/src/service/push/push.go

@@ -1,461 +1,462 @@
 package push
 
 import (
-        . "app.yhyue.com/moapp/jybase/api"
-        util "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "encoding/json"
-        "fmt"
-        "jy/src/jfw/modules/bigmember/src/config"
-        . "jy/src/jfw/modules/bigmember/src/db"
-        "log"
-        "time"
+	. "app.yhyue.com/moapp/jybase/api"
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/bigmember/src/config"
+	. "jy/src/jfw/modules/bigmember/src/db"
+	"log"
+	"time"
 )
 
 type Action struct {
-        *xweb.Action
-        items  xweb.Mapper `xweb:"/pushset/items"`  //推送项
-        detail xweb.Mapper `xweb:"/pushset/detail"` //推送设置详情
-        update xweb.Mapper `xweb:"/pushset/update"` //推送设置修改
+	*xweb.Action
+	items  xweb.Mapper `xweb:"/pushset/items"`  //推送项
+	detail xweb.Mapper `xweb:"/pushset/detail"` //推送设置详情
+	update xweb.Mapper `xweb:"/pushset/update"` //推送设置修改
 }
 
 type pushSet struct {
-        Item                string //推送设置项 member_subscribe super_subscribe free_subscribe follow_ent follow_project entniche
-        Ratemode            int    //推送时间 1:6-20点实时推送,2:每天9点推送,3:每周推送,4:每月推送
-        Apppush             int    //app推送
-        Mailpush            int    //邮箱推送
-        Mail                string //邮箱
-        Subscribe           int    //订阅
-        Follow_project      int    //项目关注
-        Follow_ent          int    //企业关注
-        Newproject_forecast int    //新项目预测
-        Analy_report        int    //分析报告
-        Entinfo             int    //企业情报
-        WXPush              int    // wx推送
+	Item                string //推送设置项 member_subscribe super_subscribe free_subscribe follow_ent follow_project entniche
+	Ratemode            int    //推送时间 1:6-20点实时推送,2:每天9点推送,3:每周推送,4:每月推送
+	Apppush             int    //app推送
+	Mailpush            int    //邮箱推送
+	Mail                string //邮箱
+	Subscribe           int    //订阅
+	Follow_project      int    //项目关注
+	Follow_ent          int    //企业关注
+	Newproject_forecast int    //新项目预测
+	Analy_report        int    //分析报告
+	Entinfo             int    //企业情报
+	WXPush              int    // wx推送
 }
 
 //后期
 //4.6.0修改 只把有权益的存入map返给前端, k:权益 v:是否开启
 func (a *Action) Items() {
-        //userId, _ := a.GetSession("userId").(string)
-        bigMsg := jy.GetBigVipUserBaseMsg("10000", a.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-        subScribeInfo := jy.GetSubScribeInfo(a.Session(), Mgo, "m", "10000")
-        /*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 {
-                data["member_subscribe"] = OpenStatus(*subScribeInfo, "member_subscribe", bigMsg) //大会员订阅
-                delete(data, "free_subscribe")
-        }
-        if bigMsg.Status <= 0 && bigMsg.VipStatus <= 0 {
-                data["follow_ent"] = true     //企业关注
-                data["follow_project"] = true //项目关注
-        }
+	//userId, _ := a.GetSession("userId").(string)
+	bigMsg := jy.GetBigVipUserBaseMsg("10000", a.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	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 {
+		data["member_subscribe"] = OpenStatus(*subScribeInfo, "member_subscribe", bigMsg) //大会员订阅
+		delete(data, "free_subscribe")
+	}
+	if bigMsg.Status <= 0 && bigMsg.VipStatus <= 0 {
+		data["follow_ent"] = true     //企业关注
+		data["follow_project"] = true //项目关注
+	}
 
-        data["entniche"] = bigMsg.IsEntService
-        a.ServeJson(Result{
-                Data: data,
-        })
+	data["entniche"] = bigMsg.IsEntService
+	a.ServeJson(Result{
+		Data: data,
+	})
 }
 func (a *Action) Detail() {
-        userId, _ := a.GetSession("userId").(string)
-        entId := util.Int64All(a.GetSession("entId"))
-        entUserId := util.Int64All(a.GetSession("entUserId "))
-        positionType := util.Int64All(a.GetSession("positionType "))
-        if !R.CheckReqParam(a.ResponseWriter, a.Request, "item") {
-                return
-        }
-        var data M
-        bigMsg := jy.GetBigVipUserBaseMsg("10000", a.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-        switch a.GetString("item") {
-        case "member_subscribe":
-                o_member_jy := jy.GetSubScribeInfo(a.Session(), Mgo, "m", "10000")
-                mail, _ := (*o_member_jy)["s_email"].(string)
-                if mail == "" {
-                        mail = bigMsg.Data.Free.Mail
-                }
-                data = M{
-                        "ratemode":       util.IntAllDef((*o_member_jy)["i_ratemode"], 1),
-                        "apppush":        util.IntAllDef((*o_member_jy)["i_apppush"], 1),
-                        "mailpush":       util.IntAll((*o_member_jy)["i_mailpush"]),
-                        "mail":           mail,
-                        "subscribe":      util.IntAllDef((*o_member_jy)["i_subscribe"], 1),
-                        "follow_project": util.IntAllDef((*o_member_jy)["i_follow_project"], 1),
-                        "follow_ent":     util.IntAllDef((*o_member_jy)["i_follow_ent"], 1),
-                        "wxpush":         util.IntAll((*o_member_jy)["i_wxpush"]),
-                }
-                power := []int{}
-                BigMsg := jy.GetBigVipUserBaseMsg("10000", a.Session(), config.Config.Etcd.Key, config.Config.Etcd.Key)
-                for k, _ := range BigMsg.PowerMap {
-                        power = append(power, k)
-                }
-                data["power"] = power
-                //潜在项目预测
-                if BigMsg.CheckBigVipBackPower("forecast") {
-                        data["newproject_forecast"] = util.IntAllDef((*o_member_jy)["i_newproject_forecast"], 1)
-                }
-                //企业情报
-                if BigMsg.CheckBigVipBackPower("entChange") {
-                        data["jy/src/jfw/modules/bigmember/src/entinfo"] = util.IntAllDef((*o_member_jy)["i_entinfo"], 1)
-                }
-                //分析报告
-                if BigMsg.CheckBigVipBackPower("report") {
-                        data["analy_report"] = util.IntAllDef((*o_member_jy)["i_analy_report"], 1)
-                }
-        case "super_subscribe":
-                o_vipjy := jy.GetSubScribeInfo(a.Session(), Mgo, "v", "10000")
-                apppush := util.IntAll((*o_vipjy)["i_apppush"])
-                mailpush := util.IntAll((*o_vipjy)["i_mailpush"])
-                if apppush == 0 && mailpush == 0 {
-                        apppush = 1
-                }
-                mail, _ := (*o_vipjy)["s_email"].(string)
-                if mail == "" {
-                        mail = bigMsg.Data.Free.Mail
-                }
-                data = M{
-                        "subscribe":      util.IntAllDef((*o_vipjy)["i_subscribe"], 1),      //订阅开关
-                        "follow_ent":     util.IntAllDef((*o_vipjy)["i_follow_ent"], 1),     //关注企业推送开关
-                        "follow_project": util.IntAllDef((*o_vipjy)["i_follow_project"], 1), //关注项目推送开关
-                        "ratemode":       util.IntAllDef((*o_vipjy)["i_ratemode"], 2),
-                        "apppush":        apppush,
-                        "mailpush":       mailpush,
-                        "mail":           mail,
-                        "analy_report":   util.IntAllDef((*o_vipjy)["i_analy_report"], 1),
-                        "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 {
-                        apppush = 1
-                }
-                mail, _ := (*o_jy)["s_email"].(string)
-                if mail == "" {
-                        mail = bigMsg.Data.Free.Mail
-                }
-                data = M{
-                        "apppush":  apppush,
-                        "mailpush": mailpush,
-                        "mail":     mail,
-                }
-        case "follow_ent":
-                user := &map[string]interface{}{}
-                if positionType == 0 {
-                        user, _ = Mgo.FindById("user", userId, `{"s_myemail":1,"o_follow_ent":1}`)
-                } else {
-                        query := map[string]interface{}{
-                                "i_userid": entUserId,
-                                "i_entid":  entId,
-                                "i_type":   1,
-                        }
-                        user, _ = Mgo.FindOneByField("entniche_rule", query, `{"s_myemail":1,"o_follow_ent":1}`)
-                }
-                o_follow_ent, _ := (*user)["o_follow_ent"].(map[string]interface{})
-                apppush := util.IntAll(o_follow_ent["i_apppush"])
-                mailpush := util.IntAll(o_follow_ent["i_mailpush"])
-                if apppush == 0 && mailpush == 0 {
-                        apppush = 1
-                }
-                mail, _ := o_follow_ent["s_email"].(string)
-                if mail == "" {
-                        mail = bigMsg.Data.Free.Mail
-                }
-                data = M{
-                        "apppush":  apppush,
-                        "mailpush": mailpush,
-                        "mail":     mail,
-                }
-        case "follow_project":
-                user := &map[string]interface{}{}
-                if positionType == 0 {
-                        user, _ = Mgo.FindById("user", userId, `{"s_myemail":1,"o_follow_project":1}`)
-                } else {
-                        query := map[string]interface{}{
-                                "i_userid": entUserId,
-                                "i_entid":  entId,
-                                "i_type":   1,
-                        }
-                        user, _ = Mgo.FindOneByField("entniche_rule", query, `{"s_myemail":1,"o_follow_project":1}`)
-                }
-                //user, _ := Mgo.FindById("user", userId, `{"s_myemail":1,"o_follow_project":1}`)
-                o_follow_project, _ := (*user)["o_follow_project"].(map[string]interface{})
-                apppush := util.IntAll(o_follow_project["i_apppush"])
-                mailpush := util.IntAll(o_follow_project["i_mailpush"])
-                if apppush == 0 && mailpush == 0 {
-                        apppush = 1
-                }
-                mail, _ := o_follow_project["s_email"].(string)
-                if mail == "" {
-                        mail = bigMsg.Data.Free.Mail
-                }
-                data = M{
-                        "apppush":  apppush,
-                        "mailpush": mailpush,
-                        "mail":     mail,
-                }
-        case "entniche":
-                //user, _ := Mgo.FindById("user", userId, `{"s_myemail":1,"s_phone":1,"s_m_phone":1,"o_entniche":1}`)
-                //o_entniche, _ := (*user)["o_entniche"].(map[string]interface{})
-                o_entniche := jy.GetSubScribeInfo(a.Session(), Mgo, "f", "10000")
-                ratemode, apppush, mailpush := 0, 0, 0
-                mail := ""
-                flag := true
-                if len(*o_entniche) == 0 {
-                        //phone:=bigMsg.Data.Free. 后期
-                        phone := ""
-                        entniche_user := Mysql.SelectBySql(`select a.id,a.ent_id,a.mail,b.model,c.dept_id from entniche_user a
-				inner join entniche_info b on (a.phone=? and b.status=1 and a.ent_id=b.id)
-				inner join entniche_department_user c on (a.id=c.user_id)`, phone)
-                        if len(*entniche_user) == 1 {
-                                if model := util.IntAll((*entniche_user)[0]["model"]); model > 0 {
-                                        mail, _ = (*entniche_user)[0]["mail"].(string)
-                                        var query map[string]interface{}
-                                        query = map[string]interface{}{
-                                                "i_entid":  entId,
-                                                "i_userid": entUserId,
-                                        }
-                                        if query != nil {
-                                                entniche_rule, _ := Mgo.FindOneByField("entniche_rule", query, `{"o_entniche":1}`)
-                                                if entniche_rule != nil && len(*entniche_rule) > 0 {
-                                                        flag = false
-                                                        obj, _ := (*entniche_rule)["o_entniche"].(map[string]interface{})
-                                                        ratemode = util.IntAll(obj["i_ratemode"])
-                                                        apppush = util.IntAll(obj["i_apppush"])
-                                                        mailpush = util.IntAll(obj["i_mailpush"])
-                                                }
-                                        }
-                                }
-                        }
-                }
-                if mail == "" {
-                        mail, _ = (*o_entniche)["s_email"].(string)
-                }
-                if mail == "" {
-                        mail = bigMsg.Data.Free.Mail
-                }
-                if flag {
-                        ratemode = util.IntAll((*o_entniche)["i_ratemode"])
-                        apppush = util.IntAll((*o_entniche)["i_apppush"])
-                        mailpush = util.IntAll((*o_entniche)["i_mailpush"])
-                }
-                if ratemode == 0 {
-                        ratemode = 2
-                }
-                if apppush == 0 && mailpush == 0 {
-                        apppush = 1
-                }
-                data = M{
-                        "ratemode": ratemode,
-                        "apppush":  apppush,
-                        "mailpush": mailpush,
-                        "mail":     mail,
-                }
-        default:
-                R.InvalidReqParam(a.ResponseWriter, a.Request, "item")
-                return
-        }
-        a.ServeJson(Result{Data: data})
+	userId, _ := a.GetSession("userId").(string)
+	entId := util.Int64All(a.GetSession("entId"))
+	entUserId := util.Int64All(a.GetSession("entUserId "))
+	positionType := util.Int64All(a.GetSession("positionType "))
+	if !R.CheckReqParam(a.ResponseWriter, a.Request, "item") {
+		return
+	}
+	var data M
+	bigMsg := jy.GetBigVipUserBaseMsg("10000", a.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	switch a.GetString("item") {
+	case "member_subscribe":
+		o_member_jy := jy.GetSubScribeInfo(a.Session(), Mgo, "m", "10000")
+		mail, _ := (*o_member_jy)["s_email"].(string)
+		if mail == "" {
+			mail = bigMsg.Data.Free.Mail
+		}
+		data = M{
+			"ratemode":       util.IntAllDef((*o_member_jy)["i_ratemode"], 1),
+			"apppush":        util.IntAllDef((*o_member_jy)["i_apppush"], 1),
+			"mailpush":       util.IntAll((*o_member_jy)["i_mailpush"]),
+			"mail":           mail,
+			"subscribe":      util.IntAllDef((*o_member_jy)["i_subscribe"], 1),
+			"follow_project": util.IntAllDef((*o_member_jy)["i_follow_project"], 1),
+			"follow_ent":     util.IntAllDef((*o_member_jy)["i_follow_ent"], 1),
+			"wxpush":         util.IntAll((*o_member_jy)["i_wxpush"]),
+		}
+		power := []int{}
+		BigMsg := jy.GetBigVipUserBaseMsg("10000", a.Session(), config.Config.Etcd.Key, config.Config.Etcd.Key)
+		for k, _ := range BigMsg.PowerMap {
+			power = append(power, k)
+		}
+		data["power"] = power
+		//潜在项目预测
+		if BigMsg.CheckBigVipBackPower("forecast") {
+			data["newproject_forecast"] = util.IntAllDef((*o_member_jy)["i_newproject_forecast"], 1)
+		}
+		//企业情报
+		if BigMsg.CheckBigVipBackPower("entChange") {
+			data["jy/src/jfw/modules/bigmember/src/entinfo"] = util.IntAllDef((*o_member_jy)["i_entinfo"], 1)
+		}
+		//分析报告
+		if BigMsg.CheckBigVipBackPower("report") {
+			data["analy_report"] = util.IntAllDef((*o_member_jy)["i_analy_report"], 1)
+		}
+	case "super_subscribe":
+		o_vipjy := jy.GetSubScribeInfo(a.Session(), Mgo, "v", "10000")
+		apppush := util.IntAll((*o_vipjy)["i_apppush"])
+		mailpush := util.IntAll((*o_vipjy)["i_mailpush"])
+		if apppush == 0 && mailpush == 0 {
+			apppush = 1
+		}
+		mail, _ := (*o_vipjy)["s_email"].(string)
+		if mail == "" {
+			mail = bigMsg.Data.Free.Mail
+		}
+		data = M{
+			"subscribe":      util.IntAllDef((*o_vipjy)["i_subscribe"], 1),      //订阅开关
+			"follow_ent":     util.IntAllDef((*o_vipjy)["i_follow_ent"], 1),     //关注企业推送开关
+			"follow_project": util.IntAllDef((*o_vipjy)["i_follow_project"], 1), //关注项目推送开关
+			"ratemode":       util.IntAllDef((*o_vipjy)["i_ratemode"], 2),
+			"apppush":        apppush,
+			"mailpush":       mailpush,
+			"mail":           mail,
+			"analy_report":   util.IntAllDef((*o_vipjy)["i_analy_report"], 1),
+			"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 {
+			apppush = 1
+		}
+		mail, _ := (*o_jy)["s_email"].(string)
+		if mail == "" {
+			mail = bigMsg.Data.Free.Mail
+		}
+		data = M{
+			"apppush":  apppush,
+			"mailpush": mailpush,
+			"mail":     mail,
+		}
+	case "follow_ent":
+		user := &map[string]interface{}{}
+		if positionType == 0 {
+			user, _ = Mgo.FindById("user", userId, `{"s_myemail":1,"o_follow_ent":1}`)
+		} else {
+			query := map[string]interface{}{
+				"i_userid": entUserId,
+				"i_entid":  entId,
+				"i_type":   1,
+			}
+			user, _ = Mgo.FindOneByField("entniche_rule", query, `{"s_myemail":1,"o_follow_ent":1}`)
+		}
+		o_follow_ent, _ := (*user)["o_follow_ent"].(map[string]interface{})
+		apppush := util.IntAll(o_follow_ent["i_apppush"])
+		mailpush := util.IntAll(o_follow_ent["i_mailpush"])
+		if apppush == 0 && mailpush == 0 {
+			apppush = 1
+		}
+		mail, _ := o_follow_ent["s_email"].(string)
+		if mail == "" {
+			mail = bigMsg.Data.Free.Mail
+		}
+		data = M{
+			"apppush":  apppush,
+			"mailpush": mailpush,
+			"mail":     mail,
+		}
+	case "follow_project":
+		user := &map[string]interface{}{}
+		if positionType == 0 {
+			user, _ = Mgo.FindById("user", userId, `{"s_myemail":1,"o_follow_project":1}`)
+		} else {
+			query := map[string]interface{}{
+				"i_userid": entUserId,
+				"i_entid":  entId,
+				"i_type":   1,
+			}
+			user, _ = Mgo.FindOneByField("entniche_rule", query, `{"s_myemail":1,"o_follow_project":1}`)
+		}
+		//user, _ := Mgo.FindById("user", userId, `{"s_myemail":1,"o_follow_project":1}`)
+		o_follow_project, _ := (*user)["o_follow_project"].(map[string]interface{})
+		apppush := util.IntAll(o_follow_project["i_apppush"])
+		mailpush := util.IntAll(o_follow_project["i_mailpush"])
+		if apppush == 0 && mailpush == 0 {
+			apppush = 1
+		}
+		mail, _ := o_follow_project["s_email"].(string)
+		if mail == "" {
+			mail = bigMsg.Data.Free.Mail
+		}
+		data = M{
+			"apppush":  apppush,
+			"mailpush": mailpush,
+			"mail":     mail,
+		}
+		/* case "entniche":
+		                //user, _ := Mgo.FindById("user", userId, `{"s_myemail":1,"s_phone":1,"s_m_phone":1,"o_entniche":1}`)
+		                //o_entniche, _ := (*user)["o_entniche"].(map[string]interface{})
+		                o_entniche := jy.GetSubScribeInfo(a.Session(), Mgo, "f", "10000")
+		                ratemode, apppush, mailpush := 0, 0, 0
+		                mail := ""
+		                flag := true
+		                if len(*o_entniche) == 0&&  {
+		                        //phone:=bigMsg.Data.Free. 后期
+		                        phone := ""
+		                        entniche_user := Mysql.SelectBySql(`select a.id,a.ent_id,a.mail,b.model,c.dept_id from entniche_user a
+						inner join entniche_info b on (a.phone=? and b.status=1 and a.ent_id=b.id)
+						inner join entniche_department_user c on (a.id=c.user_id)`, phone)
+		                        if len(*entniche_user) == 1 {
+		                                if model := util.IntAll((*entniche_user)[0]["model"]); model > 0 {
+		                                        mail, _ = (*entniche_user)[0]["mail"].(string)
+		                                        var query map[string]interface{}
+		                                        query = map[string]interface{}{
+		                                                "i_entid":  entId,
+		                                                "i_userid": entUserId,
+		                                        }
+		                                        if query != nil {
+		                                                entniche_rule, _ := Mgo.FindOneByField("entniche_rule", query, `{"o_entniche":1}`)
+		                                                if entniche_rule != nil && len(*entniche_rule) > 0 {
+		                                                        flag = false
+		                                                        obj, _ := (*entniche_rule)["o_entniche"].(map[string]interface{})
+		                                                        ratemode = util.IntAll(obj["i_ratemode"])
+		                                                        apppush = util.IntAll(obj["i_apppush"])
+		                                                        mailpush = util.IntAll(obj["i_mailpush"])
+		                                                }
+		                                        }
+		                                }
+		                        }
+		                }
+		                if mail == "" {
+		                        mail, _ = (*o_entniche)["s_email"].(string)
+		                }
+		                if mail == "" {
+		                        mail = bigMsg.Data.Free.Mail
+		                }
+		                if flag {
+		                        ratemode = util.IntAll((*o_entniche)["i_ratemode"])
+		                        apppush = util.IntAll((*o_entniche)["i_apppush"])
+		                        mailpush = util.IntAll((*o_entniche)["i_mailpush"])
+		                }
+		                if ratemode == 0 {
+		                        ratemode = 2
+		                }
+		                if apppush == 0 && mailpush == 0 {
+		                        apppush = 1
+		                }
+		                data = M{
+		                        "ratemode": ratemode,
+		                        "apppush":  apppush,
+		                        "mailpush": mailpush,
+		                        "mail":     mail,
+		                }*/
+	default:
+		R.InvalidReqParam(a.ResponseWriter, a.Request, "item")
+		return
+	}
+	a.ServeJson(Result{Data: data})
 }
 
 func (a *Action) Update() {
-        userId, _ := a.GetSession("userId").(string)
-        positionType := util.Int64All(a.GetSession("positionType"))
-        ps := pushSet{
-                Subscribe:           -1,
-                Follow_project:      -1,
-                Follow_ent:          -1,
-                Newproject_forecast: -1,
-                Analy_report:        -1,
-                Entinfo:             -1,
-        }
-        err := json.Unmarshal(a.Body(), &ps)
-        status := 0
-        if err == nil {
-                if ps.Mailpush == 1 && ps.Mail == "" {
-                        R.InvalidReqParam(a.ResponseWriter, a.Request, "mail")
-                        return
-                } else if ps.Item != "member_subscribe" && ps.Apppush == 0 && ps.Mailpush == 0 {
-                        R.InvalidReqParam(a.ResponseWriter, a.Request, "apppush mailpush 至少打开一个")
-                        return
-                }
-                var set map[string]interface{}
-                switch ps.Item {
-                case "member_subscribe":
-                        mType := "o_member_jy"
-                        if positionType == 1 {
-                                mType = "o_entniche"
-                        }
-                        set = map[string]interface{}{
-                                fmt.Sprintf("%s.i_ratemode", mType):   ps.Ratemode,
-                                fmt.Sprintf("%s.i_ratemode", mType):   ps.Apppush,
-                                fmt.Sprintf("%s.i_mailpush", mType):   ps.Mailpush,
-                                fmt.Sprintf("%s.s_email", mType):      ps.Mail,
-                                fmt.Sprintf("%s.l_modifydate", mType): time.Now().Unix(),
-                                fmt.Sprintf("%s.i_wxpush", mType):     ps.WXPush,
-                        }
-                        if ps.Subscribe >= 0 {
-                                set[fmt.Sprintf("%s.i_subscribe", mType)] = ps.Subscribe
-                        }
-                        if ps.Follow_project >= 0 {
-                                set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Follow_project
-                        }
-                        if ps.Follow_ent >= 0 {
-                                set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Follow_ent
-                        }
-                        if ps.Newproject_forecast >= 0 {
-                                set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Newproject_forecast
-                        }
-                        if ps.Analy_report >= 0 {
-                                set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Analy_report
-                        }
-                        if ps.Entinfo >= 0 {
-                                set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Entinfo
-                        }
-                case "super_subscribe":
-                        vType := "o_vipjy"
-                        if positionType == 1 {
-                                vType = "o_entniche"
-                        }
-                        set = map[string]interface{}{
-                                fmt.Sprintf("%s.i_subscribe", vType):      ps.Subscribe,      //订阅开关
-                                fmt.Sprintf("%s.i_follow_ent", vType):     ps.Follow_ent,     //关注企业推送开关
-                                fmt.Sprintf("%s.i_follow_project", vType): ps.Follow_project, //关注项目推送开关
-                                fmt.Sprintf("%s.i_ratemode", vType):       ps.Ratemode,
-                                fmt.Sprintf("%s.i_apppush", vType):        ps.Apppush,
-                                fmt.Sprintf("%s.i_mailpush", vType):       ps.Mailpush,
-                                fmt.Sprintf("%s.s_email", vType):          ps.Mail,
-                                fmt.Sprintf("%s.l_modifydate", vType):     time.Now().Unix(),
-                                fmt.Sprintf("%s.i_analy_report", vType):   ps.Analy_report,
-                        }
-                case "free_subscribe":
-                        ftype := "o_jy"
-                        if positionType == 1 {
-                                ftype = "o_entniche"
-                        }
-                        set = map[string]interface{}{
-                                fmt.Sprintf("%s.i_apppush", ftype):    ps.Apppush,
-                                fmt.Sprintf("%s.i_mailpush", ftype):   ps.Mailpush,
-                                fmt.Sprintf("%s.s_email", ftype):      ps.Mail,
-                                fmt.Sprintf("%s.l_modifydate", ftype): time.Now().Unix(),
-                        }
-                case "follow_ent":
-                        set = map[string]interface{}{
-                                "o_follow_ent.i_apppush":    ps.Apppush,
-                                "o_follow_ent.i_mailpush":   ps.Mailpush,
-                                "o_follow_ent.s_email":      ps.Mail,
-                                "o_follow_ent.l_modifydate": time.Now().Unix(),
-                        }
-                case "follow_project":
-                        set = map[string]interface{}{
-                                "o_follow_project.i_apppush":    ps.Apppush,
-                                "o_follow_project.i_mailpush":   ps.Mailpush,
-                                "o_follow_project.s_email":      ps.Mail,
-                                "o_follow_project.l_modifydate": time.Now().Unix(),
-                        }
-                default:
-                        R.InvalidReqParam(a.ResponseWriter, a.Request, "item")
-                        return
-                }
-                if positionType == 0 {
-                        if set != nil && Mgo.UpdateById("user", userId, map[string]interface{}{"$set": set}) {
-                                status = 1
-                        }
-                } else {
-                        query := map[string]interface{}{
-                                "i_userid": util.Int64All(a.GetSession("entUserId")),
-                                "i_entid":  util.Int64All(a.GetSession("entId")),
-                                "i_type":   1,
-                        }
-                        if set != nil && Mgo.Update("entniche_rule", query, map[string]interface{}{"$set": set},true,false) {
-                                status = 1
-                        }
-                }
-        } else {
-                log.Println("修改推送设置 json.Unmarshal 出错:", err)
-                R.InvalidReqParam(a.ResponseWriter, a.Request, "json格式错误")
-                return
-        }
-        a.ServeJson(Result{Data: M{"status": status}})
+	userId, _ := a.GetSession("userId").(string)
+	positionType := util.Int64All(a.GetSession("positionType"))
+	ps := pushSet{
+		Subscribe:           -1,
+		Follow_project:      -1,
+		Follow_ent:          -1,
+		Newproject_forecast: -1,
+		Analy_report:        -1,
+		Entinfo:             -1,
+	}
+	err := json.Unmarshal(a.Body(), &ps)
+	status := 0
+	if err == nil {
+		if ps.Mailpush == 1 && ps.Mail == "" {
+			R.InvalidReqParam(a.ResponseWriter, a.Request, "mail")
+			return
+		} else if ps.Item != "member_subscribe" && ps.Apppush == 0 && ps.Mailpush == 0 {
+			R.InvalidReqParam(a.ResponseWriter, a.Request, "apppush mailpush 至少打开一个")
+			return
+		}
+		var set map[string]interface{}
+		switch ps.Item {
+		case "member_subscribe":
+			mType := "o_member_jy"
+			if positionType == 1 {
+				mType = "o_entniche"
+			}
+			set = map[string]interface{}{
+				fmt.Sprintf("%s.i_ratemode", mType):   ps.Ratemode,
+				fmt.Sprintf("%s.i_ratemode", mType):   ps.Apppush,
+				fmt.Sprintf("%s.i_mailpush", mType):   ps.Mailpush,
+				fmt.Sprintf("%s.s_email", mType):      ps.Mail,
+				fmt.Sprintf("%s.l_modifydate", mType): time.Now().Unix(),
+				fmt.Sprintf("%s.i_wxpush", mType):     ps.WXPush,
+			}
+			if ps.Subscribe >= 0 {
+				set[fmt.Sprintf("%s.i_subscribe", mType)] = ps.Subscribe
+			}
+			if ps.Follow_project >= 0 {
+				set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Follow_project
+			}
+			if ps.Follow_ent >= 0 {
+				set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Follow_ent
+			}
+			if ps.Newproject_forecast >= 0 {
+				set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Newproject_forecast
+			}
+			if ps.Analy_report >= 0 {
+				set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Analy_report
+			}
+			if ps.Entinfo >= 0 {
+				set[fmt.Sprintf("%s.i_ratemode", mType)] = ps.Entinfo
+			}
+		case "super_subscribe":
+			vType := "o_vipjy"
+			if positionType == 1 {
+				vType = "o_entniche"
+			}
+			set = map[string]interface{}{
+				fmt.Sprintf("%s.i_subscribe", vType):      ps.Subscribe,      //订阅开关
+				fmt.Sprintf("%s.i_follow_ent", vType):     ps.Follow_ent,     //关注企业推送开关
+				fmt.Sprintf("%s.i_follow_project", vType): ps.Follow_project, //关注项目推送开关
+				fmt.Sprintf("%s.i_ratemode", vType):       ps.Ratemode,
+				fmt.Sprintf("%s.i_apppush", vType):        ps.Apppush,
+				fmt.Sprintf("%s.i_mailpush", vType):       ps.Mailpush,
+				fmt.Sprintf("%s.s_email", vType):          ps.Mail,
+				fmt.Sprintf("%s.l_modifydate", vType):     time.Now().Unix(),
+				fmt.Sprintf("%s.i_analy_report", vType):   ps.Analy_report,
+			}
+		case "free_subscribe":
+			ftype := "o_jy"
+			if positionType == 1 {
+				ftype = "o_entniche"
+			}
+			set = map[string]interface{}{
+				fmt.Sprintf("%s.i_apppush", ftype):    ps.Apppush,
+				fmt.Sprintf("%s.i_mailpush", ftype):   ps.Mailpush,
+				fmt.Sprintf("%s.s_email", ftype):      ps.Mail,
+				fmt.Sprintf("%s.l_modifydate", ftype): time.Now().Unix(),
+			}
+		case "follow_ent":
+			set = map[string]interface{}{
+				"o_follow_ent.i_apppush":    ps.Apppush,
+				"o_follow_ent.i_mailpush":   ps.Mailpush,
+				"o_follow_ent.s_email":      ps.Mail,
+				"o_follow_ent.l_modifydate": time.Now().Unix(),
+			}
+		case "follow_project":
+			set = map[string]interface{}{
+				"o_follow_project.i_apppush":    ps.Apppush,
+				"o_follow_project.i_mailpush":   ps.Mailpush,
+				"o_follow_project.s_email":      ps.Mail,
+				"o_follow_project.l_modifydate": time.Now().Unix(),
+			}
+		default:
+			R.InvalidReqParam(a.ResponseWriter, a.Request, "item")
+			return
+		}
+		if positionType == 0 {
+			if set != nil && Mgo.UpdateById("user", userId, map[string]interface{}{"$set": set}) {
+				status = 1
+			}
+		} else {
+			query := map[string]interface{}{
+				"i_userid": util.Int64All(a.GetSession("entUserId")),
+				"i_entid":  util.Int64All(a.GetSession("entId")),
+				"i_type":   1,
+			}
+			if set != nil && Mgo.Update("entniche_rule", query, map[string]interface{}{"$set": set}, true, false) {
+				status = 1
+			}
+		}
+	} else {
+		log.Println("修改推送设置 json.Unmarshal 出错:", err)
+		R.InvalidReqParam(a.ResponseWriter, a.Request, "json格式错误")
+		return
+	}
+	a.ServeJson(Result{Data: M{"status": status}})
 }
 
 //判断按钮是否全部开启
 func OpenStatus(ojy map[string]interface{}, types string, BigMsg *jy.BigVipBaseMsg) bool {
-        push, data := M{}, M{}
-        pushStatus, subscribe := false, false
-        switch types {
-        case "member_subscribe":
-                push = M{
-                        "apppush":  util.IntAllDef(ojy["i_apppush"], 1),
-                        "mailpush": util.IntAll(ojy["i_mailpush"]),
-                }
-                data = M{
-                        "subscribe":      util.IntAllDef(ojy["i_subscribe"], 1),
-                        "follow_project": util.IntAllDef(ojy["i_follow_project"], 1),
-                        "follow_ent":     util.IntAllDef(ojy["i_follow_ent"], 1),
-                }
-                power := []int{}
-                //BigMsg := jy.GetBigVipUserBaseMsg("10000", session, config.Config.Etcd.Key, config.Config.Etcd.Key)
-                for k, _ := range BigMsg.PowerMap {
-                        power = append(power, k)
-                }
-                //潜在项目预测
-                if BigMsg.CheckBigVipBackPower("forecast") {
-                        data["newproject_forecast"] = util.IntAllDef(ojy["i_newproject_forecast"], 1)
-                }
-                //企业情报
-                if BigMsg.CheckBigVipBackPower("entChange") {
-                        data["jy/src/jfw/modules/bigmember/src/entinfo"] = util.IntAllDef(ojy["i_entinfo"], 1)
-                }
-                //分析报告
-                if BigMsg.CheckBigVipBackPower("report") {
-                        data["analy_report"] = util.IntAllDef(ojy["i_analy_report"], 1)
-                }
-        }
+	push, data := M{}, M{}
+	pushStatus, subscribe := false, false
+	switch types {
+	case "member_subscribe":
+		push = M{
+			"apppush":  util.IntAllDef(ojy["i_apppush"], 1),
+			"mailpush": util.IntAll(ojy["i_mailpush"]),
+		}
+		data = M{
+			"subscribe":      util.IntAllDef(ojy["i_subscribe"], 1),
+			"follow_project": util.IntAllDef(ojy["i_follow_project"], 1),
+			"follow_ent":     util.IntAllDef(ojy["i_follow_ent"], 1),
+		}
+		power := []int{}
+		//BigMsg := jy.GetBigVipUserBaseMsg("10000", session, config.Config.Etcd.Key, config.Config.Etcd.Key)
+		for k, _ := range BigMsg.PowerMap {
+			power = append(power, k)
+		}
+		//潜在项目预测
+		if BigMsg.CheckBigVipBackPower("forecast") {
+			data["newproject_forecast"] = util.IntAllDef(ojy["i_newproject_forecast"], 1)
+		}
+		//企业情报
+		if BigMsg.CheckBigVipBackPower("entChange") {
+			data["jy/src/jfw/modules/bigmember/src/entinfo"] = util.IntAllDef(ojy["i_entinfo"], 1)
+		}
+		//分析报告
+		if BigMsg.CheckBigVipBackPower("report") {
+			data["analy_report"] = util.IntAllDef(ojy["i_analy_report"], 1)
+		}
+	}
 
-        for _, v := range data {
-                if util.IntAll(v) > 0 {
-                        subscribe = true
-                        break
-                }
-        }
-        for _, v := range push {
-                if util.Int64All(v) > 0 {
-                        pushStatus = true
-                        break
-                }
-        }
-        return subscribe && pushStatus
+	for _, v := range data {
+		if util.IntAll(v) > 0 {
+			subscribe = true
+			break
+		}
+	}
+	for _, v := range push {
+		if util.Int64All(v) > 0 {
+			pushStatus = true
+			break
+		}
+	}
+	return subscribe && pushStatus
 }

+ 534 - 533
src/jfw/modules/bigmember/src/service/report/report.go

@@ -1,616 +1,617 @@
 package report
 
 import (
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "fmt"
-        "jy/src/jfw/modules/bigmember/src/config"
-        . "jy/src/jfw/modules/bigmember/src/db"
-        "sort"
-        "strings"
-        "time"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"fmt"
+	"jy/src/jfw/modules/bigmember/src/config"
+	. "jy/src/jfw/modules/bigmember/src/db"
+	"sort"
+	"strings"
+	"time"
 
-        . "app.yhyue.com/moapp/jybase/api"
-        qutil "app.yhyue.com/moapp/jybase/common"
-        . "app.yhyue.com/moapp/jybase/date"
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	. "app.yhyue.com/moapp/jybase/api"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 // Report vip订阅报告
 type Report struct {
-        *xweb.Action
-        index       xweb.Mapper `xweb:"/report/index"`
-        detail      xweb.Mapper `xweb:"/report/detail"`
-        tip         xweb.Mapper `xweb:"/report/tip"`
-        tipover     xweb.Mapper `xweb:"/report/tipover"`
-        openpushmsg xweb.Mapper `xweb:"/report/openpushmsg"`
-        starttime   xweb.Mapper `xweb:"/report/starttime"`
+	*xweb.Action
+	index       xweb.Mapper `xweb:"/report/index"`
+	detail      xweb.Mapper `xweb:"/report/detail"`
+	tip         xweb.Mapper `xweb:"/report/tip"`
+	tipover     xweb.Mapper `xweb:"/report/tipover"`
+	openpushmsg xweb.Mapper `xweb:"/report/openpushmsg"`
+	starttime   xweb.Mapper `xweb:"/report/starttime"`
 }
 
 type BarChart struct {
-        Key        int64       `json:"key"`
-        Value      interface{} `json:"value"`
-        GrowthRate float64     `json:"growthrate"`
+	Key        int64       `json:"key"`
+	Value      interface{} `json:"value"`
+	GrowthRate float64     `json:"growthrate"`
 }
 
 type BarCharts struct {
-        Keys map[int64]bool
-        List []*BarChart
+	Keys map[int64]bool
+	List []*BarChart
 }
 
 func (s BarCharts) Len() int {
-        return len(s.List)
+	return len(s.List)
 }
 
 func (s BarCharts) Less(i, j int) bool {
-        return s.List[i].Key < s.List[j].Key
+	return s.List[i].Key < s.List[j].Key
 }
 
 func (s BarCharts) Swap(i, j int) {
-        s.List[i], s.List[j] = s.List[j], s.List[i]
+	s.List[i], s.List[j] = s.List[j], s.List[i]
 }
 
 const (
-        oneday                                       = 86400
-        pushspace_experience_member_statistic        = "pushspace_experience_member_statistic"
-        pushspace_experience_member_statistic_winner = "pushspace_experience_member_statistic_winner"
-        pushspace_member_statistic                   = "pushspace_member_statistic"
-        pushspace_member_statistic_winner            = "pushspace_member_statistic_winner"
-        C_User                                       = "user"
-        C_Entniche_Rule                              = "entniche_rule"
+	oneday                                       = 86400
+	pushspace_experience_member_statistic        = "pushspace_experience_member_statistic"
+	pushspace_experience_member_statistic_winner = "pushspace_experience_member_statistic_winner"
+	pushspace_member_statistic                   = "pushspace_member_statistic"
+	pushspace_member_statistic_winner            = "pushspace_member_statistic_winner"
+	C_User                                       = "user"
+	C_Entniche_Rule                              = "entniche_rule"
 )
 
 func (r *Report) Index() {
-        if !R.CheckReqParam(r.ResponseWriter, r.Request, "ym") {
-                return
-        }
-        ym := r.GetString("ym")
-        result := M{}
-        userId, qk, qv := getQuery(r.Session())
-        if qk == "" || qv == nil {
-                return
-        }
-        // userId, _, _ = MainUserId(userId, "", 0)
-        var query map[string]interface{}
-        if len(ym) == 4 {
-                query = map[string]interface{}{
-                        qk: qv,
-                        "dateym": map[string]interface{}{
-                                "$gte": qutil.IntAll(ym + "00"),
-                                "$lt":  qutil.IntAll(ym+"00") + 100,
-                        },
-                        "type": 3,
-                }
-        } else if len(ym) == 6 {
-                query = map[string]interface{}{
-                        qk:       qv,
-                        "dateym": qutil.IntAll(ym),
-                        "type":   2,
-                }
-        } else {
-                R.InvalidReqParam(r.ResponseWriter, r.Request, "ym")
-                return
-        }
-        list, ok := Mgo.Find(pushspace_member_statistic, query, `{"startdate":-1}`, `{"startdate":1,"enddate":1,"pushcount":1,"pushtime":1,"unread":1}`, false, -1, -1)
-        array := []map[string]interface{}{}
-        if ok && list != nil {
-                for _, v := range *list {
-                        array = append(array, map[string]interface{}{
-                                "pushtime":  v["pushtime"],
-                                "pushcount": v["pushcount"],
-                                "unread":    qutil.IntAll(v["unread"]),
-                                "startdate": v["startdate"],
-                                "enddate":   v["enddate"],
-                        })
-                }
-        }
-        result["list"] = array
-        result["subscribe"] = false
-        positionType := qutil.Int64All(r.GetSession("positionType"))
-        o_mb := &map[string]interface{}{}
-        if positionType == 0 {
-                data:=jy.GetBigVipUserBaseMsg("10000",r.Session(),config.Config.Etcd.Hosts,config.Config.Etcd.Key)
-                if  data.Data.Member.Pid==""{
-                        //没有父级
-                        o_mb:=jy.GetSubScribeInfo(r.Session(),Mgo,"m","10000")
-                        if (*o_mb) != nil && (*o_mb)["o_member_jy"] != nil {
-                                (*o_mb)["o_member_jy"] = (*o_mb)["o_entniche"]
-                        }
-                }else{
-                        o_mb, ok = Mgo.FindById(C_User, userId, `{"o_member_jy":1,"s_member_mainid":1,"i_member_sub_status":1}`)
-                        if ok && o_mb != nil && (*o_mb) != nil && (*o_mb)["s_member_mainid"] != nil && qutil.IntAllDef((*o_mb)["i_member_sub_status"], 0) == 1 { //如果是子账号 查询主账号信息
-                                mainId := qutil.ObjToString((*o_mb)["s_member_mainid"])
-                                o_mb, ok = Mgo.FindById(C_User, mainId, `{"o_member_jy":1}`)
-                        }
-                }
-        } else {
-                o_mb, ok = Mgo.FindById(C_Entniche_Rule, userId, `{"o_member_jy":1,"s_member_mainid":1,"i_member_sub_status":1}`)
-                query := map[string]interface{}{
-                        "i_userid": qutil.Int64All(r.GetSession("entUserId")),
-                        "i_entid":  qutil.Int64All(r.GetSession("entId")),
-                        "i_type":   1,
-                }
-                o_mb, ok = Mgo.FindOne(C_User, query)
-                if (*o_mb) != nil && (*o_mb)["o_member_jy"] != nil {
-                        (*o_mb)["o_member_jy"] = (*o_mb)["o_entniche"]
-                }
-        }
+	if !R.CheckReqParam(r.ResponseWriter, r.Request, "ym") {
+		return
+	}
+	ym := r.GetString("ym")
+	result := M{}
+	userId, qk, qv := getQuery(r.Session())
+	if qk == "" || qv == nil {
+		return
+	}
+	// userId, _, _ = MainUserId(userId, "", 0)
+	var query map[string]interface{}
+	if len(ym) == 4 {
+		query = map[string]interface{}{
+			qk: qv,
+			"dateym": map[string]interface{}{
+				"$gte": qutil.IntAll(ym + "00"),
+				"$lt":  qutil.IntAll(ym+"00") + 100,
+			},
+			"type": 3,
+		}
+	} else if len(ym) == 6 {
+		query = map[string]interface{}{
+			qk:       qv,
+			"dateym": qutil.IntAll(ym),
+			"type":   2,
+		}
+	} else {
+		R.InvalidReqParam(r.ResponseWriter, r.Request, "ym")
+		return
+	}
+	list, ok := Mgo.Find(pushspace_member_statistic, query, `{"startdate":-1}`, `{"startdate":1,"enddate":1,"pushcount":1,"pushtime":1,"unread":1}`, false, -1, -1)
+	array := []map[string]interface{}{}
+	if ok && list != nil {
+		for _, v := range *list {
+			array = append(array, map[string]interface{}{
+				"pushtime":  v["pushtime"],
+				"pushcount": v["pushcount"],
+				"unread":    qutil.IntAll(v["unread"]),
+				"startdate": v["startdate"],
+				"enddate":   v["enddate"],
+			})
+		}
+	}
+	result["list"] = array
+	result["subscribe"] = false
+	positionType := qutil.Int64All(r.GetSession("positionType"))
+	o_mb := &map[string]interface{}{}
+	if positionType == 0 {
+		data := jy.GetBigVipUserBaseMsg("10000", r.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+		if data.Data.Member.Pid == "" {
+			//没有父级
+			o_mb := jy.GetSubScribeInfo(r.Session(), Mgo, "m", "10000")
+			if o_mb != nil && (*o_mb)["o_member_jy"] != nil {
+				(*o_mb)["o_member_jy"] = o_mb
+			}
 
-        if ok && o_mb != nil {
-                o_member_jy, _ := (*o_mb)["o_member_jy"].(map[string]interface{})
-                if o_member_jy["a_infotype"] != nil || o_member_jy["o_area"] != nil || o_member_jy["a_buyerclass"] != nil {
-                        result["subscribe"] = true
-                } else {
-                        a_items, _ := o_member_jy["a_items"].([]interface{})
-                L:
-                        for _, a_item := range a_items {
-                                itemMap, _ := a_item.(map[string]interface{})
-                                a_keys, _ := itemMap["a_key"].([]interface{})
-                                for _, a_key := range a_keys {
-                                        keyMap, _ := a_key.(map[string]interface{})
-                                        keys, _ := keyMap["key"].([]interface{})
-                                        for _, key := range keys {
-                                                if strings.TrimSpace(qutil.ObjToString(key)) != "" {
-                                                        result["subscribe"] = true
-                                                        break L
-                                                }
-                                        }
-                                }
-                        }
-                }
-        }
-        r.ServeJson(Result{
-                Data: result,
-        })
+		} else {
+			o_mb, ok = Mgo.FindById(C_User, userId, `{"o_member_jy":1,"s_member_mainid":1,"i_member_sub_status":1}`)
+			if ok && o_mb != nil && (*o_mb) != nil && (*o_mb)["s_member_mainid"] != nil && qutil.IntAllDef((*o_mb)["i_member_sub_status"], 0) == 1 { //如果是子账号 查询主账号信息
+				mainId := qutil.ObjToString((*o_mb)["s_member_mainid"])
+				o_mb, ok = Mgo.FindById(C_User, mainId, `{"o_member_jy":1}`)
+			}
+		}
+	} else {
+		o_mb, ok = Mgo.FindById(C_Entniche_Rule, userId, `{"o_member_jy":1,"s_member_mainid":1,"i_member_sub_status":1}`)
+		query := map[string]interface{}{
+			"i_userid": qutil.Int64All(r.GetSession("entUserId")),
+			"i_entid":  qutil.Int64All(r.GetSession("entId")),
+			"i_type":   1,
+		}
+		o_mb, ok = Mgo.FindOne(C_User, query)
+		if (*o_mb) != nil && (*o_mb)["o_member_jy"] != nil {
+			(*o_mb)["o_member_jy"] = (*o_mb)["o_entniche"]
+		}
+	}
+
+	if ok && o_mb != nil {
+		o_member_jy, _ := (*o_mb)["o_member_jy"].(map[string]interface{})
+		if o_member_jy["a_infotype"] != nil || o_member_jy["o_area"] != nil || o_member_jy["a_buyerclass"] != nil {
+			result["subscribe"] = true
+		} else {
+			a_items, _ := o_member_jy["a_items"].([]interface{})
+		L:
+			for _, a_item := range a_items {
+				itemMap, _ := a_item.(map[string]interface{})
+				a_keys, _ := itemMap["a_key"].([]interface{})
+				for _, a_key := range a_keys {
+					keyMap, _ := a_key.(map[string]interface{})
+					keys, _ := keyMap["key"].([]interface{})
+					for _, key := range keys {
+						if strings.TrimSpace(qutil.ObjToString(key)) != "" {
+							result["subscribe"] = true
+							break L
+						}
+					}
+				}
+			}
+		}
+	}
+	r.ServeJson(Result{
+		Data: result,
+	})
 }
 func (r *Report) Detail() {
-        if !R.CheckReqParam(r.ResponseWriter, r.Request, "start", "end") {
-                return
-        }
-        start, _ := r.GetInt("start")
-        end, _ := r.GetInt("end")
-        var m M
-        userId, qk, qv := getQuery(r.Session())
-        if qk == "" || qv == nil {
-                return
-        }
-        coll, coll_winner := getColl(r.Header("referer"), r.GetString("type"))
-        // userId, _, _ = MainUserId(userId, "", 0)
-        if end-start == 518400 { //周
-                m = weekResult(qk, qv, start, end, coll, coll_winner)
-        } else if 518400 < end-start && end-start <= 2592000 { //月
-                m = monthResult(userId, qk, qv, start, end, coll, coll_winner)
-        } else {
-                R.InvalidReqParam(r.ResponseWriter, r.Request, "start", "end")
-                return
-        }
-        go Mgo.Update(coll, map[string]interface{}{
-                qk:          qv,
-                "startdate": start,
-                "enddate":   end,
-        }, map[string]interface{}{
-                "$set": map[string]interface{}{
-                        "unread": 0,
-                },
-        }, false, true)
-        r.ServeJson(Result{
-                Data: m,
-        })
+	if !R.CheckReqParam(r.ResponseWriter, r.Request, "start", "end") {
+		return
+	}
+	start, _ := r.GetInt("start")
+	end, _ := r.GetInt("end")
+	var m M
+	userId, qk, qv := getQuery(r.Session())
+	if qk == "" || qv == nil {
+		return
+	}
+	coll, coll_winner := getColl(r.Header("referer"), r.GetString("type"))
+	// userId, _, _ = MainUserId(userId, "", 0)
+	if end-start == 518400 { //周
+		m = weekResult(qk, qv, start, end, coll, coll_winner)
+	} else if 518400 < end-start && end-start <= 2592000 { //月
+		m = monthResult(userId, qk, qv, start, end, coll, coll_winner)
+	} else {
+		R.InvalidReqParam(r.ResponseWriter, r.Request, "start", "end")
+		return
+	}
+	go Mgo.Update(coll, map[string]interface{}{
+		qk:          qv,
+		"startdate": start,
+		"enddate":   end,
+	}, map[string]interface{}{
+		"$set": map[string]interface{}{
+			"unread": 0,
+		},
+	}, false, true)
+	r.ServeJson(Result{
+		Data: m,
+	})
 }
 
 //周报
 func weekResult(qk string, qv interface{}, start, end int64, coll, coll_winner string) M {
-        prevWeekStartDate := start - 7*oneday
-        list, ok := Mgo.Find(coll, map[string]interface{}{
-                qk: qv,
-                "startdate": map[string]interface{}{
-                        "$gte": prevWeekStartDate,
-                },
-                "enddate": map[string]interface{}{
-                        "$lte": end,
-                },
-                "type": 2,
-        }, `{"startdate":1}`, `{"startdate":1,"type":1,"item":1,"bidamount":1,"budget":1,"zhao_matchitem":1,"zhong_matchitem":1,"follow_project":1,"follow_ent":1,"nextweek_bidopen":1,"project_amount":1}`, false, 0, 2)
-        result := M{}
-        prevWeek := map[string]interface{}{}
-        if ok && list != nil {
-                for _, v := range *list {
-                        if qutil.Int64All(v["startdate"]) == prevWeekStartDate {
-                                prevWeek = v
-                                continue
-                        }
-                        //订阅关键词组
-                        result["item"] = v["item"]
-                        //本周新增招标项目数量
-                        result["zhao_matchitem"] = v["zhao_matchitem"]
-                        //本周新增开标项目数量
-                        result["zhong_matchitem"] = v["zhong_matchitem"]
-                        //重点关注项目
-                        result["follow_project"] = v["follow_project"]
-                        //重点关注企业
-                        result["follow_ent"] = v["follow_ent"]
-                        //下周开标提醒
-                        result["nextweek_bidopen"] = v["nextweek_bidopen"]
-                        //项目金额排行榜
-                        result["project_amount"] = v["project_amount"]
-                        //本周新增招标项目预算
-                        result["budget"] = matchitemGrowthRateHandle(prevWeek, v, "budget", "budget")
-                        //本周新增招标项目规模
-                        result["bidamount"] = matchitemGrowthRateHandle(prevWeek, v, "bidamount", "bidamount")
-                }
-        }
-        return result
+	prevWeekStartDate := start - 7*oneday
+	list, ok := Mgo.Find(coll, map[string]interface{}{
+		qk: qv,
+		"startdate": map[string]interface{}{
+			"$gte": prevWeekStartDate,
+		},
+		"enddate": map[string]interface{}{
+			"$lte": end,
+		},
+		"type": 2,
+	}, `{"startdate":1}`, `{"startdate":1,"type":1,"item":1,"bidamount":1,"budget":1,"zhao_matchitem":1,"zhong_matchitem":1,"follow_project":1,"follow_ent":1,"nextweek_bidopen":1,"project_amount":1}`, false, 0, 2)
+	result := M{}
+	prevWeek := map[string]interface{}{}
+	if ok && list != nil {
+		for _, v := range *list {
+			if qutil.Int64All(v["startdate"]) == prevWeekStartDate {
+				prevWeek = v
+				continue
+			}
+			//订阅关键词组
+			result["item"] = v["item"]
+			//本周新增招标项目数量
+			result["zhao_matchitem"] = v["zhao_matchitem"]
+			//本周新增开标项目数量
+			result["zhong_matchitem"] = v["zhong_matchitem"]
+			//重点关注项目
+			result["follow_project"] = v["follow_project"]
+			//重点关注企业
+			result["follow_ent"] = v["follow_ent"]
+			//下周开标提醒
+			result["nextweek_bidopen"] = v["nextweek_bidopen"]
+			//项目金额排行榜
+			result["project_amount"] = v["project_amount"]
+			//本周新增招标项目预算
+			result["budget"] = matchitemGrowthRateHandle(prevWeek, v, "budget", "budget")
+			//本周新增招标项目规模
+			result["bidamount"] = matchitemGrowthRateHandle(prevWeek, v, "bidamount", "bidamount")
+		}
+	}
+	return result
 }
 
 //月报
 func monthResult(userId, qk string, qv interface{}, start, end int64, coll, coll_winner string) M {
-        result := M{}
-        //最近6个月
-        fiveMonthStart := time.Unix(start, 0).AddDate(0, -5, 0).Unix()
-        sixDatas, ok := Mgo.Find(coll, map[string]interface{}{
-                qk:     qv,
-                "type": 3,
-                "startdate": map[string]interface{}{
-                        "$gte": fiveMonthStart,
-                },
-                "enddate": map[string]interface{}{
-                        "$lte": end,
-                },
-        }, `{"startdate":1}`, `{"startdate":1,"item":1,"project_matchitem_count":1,"project_matchitem_bidamount":1,"project_count":1,"project_bidamount_count":1,"project_area_count":1,"project_area_bidamount":1,"project_buyerclass_count":1,"project_buyerclass_bidamount":1,"project_buyerclass_average_bidamount":1,"winner_area":1,"buyer":1,"winner":1,"project_bidamount":1}`, false, -1, -1)
-        if ok && sixDatas != nil {
-                project_count := &BarCharts{
-                        Keys: map[int64]bool{},
-                }
-                project_bidamount_count := &BarCharts{
-                        Keys: map[int64]bool{},
-                }
-                earliest := map[string]interface{}{}
-                for _, v := range *sixDatas {
-                        startdate := qutil.Int64All(v["startdate"])
-                        if startdate == fiveMonthStart { //上个月
-                                earliest = v
-                                continue
-                        } else if startdate == start { //本月
-                                //订阅关键词组
-                                result["item"] = v["item"]
-                                //本月项目规模
-                                result["project_matchitem_count"] = v["project_matchitem_count"]
-                                //本月项目规模
-                                result["project_matchitem_bidamount"] = matchitemGrowthRateHandle(earliest, v, "project_matchitem_bidamount", "bidamount")
-                                //本月项目数量分布
-                                result["project_area_count"] = v["project_area_count"]
-                                //本月项目规模分布
-                                result["project_area_bidamount"] = v["project_area_bidamount"]
-                                //本月项目数量TOP10采购行业
-                                result["project_buyerclass_count"] = v["project_buyerclass_count"]
-                                //本月项目规模TOP10采购行业
-                                result["project_buyerclass_bidamount"] = v["project_buyerclass_bidamount"]
-                                //本月项目平均规模TOP10采购行业
-                                result["project_buyerclass_average_bidamount"] = v["project_buyerclass_average_bidamount"]
-                                //本月中标企业注册地分布
-                                result["winner_area"] = v["winner_area"]
-                                //本月采购单位排行榜
-                                result["buyer"] = v["buyer"]
-                                //本月中标企业排行榜
-                                result["winner"] = v["winner"]
-                                //本月项目规模排行榜
-                                result["project_bidamount"] = v["project_bidamount"]
-                                //
-                                result["winner_capital"] = v["winner_capital"]
-                                //本月中标企业中标项目数量分布
-                                result["winner_project"] = v["winner_project"]
-                        }
-                        project_count.Keys[startdate] = true
-                        project_count.List = append(project_count.List, &BarChart{
-                                Key:   startdate,
-                                Value: qutil.IntAll(v["project_count"]),
-                        })
-                        project_bidamount_count.Keys[startdate] = true
-                        project_bidamount_count.List = append(project_bidamount_count.List, &BarChart{
-                                Key:   startdate,
-                                Value: qutil.IntAll(v["project_bidamount_count"]),
-                        })
-                }
-                //项目数量
-                result["project_count"] = formatMonths(fiveMonthStart, start, project_count, earliest["project_count"]).List
-                //项目规模
-                result["project_bidamount_count"] = formatMonths(fiveMonthStart, start, project_bidamount_count, earliest["project_bidamount_count"]).List
-        }
-        if result["winner_capital"] == nil || result["winner_project"] == nil {
-                sess := Mgo_Log.GetMgoConn()
-                defer Mgo_Log.DestoryMongoConn(sess)
-                it := sess.DB("push").C(coll_winner).Find(map[string]interface{}{
-                        "userid": userId,
-                        "type":   3,
-                        "startdate": map[string]interface{}{
-                                "$gte": start,
-                        },
-                        "enddate": map[string]interface{}{
-                                "$lte": end,
-                        },
-                }).Select(map[string]interface{}{
-                        "capital":       1,
-                        "project_count": 1,
-                }).Iter()
-                winner_capital_map := map[string]int{}
-                winner_project_length := 5
-                winner_project := make([]map[string]interface{}, winner_project_length)
-                for i := 0; i < winner_project_length; i++ {
-                        projectcount := fmt.Sprint(i + 1)
-                        if i == winner_project_length-1 {
-                                projectcount = fmt.Sprintf("%d-%d", winner_project_length, winner_project_length+1)
-                        }
-                        winner_project[i] = map[string]interface{}{
-                                "projectcount": projectcount,
-                                "entcount":     0,
-                                "proportion":   float64(0),
-                        }
-                }
-                var count float64
-                for m := make(map[string]interface{}); it.Next(&m); {
-                        if scope := getEntCapitalScopt(qutil.Float64All(m["capital"])); scope != "" {
-                                winner_capital_map[scope] = winner_capital_map[scope] + 1
-                        }
-                        project_count := qutil.IntAll(m["project_count"])
-                        if project_count > 0 && project_count <= winner_project_length+1 {
-                                count++
-                                if project_count >= winner_project_length {
-                                        winner_project[winner_project_length-1]["entcount"] = winner_project[winner_project_length-1]["entcount"].(int) + 1
-                                } else {
-                                        winner_project[project_count-1]["entcount"] = winner_project[project_count-1]["entcount"].(int) + 1
-                                }
-                        }
-                        m = make(map[string]interface{})
-                }
-                if count > 0 {
-                        for k, v := range winner_project {
-                                v["proportion"] = qutil.RetainDecimal(float64(v["entcount"].(int))/count*100, 2)
-                                for i := 0; i < k; i++ {
-                                        v["proportion"] = qutil.RetainDecimal(v["proportion"].(float64)+(float64(winner_project[i]["entcount"].(int))/count)*100, 2)
-                                }
-                                if v["proportion"].(float64) > 100 {
-                                        v["proportion"] = float64(100)
-                                }
-                                if k == len(winner_project)-1 && v["proportion"].(float64) != 100 {
-                                        v["proportion"] = float64(100)
-                                }
-                        }
-                }
-                //本月中标企业注册资本分布
-                winner_capital_array := []map[string]interface{}{}
-                for _, v := range []string{"0-100万", "100-200万", "200-500万", "500-1000万", "1000-5000万", "5000-10000万", "1-10亿", "10-100亿", "大于100亿"} {
-                        if winner_capital_map[v] == 0 {
-                                continue
-                        }
-                        winner_capital_array = append(winner_capital_array, map[string]interface{}{
-                                "range": v,
-                                "count": winner_capital_map[v],
-                        })
-                }
-                result["winner_capital"] = winner_capital_array
-                //本月中标企业中标项目数量分布
-                result["winner_project"] = winner_project
-        }
-        return result
+	result := M{}
+	//最近6个月
+	fiveMonthStart := time.Unix(start, 0).AddDate(0, -5, 0).Unix()
+	sixDatas, ok := Mgo.Find(coll, map[string]interface{}{
+		qk:     qv,
+		"type": 3,
+		"startdate": map[string]interface{}{
+			"$gte": fiveMonthStart,
+		},
+		"enddate": map[string]interface{}{
+			"$lte": end,
+		},
+	}, `{"startdate":1}`, `{"startdate":1,"item":1,"project_matchitem_count":1,"project_matchitem_bidamount":1,"project_count":1,"project_bidamount_count":1,"project_area_count":1,"project_area_bidamount":1,"project_buyerclass_count":1,"project_buyerclass_bidamount":1,"project_buyerclass_average_bidamount":1,"winner_area":1,"buyer":1,"winner":1,"project_bidamount":1}`, false, -1, -1)
+	if ok && sixDatas != nil {
+		project_count := &BarCharts{
+			Keys: map[int64]bool{},
+		}
+		project_bidamount_count := &BarCharts{
+			Keys: map[int64]bool{},
+		}
+		earliest := map[string]interface{}{}
+		for _, v := range *sixDatas {
+			startdate := qutil.Int64All(v["startdate"])
+			if startdate == fiveMonthStart { //上个月
+				earliest = v
+				continue
+			} else if startdate == start { //本月
+				//订阅关键词组
+				result["item"] = v["item"]
+				//本月项目规模
+				result["project_matchitem_count"] = v["project_matchitem_count"]
+				//本月项目规模
+				result["project_matchitem_bidamount"] = matchitemGrowthRateHandle(earliest, v, "project_matchitem_bidamount", "bidamount")
+				//本月项目数量分布
+				result["project_area_count"] = v["project_area_count"]
+				//本月项目规模分布
+				result["project_area_bidamount"] = v["project_area_bidamount"]
+				//本月项目数量TOP10采购行业
+				result["project_buyerclass_count"] = v["project_buyerclass_count"]
+				//本月项目规模TOP10采购行业
+				result["project_buyerclass_bidamount"] = v["project_buyerclass_bidamount"]
+				//本月项目平均规模TOP10采购行业
+				result["project_buyerclass_average_bidamount"] = v["project_buyerclass_average_bidamount"]
+				//本月中标企业注册地分布
+				result["winner_area"] = v["winner_area"]
+				//本月采购单位排行榜
+				result["buyer"] = v["buyer"]
+				//本月中标企业排行榜
+				result["winner"] = v["winner"]
+				//本月项目规模排行榜
+				result["project_bidamount"] = v["project_bidamount"]
+				//
+				result["winner_capital"] = v["winner_capital"]
+				//本月中标企业中标项目数量分布
+				result["winner_project"] = v["winner_project"]
+			}
+			project_count.Keys[startdate] = true
+			project_count.List = append(project_count.List, &BarChart{
+				Key:   startdate,
+				Value: qutil.IntAll(v["project_count"]),
+			})
+			project_bidamount_count.Keys[startdate] = true
+			project_bidamount_count.List = append(project_bidamount_count.List, &BarChart{
+				Key:   startdate,
+				Value: qutil.IntAll(v["project_bidamount_count"]),
+			})
+		}
+		//项目数量
+		result["project_count"] = formatMonths(fiveMonthStart, start, project_count, earliest["project_count"]).List
+		//项目规模
+		result["project_bidamount_count"] = formatMonths(fiveMonthStart, start, project_bidamount_count, earliest["project_bidamount_count"]).List
+	}
+	if result["winner_capital"] == nil || result["winner_project"] == nil {
+		sess := Mgo_Log.GetMgoConn()
+		defer Mgo_Log.DestoryMongoConn(sess)
+		it := sess.DB("push").C(coll_winner).Find(map[string]interface{}{
+			"userid": userId,
+			"type":   3,
+			"startdate": map[string]interface{}{
+				"$gte": start,
+			},
+			"enddate": map[string]interface{}{
+				"$lte": end,
+			},
+		}).Select(map[string]interface{}{
+			"capital":       1,
+			"project_count": 1,
+		}).Iter()
+		winner_capital_map := map[string]int{}
+		winner_project_length := 5
+		winner_project := make([]map[string]interface{}, winner_project_length)
+		for i := 0; i < winner_project_length; i++ {
+			projectcount := fmt.Sprint(i + 1)
+			if i == winner_project_length-1 {
+				projectcount = fmt.Sprintf("%d-%d", winner_project_length, winner_project_length+1)
+			}
+			winner_project[i] = map[string]interface{}{
+				"projectcount": projectcount,
+				"entcount":     0,
+				"proportion":   float64(0),
+			}
+		}
+		var count float64
+		for m := make(map[string]interface{}); it.Next(&m); {
+			if scope := getEntCapitalScopt(qutil.Float64All(m["capital"])); scope != "" {
+				winner_capital_map[scope] = winner_capital_map[scope] + 1
+			}
+			project_count := qutil.IntAll(m["project_count"])
+			if project_count > 0 && project_count <= winner_project_length+1 {
+				count++
+				if project_count >= winner_project_length {
+					winner_project[winner_project_length-1]["entcount"] = winner_project[winner_project_length-1]["entcount"].(int) + 1
+				} else {
+					winner_project[project_count-1]["entcount"] = winner_project[project_count-1]["entcount"].(int) + 1
+				}
+			}
+			m = make(map[string]interface{})
+		}
+		if count > 0 {
+			for k, v := range winner_project {
+				v["proportion"] = qutil.RetainDecimal(float64(v["entcount"].(int))/count*100, 2)
+				for i := 0; i < k; i++ {
+					v["proportion"] = qutil.RetainDecimal(v["proportion"].(float64)+(float64(winner_project[i]["entcount"].(int))/count)*100, 2)
+				}
+				if v["proportion"].(float64) > 100 {
+					v["proportion"] = float64(100)
+				}
+				if k == len(winner_project)-1 && v["proportion"].(float64) != 100 {
+					v["proportion"] = float64(100)
+				}
+			}
+		}
+		//本月中标企业注册资本分布
+		winner_capital_array := []map[string]interface{}{}
+		for _, v := range []string{"0-100万", "100-200万", "200-500万", "500-1000万", "1000-5000万", "5000-10000万", "1-10亿", "10-100亿", "大于100亿"} {
+			if winner_capital_map[v] == 0 {
+				continue
+			}
+			winner_capital_array = append(winner_capital_array, map[string]interface{}{
+				"range": v,
+				"count": winner_capital_map[v],
+			})
+		}
+		result["winner_capital"] = winner_capital_array
+		//本月中标企业中标项目数量分布
+		result["winner_project"] = winner_project
+	}
+	return result
 }
 
 //处理关键词分组环比增长率
 func matchitemGrowthRateHandle(earliest, curr map[string]interface{}, key1, key2 string) []interface{} {
-        e, _ := earliest[key1].([]interface{})
-        c, _ := curr[key1].([]interface{})
-        m := map[string]float64{}
-        for _, v := range e {
-                vm, _ := v.(map[string]interface{})
-                m[qutil.ObjToString(vm["item"])] = qutil.Float64All(vm[key2])
-        }
-        for _, v := range c {
-                vm, _ := v.(map[string]interface{})
-                vm["growthrate"] = getGrowthRate(qutil.Float64All(vm[key2]), m[qutil.ObjToString(vm["item"])])
-        }
-        return c
+	e, _ := earliest[key1].([]interface{})
+	c, _ := curr[key1].([]interface{})
+	m := map[string]float64{}
+	for _, v := range e {
+		vm, _ := v.(map[string]interface{})
+		m[qutil.ObjToString(vm["item"])] = qutil.Float64All(vm[key2])
+	}
+	for _, v := range c {
+		vm, _ := v.(map[string]interface{})
+		vm["growthrate"] = getGrowthRate(qutil.Float64All(vm[key2]), m[qutil.ObjToString(vm["item"])])
+	}
+	return c
 }
 
 //获取企业注册资本范围
 func getEntCapitalScopt(capital float64) string {
-        if 0 <= capital && capital < 100 {
-                return "0-100万"
-        } else if 100 <= capital && capital < 200 {
-                return "100-200万"
-        } else if 200 <= capital && capital < 500 {
-                return "200-500万"
-        } else if 500 <= capital && capital < 1000 {
-                return "500-1000万"
-        } else if 1000 <= capital && capital < 5000 {
-                return "1000-5000万"
-        } else if 5000 <= capital && capital < 10000 {
-                return "5000-10000万"
-        } else if 10000 <= capital && capital < 100000 {
-                return "1-10亿"
-        } else if 100000 <= capital && capital < 1000000 {
-                return "10-100亿"
-        } else if 1000000 <= capital {
-                return "大于100亿"
-        } else {
-                return ""
-        }
+	if 0 <= capital && capital < 100 {
+		return "0-100万"
+	} else if 100 <= capital && capital < 200 {
+		return "100-200万"
+	} else if 200 <= capital && capital < 500 {
+		return "200-500万"
+	} else if 500 <= capital && capital < 1000 {
+		return "500-1000万"
+	} else if 1000 <= capital && capital < 5000 {
+		return "1000-5000万"
+	} else if 5000 <= capital && capital < 10000 {
+		return "5000-10000万"
+	} else if 10000 <= capital && capital < 100000 {
+		return "1-10亿"
+	} else if 100000 <= capital && capital < 1000000 {
+		return "10-100亿"
+	} else if 1000000 <= capital {
+		return "大于100亿"
+	} else {
+		return ""
+	}
 }
 
 //
 func formatMonths(start, end int64, bcs *BarCharts, pv interface{}) *BarCharts {
-        if len(bcs.List) == 0 {
-                return bcs
-        }
-        date := time.Unix(end, 0)
-        for i := 0; i < 6; i++ {
-                date = date.AddDate(0, -1, 0)
-                if date.Unix() < start {
-                        break
-                } else if bcs.Keys[date.Unix()] {
-                        continue
-                }
-                bcs.List = append(bcs.List, &BarChart{
-                        Value: 0,
-                        Key:   date.Unix(),
-                })
-        }
-        sort.Sort(bcs)
-        for k, v := range bcs.List {
-                if k == 0 {
-                        v.GrowthRate = getGrowthRate(qutil.Float64All(v.Value), qutil.Float64All(pv))
-                } else {
-                        v.GrowthRate = getGrowthRate(qutil.Float64All(v.Value), qutil.Float64All(bcs.List[k-1].Value))
-                }
-        }
-        return bcs
+	if len(bcs.List) == 0 {
+		return bcs
+	}
+	date := time.Unix(end, 0)
+	for i := 0; i < 6; i++ {
+		date = date.AddDate(0, -1, 0)
+		if date.Unix() < start {
+			break
+		} else if bcs.Keys[date.Unix()] {
+			continue
+		}
+		bcs.List = append(bcs.List, &BarChart{
+			Value: 0,
+			Key:   date.Unix(),
+		})
+	}
+	sort.Sort(bcs)
+	for k, v := range bcs.List {
+		if k == 0 {
+			v.GrowthRate = getGrowthRate(qutil.Float64All(v.Value), qutil.Float64All(pv))
+		} else {
+			v.GrowthRate = getGrowthRate(qutil.Float64All(v.Value), qutil.Float64All(bcs.List[k-1].Value))
+		}
+	}
+	return bcs
 }
 
 //环比增长率
 func getGrowthRate(v1, v2 float64) float64 {
-        if v2 == 0 {
-                return 0
-        }
-        return qutil.RetainDecimal((v1-v2)/v2*100, 2)
+	if v2 == 0 {
+		return 0
+	}
+	return qutil.RetainDecimal((v1-v2)/v2*100, 2)
 }
 
 //
 func (r *Report) Tip() {
-        _, qk, qv := getQuery(r.Session())
-        if qk == "" || qv == nil {
-                return
-        }
-        unread := Mgo.Count(pushspace_member_statistic, map[string]interface{}{
-                qk:       qv,
-                "unread": 1,
-        })
-        list, ok := Mgo.Find(pushspace_member_statistic, map[string]interface{}{
-                qk:    qv,
-                "tip": 1,
-        }, `{"enddate":-1}`, `{"_id":0,"type":1,"startdate":1,"enddate":1,"pushcount":1}`, false, 0, 1)
-        result := map[string]interface{}{
-                "unread": unread,
-        }
-        if ok && list != nil && len(*list) == 1 {
-                result["tip"] = (*list)[0]
-        }
-        r.ServeJson(result)
+	_, qk, qv := getQuery(r.Session())
+	if qk == "" || qv == nil {
+		return
+	}
+	unread := Mgo.Count(pushspace_member_statistic, map[string]interface{}{
+		qk:       qv,
+		"unread": 1,
+	})
+	list, ok := Mgo.Find(pushspace_member_statistic, map[string]interface{}{
+		qk:    qv,
+		"tip": 1,
+	}, `{"enddate":-1}`, `{"_id":0,"type":1,"startdate":1,"enddate":1,"pushcount":1}`, false, 0, 1)
+	result := map[string]interface{}{
+		"unread": unread,
+	}
+	if ok && list != nil && len(*list) == 1 {
+		result["tip"] = (*list)[0]
+	}
+	r.ServeJson(result)
 }
 func (r *Report) Tipover() {
-        _, qk, qv := getQuery(r.Session())
-        if qk == "" || qv == nil {
-                return
-        }
-        r.ServeJson(map[string]interface{}{"flag": tipover(qk, qv, pushspace_member_statistic)})
+	_, qk, qv := getQuery(r.Session())
+	if qk == "" || qv == nil {
+		return
+	}
+	r.ServeJson(map[string]interface{}{"flag": tipover(qk, qv, pushspace_member_statistic)})
 }
 
 func tipover(qk string, qv interface{}, coll string) bool {
-        return Mgo.Update(coll, map[string]interface{}{
-                qk:    qv,
-                "tip": 1,
-        }, map[string]interface{}{
-                "$set": map[string]interface{}{
-                        "tip": 0,
-                },
-        }, false, true)
+	return Mgo.Update(coll, map[string]interface{}{
+		qk:    qv,
+		"tip": 1,
+	}, map[string]interface{}{
+		"$set": map[string]interface{}{
+			"tip": 0,
+		},
+	}, false, true)
 }
 func (r *Report) Openpushmsg() error {
-        userId, qk, qv := getQuery(r.Session())
-        pushcount, _ := r.GetInteger("pushcount")
-        positionType := qutil.Int64All(r.GetSession("positionType "))
-        start, _ := r.GetInt("start")
-        end, _ := r.GetInt("end")
-        tp := "month"
-        if end-start == 518400 {
-                tp = "week"
-        }
-        if r.GetString("t") == "wx_experience" {
-                if !isFree(userId, positionType, r.Session()) {
-                        return r.Redirect("/swordfish/about?advertcode=" + r.GetString("advertcode"))
-                }
-                go tipover(qk, qv, pushspace_experience_member_statistic)
-                return r.Redirect(fmt.Sprintf("/big/wx/page/report_detail_%s?t=wx_experience&f=push&type=free&start=%d&end=%d&pushcount=%d&advertcode=%s", tp, start, end, pushcount, r.GetString("advertcode")))
-        } else if r.GetString("t") == "app_experience" {
-                if !isFree(userId, positionType, r.Session()) {
-                        return r.Redirect("/jyapp/free/swordfish/about")
-                }
-                go tipover(qk, qv, pushspace_experience_member_statistic)
-                return r.Redirect(fmt.Sprintf("/jyapp/big/page/report_detail_%s?t=app_experience&f=push&type=free&start=%d&end=%d&pushcount=%d", tp, start, end, pushcount))
-        } else {
-                go tipover(qk, qv, pushspace_member_statistic)
-                //return r.Redirect(fmt.Sprintf("/jyapp/big/page/bigvip_subreport_%s?f=push&start=%d&end=%d&pushcount=%d", tp, start, end, pushcount))
-                return r.Redirect(fmt.Sprintf("/vipreport/page/subreport.html?f=push&type=member&start=%d&end=%d&advertcode=%s", start, end, r.GetString("advertcode")))
-        }
+	userId, qk, qv := getQuery(r.Session())
+	pushcount, _ := r.GetInteger("pushcount")
+	positionType := qutil.Int64All(r.GetSession("positionType "))
+	start, _ := r.GetInt("start")
+	end, _ := r.GetInt("end")
+	tp := "month"
+	if end-start == 518400 {
+		tp = "week"
+	}
+	if r.GetString("t") == "wx_experience" {
+		if !isFree(userId, positionType, r.Session()) {
+			return r.Redirect("/swordfish/about?advertcode=" + r.GetString("advertcode"))
+		}
+		go tipover(qk, qv, pushspace_experience_member_statistic)
+		return r.Redirect(fmt.Sprintf("/big/wx/page/report_detail_%s?t=wx_experience&f=push&type=free&start=%d&end=%d&pushcount=%d&advertcode=%s", tp, start, end, pushcount, r.GetString("advertcode")))
+	} else if r.GetString("t") == "app_experience" {
+		if !isFree(userId, positionType, r.Session()) {
+			return r.Redirect("/jyapp/free/swordfish/about")
+		}
+		go tipover(qk, qv, pushspace_experience_member_statistic)
+		return r.Redirect(fmt.Sprintf("/jyapp/big/page/report_detail_%s?t=app_experience&f=push&type=free&start=%d&end=%d&pushcount=%d", tp, start, end, pushcount))
+	} else {
+		go tipover(qk, qv, pushspace_member_statistic)
+		//return r.Redirect(fmt.Sprintf("/jyapp/big/page/bigvip_subreport_%s?f=push&start=%d&end=%d&pushcount=%d", tp, start, end, pushcount))
+		return r.Redirect(fmt.Sprintf("/vipreport/page/subreport.html?f=push&type=member&start=%d&end=%d&advertcode=%s", start, end, r.GetString("advertcode")))
+	}
 }
 
 func (r *Report) Starttime() {
-        _, qk, qv := getQuery(r.Session())
-        if qk == "" || qv == nil {
-                return
-        }
-        week_start, month_start := 0, 0
-        week_list, _ := Mgo.Find(pushspace_member_statistic, map[string]interface{}{
-                qk:     qv,
-                "type": 2,
-        }, `{"enddate":1}`, `{"enddate":1,"dateym":1}`, false, 0, 1)
-        if week_list != nil && len(*week_list) == 1 {
-                enddate := qutil.Int64All((*week_list)[0]["enddate"])
-                if time.Now().After(time.Unix(enddate, 0).AddDate(0, 0, 1)) {
-                        week_start = qutil.IntAll((*week_list)[0]["dateym"])
-                }
-        }
-        //
-        month_list, _ := Mgo.Find(pushspace_member_statistic, map[string]interface{}{
-                qk:     qv,
-                "type": 3,
-        }, `{"enddate":1}`, `{"enddate":1,"dateym":1}`, false, 0, 1)
-        if month_list != nil && len(*month_list) == 1 {
-                enddate := qutil.Int64All((*month_list)[0]["enddate"])
-                if time.Now().After(time.Unix(enddate, 0).AddDate(0, 0, 1)) {
-                        month_start = qutil.IntAll((*month_list)[0]["dateym"])
-                }
-        }
-        r.ServeJson(Result{
-                Data: M{
-                        "week_firsttime":  week_start,
-                        "month_firsttime": month_start,
-                },
-        })
+	_, qk, qv := getQuery(r.Session())
+	if qk == "" || qv == nil {
+		return
+	}
+	week_start, month_start := 0, 0
+	week_list, _ := Mgo.Find(pushspace_member_statistic, map[string]interface{}{
+		qk:     qv,
+		"type": 2,
+	}, `{"enddate":1}`, `{"enddate":1,"dateym":1}`, false, 0, 1)
+	if week_list != nil && len(*week_list) == 1 {
+		enddate := qutil.Int64All((*week_list)[0]["enddate"])
+		if time.Now().After(time.Unix(enddate, 0).AddDate(0, 0, 1)) {
+			week_start = qutil.IntAll((*week_list)[0]["dateym"])
+		}
+	}
+	//
+	month_list, _ := Mgo.Find(pushspace_member_statistic, map[string]interface{}{
+		qk:     qv,
+		"type": 3,
+	}, `{"enddate":1}`, `{"enddate":1,"dateym":1}`, false, 0, 1)
+	if month_list != nil && len(*month_list) == 1 {
+		enddate := qutil.Int64All((*month_list)[0]["enddate"])
+		if time.Now().After(time.Unix(enddate, 0).AddDate(0, 0, 1)) {
+			month_start = qutil.IntAll((*month_list)[0]["dateym"])
+		}
+	}
+	r.ServeJson(Result{
+		Data: M{
+			"week_firsttime":  week_start,
+			"month_firsttime": month_start,
+		},
+	})
 }
 
 //
 func getColl(referer, t string) (string, string) {
-        if t == "free" || strings.Contains(referer, "t=wx_experience") || strings.Contains(referer, "t=app_experience") {
-                return pushspace_experience_member_statistic, pushspace_experience_member_statistic_winner
-        } else {
-                return pushspace_member_statistic, pushspace_member_statistic_winner
-        }
+	if t == "free" || strings.Contains(referer, "t=wx_experience") || strings.Contains(referer, "t=app_experience") {
+		return pushspace_experience_member_statistic, pushspace_experience_member_statistic_winner
+	} else {
+		return pushspace_member_statistic, pushspace_member_statistic_winner
+	}
 }
 func isFree(userId string, positionType int64, session *httpsession.Session) bool {
-        bigVipBaseMsg := jy.GetBigVipUserBaseMsg("10000", session, config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-        if bigVipBaseMsg == nil {
-                return true
-        } else if bigVipBaseMsg.Data.Vip.Status <= 0 && bigVipBaseMsg.Data.Member.Status <= 0 {
-                return true
-        }
-        return false
+	bigVipBaseMsg := jy.GetBigVipUserBaseMsg("10000", session, config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	if bigVipBaseMsg == nil {
+		return true
+	} else if bigVipBaseMsg.Data.Vip.Status <= 0 && bigVipBaseMsg.Data.Member.Status <= 0 {
+		return true
+	}
+	return false
 }
 
 //
 func getQuery(sess *httpsession.Session) (string, string, interface{}) {
-        sessMap := sess.GetMultiple()
-        userId := qutil.ObjToString(sessMap["userId"])
-        user, ok := Mgo.FindById(C_User, userId, `{"s_phone":1,"s_m_phone":1}`)
-        if !ok || user == nil {
-                return "", "", nil
-        }
-        phone := qutil.ObjToString((*user)["s_phone"])
-        if phone == "" {
-                phone = qutil.ObjToString((*user)["s_m_phone"])
-        }
-        if Mysql.CountBySql(`SELECT count(1) as count from entniche_user a
+	sessMap := sess.GetMultiple()
+	userId := qutil.ObjToString(sessMap["userId"])
+	user, ok := Mgo.FindById(C_User, userId, `{"s_phone":1,"s_m_phone":1}`)
+	if !ok || user == nil {
+		return "", "", nil
+	}
+	phone := qutil.ObjToString((*user)["s_phone"])
+	if phone == "" {
+		phone = qutil.ObjToString((*user)["s_m_phone"])
+	}
+	if Mysql.CountBySql(`SELECT count(1) as count from entniche_user a
 		inner join entniche_power b on (a.phone=? and b.status=1 and a.id=b.ent_user_id)
 		inner join entniche_wait_empower c on (c.end_time>? and (c.product_type like '%VIP订阅%' or c.product_type like '%大会员%') and b.wait_empower_id=c.id)`, phone, NowFormat(Date_Full_Layout)) > 0 {
-                return userId, "ent_userid", qutil.IntAll(sessMap["entUserId"])
-        } else {
-                return userId, "userid", userId
-        }
+		return userId, "ent_userid", qutil.IntAll(sessMap["entUserId"])
+	} else {
+		return userId, "userid", userId
+	}
 }

+ 371 - 372
src/jfw/modules/bigmember/src/service/subscribe/subscribe.go

@@ -1,384 +1,383 @@
 package subscribe
 
 import (
-        . "app.yhyue.com/moapp/jybase/api"
-        qutil "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/mongodb"
-        "app.yhyue.com/moapp/jybase/redis"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "encoding/json"
-        "fmt"
-        "jy/src/jfw/modules/bigmember/src/config"
-        "jy/src/jfw/modules/bigmember/src/db"
-        "jy/src/jfw/modules/bigmember/src/util"
-        "log"
-        "sort"
-        "strings"
-        "time"
+	. "app.yhyue.com/moapp/jybase/api"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/bigmember/src/config"
+	"jy/src/jfw/modules/bigmember/src/db"
+	"jy/src/jfw/modules/bigmember/src/util"
+	"log"
+	"sort"
+	"strings"
+	"time"
 
-        "go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson"
 
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 type Subscribe struct {
-        *xweb.Action
-        key_update           xweb.Mapper `xweb:"/subscribe/key/update"`           //修改关键词
-        area_update          xweb.Mapper `xweb:"/subscribe/area/update"`          //修改地区
-        infotype_update      xweb.Mapper `xweb:"/subscribe/infotype/update"`      //修改信息类型
-        buyerclass_update    xweb.Mapper `xweb:"/subscribe/buyerclass/update"`    //修改采购单位行业
-        projectmatch_update  xweb.Mapper `xweb:"/subscribe/projectmatch/update"`  //修改项目匹配
-        otherbuyclass_update xweb.Mapper `xweb:"/subscribe/otherbuyclass/update"` //修改"其他"采购单位按钮
-        matchtype_update     xweb.Mapper `xweb:"/subscribe/matchtype/update"`     //修改"其他"采购单位按钮
-        getPushView          xweb.Mapper `xweb:"/subscribe/getPushView"`          //推送预览
-        list                 xweb.Mapper `xweb:"/subscribe/push/list"`            //推送列表
-        visit                xweb.Mapper `xweb:"/subscribe/push/visit"`           //推送记录访问接口
+	*xweb.Action
+	key_update           xweb.Mapper `xweb:"/subscribe/key/update"`           //修改关键词
+	area_update          xweb.Mapper `xweb:"/subscribe/area/update"`          //修改地区
+	infotype_update      xweb.Mapper `xweb:"/subscribe/infotype/update"`      //修改信息类型
+	buyerclass_update    xweb.Mapper `xweb:"/subscribe/buyerclass/update"`    //修改采购单位行业
+	projectmatch_update  xweb.Mapper `xweb:"/subscribe/projectmatch/update"`  //修改项目匹配
+	otherbuyclass_update xweb.Mapper `xweb:"/subscribe/otherbuyclass/update"` //修改"其他"采购单位按钮
+	matchtype_update     xweb.Mapper `xweb:"/subscribe/matchtype/update"`     //修改"其他"采购单位按钮
+	getPushView          xweb.Mapper `xweb:"/subscribe/getPushView"`          //推送预览
+	list                 xweb.Mapper `xweb:"/subscribe/push/list"`            //推送列表
+	visit                xweb.Mapper `xweb:"/subscribe/push/visit"`           //推送记录访问接口
 
-        freeUserSubscribe xweb.Mapper `xweb:"/subscribe/freeUser/searchSubscribe"` //免费用户搜索订阅
-        subscribeSearch   xweb.Mapper `xweb:"/subscribe/freeUser/subscribeSearch"` //免费用户订阅搜索词设置
+	freeUserSubscribe xweb.Mapper `xweb:"/subscribe/freeUser/searchSubscribe"` //免费用户搜索订阅
+	subscribeSearch   xweb.Mapper `xweb:"/subscribe/freeUser/subscribeSearch"` //免费用户订阅搜索词设置
 }
 
 func (s *Subscribe) FreeUserSubscribe() {
-        //isVip, isMember 付费用户 isEntNiche, isEntNicheNew 商机管理用户 iPpStatus 非省份订阅包 promptBool 是否今日已提醒 areaConfig 区域配置
-        var isVip, isMember, isEntNiche, isEntNicheNew, iPpStatus, searchPrompt, promptBool, isAreaConfig bool
-        userId := s.GetSession("userId").(string)
-        if userId == "" {
-                fmt.Println("用户未登录,搜索词不进行校验")
-                s.ServeJson(Result{Data: M{"prompt": false, "areaSet": false, "freeArea": false}})
-                return
-        }
-        t := time.Now()
-        redisKey := fmt.Sprintf("%d_%s_%d_freeSubscription_%s", t.Year(), t.Month(), t.Day(), userId)
-        bigMsg := jy.GetBigVipUserBaseMsg("10000", s.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-        /*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*/
+	//isVip, isMember 付费用户 isEntNiche, isEntNicheNew 商机管理用户 iPpStatus 非省份订阅包 promptBool 是否今日已提醒 areaConfig 区域配置
+	var isVip, isMember, isEntNiche, isEntNicheNew, iPpStatus, searchPrompt, promptBool, isAreaConfig bool
+	userId := s.GetSession("userId").(string)
+	if userId == "" {
+		fmt.Println("用户未登录,搜索词不进行校验")
+		s.ServeJson(Result{Data: M{"prompt": false, "areaSet": false, "freeArea": false}})
+		return
+	}
+	t := time.Now()
+	redisKey := fmt.Sprintf("%d_%s_%d_freeSubscription_%s", t.Year(), t.Month(), t.Day(), userId)
+	bigMsg := jy.GetBigVipUserBaseMsg("10000", s.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	/*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
-        //校验区域设置
-        if v, ok := (*oJy)["o_area"]; ok && v != nil && len(v.(map[string]interface{})) > 0 {
-                isAreaConfig = true
-        }
-        if !isVip && !isAreaConfig {
-                freeArea = false
-        }
-        isMember = bigMsg.Data.Member.Status > 0
-        //后期处理
-        //是否免费用户(免费用户:非省份订阅包、超级订阅、大会员、商机管理用户)
-        /*if phone, _ := qutil.If(qutil.ObjToString((*res)["s_phone"]) != "", qutil.ObjToString((*res)["s_phone"]), qutil.ObjToString((*res)["s_m_phone"])).(string); phone != "" {
-                isEntNiche = db.Mysql.CountBySql(`SELECT count(1) from entniche_user a INNER JOIN entniche_info b on (a.phone=? and a.power=1 and a.ent_id=b.id and b.status>0)`, phone) > 0
-                isEntNicheNew = db.Mysql.CountBySql(`SELECT count(1) from entniche_user a INNER JOIN entniche_info b on (a.phone=? and a.power=1 and a.ent_id=b.id and b.status>0 and b.isNew > 0)`, phone) > 0
-        }*/
-        isEntNiche = bigMsg.EntnicheStatus > 0
-        isEntNicheNew = bigMsg.EntIsNew
-        //非省份订阅包
-        if (*oJy)["i_ppstatus"] != nil && qutil.IntAll((*oJy)["i_ppstatus"]) > 0 {
-                iPpStatus = true
-        }
-        if isVip || isMember || isEntNiche || isEntNicheNew || iPpStatus {
-                goto env
-        }
-        //校验新老用户
-        //if o_jy["i_newfree"] != nil && qutil.IntAll(o_jy["i_newfree"]) > 0 {
-        //	nweOldUser = true
-        //}
+	oJy := jy.GetSubScribeInfo(s.Session(), db.Mgo, "f", "10000")
+	//oJy, _ := (*res)["o_jy"].(map[string]interface{})
+	freeArea := true
+	//校验区域设置
+	if v, ok := (*oJy)["o_area"]; ok && v != nil && len(v.(map[string]interface{})) > 0 {
+		isAreaConfig = true
+	}
+	if !isVip && !isAreaConfig {
+		freeArea = false
+	}
+	isMember = bigMsg.Data.Member.Status > 0
+	//后期处理
+	//是否免费用户(免费用户:非省份订阅包、超级订阅、大会员、商机管理用户)
+	/*if phone, _ := qutil.If(qutil.ObjToString((*res)["s_phone"]) != "", qutil.ObjToString((*res)["s_phone"]), qutil.ObjToString((*res)["s_m_phone"])).(string); phone != "" {
+	        isEntNiche = db.Mysql.CountBySql(`SELECT count(1) from entniche_user a INNER JOIN entniche_info b on (a.phone=? and a.power=1 and a.ent_id=b.id and b.status>0)`, phone) > 0
+	        isEntNicheNew = db.Mysql.CountBySql(`SELECT count(1) from entniche_user a INNER JOIN entniche_info b on (a.phone=? and a.power=1 and a.ent_id=b.id and b.status>0 and b.isNew > 0)`, phone) > 0
+	}*/
+	isEntNiche = bigMsg.EntnicheStatus > 0
+	isEntNicheNew = bigMsg.EntIsNew
+	if (*oJy)["i_ppstatus"] != nil && qutil.IntAll((*oJy)["i_ppstatus"]) > 0 {
+		iPpStatus = true
+	}
+	if isVip || isMember || isEntNiche || isEntNicheNew || iPpStatus {
+		goto env
+	}
+	//校验新老用户
+	//if o_jy["i_newfree"] != nil && qutil.IntAll(o_jy["i_newfree"]) > 0 {
+	//	nweOldUser = true
+	//}
 
-        //是否有关键词
-        if (*oJy)["a_key"] != nil && len((*oJy)["a_key"].([]interface{})) > 0 {
-                goto env
-        }
-        //是否勾选不在提示
-        if v, ok := (*oJy)["l_search_prompt"]; ok && v != nil && v.(bool) {
-                goto env
-        }
-        //今天是否提示过
-        if searchPrompt, _ = redis.Exists("other", redisKey); !searchPrompt {
-                promptBool = true
-                redis.Put("other", redisKey, 1, 24*60*60)
-        }
+	//是否有关键词
+	if (*oJy)["a_key"] != nil && len((*oJy)["a_key"].([]interface{})) > 0 {
+		goto env
+	}
+	//是否勾选不在提示
+	if v, ok := (*oJy)["l_search_prompt"]; ok && v != nil && v.(bool) {
+		goto env
+	}
+	//今天是否提示过
+	if searchPrompt, _ = redis.Exists("other", redisKey); !searchPrompt {
+		promptBool = true
+		redis.Put("other", redisKey, 1, 24*60*60)
+	}
 env:
-        s.ServeJson(Result{Data: M{"prompt": promptBool, "areaSet": !isAreaConfig, "freeArea": freeArea}})
+	s.ServeJson(Result{Data: M{"prompt": promptBool, "areaSet": !isAreaConfig, "freeArea": freeArea}})
 
 }
 
 func (s *Subscribe) SubscribeSearch() {
-        isNoSubscribe := s.GetString("isNoSubscribe")
-        area := s.GetString("area")
-        subsequentPrompt := s.GetString("subsequentPrompt")
-        key := s.GetString("key")
-        userId := s.GetSession("userId").(string)
-        positionType := qutil.Int64All(s.GetSession("positionType"))
-        if userId == "" {
-                s.ServeJson(Result{Data: nil, Error_msg: "未登录"})
-                return
-        }
-        var search_prompt bool
-        if subsequentPrompt == "Y" {
-                search_prompt = true
-        } else if subsequentPrompt == "N" {
-                search_prompt = false
-        }
+	isNoSubscribe := s.GetString("isNoSubscribe")
+	area := s.GetString("area")
+	subsequentPrompt := s.GetString("subsequentPrompt")
+	key := s.GetString("key")
+	userId := s.GetSession("userId").(string)
+	positionType := qutil.Int64All(s.GetSession("positionType"))
+	if userId == "" {
+		s.ServeJson(Result{Data: nil, Error_msg: "未登录"})
+		return
+	}
+	var search_prompt bool
+	if subsequentPrompt == "Y" {
+		search_prompt = true
+	} else if subsequentPrompt == "N" {
+		search_prompt = false
+	}
 
-        //暂不订阅修改
-        if isNoSubscribe == "N" {
-                aa := false
-                if positionType == 0 {
-                        aa = db.Mgo.UpdateById("user", userId, bson.M{"$set": bson.M{"o_jy.l_search_prompt": search_prompt}})
-                } else {
-                        query := map[string]interface{}{
-                                "i_userid": qutil.Int64All(s.GetSession("entUserId")),
-                                "i_entid":  qutil.Int64All(s.GetSession("entId")),
-                                "i_type":   1,
-                        }
-                        aa = db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{"o_entniche.l_search_prompt": search_prompt}}, true, false)
-                }
-                s.ServeJson(Result{Data: M{"status": aa}})
-                return
-        }
+	//暂不订阅修改
+	if isNoSubscribe == "N" {
+		aa := false
+		if positionType == 0 {
+			aa = db.Mgo.UpdateById("user", userId, bson.M{"$set": bson.M{"o_jy.l_search_prompt": search_prompt}})
+		} else {
+			query := map[string]interface{}{
+				"i_userid": qutil.Int64All(s.GetSession("entUserId")),
+				"i_entid":  qutil.Int64All(s.GetSession("entId")),
+				"i_type":   1,
+			}
+			aa = db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{"o_entniche.l_search_prompt": search_prompt}}, true, false)
+		}
+		s.ServeJson(Result{Data: M{"status": aa}})
+		return
+	}
 
-        //一键订阅修改
-        res := &map[string]interface{}{}
-        oJy := map[string]interface{}{}
-        fType := "o_jy"
-        if positionType == 0 {
-                res, _ = db.Mgo.FindById("user", userId, `{"o_jy":1,"i_ts_guide":1}`)
-                oJy, _ = (*res)["o_jy"].(map[string]interface{})
-        } else {
-                query := map[string]interface{}{
-                        "i_userid": qutil.Int64All(s.GetSession("entUserId")),
-                        "i_entid":  qutil.Int64All(s.GetSession("entId")),
-                        "i_type":   2,
-                }
-                res, _ = db.Mgo.FindOne("entniche_rule", query)
-                oJy, _ = (*res)["o_entniche"].(map[string]interface{})
-                fType = "o_entniche"
-        }
-        //获取原有订阅词
-        aKey, _ := oJy["a_key"].([]interface{})
-        if key != "" {
-                keyData := []string{strings.Replace(key, " ", "", -1)}
-                var aKeys = map[string]interface{}{"key": keyData}
-                aKey = append(aKey, aKeys)
-        }
-        var newFree int
-        if v, ok := oJy["i_newfree"]; ok && v != nil {
-                newFree = qutil.IntAll(v)
-        }
-        //更新新订阅词并升级
-        data := make(map[string]interface{})
-        data[fmt.Sprintf("%s.l_search_prompt", fType)] = search_prompt
-        data[fmt.Sprintf("%s.i_newfree", fType)] = 1
-        data[fmt.Sprintf("%s.a_key", fType)] = aKey
-        if area != "" {
-                data[fmt.Sprintf("%s.o_area", fType)] = map[string]interface{}{
-                        area: []string{},
-                }
-                if v, ok := (*res)["i_ts_guide"]; !ok || qutil.IntAll(v) != 1 {
-                        data["i_ts_guide"] = 1
-                }
-        }
-        UpData := map[string]interface{}{
-                "$set": data,
-        }
-        status := false
-        if positionType == 0 {
-                status = db.Mgo.UpdateById("user", userId, UpData)
-        } else {
-                query := map[string]interface{}{
-                        "i_userid": qutil.Int64All(s.GetSession("entUserId")),
-                        "i_entid":  qutil.Int64All(s.GetSession("entId")),
-                        "i_type":   1,
-                }
-                status = db.Mgo.Update("entniche_rule", query, UpData, true, false)
-        }
-        if status && newFree == 0 {
-                if !redis.Del("other", "bigmember_power_3_"+userId) {
-                        log.Println("redis delete bigmember_power ", userId)
-                }
-        }
-        s.ServeJson(Result{Data: M{"status": status}})
+	//一键订阅修改
+	res := &map[string]interface{}{}
+	oJy := map[string]interface{}{}
+	fType := "o_jy"
+	if positionType == 0 {
+		res, _ = db.Mgo.FindById("user", userId, `{"o_jy":1,"i_ts_guide":1}`)
+		oJy, _ = (*res)["o_jy"].(map[string]interface{})
+	} else {
+		query := map[string]interface{}{
+			"i_userid": qutil.Int64All(s.GetSession("entUserId")),
+			"i_entid":  qutil.Int64All(s.GetSession("entId")),
+			"i_type":   2,
+		}
+		res, _ = db.Mgo.FindOne("entniche_rule", query)
+		oJy, _ = (*res)["o_entniche"].(map[string]interface{})
+		fType = "o_entniche"
+	}
+	//获取原有订阅词
+	aKey, _ := oJy["a_key"].([]interface{})
+	if key != "" {
+		keyData := []string{strings.Replace(key, " ", "", -1)}
+		var aKeys = map[string]interface{}{"key": keyData}
+		aKey = append(aKey, aKeys)
+	}
+	var newFree int
+	if v, ok := oJy["i_newfree"]; ok && v != nil {
+		newFree = qutil.IntAll(v)
+	}
+	//更新新订阅词并升级
+	data := make(map[string]interface{})
+	data[fmt.Sprintf("%s.l_search_prompt", fType)] = search_prompt
+	data[fmt.Sprintf("%s.i_newfree", fType)] = 1
+	data[fmt.Sprintf("%s.a_key", fType)] = aKey
+	if area != "" {
+		data[fmt.Sprintf("%s.o_area", fType)] = map[string]interface{}{
+			area: []string{},
+		}
+		if v, ok := (*res)["i_ts_guide"]; !ok || qutil.IntAll(v) != 1 {
+			data["i_ts_guide"] = 1
+		}
+	}
+	UpData := map[string]interface{}{
+		"$set": data,
+	}
+	status := false
+	if positionType == 0 {
+		status = db.Mgo.UpdateById("user", userId, UpData)
+	} else {
+		query := map[string]interface{}{
+			"i_userid": qutil.Int64All(s.GetSession("entUserId")),
+			"i_entid":  qutil.Int64All(s.GetSession("entId")),
+			"i_type":   1,
+		}
+		status = db.Mgo.Update("entniche_rule", query, UpData, true, false)
+	}
+	if status && newFree == 0 {
+		if !redis.Del("other", "bigmember_power_3_"+userId) {
+			log.Println("redis delete bigmember_power ", userId)
+		}
+	}
+	s.ServeJson(Result{Data: M{"status": status}})
 }
 
 func (s *Subscribe) Key_update() {
-        r := func() Result {
-                keywords := map[string]interface{}{}
-                getkeywords := s.Body()
-                if len(getkeywords) > 0 {
-                        err := json.Unmarshal(getkeywords, &keywords)
-                        if err != nil {
-                                log.Println("Umarshal failed:", err)
-                                return Result{Data: M{"status": -1}, Error_msg: "格式解析失败"}
-                        }
-                        a_items, _ := keywords["a_items"].([]interface{})
-                        real_aitems := []map[string]interface{}{}
-                        if a_items == nil {
-                                return Result{Data: M{"status": -1}, Error_msg: "格式错误"}
-                        }
-                        new_item := []string{} //分类名
-                        new_key := []string{}  //关键词
-                        count := 0             //关键词数量
-                        for _, v := range qutil.ObjArrToMapArr(a_items) {
-                                if v["a_key"] != nil {
-                                        a_key, _ := v["a_key"].([]interface{})
-                                        if len(a_key) == 0 {
-                                                continue //过滤掉错误数据
-                                        }
-                                        for _, vv := range qutil.ObjArrToMapArr(a_key) {
-                                                count++
-                                                key, _ := vv["key"].([]interface{})
-                                                appendArr := qutil.ObjArrToStringArr(key)
-                                                sort.Strings(appendArr)
-                                                new_key = append(new_key, strings.Join(appendArr, "&&"))
-                                        }
-                                } else {
-                                        continue //过滤掉错误数据
-                                }
-                                if v["s_item"] != nil {
-                                        new_item = append(new_item, qutil.ObjToString(v["s_item"]))
-                                }
-                                real_aitems = append(real_aitems, v)
-                        }
-                        if isRepeat(new_item) {
-                                return Result{Data: M{"status": -1}, Error_msg: "分类名重复"}
-                        }
-                        if isRepeat(new_key) {
-                                return Result{Data: M{"status": -1}, Error_msg: "关键词重复"}
-                        }
-                        if count > config.Config.KeyMaxLength {
-                                return Result{Data: M{"status": -1}, Error_msg: "关键词数量超过上限"}
-                        }
-                        if s.UpdateSub("a_items", real_aitems) {
-                                return Result{Data: M{"status": 1}}
-                        }
-                }
-                return Result{Data: M{"status": -1}, Error_msg: "修改失败"}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		keywords := map[string]interface{}{}
+		getkeywords := s.Body()
+		if len(getkeywords) > 0 {
+			err := json.Unmarshal(getkeywords, &keywords)
+			if err != nil {
+				log.Println("Umarshal failed:", err)
+				return Result{Data: M{"status": -1}, Error_msg: "格式解析失败"}
+			}
+			a_items, _ := keywords["a_items"].([]interface{})
+			real_aitems := []map[string]interface{}{}
+			if a_items == nil {
+				return Result{Data: M{"status": -1}, Error_msg: "格式错误"}
+			}
+			new_item := []string{} //分类名
+			new_key := []string{}  //关键词
+			count := 0             //关键词数量
+			for _, v := range qutil.ObjArrToMapArr(a_items) {
+				if v["a_key"] != nil {
+					a_key, _ := v["a_key"].([]interface{})
+					if len(a_key) == 0 {
+						continue //过滤掉错误数据
+					}
+					for _, vv := range qutil.ObjArrToMapArr(a_key) {
+						count++
+						key, _ := vv["key"].([]interface{})
+						appendArr := qutil.ObjArrToStringArr(key)
+						sort.Strings(appendArr)
+						new_key = append(new_key, strings.Join(appendArr, "&&"))
+					}
+				} else {
+					continue //过滤掉错误数据
+				}
+				if v["s_item"] != nil {
+					new_item = append(new_item, qutil.ObjToString(v["s_item"]))
+				}
+				real_aitems = append(real_aitems, v)
+			}
+			if isRepeat(new_item) {
+				return Result{Data: M{"status": -1}, Error_msg: "分类名重复"}
+			}
+			if isRepeat(new_key) {
+				return Result{Data: M{"status": -1}, Error_msg: "关键词重复"}
+			}
+			if count > config.Config.KeyMaxLength {
+				return Result{Data: M{"status": -1}, Error_msg: "关键词数量超过上限"}
+			}
+			if s.UpdateSub("a_items", real_aitems) {
+				return Result{Data: M{"status": 1}}
+			}
+		}
+		return Result{Data: M{"status": -1}, Error_msg: "修改失败"}
+	}()
+	s.ServeJson(r)
 }
 
 //修改地区
 func (s *Subscribe) Area_update() {
-        r := func() Result {
-                area := map[string]interface{}{}
-                getarea := s.Body()
-                if len(getarea) > 0 {
-                        err := json.Unmarshal(getarea, &area)
-                        if err != nil {
-                                log.Println("Umarshal failed:", err)
-                                return Result{Data: M{"status": -1}, Error_msg: "格式解析失败"}
-                        }
-                        if s.UpdateSub("o_area", area) {
-                                return Result{Data: M{"status": 1}}
-                        }
-                }
-                return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		area := map[string]interface{}{}
+		getarea := s.Body()
+		if len(getarea) > 0 {
+			err := json.Unmarshal(getarea, &area)
+			if err != nil {
+				log.Println("Umarshal failed:", err)
+				return Result{Data: M{"status": -1}, Error_msg: "格式解析失败"}
+			}
+			if s.UpdateSub("o_area", area) {
+				return Result{Data: M{"status": 1}}
+			}
+		}
+		return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
+	}()
+	s.ServeJson(r)
 }
 
 //修改信息类型设置
 func (s *Subscribe) Infotype_update() {
-        r := func() Result {
-                infotype_map := map[string]interface{}{}
-                infotype := []string{}
-                getinfotype := s.Body()
-                if len(getinfotype) != 0 {
-                        err := json.Unmarshal(getinfotype, &infotype_map)
-                        if err != nil {
-                                log.Println("Umarshal failed:", err)
-                                return Result{Data: M{"status": -1}, Error_msg: "格式解析错误"}
-                        }
-                        for _, v := range infotype_map {
-                                infotype = qutil.ObjArrToStringArr(v.([]interface{}))
-                        }
-                        if s.UpdateSub("a_infotype", infotype) {
-                                return Result{Data: M{"status": 1}}
-                        }
-                }
-                return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		infotype_map := map[string]interface{}{}
+		infotype := []string{}
+		getinfotype := s.Body()
+		if len(getinfotype) != 0 {
+			err := json.Unmarshal(getinfotype, &infotype_map)
+			if err != nil {
+				log.Println("Umarshal failed:", err)
+				return Result{Data: M{"status": -1}, Error_msg: "格式解析错误"}
+			}
+			for _, v := range infotype_map {
+				infotype = qutil.ObjArrToStringArr(v.([]interface{}))
+			}
+			if s.UpdateSub("a_infotype", infotype) {
+				return Result{Data: M{"status": 1}}
+			}
+		}
+		return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
+	}()
+	s.ServeJson(r)
 }
 
 //修改采购单位行业设置
 func (s *Subscribe) Buyerclass_update() {
-        r := func() Result {
-                buyerclass_map := map[string]interface{}{}
-                buyerclass := []string{}
-                getbuyerclass := s.Body()
-                if len(getbuyerclass) != 0 {
-                        err := json.Unmarshal(getbuyerclass, &buyerclass_map)
-                        if err != nil {
-                                log.Println("Umarshal failed:", err)
-                                return Result{Data: M{"status": -1}, Error_msg: "格式解析错误"}
-                        }
-                        for _, v := range buyerclass_map {
-                                buyerclass = qutil.ObjArrToStringArr(v.([]interface{}))
-                        }
-                        if s.UpdateSub("a_buyerclass", buyerclass) {
-                                return Result{Data: M{"status": 1}}
-                        }
-                }
-                return Result{Data: M{"status": -1}}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		buyerclass_map := map[string]interface{}{}
+		buyerclass := []string{}
+		getbuyerclass := s.Body()
+		if len(getbuyerclass) != 0 {
+			err := json.Unmarshal(getbuyerclass, &buyerclass_map)
+			if err != nil {
+				log.Println("Umarshal failed:", err)
+				return Result{Data: M{"status": -1}, Error_msg: "格式解析错误"}
+			}
+			for _, v := range buyerclass_map {
+				buyerclass = qutil.ObjArrToStringArr(v.([]interface{}))
+			}
+			if s.UpdateSub("a_buyerclass", buyerclass) {
+				return Result{Data: M{"status": 1}}
+			}
+		}
+		return Result{Data: M{"status": -1}}
+	}()
+	s.ServeJson(r)
 }
 
 //修改项目匹配
 func (s *Subscribe) Projectmatch_update() {
-        r := func() Result {
-                projectmatch, _ := s.GetInteger("projectmatch")
-                if s.UpdateSub("i_projectmatch", projectmatch) {
-                        return Result{Data: M{"status": 1}}
-                }
-                return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		projectmatch, _ := s.GetInteger("projectmatch")
+		if s.UpdateSub("i_projectmatch", projectmatch) {
+			return Result{Data: M{"status": 1}}
+		}
+		return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
+	}()
+	s.ServeJson(r)
 }
 
 //修改“其他”采购单位行业
 func (s *Subscribe) Otherbuyclass_update() {
-        r := func() Result {
-                otherbuyclass, _ := s.GetInteger("otherbuyclass")
-                if s.UpdateSub("i_matchbuyerclass_other", otherbuyclass) {
-                        return Result{Data: M{"status": 1}}
-                }
-                return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		otherbuyclass, _ := s.GetInteger("otherbuyclass")
+		if s.UpdateSub("i_matchbuyerclass_other", otherbuyclass) {
+			return Result{Data: M{"status": 1}}
+		}
+		return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
+	}()
+	s.ServeJson(r)
 }
 
 //匹配方式
 func (s *Subscribe) Matchtype_update() {
-        r := func() Result {
-                matchtype, _ := s.GetInteger("matchtype")
-                if s.UpdateSub("i_matchway", matchtype) {
-                        return Result{Data: M{"status": 1}}
-                }
-                return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		matchtype, _ := s.GetInteger("matchtype")
+		if s.UpdateSub("i_matchway", matchtype) {
+			return Result{Data: M{"status": 1}}
+		}
+		return Result{Data: M{"status": -1}, Error_msg: "保存失败"}
+	}()
+	s.ServeJson(r)
 }
 
 //推送预览
 func (s *Subscribe) GetPushView() {
-        r := func() Result {
-                userId, _ := s.GetSession("userId").(string)
-                if userId == "" {
-                        return Result{Data: nil, Error_msg: "未登录"}
-                }
-                pageNum, _ := s.GetInteger("pageNum")
-                pageSize, _ := s.GetInteger("pageSize")
-                keys, list, hasNextPage, count := util.SubViewDatas(userId, "", pageNum, pageSize, s.Session())
-                return Result{Data: M{
-                        "total":       count,
-                        "keys":        strings.Replace(strings.Trim(fmt.Sprint(keys), "[]"), " ", ",", -1),
-                        "list":        list,
-                        "hasNextPage": hasNextPage,
-                }}
-        }()
-        s.ServeJson(r)
+	r := func() Result {
+		userId, _ := s.GetSession("userId").(string)
+		if userId == "" {
+			return Result{Data: nil, Error_msg: "未登录"}
+		}
+		pageNum, _ := s.GetInteger("pageNum")
+		pageSize, _ := s.GetInteger("pageSize")
+		keys, list, hasNextPage, count := util.SubViewDatas(userId, "", pageNum, pageSize, s.Session())
+		return Result{Data: M{
+			"total":       count,
+			"keys":        strings.Replace(strings.Trim(fmt.Sprint(keys), "[]"), " ", ",", -1),
+			"list":        list,
+			"hasNextPage": hasNextPage,
+		}}
+	}()
+	s.ServeJson(r)
 }
 
 //推送列表
@@ -432,51 +431,51 @@ func (s *Subscribe) GetPushView() {
 
 //判断同一个数组是否重复
 func isRepeat(slice1 []string) bool {
-        m := make(map[string]int)
-        for _, v := range slice1 {
-                m[v]++
-                if m[v] > 1 {
-                        return true
-                }
-        }
-        return false
+	m := make(map[string]int)
+	for _, v := range slice1 {
+		m[v]++
+		if m[v] > 1 {
+			return true
+		}
+	}
+	return false
 }
 
 //修改订阅信息  parameter_name参数名  parameter参数
 func (s *Subscribe) UpdateSub(parameter_name string, parameter interface{}) bool {
-        userid := mongodb.StringTOBsonId(qutil.ObjToString(s.GetSession("userId")))
-        positionType := qutil.Int64All(s.GetSession("positionType"))
-        ok := false
-        if positionType == 0 {
-                ok = db.Mgo.Update("user", map[string]interface{}{"_id": userid}, map[string]interface{}{
-                        "$set": map[string]interface{}{
-                                "o_member_jy.l_modifydate":      time.Now().Unix(),
-                                "o_member_jy." + parameter_name: parameter,
-                        },
-                }, true, false)
-        } else {
-                entUserId := qutil.IntAll(s.GetSession("entUserId"))
-                entId := qutil.IntAll(s.GetSession("entId"))
-                query := map[string]interface{}{
-                        "i_userid": entUserId,
-                        "i_entid":  entId,
-                        "i_type":   1,
-                }
-                ok = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                        "$set": map[string]interface{}{
-                                "o_entniche.l_modifydate":      time.Now().Unix(),
-                                "o_entniche." + parameter_name: parameter,
-                        },
-                }, true, false)
-        }
-        if ok {
-                go func() {
-                        db.Mgo_Log.Save("bigmember_sub_logs", map[string]interface{}{
-                                "userid":       s.GetSession("userId"),
-                                parameter_name: parameter,
-                                "createtime":   time.Now().Unix(),
-                        })
-                }()
-        }
-        return ok
+	userid := mongodb.StringTOBsonId(qutil.ObjToString(s.GetSession("userId")))
+	positionType := qutil.Int64All(s.GetSession("positionType"))
+	ok := false
+	if positionType == 0 {
+		ok = db.Mgo.Update("user", map[string]interface{}{"_id": userid}, map[string]interface{}{
+			"$set": map[string]interface{}{
+				"o_member_jy.l_modifydate":      time.Now().Unix(),
+				"o_member_jy." + parameter_name: parameter,
+			},
+		}, true, false)
+	} else {
+		entUserId := qutil.IntAll(s.GetSession("entUserId"))
+		entId := qutil.IntAll(s.GetSession("entId"))
+		query := map[string]interface{}{
+			"i_userid": entUserId,
+			"i_entid":  entId,
+			"i_type":   1,
+		}
+		ok = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+			"$set": map[string]interface{}{
+				"o_entniche.l_modifydate":      time.Now().Unix(),
+				"o_entniche." + parameter_name: parameter,
+			},
+		}, true, false)
+	}
+	if ok {
+		go func() {
+			db.Mgo_Log.Save("bigmember_sub_logs", map[string]interface{}{
+				"userid":       s.GetSession("userId"),
+				parameter_name: parameter,
+				"createtime":   time.Now().Unix(),
+			})
+		}()
+	}
+	return ok
 }

+ 248 - 248
src/jfw/modules/bigmember/src/util/view.go

@@ -1,289 +1,289 @@
 package util
 
 import (
-        qutil "app.yhyue.com/moapp/jybase/common"
-        elastic "app.yhyue.com/moapp/jybase/esv1"
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "encoding/json"
-        "fmt"
-        "jy/src/jfw/modules/bigmember/src/db"
-        "log"
-        "strconv"
-        "strings"
-        "time"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	elastic "app.yhyue.com/moapp/jybase/esv1"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/bigmember/src/db"
+	"log"
+	"strconv"
+	"strings"
+	"time"
 )
 
 /*已选条件--关键词*/
 type ViewKeyWord struct {
-        Keyword  []string `json:"key"`       //关键词
-        Appended []string `json:"appendkey"` //附加词
-        Exclude  []string `json:"notkey"`    //排除词
-        MatchWay int      `json:"matchway"`  //匹配模式
+	Keyword  []string `json:"key"`       //关键词
+	Appended []string `json:"appendkey"` //附加词
+	Exclude  []string `json:"notkey"`    //排除词
+	MatchWay int      `json:"matchway"`  //匹配模式
 }
 
 /*已选条件*/
 type ViewCondition struct {
-        Area       []string      //地区-省份
-        City       []string      //地区-城市
-        Buyerclass []string      //采购行业
-        Keyword    []ViewKeyWord //关键词
-        SelectType string        //筛选(正文 or 标题)
-        Subtype    []string      //信息类型
+	Area       []string      //地区-省份
+	City       []string      //地区-城市
+	Buyerclass []string      //采购行业
+	Keyword    []ViewKeyWord //关键词
+	SelectType string        //筛选(正文 or 标题)
+	Subtype    []string      //信息类型
 }
 
 const (
-        INDEX          = "bidding"
-        TYPE           = "bidding"
-        bidSearch_sort = `{"publishtime":-1}`
-        findfields     = `"title"`
+	INDEX          = "bidding"
+	TYPE           = "bidding"
+	bidSearch_sort = `{"publishtime":-1}`
+	findfields     = `"title"`
 
-        view_maxPageNum = 20
-        view_pageSize   = 50
-        bidSearch_field = `"_id","title","publishtime","toptype","subtype","type","area","buyerclass","budget","bidamount"`
+	view_maxPageNum = 20
+	view_pageSize   = 50
+	bidSearch_field = `"_id","title","publishtime","toptype","subtype","type","area","buyerclass","budget","bidamount"`
 )
 
-func SubViewDatas(userId, allquery string, pageNum, pageSize int,session *httpsession.Session) (keys []interface{}, list *[]map[string]interface{}, hasNextPage bool, count int64) {
-        if userId == "" {
-                return
-        }
-        sql := GetSqlObjFromId(session, "", -1)
-        if sql == nil {
-                return
-        }
-        //PC端
-        if pageSize == 0 || pageSize > 100 {
-                pageSize = view_pageSize
-        }
-        for _, v := range sql.Keyword {
-                var keys_one []string
-                for _, k := range v.Keyword {
-                        keys_one = append(keys_one, k)
-                }
-                //dev3.5 附加词也要高亮
-                for _, k := range v.Appended {
-                        keys_one = append(keys_one, k)
-                }
-                keys = append(keys, strings.Join(keys_one, "++"))
-        }
-        qstr := GetMemberViewSql(sql)
-        count = elastic.Count(INDEX, TYPE, qstr)
-        list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, (pageNum-1)*pageSize, pageSize, 0, false)
-        if list != nil {
-                for _, v := range *list {
-                        v["_id"] = EncodeId(qutil.ObjToString(v["_id"]))
-                }
-        }
-        hasNextPage = list != nil && len(*list) == pageSize && pageNum < view_maxPageNum
-        return
+func SubViewDatas(userId, allquery string, pageNum, pageSize int, session *httpsession.Session) (keys []interface{}, list *[]map[string]interface{}, hasNextPage bool, count int64) {
+	if userId == "" {
+		return
+	}
+	sql := GetSqlObjFromId(session, "", -1)
+	if sql == nil {
+		return
+	}
+	//PC端
+	if pageSize == 0 || pageSize > 100 {
+		pageSize = view_pageSize
+	}
+	for _, v := range sql.Keyword {
+		var keys_one []string
+		for _, k := range v.Keyword {
+			keys_one = append(keys_one, k)
+		}
+		//dev3.5 附加词也要高亮
+		for _, k := range v.Appended {
+			keys_one = append(keys_one, k)
+		}
+		keys = append(keys, strings.Join(keys_one, "++"))
+	}
+	qstr := GetMemberViewSql(sql)
+	count = elastic.Count(INDEX, TYPE, qstr)
+	list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, (pageNum-1)*pageSize, pageSize, 0, false)
+	if list != nil {
+		for _, v := range *list {
+			v["_id"] = EncodeId(qutil.ObjToString(v["_id"]))
+		}
+	}
+	hasNextPage = list != nil && len(*list) == pageSize && pageNum < view_maxPageNum
+	return
 }
 
 //member_jy
 func GetSqlObjFromId(session *httpsession.Session, item string, index int) *ViewCondition {
-        var (
-                query *map[string]interface{}
-        )
-        if query := jy.GetSubScribeInfo(session, db.Mgo, "m", "10000"); query == nil {
-                return nil
-        }
-        o_member_jy, _ := (*query)["o_member_jy"].(map[string]interface{})
-        if o_member_jy["a_items"] == nil && o_member_jy["a_buyerclass"] == nil && o_member_jy["a_infotype"] == nil && o_member_jy["o_area"] == nil {
-                return nil
-        }
-        a_items := []interface{}{}
-        if o_member_jy["a_items"] != nil {
-                a_items = o_member_jy["a_items"].([]interface{})
-        }
-        a_buyerclass := []interface{}{}
-        if o_member_jy["a_buyerclass"] != nil {
-                a_buyerclass = o_member_jy["a_buyerclass"].([]interface{})
-        }
-        if len(a_buyerclass) > 0 && qutil.IntAllDef(o_member_jy["i_matchbuyerclass_other"], 1) == 1 && len(a_items) > 0 {
-                a_buyerclass = append(a_buyerclass, "其它")
-        }
-        a_infotype := []interface{}{}
-        if o_member_jy["a_infotype"] != nil {
-                a_infotype = o_member_jy["a_infotype"].([]interface{})
-        }
-        o_area := map[string]interface{}{}
-        if o_member_jy["o_area"] != nil {
-                o_area = o_member_jy["o_area"].(map[string]interface{})
-        }
-        return &ViewCondition{
-                Keyword:    getKeyWordArrFromDbResult(a_items, item, index),
-                Buyerclass: qutil.ObjArrToStringArr(a_buyerclass),
-                Subtype:    qutil.ObjArrToStringArr(a_infotype),
-                Area:       getStringArrFromDbResult(o_area, 1),
-                City:       getStringArrFromDbResult(o_area, 2),
-                SelectType: strconv.Itoa(qutil.IntAll(o_member_jy["i_matchway"])),
-        }
+	var (
+		o_member_jy *map[string]interface{}
+	)
+	if o_member_jy = jy.GetSubScribeInfo(session, db.Mgo, "m", "10000"); o_member_jy == nil {
+		return nil
+	}
+	/*o_member_jy, _ := (*query)["o_member_jy"].(map[string]interface{})*/
+	if (*o_member_jy)["a_items"] == nil && (*o_member_jy)["a_buyerclass"] == nil && (*o_member_jy)["a_infotype"] == nil && (*o_member_jy)["o_area"] == nil {
+		return nil
+	}
+	a_items := []interface{}{}
+	if (*o_member_jy)["a_items"] != nil {
+		a_items = (*o_member_jy)["a_items"].([]interface{})
+	}
+	a_buyerclass := []interface{}{}
+	if (*o_member_jy)["a_buyerclass"] != nil {
+		a_buyerclass = (*o_member_jy)["a_buyerclass"].([]interface{})
+	}
+	if len(a_buyerclass) > 0 && qutil.IntAllDef((*o_member_jy)["i_matchbuyerclass_other"], 1) == 1 && len(a_items) > 0 {
+		a_buyerclass = append(a_buyerclass, "其它")
+	}
+	a_infotype := []interface{}{}
+	if (*o_member_jy)["a_infotype"] != nil {
+		a_infotype = (*o_member_jy)["a_infotype"].([]interface{})
+	}
+	o_area := map[string]interface{}{}
+	if (*o_member_jy)["o_area"] != nil {
+		o_area = (*o_member_jy)["o_area"].(map[string]interface{})
+	}
+	return &ViewCondition{
+		Keyword:    getKeyWordArrFromDbResult(a_items, item, index),
+		Buyerclass: qutil.ObjArrToStringArr(a_buyerclass),
+		Subtype:    qutil.ObjArrToStringArr(a_infotype),
+		Area:       getStringArrFromDbResult(o_area, 1),
+		City:       getStringArrFromDbResult(o_area, 2),
+		SelectType: strconv.Itoa(qutil.IntAll((*o_member_jy)["i_matchway"])),
+	}
 }
 
 //获取大会员预览的查询语句
 func GetMemberViewSql(scd *ViewCondition) 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{}
-        //发布时间最新三个月
-        musts = append(musts, fmt.Sprintf(`{"range":{"publishtime":{"gte":%d}}}`, time.Now().AddDate(0, -3, 0).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{}
+	//发布时间最新三个月
+	musts = append(musts, fmt.Sprintf(`{"range":{"publishtime":{"gte":%d}}}`, time.Now().AddDate(0, -3, 0).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 {
-                                shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
+		for _, v := range scd.Keyword {
+			shoulds := []string{}
+			must_not := []string{}
+			//附加词
+			for _, vv := range v.Keyword {
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
 
-                        for _, vv := range v.Appended {
-                                shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
+			for _, vv := range v.Appended {
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
 
-                        //排除词
-                        for _, vv := range v.Exclude {
-                                must_not = append(must_not, fmt.Sprintf(multi_match, "\""+vv+"\""))
-                        }
+			//排除词
+			for _, vv := range v.Exclude {
+				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", qstr)
-        return qstr
+	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
+	// log.Println("------qstr", qstr)
+	return qstr
 }
 
 //关键词 附加词 排除词
 func getKeyWordArrFromDbResult(a_items []interface{}, item string, index int) (arr []ViewKeyWord) {
-        if a_items == nil {
-                return
-        }
-        for _, v := range a_items {
-                vm, _ := v.(map[string]interface{})
-                if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
-                        continue
-                }
-                kwsArr := vm["a_key"]
-                for i, k := range kwsArr.([]interface{}) {
-                        if item != "" && index >= 0 && i != index {
-                                continue
-                        }
-                        kw := ViewKeyWord{}
-                        b, e := json.Marshal(k)
-                        if e != nil {
-                                log.Println(e.Error())
-                        }
-                        json.Unmarshal(b, &kw)
-                        if kw.MatchWay == 1 {
-                                for _, kk := range kw.Keyword {
-                                        arr = append(arr, ViewKeyWord{
-                                                Keyword: []string{kk},
-                                                Exclude: kw.Exclude,
-                                        })
-                                }
-                                for _, kk := range kw.Appended {
-                                        arr = append(arr, ViewKeyWord{
-                                                Keyword: []string{kk},
-                                                Exclude: kw.Exclude,
-                                        })
-                                }
-                        } else {
-                                arr = append(arr, kw)
-                        }
-                }
-        }
-        return
+	if a_items == nil {
+		return
+	}
+	for _, v := range a_items {
+		vm, _ := v.(map[string]interface{})
+		if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
+			continue
+		}
+		kwsArr := vm["a_key"]
+		for i, k := range kwsArr.([]interface{}) {
+			if item != "" && index >= 0 && i != index {
+				continue
+			}
+			kw := ViewKeyWord{}
+			b, e := json.Marshal(k)
+			if e != nil {
+				log.Println(e.Error())
+			}
+			json.Unmarshal(b, &kw)
+			if kw.MatchWay == 1 {
+				for _, kk := range kw.Keyword {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+				for _, kk := range kw.Appended {
+					arr = append(arr, ViewKeyWord{
+						Keyword: []string{kk},
+						Exclude: kw.Exclude,
+					})
+				}
+			} else {
+				arr = append(arr, kw)
+			}
+		}
+	}
+	return
 }
 
 //
 func getStringArrFromDbResult(area map[string]interface{}, i int) (arr []string) {
-        if area == nil {
-                return
-        }
-        var eareArr []string
-        var cityArr []string
-        for k, v := range area {
-                if len(v.([]interface{})) > 0 {
-                        cityArr = append(cityArr, qutil.ObjArrToStringArr(v.([]interface{}))...)
-                } else {
-                        eareArr = append(eareArr, k)
-                }
-        }
-        if i == 1 {
-                arr = eareArr
-        } else {
-                arr = cityArr
-        }
-        return
+	if area == nil {
+		return
+	}
+	var eareArr []string
+	var cityArr []string
+	for k, v := range area {
+		if len(v.([]interface{})) > 0 {
+			cityArr = append(cityArr, qutil.ObjArrToStringArr(v.([]interface{}))...)
+		} else {
+			eareArr = append(eareArr, k)
+		}
+	}
+	if i == 1 {
+		arr = eareArr
+	} else {
+		arr = cityArr
+	}
+	return
 }

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

@@ -1,8 +1,8 @@
 package action
 
 import (
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "database/sql"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"database/sql"
 	"encoding/base64"
 	"fmt"
 	. "jy/src/jfw/modules/distribution/src/service/config"
@@ -123,7 +123,7 @@ func (this *Share) LinkShare(discored string) error {
 	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.GetSubScribeInfo(this.Session(),MQFW,"f", "10000")
+			user := jy.GetBigVipUserBaseMsg(this.Session(), MQFW, "f", "10000")
 			log.Println(user)
 			if ok && user != nil {
 				i_vip_status := user.VipStatus

+ 2 - 2
src/jfw/modules/publicapply/src/attachmentdow/service/service.go

@@ -36,7 +36,7 @@ func (u *Dow) SupplyInfoFileDownload() {
 		}
 
 		BaseMsg := jy.GetBigVipUserBaseMsg("10000", u.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-		vipStatus := jy.GetVipState(db.Mysql, db.Mgo, userid)
+		vipStatus := jy.GetVipState("10000", u.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key, userid)
 		isPower := false
 		//大会员下载权限判断
 		if BaseMsg.Status > 0 && BaseMsg.PowerMap[3] {
@@ -121,7 +121,7 @@ func (u *Dow) Subdow() {
 		}
 
 		BaseMsg := jy.GetBigVipUserBaseMsg("10000", u.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-		vipStatus := jy.GetVipState(db.Mysql, db.Mgo, userid)
+		vipStatus := jy.GetVipState("10000", u.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key, userid)
 
 		var (
 			mon string

+ 2 - 1
src/jfw/modules/publicapply/src/dataexport/service/action.go

@@ -3,6 +3,7 @@ package service
 import (
 	"errors"
 	"fmt"
+	"jy/src/jfw/modules/publicapply/src/config"
 	de "jy/src/jfw/modules/publicapply/src/dataexport/dexport"
 	"jy/src/jfw/modules/publicapply/src/dataexport/entity"
 	"jy/src/jfw/modules/publicapply/src/db"
@@ -195,7 +196,7 @@ func (des *DataExportStruct) ByPushHistory() {
 		defer util.Catch()
 		vipType := des.GetString("vt")
 		if vipType == "" { //默认取已切换的企业
-			vipType = jy.SwitchService.GetEntniche(des.Session(), db.Mgo, db.Mysql)
+			vipType = jy.SwitchService.GetEntniche(des.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key)
 		}
 		if vipType == jy.SwitchService.Entniche {
 			userId = fmt.Sprint(util.IntAll(des.GetSession("entUserId")))

+ 6 - 5
src/jfw/modules/publicapply/src/go.mod

@@ -3,19 +3,19 @@ module jy/src/jfw/modules/publicapply/src
 go 1.18
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20230109053435-fe962d69e751
-	app.yhyue.com/moapp/jypkg v0.0.0-20230110033557-004ea51c1d18
-	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230109023014-2cd2a0b9b979
+	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
+	app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8
+	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230128064517-23fe8581b7f1
 	github.com/SKatiyar/qr v0.0.0-20151201054752-25b6bdf44e67
 	github.com/gogf/gf/v2 v2.0.6
-	github.com/zeromicro/go-zero v1.4.3
+	github.com/zeromicro/go-zero v1.4.4
 	go.mongodb.org/mongo-driver v1.11.1
 )
 
 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-20230106052936-bd3ab7edf7a4 // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c // indirect
 	github.com/BurntSushi/toml v0.4.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
@@ -86,6 +86,7 @@ require (
 	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
 	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
 	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
 	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
 	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
 	go.opentelemetry.io/otel/trace v1.11.0 // indirect

+ 15 - 10
src/jfw/modules/publicapply/src/go.sum

@@ -11,17 +11,17 @@ app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa/go.mod h1:FjBF25AYoBrPhVKTXGXWcmEAbBT0ATTK6KJMOA+I80Q=
 app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tcD9TcKb/HOP2BLbzppyDz2kpQSFhPMQTUgbQ=
 app.yhyue.com/moapp/jybase v0.0.0-20230109015757-aa3d5e19b196/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jybase v0.0.0-20230109053435-fe962d69e751 h1:Z3Ye/xauzer3FymqIElv9/iEIfDOUkQBfnQPcKthoSc=
-app.yhyue.com/moapp/jybase v0.0.0-20230109053435-fe962d69e751/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110033557-004ea51c1d18 h1:VEImnN1BTIOgjEwUUvqatGqz9/CUoLPumMfRvrbgAEY=
-app.yhyue.com/moapp/jypkg v0.0.0-20230110033557-004ea51c1d18/go.mod h1:n2XBXZGvxUuc4AZMeMYUZuK7ayrwDQ7UdrZd6AJkUVM=
+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-20230131023215-ca51808c57b8 h1:bpCxm9zroB4vy4IF2PAlD+iIPc+GwC1YMquORPBWuLI=
+app.yhyue.com/moapp/jypkg v0.0.0-20230131023215-ca51808c57b8/go.mod h1:MqJfBFTSfZhrNDEnE4e19BmaLkaMr+lYActLXm6lrpw=
 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-20230106052936-bd3ab7edf7a4 h1:Xv1D9avDKeaM5kQTisF/pIt8y7B7yQ/hAxuWEg75LMs=
-bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
+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/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=
@@ -31,8 +31,8 @@ bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.4/go.mod h1:rRiGzKG4F/fmkN
 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=
 bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20220905055615-8540037e1b06/go.mod h1:LS21iwbgP8i3ZHJ1n4yNpLXQ/nzEudUOk0klC6VM2dQ=
-bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230109023014-2cd2a0b9b979 h1:hC97JNmBonTAsnDH4XMWLXVqWdo85tCo0ge04cy0e4E=
-bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230109023014-2cd2a0b9b979/go.mod h1:m7/aZ1r1FapNT2h3gqmCFVb0EV+CaJaNKNPHMzLHx8Y=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230128064517-23fe8581b7f1 h1:LH/gm2iRShZ64FEuF7LTzF62iJhOVVD9AxGVHFd0ORI=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230128064517-23fe8581b7f1/go.mod h1:m7/aZ1r1FapNT2h3gqmCFVb0EV+CaJaNKNPHMzLHx8Y=
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
@@ -441,8 +441,9 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGn
 github.com/alicebob/miniredis/v2 v2.14.1/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg=
 github.com/alicebob/miniredis/v2 v2.17.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
 github.com/alicebob/miniredis/v2 v2.22.0/go.mod h1:XNqvJdQJv5mSuVMc0ynneafpnL/zv52acZ6kqeS0t88=
-github.com/alicebob/miniredis/v2 v2.23.1 h1:jR6wZggBxwWygeXcdNyguCOCIjPsZyNUNlAkTx2fu0U=
 github.com/alicebob/miniredis/v2 v2.23.1/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
+github.com/alicebob/miniredis/v2 v2.30.0 h1:uA3uhDbCxfO9+DI/DuGeAMr9qI+noVWwGPNTFuKID5M=
+github.com/alicebob/miniredis/v2 v2.30.0/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
 github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
 github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
 github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
@@ -807,6 +808,7 @@ github.com/jhump/protoreflect v1.10.3/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd
 github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E=
 github.com/jhump/protoreflect v1.12.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
 github.com/jhump/protoreflect v1.14.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
+github.com/jhump/protoreflect v1.14.1/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI=
 github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
@@ -1108,8 +1110,9 @@ github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ
 github.com/zeromicro/go-zero v1.3.2/go.mod h1:DEj3Fwj1Ui1ltsgf6YqwTL9nD4+tYzIRX0c1pWtQo1E=
 github.com/zeromicro/go-zero v1.3.5/go.mod h1:wh4o794b7Ul3W0k35Pw9nc3iB4O0OpaQTMQz/PJc1bc=
 github.com/zeromicro/go-zero v1.4.0/go.mod h1:1amLn98K7c6FLntb9f8hdmq26ajtolOg4DTFWnRt54o=
-github.com/zeromicro/go-zero v1.4.3 h1:sTQ++6fxQHJnpGCN7h2CUrhWmbvhBqEgE75cJl635SM=
 github.com/zeromicro/go-zero v1.4.3/go.mod h1:UmDjuW7LHd9j7+nnnPBcXF0HLNmjJw6OjHPTlSp7X7Y=
+github.com/zeromicro/go-zero v1.4.4 h1:J8M768EVFNtIQJ/GCEsoIQPanxbx2HHT0it7r69U76Y=
+github.com/zeromicro/go-zero v1.4.4/go.mod h1:5WSUwtJm0bYdDZ69GlckigcT6D0EyAPbDaX3unbSY/4=
 github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
 go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
 go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM=
@@ -1161,6 +1164,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0/go.mod h1:FnDp7XemjN3o
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0/go.mod h1:OfUCyyIiDvNXHWpcWgbF+MWvqPZiNa3YDEnivcnYsV0=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 h1:j2RFV0Qdt38XQ2Jvi4WIsQ56w8T7eSirYbMw19VXRDg=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0/go.mod h1:pILgiTEtrqvZpoiuGdblDgS5dbIaTgDrkIuKfEFkt+A=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 h1:S8DedULB3gp93Rh+9Z+7NTEv+6Id/KYS7LDyipZ9iCE=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0/go.mod h1:5WV40MLWwvWlGP7Xm8g3pMcg0pKOUY609qxJn8y7LmM=
 go.opentelemetry.io/otel/exporters/zipkin v1.3.0/go.mod h1:LxGGfHIYbvsFnrJtBcazb0yG24xHdDGrT/H6RB9r3+8=
 go.opentelemetry.io/otel/exporters/zipkin v1.8.0/go.mod h1:0uYAyCuGT67MFV9Z/Mmx93wGuugHw0FbxMc74fs3LNo=
 go.opentelemetry.io/otel/exporters/zipkin v1.9.0/go.mod h1:HyIvYIu37wV4Wx5azd7e05x9k/dOz9KB4x0plw2QNvs=

+ 199 - 199
src/jfw/modules/publicapply/src/me/me.go

@@ -1,240 +1,240 @@
 package me
 
 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"
-        "jy/src/jfw/modules/publicapply/src/config"
-        "jy/src/jfw/modules/publicapply/src/db"
-        "jy/src/jfw/modules/publicapply/src/util"
-        "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"
+	"jy/src/jfw/modules/publicapply/src/config"
+	"jy/src/jfw/modules/publicapply/src/db"
+	"jy/src/jfw/modules/publicapply/src/util"
+	"time"
 
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 type Me struct {
-        *xweb.Action
+	*xweb.Action
 
-        myInfo xweb.Mapper `xweb:"/myinfo"`
+	myInfo xweb.Mapper `xweb:"/myinfo"`
 }
 
 func init() {
-        xweb.AddAction(&Me{})
+	xweb.AddAction(&Me{})
 }
 
 const (
-        Role_admin_system     = 1 //系统管理员
-        Role_admin_department = 2 //部门管理员
+	Role_admin_system     = 1 //系统管理员
+	Role_admin_department = 2 //部门管理员
 )
 
 //
 func (m *Me) MyInfo() {
-        r := map[string]interface{}{
-                "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("10000", m.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-        if user != nil {
-                isExpire := -1
-                isPassCount := false
-                tedayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
-                if user.Data.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 := user.Data.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
-                } else {
-                        isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) >= 150
-                }
-                isEnt := user.Data.Entniche.Status > 0
-                if isEnt {
-                        r["userType"] = "entniche"
-                       /* o_entniche := jy.GetSubScribeInfo(m.Session(), db.Mgo, "s", "10000")
-                        if (*o_entniche)["a_items"] != nil {
-                                a_items := qutil.ObjArrToMapArr((*o_entniche)["a_items"].([]interface{}))
-                                for _, v := range a_items {
-                                        if v["a_key"] != nil {
-                                                a_key_arr := qutil.ObjArrToMapArr(v["a_key"].([]interface{}))
-                                                for kk, vv := range a_key_arr {
-                                                        if vv["notkey"] == nil {
-                                                                a_key_arr[kk]["notkey"] = []string{}
-                                                        }
-                                                        if vv["appendkey"] == nil {
-                                                                a_key_arr[kk]["appendkey"] = []string{}
-                                                        }
-                                                        for kkk, vvv := range vv {
-                                                                if vvv == nil && kkk == "notkey" {
-                                                                        a_key_arr[kk][kkk] = []string{}
-                                                                }
-                                                                if vvv == nil && kkk == "appendkey" {
-                                                                        a_key_arr[kk][kkk] = []string{}
-                                                                }
-                                                        }
-                                                }
-                                                v["a_key"] = a_key_arr
-                                        }
-                                }
-                                data = qutil.ObjArrToStringArr(qutil.MapArrToObjArr(a_items))
-                        }*/
-                }
-                r["isExpire"] = isExpire
-                r["vipStatus"] = user.Data.Vip.Status
-                r["isPassCount"] = isPassCount
-                r["haskey"], _ = GetKeySet(jy.SwitchService.GetEntniche(m.Session(), db.Mgo, db.Mysql),m.Session())
-        }
-        m.ServeJson(r)
+	r := map[string]interface{}{
+		"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("10000", m.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	if user != nil {
+		isExpire := -1
+		isPassCount := false
+		tedayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
+		if user.Data.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 := user.Data.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
+		} else {
+			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) >= 150
+		}
+		isEnt := user.Data.Entniche.Status > 0
+		if isEnt {
+			r["userType"] = "entniche"
+			/* o_entniche := jy.GetSubScribeInfo(m.Session(), db.Mgo, "s", "10000")
+			   if (*o_entniche)["a_items"] != nil {
+			           a_items := qutil.ObjArrToMapArr((*o_entniche)["a_items"].([]interface{}))
+			           for _, v := range a_items {
+			                   if v["a_key"] != nil {
+			                           a_key_arr := qutil.ObjArrToMapArr(v["a_key"].([]interface{}))
+			                           for kk, vv := range a_key_arr {
+			                                   if vv["notkey"] == nil {
+			                                           a_key_arr[kk]["notkey"] = []string{}
+			                                   }
+			                                   if vv["appendkey"] == nil {
+			                                           a_key_arr[kk]["appendkey"] = []string{}
+			                                   }
+			                                   for kkk, vvv := range vv {
+			                                           if vvv == nil && kkk == "notkey" {
+			                                                   a_key_arr[kk][kkk] = []string{}
+			                                           }
+			                                           if vvv == nil && kkk == "appendkey" {
+			                                                   a_key_arr[kk][kkk] = []string{}
+			                                           }
+			                                   }
+			                           }
+			                           v["a_key"] = a_key_arr
+			                   }
+			           }
+			           data = qutil.ObjArrToStringArr(qutil.MapArrToObjArr(a_items))
+			   }*/
+		}
+		r["isExpire"] = isExpire
+		r["vipStatus"] = user.Data.Vip.Status
+		r["isPassCount"] = isPassCount
+		r["haskey"], _ = GetKeySet(jy.SwitchService.GetEntniche(m.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key), m.Session())
+	}
+	m.ServeJson(r)
 }
 
 //是否有订阅词
-func GetKeySet(t string, session  *httpsession.Session) (bool, []string) {
-        var industry_ = []string{}
+func GetKeySet(t string, session *httpsession.Session) (bool, []string) {
+	var industry_ = []string{}
 
-                if t == jy.SwitchService.Free{
-                        o_jy:= jy.GetSubScribeInfo(session,db.Mgo,"f","10000")
-                        a_key, _ := (*o_jy)["a_key"].([]interface{})
-                        return len(a_key) > 0, industry_
-                } else {
-                        obj:= &map[string]interface{}{}
-                        if t == jy.SwitchService.Vip {
-                                obj= jy.GetSubScribeInfo(session,db.Mgo,"v","10000")
-                                //obj, _ = (*u)["o_vipjy"].(map[string]interface{})
-                        } else if t == jy.SwitchService.Member {
-                                obj= jy.GetSubScribeInfo(session,db.Mgo,"m","10000")
+	if t == jy.SwitchService.Free {
+		o_jy := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
+		a_key, _ := (*o_jy)["a_key"].([]interface{})
+		return len(a_key) > 0, industry_
+	} else {
+		obj := &map[string]interface{}{}
+		if t == jy.SwitchService.Vip {
+			obj = jy.GetSubScribeInfo(session, db.Mgo, "v", "10000")
+			//obj, _ = (*u)["o_vipjy"].(map[string]interface{})
+		} else if t == jy.SwitchService.Member {
+			obj = jy.GetSubScribeInfo(session, db.Mgo, "m", "10000")
 
-                        } else if t == jy.SwitchService.Entniche {
-                                obj= jy.GetSubScribeInfo(session,db.Mgo,"m","10000")
+		} else if t == jy.SwitchService.Entniche {
+			obj = jy.GetSubScribeInfo(session, db.Mgo, "m", "10000")
 
-                        }
-                        if obj != nil {
-                                if buyerclassObj, ok := (*obj)["a_buyerclass"].([]interface{}); ok {
-                                        industry_ = qutil.ObjArrToStringArr(buyerclassObj)
-                                }
-                                itmes, _ := (*obj)["a_items"].([]interface{})
-                                for _, v := range itmes {
-                                        item, _ := v.(map[string]interface{})
-                                        keys, _ := item["a_key"].([]interface{})
-                                        if len(keys) > 0 {
-                                                return true, industry_
-                                        }
-                                }
-                        }
-                }
-        return false, industry_
+		}
+		if obj != nil {
+			if buyerclassObj, ok := (*obj)["a_buyerclass"].([]interface{}); ok {
+				industry_ = qutil.ObjArrToStringArr(buyerclassObj)
+			}
+			itmes, _ := (*obj)["a_items"].([]interface{})
+			for _, v := range itmes {
+				item, _ := v.(map[string]interface{})
+				keys, _ := item["a_key"].([]interface{})
+				if len(keys) > 0 {
+					return true, industry_
+				}
+			}
+		}
+	}
+	return false, industry_
 }
 
 type CurrentUser struct {
-        Role_admin_department bool        //是否是部门管理员
-        Role_admin_system     bool        //是否是系统管理员
-        Ent                   *EntInfo    //企业信息
-        Dept                  *Department //部门信息
-        BondPhone             string      //手机号
-        NickName              string      //昵称
-        HeadImageUrl          string      //头像
-        PersonalAuth          int         //个人认证
-        PersonalAuthReason    string      //个人认证不通过原因
-        User_power            int         //是否分配权限
-        User_name             string      //用户姓名
+	Role_admin_department bool        //是否是部门管理员
+	Role_admin_system     bool        //是否是系统管理员
+	Ent                   *EntInfo    //企业信息
+	Dept                  *Department //部门信息
+	BondPhone             string      //手机号
+	NickName              string      //昵称
+	HeadImageUrl          string      //头像
+	PersonalAuth          int         //个人认证
+	PersonalAuthReason    string      //个人认证不通过原因
+	User_power            int         //是否分配权限
+	User_name             string      //用户姓名
 }
 type EntInfo struct {
-        Id                    int    //企业id
-        Name                  string //企业名
-        Phone                 string //手机号
-        Model                 int    //1-统一订阅,2-个人订阅
-        Status                int    //0:未生效,1:已生效,-1:已到期
-        Quota                 int    //限额人数
-        Startdate             int    //开始时间
-        Enddate               int    //结束时间
-        Createtime            string //创建时间
-        Mail                  string //邮箱
-        Marketarea            string
-        Industryclass         string //行业分类
-        Admin                 string //管理员姓名-只有商机洞察中有,可能没什么用
-        Code                  string //统一社会信用代码
-        License               string //营业执照
-        Legal_name            string //法人姓名
-        Legal_idcard          string //身份证号
-        Legal_idcard_front    string //身份证前面
-        Legal_idcard_after    string //身份证后面
-        Auth_status           int    //-1-未通过 0-未认证 1-已认证
-        Auth_reason           string //审核不通过的原因说明
-        Auth_time             string //提交时间
-        Audit_time            string //审核时间
-        User_id               int
-        Auth_type             int    //认证类型 1-事业单位  其他:企业
-        Legal_mancard         string //法人证
-        IsNew                 int    //1新商机管理0老商机管理
-        Power_virtual_account int    //是否有添加虚拟账号权限
-        Virtual_account_rule  string //虚拟账号的手机号规则
+	Id                    int    //企业id
+	Name                  string //企业名
+	Phone                 string //手机号
+	Model                 int    //1-统一订阅,2-个人订阅
+	Status                int    //0:未生效,1:已生效,-1:已到期
+	Quota                 int    //限额人数
+	Startdate             int    //开始时间
+	Enddate               int    //结束时间
+	Createtime            string //创建时间
+	Mail                  string //邮箱
+	Marketarea            string
+	Industryclass         string //行业分类
+	Admin                 string //管理员姓名-只有商机洞察中有,可能没什么用
+	Code                  string //统一社会信用代码
+	License               string //营业执照
+	Legal_name            string //法人姓名
+	Legal_idcard          string //身份证号
+	Legal_idcard_front    string //身份证前面
+	Legal_idcard_after    string //身份证后面
+	Auth_status           int    //-1-未通过 0-未认证 1-已认证
+	Auth_reason           string //审核不通过的原因说明
+	Auth_time             string //提交时间
+	Audit_time            string //审核时间
+	User_id               int
+	Auth_type             int    //认证类型 1-事业单位  其他:企业
+	Legal_mancard         string //法人证
+	IsNew                 int    //1新商机管理0老商机管理
+	Power_virtual_account int    //是否有添加虚拟账号权限
+	Virtual_account_rule  string //虚拟账号的手机号规则
 }
 type Department struct {
-        Id         int
-        Name       string //部门名
-        Pid        int    //上级部门id
-        Pname      string //上级部门名称
-        Nodiff     int    //全员无差别接收 0:关闭 1:打开
-        Subdis     int    //订阅分发 0:关闭 1:打开
-        Aid        int    //管理员id
-        Aname      string //管理员姓名
-        Rname      string //角色名
-        User_count int    //该部门下员工的总数
-        Dept_count int    //该部门下子部门总数
-        Ent_id     int    //公司id
+	Id         int
+	Name       string //部门名
+	Pid        int    //上级部门id
+	Pname      string //上级部门名称
+	Nodiff     int    //全员无差别接收 0:关闭 1:打开
+	Subdis     int    //订阅分发 0:关闭 1:打开
+	Aid        int    //管理员id
+	Aname      string //管理员姓名
+	Rname      string //角色名
+	User_count int    //该部门下员工的总数
+	Dept_count int    //该部门下子部门总数
+	Ent_id     int    //公司id
 }
 
 //当前登录用户的信息
 func GetEntInfo(entId, entUserId int) *CurrentUser {
-        currentUser := &CurrentUser{
-                Ent:  &EntInfo{},
-                Dept: &Department{},
-        }
-        currentUser.Ent = &EntInfo{Id: entId}
-        user := db.Mysql.SelectBySql(`SELECT a.name as user_name from entniche_user a INNER JOIN entniche_user_role b on (a.id=b.user_id) where a.id=? and b.role_id=? limit 1`, entUserId, Role_admin_system)
-        if user != nil && len(*user) > 0 {
-                currentUser.Role_admin_system = true
-                currentUser.User_name, _ = (*user)[0]["user_name"].(string)
-                currentUser.User_power = 1
-                r := db.Mysql.SelectBySql(`SELECT id,name,subdis,nodiff from entniche_department where ent_id=? and pid=0 limit 1`, entId)
-                if r != nil && len(*r) == 1 {
-                        department := util.JsonUnmarshal((*r)[0], &Department{}).(*Department)
-                        if department != nil {
-                                department.Pid = department.Id
-                                currentUser.Dept = department
-                        }
-                }
-        } else {
-                //角色、权限
-                r := db.Mysql.SelectBySql(`SELECT a.name as user_name,a.power as user_power,b.role_id,d.id as dept_id,d.name as dept_name,d.subdis as dept_subdis,d.nodiff as dept_nodiff,e.id as dept_pid from entniche_user a
+	currentUser := &CurrentUser{
+		Ent:  &EntInfo{},
+		Dept: &Department{},
+	}
+	currentUser.Ent = &EntInfo{Id: entId}
+	user := db.Mysql.SelectBySql(`SELECT a.name as user_name from entniche_user a INNER JOIN entniche_user_role b on (a.id=b.user_id) where a.id=? and b.role_id=? limit 1`, entUserId, Role_admin_system)
+	if user != nil && len(*user) > 0 {
+		currentUser.Role_admin_system = true
+		currentUser.User_name, _ = (*user)[0]["user_name"].(string)
+		currentUser.User_power = 1
+		r := db.Mysql.SelectBySql(`SELECT id,name,subdis,nodiff from entniche_department where ent_id=? and pid=0 limit 1`, entId)
+		if r != nil && len(*r) == 1 {
+			department := util.JsonUnmarshal((*r)[0], &Department{}).(*Department)
+			if department != nil {
+				department.Pid = department.Id
+				currentUser.Dept = department
+			}
+		}
+	} else {
+		//角色、权限
+		r := db.Mysql.SelectBySql(`SELECT a.name as user_name,a.power as user_power,b.role_id,d.id as dept_id,d.name as dept_name,d.subdis as dept_subdis,d.nodiff as dept_nodiff,e.id as dept_pid from entniche_user a
 			LEFT JOIN entniche_user_role b on (b.user_id=?)
 			INNER JOIN entniche_department_user c on (a.id=? and a.id=c.user_id)
 			INNER JOIN entniche_department d on (c.dept_id=d.id)
 			INNER JOIN entniche_department e on (e.ent_id=? and e.pid=0)
 			order by a.id desc limit 1`, entUserId, entUserId, entId)
-                if r != nil && len(*r) == 1 {
-                        currentUser.User_name, _ = (*r)[0]["user_name"].(string)
-                        currentUser.User_power = qutil.IntAll((*r)[0]["user_power"])
-                        if qutil.IntAll((*r)[0]["role_id"]) == Role_admin_department {
-                                currentUser.Role_admin_department = true
-                        }
-                        currentUser.Dept.Id = qutil.IntAll((*r)[0]["dept_id"])
-                        currentUser.Dept.Pid = qutil.IntAll((*r)[0]["dept_pid"])
-                        currentUser.Dept.Name = qutil.ObjToString((*r)[0]["dept_name"])
-                        currentUser.Dept.Subdis = qutil.IntAll((*r)[0]["dept_subdis"])
-                        currentUser.Dept.Nodiff = qutil.IntAll((*r)[0]["dept_nodiff"])
-                }
-        }
-        return currentUser
+		if r != nil && len(*r) == 1 {
+			currentUser.User_name, _ = (*r)[0]["user_name"].(string)
+			currentUser.User_power = qutil.IntAll((*r)[0]["user_power"])
+			if qutil.IntAll((*r)[0]["role_id"]) == Role_admin_department {
+				currentUser.Role_admin_department = true
+			}
+			currentUser.Dept.Id = qutil.IntAll((*r)[0]["dept_id"])
+			currentUser.Dept.Pid = qutil.IntAll((*r)[0]["dept_pid"])
+			currentUser.Dept.Name = qutil.ObjToString((*r)[0]["dept_name"])
+			currentUser.Dept.Subdis = qutil.IntAll((*r)[0]["dept_subdis"])
+			currentUser.Dept.Nodiff = qutil.IntAll((*r)[0]["dept_nodiff"])
+		}
+	}
+	return currentUser
 }

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

@@ -1,1098 +1,1098 @@
 package entity
 
 import (
-        qutil "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-        "fmt"
-        "jy/src/jfw/modules/publicapply/src/config"
-        "jy/src/jfw/modules/publicapply/src/db"
-        "jy/src/jfw/modules/publicapply/src/util"
-        "strconv"
-        "strings"
-        "time"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"fmt"
+	"jy/src/jfw/modules/publicapply/src/config"
+	"jy/src/jfw/modules/publicapply/src/db"
+	"jy/src/jfw/modules/publicapply/src/util"
+	"strconv"
+	"strings"
+	"time"
 
-        "go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson"
 )
 
 type KeyWordsSet struct {
-        ClassifyIndex string   //分类索引
-        ClassifyName  string   //分类名称
-        KeyWordIndex  string   //关键词索引
-        KeyWordName   string   //关键词名称
-        ActionType    string   //操作类型 SK:保存/修改关键词; DK:删除关键词; SC:保存/修改分类  DC:删除分类
-        AppendKeyWord []string //附加词
-        NotKeyWord    []string //排除词
-        MatchWay      int      // 单个关键词匹配方事 0:精准匹配 1:模糊匹配
-        KeyWordsCount string   //是否是首次添加关键词
-        Type          string   // 大会员/超级订阅
-        UserId        string   //用户id
-        DeleteKey     string   //删除的关键词 json字符串{"0":"1,2","2":"0,3"} key:分类名称索引  value:分类名称下的关键词索引
-        Power         int
-        EntId         int
-        EntUserId     int
-        Session       *httpsession.Session
+	ClassifyIndex string   //分类索引
+	ClassifyName  string   //分类名称
+	KeyWordIndex  string   //关键词索引
+	KeyWordName   string   //关键词名称
+	ActionType    string   //操作类型 SK:保存/修改关键词; DK:删除关键词; SC:保存/修改分类  DC:删除分类
+	AppendKeyWord []string //附加词
+	NotKeyWord    []string //排除词
+	MatchWay      int      // 单个关键词匹配方事 0:精准匹配 1:模糊匹配
+	KeyWordsCount string   //是否是首次添加关键词
+	Type          string   // 大会员/超级订阅
+	UserId        string   //用户id
+	DeleteKey     string   //删除的关键词 json字符串{"0":"1,2","2":"0,3"} key:分类名称索引  value:分类名称下的关键词索引
+	Power         int
+	EntId         int
+	EntUserId     int
+	Session       *httpsession.Session
 }
 
 func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
-        power := jy.GetBigVipUserBaseMsg("10000", this.Session, config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-        if this.Type == "m" && power.Status < 0 {
-                return map[string]interface{}{"flag": false, "msg": "暂无权限"}
-        }
-        types := "o_jy"
-        if this.Type == "m" {
-                types = "o_member_jy"
-        } else if this.Type == "v" {
-                types = "o_vipjy"
-        }
-        //付费用户
-        if this.Type != "f" && (power.Status > 0 || power.VipStatus > 0) {
-                switch this.ActionType {
-                case "SK": //保存/修改关键词
-                        return AddKeyWords(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session)
-                case "DK": //删除关键词
-                        return DeleteKeyWords(types, this.DeleteKey, this.UserId, this.Session)
-                case "SC": //保存/修改分类
-                        return AddClass(types, this.ClassifyIndex, this.ClassifyName, this.UserId, this.Session)
-                case "DC": //删除分类
-                        return DeleteClass(types, this.ClassifyIndex, this.UserId, this.Session)
-                case "directSubKWS": //搜索列表直接订阅关键词
-                        return directSubKWS(types, this.KeyWordName, this.UserId, this.Session)
-                }
-        } else {
-                this.ClassifyIndex = "0"
-                this.ClassifyName = "未分类"
-                switch this.ActionType {
-                case "SK": //保存/修改关键词
-                        return AddKeyWordsFree(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session)
-                case "DK": //删除关键词
-                        return DeleteKeyWordsFree(types, this.DeleteKey, this.Session)
-                case "directSubKWS": //搜索列表直接订阅关键词
-                        return directSubKWSFree(types, this.KeyWordName, this.Session)
-                }
-        }
-        return map[string]interface{}{"flag": true, "msg": ""}
+	power := jy.GetBigVipUserBaseMsg("10000", this.Session, config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	if this.Type == "m" && power.Status < 0 {
+		return map[string]interface{}{"flag": false, "msg": "暂无权限"}
+	}
+	types := "o_jy"
+	if this.Type == "m" {
+		types = "o_member_jy"
+	} else if this.Type == "v" {
+		types = "o_vipjy"
+	}
+	//付费用户
+	if this.Type != "f" && (power.Status > 0 || power.VipStatus > 0) {
+		switch this.ActionType {
+		case "SK": //保存/修改关键词
+			return AddKeyWords(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session)
+		case "DK": //删除关键词
+			return DeleteKeyWords(types, this.DeleteKey, this.UserId, this.Session)
+		case "SC": //保存/修改分类
+			return AddClass(types, this.ClassifyIndex, this.ClassifyName, this.UserId, this.Session)
+		case "DC": //删除分类
+			return DeleteClass(types, this.ClassifyIndex, this.UserId, this.Session)
+		case "directSubKWS": //搜索列表直接订阅关键词
+			return directSubKWS(types, this.KeyWordName, this.UserId, this.Session)
+		}
+	} else {
+		this.ClassifyIndex = "0"
+		this.ClassifyName = "未分类"
+		switch this.ActionType {
+		case "SK": //保存/修改关键词
+			return AddKeyWordsFree(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session)
+		case "DK": //删除关键词
+			return DeleteKeyWordsFree(types, this.DeleteKey, this.Session)
+		case "directSubKWS": //搜索列表直接订阅关键词
+			return directSubKWSFree(types, this.KeyWordName, this.Session)
+		}
+	}
+	return map[string]interface{}{"flag": true, "msg": ""}
 }
 
 //
 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))
-        data := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
-        var repleat = false
-        var kwsCount = 0
-        if len([]rune(keys)) > 20 {
-                keys = qutil.SubString(keys, 0, 20)
-        }
-        positionType := qutil.Int64All(session.Get("positionType"))
-        query := map[string]interface{}{
-                "i_userid": qutil.Int64All(session.Get("entUserId")),
-                "i_entid":  qutil.Int64All(session.Get("entId")),
-                "i_type":   1,
-        }
-        flag := "n"
-        if data != nil && len(*data) > 0 && keys != "" {
-                updateObj, _ := (*data)[types].(map[string]interface{})
-                if updateObj["a_key"] != nil && len(qutil.ObjArrToMapArr(updateObj["a_key"].([]interface{}))) > 0 {
-                        a_key := updateObj["a_key"].([]interface{})
-                        for _, n := range a_key {
-                                ntmp := qutil.ObjToMap(n.(interface{}))
-                                nkey := qutil.ObjArrToStringArr((*ntmp)["key"].([]interface{}))
-                                if strings.Join(nkey, " ") == keys {
-                                        repleat = true
-                                        break
-                                }
-                        }
-                } else {
-                        //无关键词 直接添加
-                        if positionType == 0 {
-                                if ok := db.Mgo.UpdateById("user", userId, bson.M{"$set": bson.M{
-                                        fmt.Sprintf("%s.a_key", types): bson.A{
-                                                bson.M{
-                                                        "key":        bson.A{keys},
-                                                        "appendkey":  bson.A{},
-                                                        "notkey":     bson.A{},
-                                                        "updatetime": time.Now().Unix(),
-                                                },
-                                        },
-                                        types + ".l_modifydate": time.Now().Unix(),
-                                        // types + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
-                                },
-                                }); ok {
-                                        flag = "y"
-                                }
-                        } else {
-                                if ok := db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{
-                                        fmt.Sprintf("%s.a_key", types): bson.A{
-                                                bson.M{
-                                                        "key":        bson.A{keys},
-                                                        "appendkey":  bson.A{},
-                                                        "notkey":     bson.A{},
-                                                        "updatetime": time.Now().Unix(),
-                                                },
-                                        },
-                                        types + ".l_modifydate": time.Now().Unix(),
-                                        // types + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
-                                },
-                                }, true, false); ok {
-                                        flag = "y"
-                                }
-                        }
+	userId := qutil.ObjToString(session.Get("userId"))
+	//data, ok := db.Mgo.FindById("user", userId, fmt.Sprintf(`{"%s":1}`, types))
 
-                        return map[string]interface{}{"flag": flag}
-                }
-                if repleat {
-                        flag = "o"
-                } else if kwsCount >= 10 {
-                        flag = "m"
-                } else {
-                        var _key = make(map[string]interface{})
-                        var a_key = make([]map[string]interface{}, 1)
-                        classify_name := "未分类"
-                        _key["key"] = strings.Split(strings.ReplaceAll(keys, " ", ""), " ")
-                        _key["appendkey"] = []string{}
-                        _key["notkey"] = []string{}
-                        _key["updatetime"] = time.Now().Unix()
-                        a_key[0] = _key
-                        if len(a_key) > 0 {
-                                ok := false
-                                if positionType == 0 {
-                                        ok = db.Mgo.UpdateById("user", userId, bson.M{
-                                                "$push": bson.M{
-                                                        types + ".a_key": bson.M{
-                                                                "$each": a_key,
-                                                        },
-                                                },
-                                                "$set": bson.M{
-                                                        types + ".l_modifydate": time.Now().Unix(),
-                                                        types + ".s_item":       classify_name,
-                                                        // updateItems + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
-                                                },
-                                        })
-                                } else {
-                                        ok = db.Mgo.Update("entniche_rule", query, bson.M{
-                                                "$push": bson.M{
-                                                        types + ".a_key": bson.M{
-                                                                "$each": a_key,
-                                                        },
-                                                },
-                                                "$set": bson.M{
-                                                        types + ".l_modifydate": time.Now().Unix(),
-                                                        types + ".s_item":       classify_name,
-                                                        // updateItems + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
-                                                },
-                                        }, true, false)
-                                }
-                                if ok {
-                                        flag = "y"
-                                }
-                        }
-                }
-        }
-        if flag == "y" {
-                //清楚缓存
-                jy.ClearBigVipUserPower(userId)
-        }
-        return map[string]interface{}{"flag": flag}
+	var repleat = false
+	var kwsCount = 0
+	if len([]rune(keys)) > 20 {
+		keys = qutil.SubString(keys, 0, 20)
+	}
+	positionType := qutil.Int64All(session.Get("positionType"))
+	query := map[string]interface{}{
+		"i_userid": qutil.Int64All(session.Get("entUserId")),
+		"i_entid":  qutil.Int64All(session.Get("entId")),
+		"i_type":   1,
+	}
+	flag := "n"
+	updateObj := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
+	if updateObj != nil && len(*updateObj) > 0 && keys != "" {
+		if (*updateObj)["a_key"] != nil && len(qutil.ObjArrToMapArr((*updateObj)["a_key"].([]interface{}))) > 0 {
+			a_key := (*updateObj)["a_key"].([]interface{})
+			for _, n := range a_key {
+				ntmp := qutil.ObjToMap(n.(interface{}))
+				nkey := qutil.ObjArrToStringArr((*ntmp)["key"].([]interface{}))
+				if strings.Join(nkey, " ") == keys {
+					repleat = true
+					break
+				}
+			}
+		} else {
+			//无关键词 直接添加
+			if positionType == 0 {
+				if ok := db.Mgo.UpdateById("user", userId, bson.M{"$set": bson.M{
+					fmt.Sprintf("%s.a_key", types): bson.A{
+						bson.M{
+							"key":        bson.A{keys},
+							"appendkey":  bson.A{},
+							"notkey":     bson.A{},
+							"updatetime": time.Now().Unix(),
+						},
+					},
+					types + ".l_modifydate": time.Now().Unix(),
+					// types + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
+				},
+				}); ok {
+					flag = "y"
+				}
+			} else {
+				if ok := db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{
+					fmt.Sprintf("%s.a_key", types): bson.A{
+						bson.M{
+							"key":        bson.A{keys},
+							"appendkey":  bson.A{},
+							"notkey":     bson.A{},
+							"updatetime": time.Now().Unix(),
+						},
+					},
+					types + ".l_modifydate": time.Now().Unix(),
+					// types + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
+				},
+				}, true, false); ok {
+					flag = "y"
+				}
+			}
+
+			return map[string]interface{}{"flag": flag}
+		}
+		if repleat {
+			flag = "o"
+		} else if kwsCount >= 10 {
+			flag = "m"
+		} else {
+			var _key = make(map[string]interface{})
+			var a_key = make([]map[string]interface{}, 1)
+			classify_name := "未分类"
+			_key["key"] = strings.Split(strings.ReplaceAll(keys, " ", ""), " ")
+			_key["appendkey"] = []string{}
+			_key["notkey"] = []string{}
+			_key["updatetime"] = time.Now().Unix()
+			a_key[0] = _key
+			if len(a_key) > 0 {
+				ok := false
+				if positionType == 0 {
+					ok = db.Mgo.UpdateById("user", userId, bson.M{
+						"$push": bson.M{
+							types + ".a_key": bson.M{
+								"$each": a_key,
+							},
+						},
+						"$set": bson.M{
+							types + ".l_modifydate": time.Now().Unix(),
+							types + ".s_item":       classify_name,
+							// updateItems + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
+						},
+					})
+				} else {
+					ok = db.Mgo.Update("entniche_rule", query, bson.M{
+						"$push": bson.M{
+							types + ".a_key": bson.M{
+								"$each": a_key,
+							},
+						},
+						"$set": bson.M{
+							types + ".l_modifydate": time.Now().Unix(),
+							types + ".s_item":       classify_name,
+							// updateItems + ".i_newfree":    1, //老免费用户=>新订阅设置页面 20211122
+						},
+					}, true, false)
+				}
+				if ok {
+					flag = "y"
+				}
+			}
+		}
+	}
+	if flag == "y" {
+		//清楚缓存
+		jy.ClearBigVipUserPower(userId)
+	}
+	return map[string]interface{}{"flag": flag}
 }
 
 //免费用户删除关键词
 func DeleteKeyWordsFree(types, deletekey string, session *httpsession.Session) map[string]interface{} {
-        //免费用户只有一个分类
-        var index = "0"
-        userId := qutil.ObjToString(session.Get("userId"))
-        dMap, err := util.JsonToMap(deletekey)
-        newMap, saveData := []interface{}{}, map[string]interface{}{}
-        if err == nil && len(dMap) > 0 {
-                data := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
-                if data != nil && len(*data) > 0 {
-                        ojy, _ := (*data)[types].(map[string]interface{})
-                        a_key, _ := ojy["a_key"].([]interface{})
-                        if dMap[index] != nil {
-                                keyarrs := qutil.ObjArrToMapArr(a_key)
-                                for kk, vk := range keyarrs {
-                                        if util.IsContain(strings.Split(dMap[index].(string), ","), strconv.Itoa(kk)) {
-                                                continue
-                                        }
-                                        newMap = append(newMap, vk)
-                                }
-                                saveData[types+".a_key"] = newMap
-                        }
-                }
-        }
-        flag := true
-        if len(saveData) > 0 {
-                positionType := qutil.Int64All(session.Get("positionType"))
-                if positionType == 0 {
-                        flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                "$set": saveData,
-                        })
-                } else {
-                        query := map[string]interface{}{
-                                "i_userid": qutil.Int64All(session.Get("entUserId")),
-                                "i_entid":  qutil.Int64All(session.Get("entId")),
-                                "i_type":   1,
-                        }
-                        flag = db.Mgo.Update("entniche_rule", query, map[string]interface{}{"$set": saveData}, true, false)
+	//免费用户只有一个分类
+	var index = "0"
+	userId := qutil.ObjToString(session.Get("userId"))
+	dMap, err := util.JsonToMap(deletekey)
+	newMap, saveData := []interface{}{}, map[string]interface{}{}
+	if err == nil && len(dMap) > 0 {
+		data := jy.GetSubScribeInfo(session, db.Mgo, "f", "10000")
+		if data != nil && len(*data) > 0 {
+			ojy, _ := (*data)[types].(map[string]interface{})
+			a_key, _ := ojy["a_key"].([]interface{})
+			if dMap[index] != nil {
+				keyarrs := qutil.ObjArrToMapArr(a_key)
+				for kk, vk := range keyarrs {
+					if util.IsContain(strings.Split(dMap[index].(string), ","), strconv.Itoa(kk)) {
+						continue
+					}
+					newMap = append(newMap, vk)
+				}
+				saveData[types+".a_key"] = newMap
+			}
+		}
+	}
+	flag := true
+	if len(saveData) > 0 {
+		positionType := qutil.Int64All(session.Get("positionType"))
+		if positionType == 0 {
+			flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
+				"$set": saveData,
+			})
+		} else {
+			query := map[string]interface{}{
+				"i_userid": qutil.Int64All(session.Get("entUserId")),
+				"i_entid":  qutil.Int64All(session.Get("entId")),
+				"i_type":   1,
+			}
+			flag = db.Mgo.Update("entniche_rule", query, map[string]interface{}{"$set": saveData}, true, false)
 
-                }
-                SetLog(userId, types, 0, session)
-        }
-        return map[string]interface{}{"flag": flag, "msg": ""}
+		}
+		SetLog(userId, types, 0, session)
+	}
+	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 //免费用户修改 保存关键词
 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"))
-        query := map[string]interface{}{
-                "i_userid": qutil.Int64All(session.Get("entUserId")),
-                "i_entid":  qutil.Int64All(session.Get("entId")),
-                "i_type":   1,
-        }
-        if data != nil && len(*data) > 0 {
-                a_items := make([]interface{}, 0)
-                ojy, _ := (*data)[types].(map[string]interface{})
-                a_key, errs := (*data)["a_key"].([]interface{})
-                if !errs {
+	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"))
+	query := map[string]interface{}{
+		"i_userid": qutil.Int64All(session.Get("entUserId")),
+		"i_entid":  qutil.Int64All(session.Get("entId")),
+		"i_type":   1,
+	}
+	if data != nil && len(*data) > 0 {
+		a_items := make([]interface{}, 0)
+		ojy, _ := (*data)[types].(map[string]interface{})
+		a_key, errs := (*data)["a_key"].([]interface{})
+		if !errs {
 
-                        if positionType == 0 {
-                                db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                        "$set": map[string]interface{}{
-                                                types + ".a_key": []map[string]interface{}{},
-                                                // types + ".i_newfree": 1, //老免费用户=>新订阅设置页面 20211122
-                                        },
-                                })
-                        } else {
+			if positionType == 0 {
+				db.Mgo.UpdateById("user", userId, map[string]interface{}{
+					"$set": map[string]interface{}{
+						types + ".a_key": []map[string]interface{}{},
+						// types + ".i_newfree": 1, //老免费用户=>新订阅设置页面 20211122
+					},
+				})
+			} else {
 
-                                db.Mgo.Update("entniche_rule", query, map[string]interface{}{"$set": map[string]interface{}{
-                                        "o_entniche.a_key": []map[string]interface{}{},
-                                }}, true, false)
-                        }
+				db.Mgo.Update("entniche_rule", query, map[string]interface{}{"$set": map[string]interface{}{
+					"o_entniche.a_key": []map[string]interface{}{},
+				}}, true, false)
+			}
 
-                }
-                if ki, _ := strconv.Atoi(keywordsIndex); ki > len(a_key) {
-                        keywordsIndex = strconv.Itoa(len(a_key))
-                } else if ki == 0 {
-                        keywordsIndex = strconv.Itoa(ki)
-                }
-                a_items = append(a_items, ojy)
-                //排除词处理 词过长或者为空的情况
-                if len(notKeyword) > 0 {
-                        for i, notval := range notKeyword {
-                                if len([]rune(notval)) > 20 {
-                                        notval = qutil.SubString(notval, 0, 20)
-                                }
-                                if notval == "" {
-                                        notKeyword = append(notKeyword[:i], notKeyword[i+1:]...)
-                                }
-                        }
-                }
-                var _kws []string //关键词
-                for _, kn := range strings.Split(keywordName, " ") {
-                        if kn != "" {
-                                _kws = append(_kws, kn)
-                        }
-                }
-                var _key = make(map[string]interface{})
-                newKws := []string{_kws[0]} //第一个关键词在key中 后边的存入appendkey
-                _key["key"] = newKws
-                _key["appendkey"] = append(appendKeyword, _kws[1:]...)
-                _key["notkey"] = notKeyword
-                _key["matchway"] = matchWay //matchway 0:精准匹配 1:模糊匹配
-                if KeyWordsRepeat(_key, a_items) {
-                        return map[string]interface{}{"flag": false, "msg": "关键词已存在"}
-                } else {
-                        //修改关键词
-                        saveData[types+".s_item"] = className
-                        // saveData[types+".i_newfree"] = 1 //老免费用户=>新订阅设置页面 20211122
-                        saveData[types+".a_key."+keywordsIndex+".key"] = newKws
-                        saveData[types+".a_key."+keywordsIndex+".appendkey"] = append(appendKeyword, _kws[1:]...)
-                        saveData[types+".a_key."+keywordsIndex+".notkey"] = notKeyword
-                        saveData[types+".a_key."+keywordsIndex+".matchway"] = matchWay
-                        saveData[types+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
-                }
-        }
-        if len(saveData) > 0 {
-                ok := false
-                if positionType == 0 {
-                        ok = db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                "$set": saveData,
-                        })
-                } else {
-                        ok = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                                "$set": saveData,
-                        }, true, false)
-                }
-                if ok {
-                        flag = true
-                        //清楚缓存
-                        jy.ClearBigVipUserPower(userId)
-                }
-                SetLog(userId, types, 0, session)
-        }
-        return map[string]interface{}{"flag": flag, "msg": ""}
+		}
+		if ki, _ := strconv.Atoi(keywordsIndex); ki > len(a_key) {
+			keywordsIndex = strconv.Itoa(len(a_key))
+		} else if ki == 0 {
+			keywordsIndex = strconv.Itoa(ki)
+		}
+		a_items = append(a_items, ojy)
+		//排除词处理 词过长或者为空的情况
+		if len(notKeyword) > 0 {
+			for i, notval := range notKeyword {
+				if len([]rune(notval)) > 20 {
+					notval = qutil.SubString(notval, 0, 20)
+				}
+				if notval == "" {
+					notKeyword = append(notKeyword[:i], notKeyword[i+1:]...)
+				}
+			}
+		}
+		var _kws []string //关键词
+		for _, kn := range strings.Split(keywordName, " ") {
+			if kn != "" {
+				_kws = append(_kws, kn)
+			}
+		}
+		var _key = make(map[string]interface{})
+		newKws := []string{_kws[0]} //第一个关键词在key中 后边的存入appendkey
+		_key["key"] = newKws
+		_key["appendkey"] = append(appendKeyword, _kws[1:]...)
+		_key["notkey"] = notKeyword
+		_key["matchway"] = matchWay //matchway 0:精准匹配 1:模糊匹配
+		if KeyWordsRepeat(_key, a_items) {
+			return map[string]interface{}{"flag": false, "msg": "关键词已存在"}
+		} else {
+			//修改关键词
+			saveData[types+".s_item"] = className
+			// saveData[types+".i_newfree"] = 1 //老免费用户=>新订阅设置页面 20211122
+			saveData[types+".a_key."+keywordsIndex+".key"] = newKws
+			saveData[types+".a_key."+keywordsIndex+".appendkey"] = append(appendKeyword, _kws[1:]...)
+			saveData[types+".a_key."+keywordsIndex+".notkey"] = notKeyword
+			saveData[types+".a_key."+keywordsIndex+".matchway"] = matchWay
+			saveData[types+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
+		}
+	}
+	if len(saveData) > 0 {
+		ok := false
+		if positionType == 0 {
+			ok = db.Mgo.UpdateById("user", userId, map[string]interface{}{
+				"$set": saveData,
+			})
+		} else {
+			ok = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+				"$set": saveData,
+			}, true, false)
+		}
+		if ok {
+			flag = true
+			//清楚缓存
+			jy.ClearBigVipUserPower(userId)
+		}
+		SetLog(userId, types, 0, session)
+	}
+	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 //保存/修改关键词
 func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, session *httpsession.Session) map[string]interface{} {
-        flag := true
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if positionType == 0 {
-                //个人版
-                data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
-                saveData := map[string]interface{}{}
-                if ok && data != nil && len(*data) > 0 {
-                        ojy, _ := (*data)[types].(map[string]interface{})
-                        a_items, errs := ojy["a_items"].([]interface{})
-                        if !errs {
-                                db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                        "$set": map[string]interface{}{
-                                                types + ".a_items": []map[string]interface{}{},
-                                        },
-                                })
-                        }
-                        //附加词处理
-                        if len(appendKeyword) > 0 {
-                                for i, addval := range appendKeyword {
-                                        if len([]rune(addval)) > 20 {
-                                                addval = qutil.SubString(addval, 0, 20)
-                                        }
-                                        if addval == "" {
-                                                appendKeyword = append(appendKeyword[:i], appendKeyword[i+1:]...)
-                                        }
-                                }
-                        }
-                        //排除词处理 词过长或者为空的情况
-                        if len(notKeyword) > 0 {
-                                for i, notval := range notKeyword {
-                                        if len([]rune(notval)) > 20 {
-                                                notval = qutil.SubString(notval, 0, 20)
-                                        }
-                                        if notval == "" {
-                                                notKeyword = append(notKeyword[:i], notKeyword[i+1:]...)
-                                        }
-                                }
-                        }
-                        var _kws []string //关键词
-                        for _, kn := range strings.Split(keywordName, " ") {
-                                if kn != "" {
-                                        _kws = append(_kws, kn)
-                                }
-                        }
-                        var _key = make(map[string]interface{})
-                        newKws := []string{_kws[0]} //第一个关键词在key中 后边的存入appendkey
-                        _key["key"] = newKws
-                        _key["appendkey"] = append(appendKeyword, _kws[1:]...)
-                        _key["notkey"] = notKeyword
-                        _key["matchway"] = matchWay //matchway 0:精准匹配 1:模糊匹配
-                        if KeyWordsRepeat(_key, a_items) {
-                                return map[string]interface{}{"flag": false, "msg": "关键词已存在"}
-                        } else {
-                                //修改关键词
-                                saveData[types+".a_items."+classIndex+".s_item"] = className
-                                saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".key"] = newKws
-                                saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".appendkey"] = append(appendKeyword, _kws[1:]...)
-                                saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".notkey"] = notKeyword
-                                saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".matchway"] = matchWay
-                                saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
-                        }
-                }
+	flag := true
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if positionType == 0 {
+		//个人版
+		data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
+		saveData := map[string]interface{}{}
+		if ok && data != nil && len(*data) > 0 {
+			ojy, _ := (*data)[types].(map[string]interface{})
+			a_items, errs := ojy["a_items"].([]interface{})
+			if !errs {
+				db.Mgo.UpdateById("user", userId, map[string]interface{}{
+					"$set": map[string]interface{}{
+						types + ".a_items": []map[string]interface{}{},
+					},
+				})
+			}
+			//附加词处理
+			if len(appendKeyword) > 0 {
+				for i, addval := range appendKeyword {
+					if len([]rune(addval)) > 20 {
+						addval = qutil.SubString(addval, 0, 20)
+					}
+					if addval == "" {
+						appendKeyword = append(appendKeyword[:i], appendKeyword[i+1:]...)
+					}
+				}
+			}
+			//排除词处理 词过长或者为空的情况
+			if len(notKeyword) > 0 {
+				for i, notval := range notKeyword {
+					if len([]rune(notval)) > 20 {
+						notval = qutil.SubString(notval, 0, 20)
+					}
+					if notval == "" {
+						notKeyword = append(notKeyword[:i], notKeyword[i+1:]...)
+					}
+				}
+			}
+			var _kws []string //关键词
+			for _, kn := range strings.Split(keywordName, " ") {
+				if kn != "" {
+					_kws = append(_kws, kn)
+				}
+			}
+			var _key = make(map[string]interface{})
+			newKws := []string{_kws[0]} //第一个关键词在key中 后边的存入appendkey
+			_key["key"] = newKws
+			_key["appendkey"] = append(appendKeyword, _kws[1:]...)
+			_key["notkey"] = notKeyword
+			_key["matchway"] = matchWay //matchway 0:精准匹配 1:模糊匹配
+			if KeyWordsRepeat(_key, a_items) {
+				return map[string]interface{}{"flag": false, "msg": "关键词已存在"}
+			} else {
+				//修改关键词
+				saveData[types+".a_items."+classIndex+".s_item"] = className
+				saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".key"] = newKws
+				saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".appendkey"] = append(appendKeyword, _kws[1:]...)
+				saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".notkey"] = notKeyword
+				saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".matchway"] = matchWay
+				saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
+			}
+		}
 
-                if len(saveData) > 0 {
-                        flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                "$set": saveData,
-                        })
-                        SetLog(userId, types, positionType, session)
-                }
-        } else {
-                //企业个人版
-                //先查看有没有关键词
-                types := "o_entniche"
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                data, ok := db.Mgo.Find("entniche_rule", query, `{"`+types+`.a_items":1}`, nil, false, -1, -1)
-                saveData := map[string]interface{}{}
-                if !ok || data == nil || len(*data) == 0 {
-                        db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                                "$set": map[string]interface{}{
-                                        "o_entniche.a_items": []map[string]interface{}{},
-                                        "l_updatetime":       time.Now().Unix(),
-                                }}, true, false)
-                }
-                //entniche_rule有数据
-                ojy, _ := (*data)[0][types].(map[string]interface{})
-                a_items, errs := ojy["a_items"].([]interface{})
-                if !errs {
-                        db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                                "$set": map[string]interface{}{
-                                        "o_entniche.a_items": []map[string]interface{}{},
-                                }}, true, false)
-                }
-                //附加词处理
-                if len(appendKeyword) > 0 {
-                        for i, addval := range appendKeyword {
-                                if len([]rune(addval)) > 20 {
-                                        addval = qutil.SubString(addval, 0, 20)
-                                }
-                                if addval == "" {
-                                        appendKeyword = append(appendKeyword[:i], appendKeyword[i+1:]...)
-                                }
-                        }
-                }
-                //排除词处理 词过长或者为空的情况
-                if len(notKeyword) > 0 {
-                        for i, notval := range notKeyword {
-                                if len([]rune(notval)) > 20 {
-                                        notval = qutil.SubString(notval, 0, 20)
-                                }
-                                if notval == "" {
-                                        notKeyword = append(notKeyword[:i], notKeyword[i+1:]...)
-                                }
-                        }
-                }
-                var _kws []string //关键词
-                for _, kn := range strings.Split(keywordName, " ") {
-                        if kn != "" {
-                                _kws = append(_kws, kn)
-                        }
-                }
-                var _key = make(map[string]interface{})
-                newKws := []string{_kws[0]} //第一个关键词在key中 后边的存入appendkey
-                _key["key"] = newKws
-                _key["appendkey"] = append(appendKeyword, _kws[1:]...)
-                _key["notkey"] = notKeyword
-                _key["updatetime"] = time.Now().Unix()
-                _key["matchway"] = matchWay //matchway 0:精准匹配 1:模糊匹配
-                if KeyWordsRepeat(_key, a_items) {
-                        return map[string]interface{}{"flag": false, "msg": "关键词已存在"}
-                } else {
-                        //修改关键词
-                        saveData[types+".a_items."+classIndex+".s_item"] = className
-                        saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".key"] = newKws
-                        saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".appendkey"] = append(appendKeyword, _kws[1:]...)
-                        saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".notkey"] = notKeyword
-                        saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".matchway"] = matchWay
-                        saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
-                }
+		if len(saveData) > 0 {
+			flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
+				"$set": saveData,
+			})
+			SetLog(userId, types, positionType, session)
+		}
+	} else {
+		//企业个人版
+		//先查看有没有关键词
+		types := "o_entniche"
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		data, ok := db.Mgo.Find("entniche_rule", query, `{"`+types+`.a_items":1}`, nil, false, -1, -1)
+		saveData := map[string]interface{}{}
+		if !ok || data == nil || len(*data) == 0 {
+			db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+				"$set": map[string]interface{}{
+					"o_entniche.a_items": []map[string]interface{}{},
+					"l_updatetime":       time.Now().Unix(),
+				}}, true, false)
+		}
+		//entniche_rule有数据
+		ojy, _ := (*data)[0][types].(map[string]interface{})
+		a_items, errs := ojy["a_items"].([]interface{})
+		if !errs {
+			db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+				"$set": map[string]interface{}{
+					"o_entniche.a_items": []map[string]interface{}{},
+				}}, true, false)
+		}
+		//附加词处理
+		if len(appendKeyword) > 0 {
+			for i, addval := range appendKeyword {
+				if len([]rune(addval)) > 20 {
+					addval = qutil.SubString(addval, 0, 20)
+				}
+				if addval == "" {
+					appendKeyword = append(appendKeyword[:i], appendKeyword[i+1:]...)
+				}
+			}
+		}
+		//排除词处理 词过长或者为空的情况
+		if len(notKeyword) > 0 {
+			for i, notval := range notKeyword {
+				if len([]rune(notval)) > 20 {
+					notval = qutil.SubString(notval, 0, 20)
+				}
+				if notval == "" {
+					notKeyword = append(notKeyword[:i], notKeyword[i+1:]...)
+				}
+			}
+		}
+		var _kws []string //关键词
+		for _, kn := range strings.Split(keywordName, " ") {
+			if kn != "" {
+				_kws = append(_kws, kn)
+			}
+		}
+		var _key = make(map[string]interface{})
+		newKws := []string{_kws[0]} //第一个关键词在key中 后边的存入appendkey
+		_key["key"] = newKws
+		_key["appendkey"] = append(appendKeyword, _kws[1:]...)
+		_key["notkey"] = notKeyword
+		_key["updatetime"] = time.Now().Unix()
+		_key["matchway"] = matchWay //matchway 0:精准匹配 1:模糊匹配
+		if KeyWordsRepeat(_key, a_items) {
+			return map[string]interface{}{"flag": false, "msg": "关键词已存在"}
+		} else {
+			//修改关键词
+			saveData[types+".a_items."+classIndex+".s_item"] = className
+			saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".key"] = newKws
+			saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".appendkey"] = append(appendKeyword, _kws[1:]...)
+			saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".notkey"] = notKeyword
+			saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".matchway"] = matchWay
+			saveData[types+".a_items."+classIndex+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
+		}
 
-                saveData["l_updatetime"] = time.Now().Unix()
-                flag = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                        "$set": saveData,
-                }, true, false)
-                SetLog(userId, types, positionType, session)
-        }
+		saveData["l_updatetime"] = time.Now().Unix()
+		flag = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+			"$set": saveData,
+		}, true, false)
+		SetLog(userId, types, positionType, session)
+	}
 
-        return map[string]interface{}{"flag": flag, "msg": ""}
+	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 //删除关键词可以批量
 func DeleteKeyWords(types, deletekey, userId string, session *httpsession.Session) map[string]interface{} {
-        flag := true
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if positionType == 0 {
-                dMap, err := util.JsonToMap(deletekey)
-                newMap, saveData := []interface{}{}, map[string]interface{}{}
-                if err == nil && len(dMap) > 0 {
-                        data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
-                        if data != nil && ok && len(*data) > 0 {
-                                ojy, _ := (*data)[types].(map[string]interface{})
-                                a_items, _ := ojy["a_items"].([]interface{})
-                                for k, v := range a_items {
-                                        newItems := map[string]interface{}{}
-                                        if dMap[strconv.Itoa(k)] != nil {
-                                                if items, ok := v.(map[string]interface{}); ok && len(items) > 0 {
-                                                        for kk, vv := range items {
-                                                                new_vv := vv
-                                                                new_m := []map[string]interface{}{}
-                                                                if kk == "a_key" {
-                                                                        keyarrs := qutil.ObjArrToMapArr(vv.([]interface{}))
-                                                                        for kk, vk := range keyarrs {
-                                                                                if util.IsContain(strings.Split(dMap[strconv.Itoa(k)].(string), ","), strconv.Itoa(kk)) {
-                                                                                        continue
-                                                                                }
-                                                                                new_m = append(new_m, vk)
-                                                                        }
-                                                                        new_vv = new_m
-                                                                }
-                                                                newItems[kk] = new_vv
-                                                        }
-                                                }
-                                                newMap = append(newMap, newItems)
-                                        } else {
-                                                newMap = append(newMap, v)
-                                        }
-                                }
-                        }
-                        saveData[types+".a_items"] = newMap
-                }
-                if len(saveData) > 0 {
-                        flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                "$set": saveData,
-                        })
-                        SetLog(userId, types, 0, session)
-                }
-        } else {
-                types := "o_entniche"
-                dMap, err := util.JsonToMap(deletekey)
-                newMap := []interface{}{}
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                if err == nil && len(dMap) > 0 {
-                        data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
-                        if data == nil || !ok || len(*data) == 0 {
-                                return map[string]interface{}{"flag": flag, "msg": ""}
-                        }
-                        ojy, _ := (*data)[0][types].(map[string]interface{})
-                        a_items, _ := ojy["a_items"].([]interface{})
-                        for k, v := range a_items {
-                                newItems := map[string]interface{}{}
-                                if dMap[strconv.Itoa(k)] != nil {
-                                        if items, ok := v.(map[string]interface{}); ok && len(items) > 0 {
-                                                for kk, vv := range items {
-                                                        new_vv := vv
-                                                        new_m := []map[string]interface{}{}
-                                                        if kk == "a_key" {
-                                                                keyarrs := qutil.ObjArrToMapArr(vv.([]interface{}))
-                                                                for kk, vk := range keyarrs {
-                                                                        if util.IsContain(strings.Split(dMap[strconv.Itoa(k)].(string), ","), strconv.Itoa(kk)) {
-                                                                                continue
-                                                                        }
-                                                                        new_m = append(new_m, vk)
-                                                                }
-                                                                new_vv = new_m
-                                                        }
-                                                        newItems[kk] = new_vv
-                                                }
-                                        }
-                                        newMap = append(newMap, newItems)
-                                } else {
-                                        newMap = append(newMap, v)
-                                }
-                        }
-                }
+	flag := true
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if positionType == 0 {
+		dMap, err := util.JsonToMap(deletekey)
+		newMap, saveData := []interface{}{}, map[string]interface{}{}
+		if err == nil && len(dMap) > 0 {
+			data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
+			if data != nil && ok && len(*data) > 0 {
+				ojy, _ := (*data)[types].(map[string]interface{})
+				a_items, _ := ojy["a_items"].([]interface{})
+				for k, v := range a_items {
+					newItems := map[string]interface{}{}
+					if dMap[strconv.Itoa(k)] != nil {
+						if items, ok := v.(map[string]interface{}); ok && len(items) > 0 {
+							for kk, vv := range items {
+								new_vv := vv
+								new_m := []map[string]interface{}{}
+								if kk == "a_key" {
+									keyarrs := qutil.ObjArrToMapArr(vv.([]interface{}))
+									for kk, vk := range keyarrs {
+										if util.IsContain(strings.Split(dMap[strconv.Itoa(k)].(string), ","), strconv.Itoa(kk)) {
+											continue
+										}
+										new_m = append(new_m, vk)
+									}
+									new_vv = new_m
+								}
+								newItems[kk] = new_vv
+							}
+						}
+						newMap = append(newMap, newItems)
+					} else {
+						newMap = append(newMap, v)
+					}
+				}
+			}
+			saveData[types+".a_items"] = newMap
+		}
+		if len(saveData) > 0 {
+			flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
+				"$set": saveData,
+			})
+			SetLog(userId, types, 0, session)
+		}
+	} else {
+		types := "o_entniche"
+		dMap, err := util.JsonToMap(deletekey)
+		newMap := []interface{}{}
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		if err == nil && len(dMap) > 0 {
+			data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
+			if data == nil || !ok || len(*data) == 0 {
+				return map[string]interface{}{"flag": flag, "msg": ""}
+			}
+			ojy, _ := (*data)[0][types].(map[string]interface{})
+			a_items, _ := ojy["a_items"].([]interface{})
+			for k, v := range a_items {
+				newItems := map[string]interface{}{}
+				if dMap[strconv.Itoa(k)] != nil {
+					if items, ok := v.(map[string]interface{}); ok && len(items) > 0 {
+						for kk, vv := range items {
+							new_vv := vv
+							new_m := []map[string]interface{}{}
+							if kk == "a_key" {
+								keyarrs := qutil.ObjArrToMapArr(vv.([]interface{}))
+								for kk, vk := range keyarrs {
+									if util.IsContain(strings.Split(dMap[strconv.Itoa(k)].(string), ","), strconv.Itoa(kk)) {
+										continue
+									}
+									new_m = append(new_m, vk)
+								}
+								new_vv = new_m
+							}
+							newItems[kk] = new_vv
+						}
+					}
+					newMap = append(newMap, newItems)
+				} else {
+					newMap = append(newMap, v)
+				}
+			}
+		}
 
-                if len(newMap) > 0 {
-                        flag = db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{
-                                "l_updatetime":       time.Now().Unix(),
-                                "o_entniche.a_items": newMap,
-                        }}, true, false)
-                        SetLog(userId, types, positionType, session)
-                }
+		if len(newMap) > 0 {
+			flag = db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{
+				"l_updatetime":       time.Now().Unix(),
+				"o_entniche.a_items": newMap,
+			}}, true, false)
+			SetLog(userId, types, positionType, session)
+		}
 
-        }
-        return map[string]interface{}{"flag": flag, "msg": ""}
+	}
+	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 //删除分类【可以批量删除】
 func DeleteClass(types, classIndex, userId string, session *httpsession.Session) map[string]interface{} {
-        flag := true
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if positionType != 1 {
-                items, saveData := []interface{}{}, map[string]interface{}{}
-                m := map[string]bool{}
-                for _, v := range strings.Split(classIndex, ",") {
-                        m[v] = true
-                }
-                data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
-                if data != nil && ok && len(*data) > 0 {
-                        ojy, _ := (*data)[types].(map[string]interface{})
-                        a_items, _ := ojy["a_items"].([]interface{})
-                        for k, v := range a_items {
-                                if !m[strconv.Itoa(k)] {
-                                        items = append(items, v)
-                                }
-                        }
-                }
-                saveData[types+".a_items"] = items
+	flag := true
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if positionType != 1 {
+		items, saveData := []interface{}{}, map[string]interface{}{}
+		m := map[string]bool{}
+		for _, v := range strings.Split(classIndex, ",") {
+			m[v] = true
+		}
+		data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
+		if data != nil && ok && len(*data) > 0 {
+			ojy, _ := (*data)[types].(map[string]interface{})
+			a_items, _ := ojy["a_items"].([]interface{})
+			for k, v := range a_items {
+				if !m[strconv.Itoa(k)] {
+					items = append(items, v)
+				}
+			}
+		}
+		saveData[types+".a_items"] = items
 
-                if len(saveData) > 0 {
-                        flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                "$set": saveData,
-                        })
-                        SetLog(userId, types, 0, session)
-                }
-        } else {
-                types := "o_entniche"
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                items := []interface{}{}
-                m := map[string]bool{}
-                for _, v := range strings.Split(classIndex, ",") {
-                        m[v] = true
-                }
-                data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
-                if data == nil || !ok || len(*data) == 0 {
-                        return map[string]interface{}{"flag": flag, "msg": ""}
-                }
-                ojy, _ := (*data)[0][types].(map[string]interface{})
-                a_items, _ := ojy["a_items"].([]interface{})
-                for k, v := range a_items {
-                        if !m[strconv.Itoa(k)] {
-                                items = append(items, v)
-                        }
-                }
+		if len(saveData) > 0 {
+			flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
+				"$set": saveData,
+			})
+			SetLog(userId, types, 0, session)
+		}
+	} else {
+		types := "o_entniche"
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		items := []interface{}{}
+		m := map[string]bool{}
+		for _, v := range strings.Split(classIndex, ",") {
+			m[v] = true
+		}
+		data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
+		if data == nil || !ok || len(*data) == 0 {
+			return map[string]interface{}{"flag": flag, "msg": ""}
+		}
+		ojy, _ := (*data)[0][types].(map[string]interface{})
+		a_items, _ := ojy["a_items"].([]interface{})
+		for k, v := range a_items {
+			if !m[strconv.Itoa(k)] {
+				items = append(items, v)
+			}
+		}
 
-                if len(items) > 0 {
-                        flag = db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{
-                                "l_updatetime":       time.Now().Unix(),
-                                "o_entniche.a_items": items,
-                        }}, true, false)
-                        SetLog(userId, types, positionType, session)
-                }
-        }
-        return map[string]interface{}{"flag": flag, "msg": ""}
+		if len(items) > 0 {
+			flag = db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{
+				"l_updatetime":       time.Now().Unix(),
+				"o_entniche.a_items": items,
+			}}, true, false)
+			SetLog(userId, types, positionType, session)
+		}
+	}
+	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 //创建分类名
 func AddClass(types, classIndex, className, userId string, session *httpsession.Session) map[string]interface{} {
-        flag := true
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if positionType == 0 {
-                saveData := map[string]interface{}{}
-                data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
-                if data != nil && ok && len(*data) > 0 {
-                        ojy, _ := (*data)[types].(map[string]interface{})
-                        a_items, errs := ojy["a_items"].([]interface{})
-                        //没有该字段创建
-                        if !errs {
-                                db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                        "$set": map[string]interface{}{
-                                                "" + types + ".a_items": []map[string]interface{}{},
-                                        },
-                                })
-                        }
-                        sitemsArr := []string{} //分类名称数组
-                        for _, av := range a_items {
-                                _av := qutil.ObjToMap(av)
-                                sitemsArr = append(sitemsArr, qutil.ObjToString((*_av)["s_item"]))
-                        }
-                        if util.IsRepeat(append(sitemsArr, className)) {
-                                return map[string]interface{}{"flag": false, "msg": "分类名称重复"}
-                        }
-                        c_lens := strconv.Itoa(len(a_items))
-                        if ci, _ := strconv.Atoi(classIndex); ci < len(a_items)+1 {
-                                if classIndex == "" || c_lens == classIndex { //新增
-                                        classIndex = strconv.Itoa(len(a_items)) //索引
-                                        saveData[types+".a_items."+classIndex+".a_key"] = []map[string]interface{}{}
-                                }
-                                saveData[types+".a_items."+classIndex+".s_item"] = className
-                                saveData[types+".a_items."+classIndex+".updatetime"] = time.Now().Unix()
-                        }
-                }
+	flag := true
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if positionType == 0 {
+		saveData := map[string]interface{}{}
+		data, ok := db.Mgo.FindById("user", userId, `{"`+types+`.a_items":1}`)
+		if data != nil && ok && len(*data) > 0 {
+			ojy, _ := (*data)[types].(map[string]interface{})
+			a_items, errs := ojy["a_items"].([]interface{})
+			//没有该字段创建
+			if !errs {
+				db.Mgo.UpdateById("user", userId, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"" + types + ".a_items": []map[string]interface{}{},
+					},
+				})
+			}
+			sitemsArr := []string{} //分类名称数组
+			for _, av := range a_items {
+				_av := qutil.ObjToMap(av)
+				sitemsArr = append(sitemsArr, qutil.ObjToString((*_av)["s_item"]))
+			}
+			if util.IsRepeat(append(sitemsArr, className)) {
+				return map[string]interface{}{"flag": false, "msg": "分类名称重复"}
+			}
+			c_lens := strconv.Itoa(len(a_items))
+			if ci, _ := strconv.Atoi(classIndex); ci < len(a_items)+1 {
+				if classIndex == "" || c_lens == classIndex { //新增
+					classIndex = strconv.Itoa(len(a_items)) //索引
+					saveData[types+".a_items."+classIndex+".a_key"] = []map[string]interface{}{}
+				}
+				saveData[types+".a_items."+classIndex+".s_item"] = className
+				saveData[types+".a_items."+classIndex+".updatetime"] = time.Now().Unix()
+			}
+		}
 
-                if len(saveData) > 0 {
-                        flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
-                                "$set": saveData,
-                        })
-                        SetLog(userId, types, 0, session)
-                }
-        } else {
-                types := "o_entniche"
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                saveData := map[string]interface{}{}
-                data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
-                a_items := []interface{}{}
-                if data == nil || !ok || len(*data) == 0 {
-                        db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                                "$set": map[string]interface{}{
-                                        "o_entniche.a_items": []map[string]interface{}{},
-                                        "l_updatetime":       time.Now().Unix(),
-                                }}, true, false)
+		if len(saveData) > 0 {
+			flag = db.Mgo.UpdateById("user", userId, map[string]interface{}{
+				"$set": saveData,
+			})
+			SetLog(userId, types, 0, session)
+		}
+	} else {
+		types := "o_entniche"
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		saveData := map[string]interface{}{}
+		data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
+		a_items := []interface{}{}
+		if data == nil || !ok || len(*data) == 0 {
+			db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+				"$set": map[string]interface{}{
+					"o_entniche.a_items": []map[string]interface{}{},
+					"l_updatetime":       time.Now().Unix(),
+				}}, true, false)
 
-                } else {
-                        ojy, _ := (*data)[0][types].(map[string]interface{})
-                        a_items, _ = ojy["a_items"].([]interface{})
-                }
+		} else {
+			ojy, _ := (*data)[0][types].(map[string]interface{})
+			a_items, _ = ojy["a_items"].([]interface{})
+		}
 
-                sitemsArr := []string{} //分类名称数组
-                for _, av := range a_items {
-                        _av := qutil.ObjToMap(av)
-                        sitemsArr = append(sitemsArr, qutil.ObjToString((*_av)["s_item"]))
-                }
-                if util.IsRepeat(append(sitemsArr, className)) {
-                        return map[string]interface{}{"flag": false, "msg": "分类名称重复"}
-                }
-                c_lens := strconv.Itoa(len(a_items))
-                if ci, _ := strconv.Atoi(classIndex); ci < len(a_items)+1 {
-                        if classIndex == "" || c_lens == classIndex { //新增
-                                classIndex = strconv.Itoa(len(a_items)) //索引
-                                saveData[types+".a_items."+classIndex+".a_key"] = []map[string]interface{}{}
-                        }
-                        saveData[types+".a_items."+classIndex+".s_item"] = className
-                        saveData[types+".a_items."+classIndex+".updatetime"] = time.Now().Unix()
+		sitemsArr := []string{} //分类名称数组
+		for _, av := range a_items {
+			_av := qutil.ObjToMap(av)
+			sitemsArr = append(sitemsArr, qutil.ObjToString((*_av)["s_item"]))
+		}
+		if util.IsRepeat(append(sitemsArr, className)) {
+			return map[string]interface{}{"flag": false, "msg": "分类名称重复"}
+		}
+		c_lens := strconv.Itoa(len(a_items))
+		if ci, _ := strconv.Atoi(classIndex); ci < len(a_items)+1 {
+			if classIndex == "" || c_lens == classIndex { //新增
+				classIndex = strconv.Itoa(len(a_items)) //索引
+				saveData[types+".a_items."+classIndex+".a_key"] = []map[string]interface{}{}
+			}
+			saveData[types+".a_items."+classIndex+".s_item"] = className
+			saveData[types+".a_items."+classIndex+".updatetime"] = time.Now().Unix()
 
-                }
-                saveData["l_updatetime"] = time.Now().Unix()
-                if len(saveData) > 0 {
-                        flag = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                                "$set": saveData,
-                        }, true, false)
-                        SetLog(userId, types, positionType, session)
-                }
-        }
-        return map[string]interface{}{"flag": flag, "msg": ""}
+		}
+		saveData["l_updatetime"] = time.Now().Unix()
+		if len(saveData) > 0 {
+			flag = db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+				"$set": saveData,
+			}, true, false)
+			SetLog(userId, types, positionType, session)
+		}
+	}
+	return map[string]interface{}{"flag": flag, "msg": ""}
 
 }
 
 //关键词判重
 func KeyWordsRepeat(obj map[string]interface{}, aitems []interface{}) bool {
-        // 录入的关键词
-        key, _ := obj["key"].([]string)
-        notkey, _ := obj["notkey"].([]string)
-        matchway, _ := obj["matchway"].(int) //matchway 0:精准匹配 1:模糊匹配
-        appendkey, _ := obj["appendkey"].([]string)
-        if util.IsRepeat(key) || util.IsRepeat(appendkey) {
-                return true
-        }
-        // 录入的关键词
-        for _, v := range aitems {
-                if items, ok := v.(map[string]interface{}); ok && len(items) > 0 {
-                        for kk, vv := range items {
-                                if kk == "a_key" {
-                                        for _, n := range qutil.ObjArrToMapArr(vv.([]interface{})) {
-                                                db_not := []string{}
-                                                db_key := []string{}
-                                                db_append := []string{}
-                                                if n["key"] != nil {
-                                                        db_key = qutil.ObjArrToStringArr(n["key"].([]interface{}))
-                                                }
-                                                if n["notkey"] != nil {
-                                                        db_not = qutil.ObjArrToStringArr(n["notkey"].([]interface{}))
-                                                }
-                                                if n["appendkey"] != nil {
-                                                        db_append = qutil.ObjArrToStringArr(n["appendkey"].([]interface{}))
-                                                }
-                                                if util.StringArrEqual(key, db_key) && util.StringArrEqual(notkey, db_not) && qutil.IntAllDef(n["matchway"], 0) == matchway && util.StringArrEqual(appendkey, db_append) {
-                                                        return true
-                                                }
-                                        }
-                                }
-                        }
-                }
-        }
-        return false
+	// 录入的关键词
+	key, _ := obj["key"].([]string)
+	notkey, _ := obj["notkey"].([]string)
+	matchway, _ := obj["matchway"].(int) //matchway 0:精准匹配 1:模糊匹配
+	appendkey, _ := obj["appendkey"].([]string)
+	if util.IsRepeat(key) || util.IsRepeat(appendkey) {
+		return true
+	}
+	// 录入的关键词
+	for _, v := range aitems {
+		if items, ok := v.(map[string]interface{}); ok && len(items) > 0 {
+			for kk, vv := range items {
+				if kk == "a_key" {
+					for _, n := range qutil.ObjArrToMapArr(vv.([]interface{})) {
+						db_not := []string{}
+						db_key := []string{}
+						db_append := []string{}
+						if n["key"] != nil {
+							db_key = qutil.ObjArrToStringArr(n["key"].([]interface{}))
+						}
+						if n["notkey"] != nil {
+							db_not = qutil.ObjArrToStringArr(n["notkey"].([]interface{}))
+						}
+						if n["appendkey"] != nil {
+							db_append = qutil.ObjArrToStringArr(n["appendkey"].([]interface{}))
+						}
+						if util.StringArrEqual(key, db_key) && util.StringArrEqual(notkey, db_not) && qutil.IntAllDef(n["matchway"], 0) == matchway && util.StringArrEqual(appendkey, db_append) {
+							return true
+						}
+					}
+				}
+			}
+		}
+	}
+	return false
 }
 
 type UpdateOther struct {
-        PageType        string //projectMatch项目匹配  saveSeniorset关键词匹配方式  infoType信息类型
-        Pmindex         int    //1项目匹配开启 0项目匹配关闭
-        InfoTypeArr     string //信息类型
-        Matchtype       int    //1标题匹配 2项目匹配
-        UserId          string
-        Type            string
-        OtherBuyerclass int //其它采购单位
-        EntId           int
-        EntUserId       int
-        Session         *httpsession.Session
+	PageType        string //projectMatch项目匹配  saveSeniorset关键词匹配方式  infoType信息类型
+	Pmindex         int    //1项目匹配开启 0项目匹配关闭
+	InfoTypeArr     string //信息类型
+	Matchtype       int    //1标题匹配 2项目匹配
+	UserId          string
+	Type            string
+	OtherBuyerclass int //其它采购单位
+	EntId           int
+	EntUserId       int
+	Session         *httpsession.Session
 }
 
 func (this *UpdateOther) UpdateOther() map[string]interface{} {
-        power := jy.GetBigVipUserBaseMsg("10000", this.Session, config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-        positionType := qutil.Int64All(this.Session.Get("positionType"))
-        if this.Type == "m" && power.Status < 0 {
-                return map[string]interface{}{"flag": false, "msg": "暂无权限"}
-        }
-        types := "o_jy"
-        if this.Type == "m" {
-                types = "o_member_jy"
-        } else if this.Type == "v" {
-                types = "o_vipjy"
-        }
-        if positionType == 1 {
-                types = "o_entniche"
-        }
-        setMap := func() map[string]interface{} {
-                switch this.PageType {
-                case "projectMatch": //项目匹配
-                        return UpdateProjectMatch(types, this.Pmindex)
-                case "saveSeniorset": //关键词匹配方式
-                        return UpdateSaveSeniorset(types, this.Matchtype)
-                case "infoType": //信息类型
-                        return UpdateInfoType(types, this.InfoTypeArr)
-                case "other_buyerclass":
-                        return UpdateOtherBuyerClass(types, this.OtherBuyerclass)
-                case "keytip": //关键词升级弹窗提示(一个用户只提示一次)
-                        return UpdateKeyTip(types)
-                }
-                return nil
-        }()
-        flag := true
-        if types == "o_jy" {
-                // setMap["o_jy.i_newfree"] = 1 //老免费用户=>新订阅设置页面 20211122
-        }
-        if setMap != nil {
-                if positionType == 1 {
-                        query := map[string]interface{}{
-                                "i_userid": this.EntUserId,
-                                "i_entid":  this.EntId,
-                                "i_type":   1,
-                        }
-                        if db.Mgo.Update("entniche_rule", query, map[string]interface{}{
-                                "$set": setMap,
-                        }, true, false) {
-                                flag = true
-                                //清楚缓存
-                                jy.ClearBigVipUserPower(this.UserId)
-                        }
-                        SetLog(this.UserId, types, positionType, this.Session)
-                } else {
-                        query := map[string]interface{}{
-                                "i_userid": this.EntUserId,
-                                "i_entid":  this.EntId,
-                        }
-                        setMap["l_updatetime"] = time.Now().Unix()
-                        flag = db.Mgo.Update("entniche_rule", query, bson.M{"$set": setMap}, true, false)
-                        if flag {
-                                flag = true
-                                //清楚缓存
-                                jy.ClearBigVipUserPower(this.UserId)
-                        }
-                        SetLog(this.UserId, types, positionType, this.Session)
+	power := jy.GetBigVipUserBaseMsg("10000", this.Session, config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	positionType := qutil.Int64All(this.Session.Get("positionType"))
+	if this.Type == "m" && power.Status < 0 {
+		return map[string]interface{}{"flag": false, "msg": "暂无权限"}
+	}
+	types := "o_jy"
+	if this.Type == "m" {
+		types = "o_member_jy"
+	} else if this.Type == "v" {
+		types = "o_vipjy"
+	}
+	if positionType == 1 {
+		types = "o_entniche"
+	}
+	setMap := func() map[string]interface{} {
+		switch this.PageType {
+		case "projectMatch": //项目匹配
+			return UpdateProjectMatch(types, this.Pmindex)
+		case "saveSeniorset": //关键词匹配方式
+			return UpdateSaveSeniorset(types, this.Matchtype)
+		case "infoType": //信息类型
+			return UpdateInfoType(types, this.InfoTypeArr)
+		case "other_buyerclass":
+			return UpdateOtherBuyerClass(types, this.OtherBuyerclass)
+		case "keytip": //关键词升级弹窗提示(一个用户只提示一次)
+			return UpdateKeyTip(types)
+		}
+		return nil
+	}()
+	flag := true
+	if types == "o_jy" {
+		// setMap["o_jy.i_newfree"] = 1 //老免费用户=>新订阅设置页面 20211122
+	}
+	if setMap != nil {
+		if positionType == 1 {
+			query := map[string]interface{}{
+				"i_userid": this.EntUserId,
+				"i_entid":  this.EntId,
+				"i_type":   1,
+			}
+			if db.Mgo.Update("entniche_rule", query, map[string]interface{}{
+				"$set": setMap,
+			}, true, false) {
+				flag = true
+				//清楚缓存
+				jy.ClearBigVipUserPower(this.UserId)
+			}
+			SetLog(this.UserId, types, positionType, this.Session)
+		} else {
+			query := map[string]interface{}{
+				"i_userid": this.EntUserId,
+				"i_entid":  this.EntId,
+			}
+			setMap["l_updatetime"] = time.Now().Unix()
+			flag = db.Mgo.Update("entniche_rule", query, bson.M{"$set": setMap}, true, false)
+			if flag {
+				flag = true
+				//清楚缓存
+				jy.ClearBigVipUserPower(this.UserId)
+			}
+			SetLog(this.UserId, types, positionType, this.Session)
 
-                }
+		}
 
-        }
-        return map[string]interface{}{"flag": flag, "msg": ""}
+	}
+	return map[string]interface{}{"flag": flag, "msg": ""}
 }
 
 //
 func UpdateProjectMatch(types string, pmindex int) map[string]interface{} {
-        return map[string]interface{}{
-                types + ".i_projectmatch": pmindex,
-        }
+	return map[string]interface{}{
+		types + ".i_projectmatch": pmindex,
+	}
 }
 
 //
 func UpdateSaveSeniorset(types string, matchtype int) map[string]interface{} {
-        return map[string]interface{}{
-                types + ".i_matchway": matchtype,
-        }
+	return map[string]interface{}{
+		types + ".i_matchway": matchtype,
+	}
 }
 
 //
 func UpdateInfoType(types string, infotype string) map[string]interface{} {
-        if infotype != "" {
-                return map[string]interface{}{
-                        types + ".a_infotype": strings.Split(infotype, ","),
-                }
-        } else {
-                return map[string]interface{}{
-                        types + ".a_infotype": []string{},
-                }
-        }
+	if infotype != "" {
+		return map[string]interface{}{
+			types + ".a_infotype": strings.Split(infotype, ","),
+		}
+	} else {
+		return map[string]interface{}{
+			types + ".a_infotype": []string{},
+		}
+	}
 }
 
 //
 func UpdateOtherBuyerClass(types string, other int) map[string]interface{} {
-        return map[string]interface{}{
-                types + ".i_matchbuyerclass_other": other,
-        }
+	return map[string]interface{}{
+		types + ".i_matchbuyerclass_other": other,
+	}
 }
 
 //UpdateKeyTip 关键词升级提示
 func UpdateKeyTip(types string) map[string]interface{} {
-        return map[string]interface{}{
-                types + ".b_keytip": true,
-        }
+	return map[string]interface{}{
+		types + ".b_keytip": true,
+	}
 }
 
 func directSubKWS(updateItems string, keys string, userId string, session *httpsession.Session) map[string]interface{} {
-        flag := "n"
-        positionType := qutil.Int64All(session.Get("positionType"))
-        if positionType == 0 {
-                data, ok := db.Mgo.FindById("user", userId, fmt.Sprintf(`{"%s":1}`, updateItems))
-                var repleat = false
-                var classify_index = -1
-                var kwsCount = 0
-                if len([]rune(keys)) > 20 {
-                        keys = qutil.SubString(keys, 0, 20)
-                }
-                if ok && data != nil && len(*data) > 0 && keys != "" {
-                        updateObj, _ := (*data)[updateItems].(map[string]interface{})
-                        if updateObj["a_items"] != nil {
-                                a_items := updateObj["a_items"].([]interface{})
-                                for k, v := range a_items {
-                                        tmp := qutil.ObjToMap(v.(map[string]interface{}))
-                                        a_key := (*tmp)["a_key"].([]interface{})
-                                        kwsCount = kwsCount + len(a_key)
-                                        if (*tmp)["s_item"] == "未分类" {
-                                                classify_index = k
-                                        }
-                                        for _, n := range a_key {
-                                                ntmp := qutil.ObjToMap(n.(interface{}))
-                                                nkey := qutil.ObjArrToStringArr((*ntmp)["key"].([]interface{}))
-                                                if strings.Join(nkey, " ") == keys {
-                                                        repleat = true
-                                                        break
-                                                }
-                                        }
-                                        if repleat {
-                                                break
-                                        }
-                                }
-                                if classify_index == -1 {
-                                        classify_index = len(a_items)
-                                }
-                        } else {
-                                //无关键词 直接添加
-                                if ok := db.Mgo.UpdateById("user", userId, bson.M{"$set": bson.M{fmt.Sprintf("%s.a_items", updateItems): bson.A{bson.M{"s_item": "未分类",
-                                        "a_key":        bson.A{bson.M{"key": bson.A{keys}}},
-                                        "l_modifydate": time.Now().Unix()}}}}); ok {
-                                        flag = "y"
-                                }
-                                return map[string]interface{}{"flag": flag}
-                        }
-                        if repleat {
-                                flag = "o"
-                        } else if kwsCount >= 300 {
-                                flag = "m"
-                        } else {
-                                var _key = make(map[string]interface{})
-                                var a_key = make([]map[string]interface{}, 1)
-                                classify_name := "未分类"
-                                _key["key"] = strings.Split(keys, " ")
-                                a_key[0] = _key
-                                if len(a_key) > 0 {
-                                        ok := db.Mgo.UpdateById("user", userId, bson.M{
-                                                "$push": bson.M{
-                                                        updateItems + ".a_items." + strconv.Itoa(classify_index) + ".a_key": bson.M{
-                                                                "$each": a_key,
-                                                        },
-                                                },
-                                                "$set": bson.M{
-                                                        updateItems + ".l_modifydate":                                        time.Now().Unix(),
-                                                        updateItems + ".a_items." + strconv.Itoa(classify_index) + ".s_item": classify_name,
-                                                },
-                                        })
-                                        if ok {
-                                                flag = "y"
-                                        }
-                                }
-                        }
-                }
-        } else {
-                updateItems = "o_entniche"
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
-                var repleat = false
-                var classify_index = -1
-                var kwsCount = 0
-                if len([]rune(keys)) > 20 {
-                        keys = qutil.SubString(keys, 0, 20)
-                }
-                if ok && data != nil && len(*data) > 0 && keys != "" {
-                        updateObj, _ := (*data)[0]["o_entniche"].(map[string]interface{})
-                        if updateObj["a_items"] != nil {
-                                a_items := updateObj["a_items"].([]interface{})
-                                for k, v := range a_items {
-                                        tmp := qutil.ObjToMap(v.(map[string]interface{}))
-                                        a_key := (*tmp)["a_key"].([]interface{})
-                                        kwsCount = kwsCount + len(a_key)
-                                        if (*tmp)["s_item"] == "未分类" {
-                                                classify_index = k
-                                        }
-                                        for _, n := range a_key {
-                                                ntmp := qutil.ObjToMap(n.(interface{}))
-                                                nkey := qutil.ObjArrToStringArr((*ntmp)["key"].([]interface{}))
-                                                if strings.Join(nkey, " ") == keys {
-                                                        repleat = true
-                                                        break
-                                                }
-                                        }
-                                        if repleat {
-                                                break
-                                        }
-                                }
-                                if classify_index == -1 {
-                                        classify_index = len(a_items)
-                                }
-                        } else {
-                                //无关键词 直接添加
-                                if ok := db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{"o_entniche.a_items": bson.A{bson.M{"s_item": "未分类",
-                                        "a_key":      bson.A{bson.M{"key": bson.A{keys}}},
-                                        "updatetime": time.Now().Unix()}},
-                                        "l_updatetime": time.Now().Unix(),
-                                }}, true, false); ok {
-                                        flag = "y"
-                                }
-                                return map[string]interface{}{"flag": flag}
-                        }
-                        if repleat {
-                                flag = "o"
-                        } else if kwsCount >= 300 {
-                                flag = "m"
-                        } else {
-                                var _key = make(map[string]interface{})
-                                var a_key = make([]map[string]interface{}, 1)
-                                classify_name := "未分类"
-                                _key["key"] = strings.Split(keys, " ")
-                                a_key[0] = _key
-                                if len(a_key) > 0 {
-                                        ok := db.Mgo.Update("entniche_rule", query, bson.M{
+	flag := "n"
+	positionType := qutil.Int64All(session.Get("positionType"))
+	if positionType == 0 {
+		data, ok := db.Mgo.FindById("user", userId, fmt.Sprintf(`{"%s":1}`, updateItems))
+		var repleat = false
+		var classify_index = -1
+		var kwsCount = 0
+		if len([]rune(keys)) > 20 {
+			keys = qutil.SubString(keys, 0, 20)
+		}
+		if ok && data != nil && len(*data) > 0 && keys != "" {
+			updateObj, _ := (*data)[updateItems].(map[string]interface{})
+			if updateObj["a_items"] != nil {
+				a_items := updateObj["a_items"].([]interface{})
+				for k, v := range a_items {
+					tmp := qutil.ObjToMap(v.(map[string]interface{}))
+					a_key := (*tmp)["a_key"].([]interface{})
+					kwsCount = kwsCount + len(a_key)
+					if (*tmp)["s_item"] == "未分类" {
+						classify_index = k
+					}
+					for _, n := range a_key {
+						ntmp := qutil.ObjToMap(n.(interface{}))
+						nkey := qutil.ObjArrToStringArr((*ntmp)["key"].([]interface{}))
+						if strings.Join(nkey, " ") == keys {
+							repleat = true
+							break
+						}
+					}
+					if repleat {
+						break
+					}
+				}
+				if classify_index == -1 {
+					classify_index = len(a_items)
+				}
+			} else {
+				//无关键词 直接添加
+				if ok := db.Mgo.UpdateById("user", userId, bson.M{"$set": bson.M{fmt.Sprintf("%s.a_items", updateItems): bson.A{bson.M{"s_item": "未分类",
+					"a_key":        bson.A{bson.M{"key": bson.A{keys}}},
+					"l_modifydate": time.Now().Unix()}}}}); ok {
+					flag = "y"
+				}
+				return map[string]interface{}{"flag": flag}
+			}
+			if repleat {
+				flag = "o"
+			} else if kwsCount >= 300 {
+				flag = "m"
+			} else {
+				var _key = make(map[string]interface{})
+				var a_key = make([]map[string]interface{}, 1)
+				classify_name := "未分类"
+				_key["key"] = strings.Split(keys, " ")
+				a_key[0] = _key
+				if len(a_key) > 0 {
+					ok := db.Mgo.UpdateById("user", userId, bson.M{
+						"$push": bson.M{
+							updateItems + ".a_items." + strconv.Itoa(classify_index) + ".a_key": bson.M{
+								"$each": a_key,
+							},
+						},
+						"$set": bson.M{
+							updateItems + ".l_modifydate":                                        time.Now().Unix(),
+							updateItems + ".a_items." + strconv.Itoa(classify_index) + ".s_item": classify_name,
+						},
+					})
+					if ok {
+						flag = "y"
+					}
+				}
+			}
+		}
+	} else {
+		updateItems = "o_entniche"
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		data, ok := db.Mgo.Find("entniche_rule", query, `{"o_entniche.a_items":1}`, nil, false, -1, -1)
+		var repleat = false
+		var classify_index = -1
+		var kwsCount = 0
+		if len([]rune(keys)) > 20 {
+			keys = qutil.SubString(keys, 0, 20)
+		}
+		if ok && data != nil && len(*data) > 0 && keys != "" {
+			updateObj, _ := (*data)[0]["o_entniche"].(map[string]interface{})
+			if updateObj["a_items"] != nil {
+				a_items := updateObj["a_items"].([]interface{})
+				for k, v := range a_items {
+					tmp := qutil.ObjToMap(v.(map[string]interface{}))
+					a_key := (*tmp)["a_key"].([]interface{})
+					kwsCount = kwsCount + len(a_key)
+					if (*tmp)["s_item"] == "未分类" {
+						classify_index = k
+					}
+					for _, n := range a_key {
+						ntmp := qutil.ObjToMap(n.(interface{}))
+						nkey := qutil.ObjArrToStringArr((*ntmp)["key"].([]interface{}))
+						if strings.Join(nkey, " ") == keys {
+							repleat = true
+							break
+						}
+					}
+					if repleat {
+						break
+					}
+				}
+				if classify_index == -1 {
+					classify_index = len(a_items)
+				}
+			} else {
+				//无关键词 直接添加
+				if ok := db.Mgo.Update("entniche_rule", query, bson.M{"$set": bson.M{"o_entniche.a_items": bson.A{bson.M{"s_item": "未分类",
+					"a_key":      bson.A{bson.M{"key": bson.A{keys}}},
+					"updatetime": time.Now().Unix()}},
+					"l_updatetime": time.Now().Unix(),
+				}}, true, false); ok {
+					flag = "y"
+				}
+				return map[string]interface{}{"flag": flag}
+			}
+			if repleat {
+				flag = "o"
+			} else if kwsCount >= 300 {
+				flag = "m"
+			} else {
+				var _key = make(map[string]interface{})
+				var a_key = make([]map[string]interface{}, 1)
+				classify_name := "未分类"
+				_key["key"] = strings.Split(keys, " ")
+				a_key[0] = _key
+				if len(a_key) > 0 {
+					ok := db.Mgo.Update("entniche_rule", query, bson.M{
 
-                                                "$push": bson.M{
-                                                        updateItems + ".a_items." + strconv.Itoa(classify_index) + ".a_key": bson.M{
-                                                                "$each": a_key,
-                                                        },
-                                                },
-                                                "$set": bson.M{
-                                                        "l_updatetime": time.Now().Unix(),
-                                                        updateItems + ".a_items." + strconv.Itoa(classify_index) + ".s_item":     classify_name,
-                                                        updateItems + ".a_items." + strconv.Itoa(classify_index) + ".updatetime": time.Now().Unix(),
-                                                },
-                                        }, true, false)
-                                        if ok {
-                                                flag = "y"
-                                        }
-                                }
-                        }
-                }
-        }
-        return map[string]interface{}{"flag": flag}
+						"$push": bson.M{
+							updateItems + ".a_items." + strconv.Itoa(classify_index) + ".a_key": bson.M{
+								"$each": a_key,
+							},
+						},
+						"$set": bson.M{
+							"l_updatetime": time.Now().Unix(),
+							updateItems + ".a_items." + strconv.Itoa(classify_index) + ".s_item":     classify_name,
+							updateItems + ".a_items." + strconv.Itoa(classify_index) + ".updatetime": time.Now().Unix(),
+						},
+					}, true, false)
+					if ok {
+						flag = "y"
+					}
+				}
+			}
+		}
+	}
+	return map[string]interface{}{"flag": flag}
 }
 
 //订阅设置记录
 func SetLog(userid, types string, power int64, session *httpsession.Session) {
-        if power == 1 {
-                query := map[string]interface{}{
-                        "i_userid": qutil.IntAll(session.Get("entUserId")),
-                        "i_entid":  qutil.IntAll(session.Get("entId")),
-                        "i_type":   1,
-                }
-                res, _ := db.Mgo.FindOne("entniche_rule", query)
-                if res != nil && len(*res) > 0 {
-                        (*res)["userid"] = userid
-                        (*res)["type"] = types
-                        (*res)["createtime"] = time.Now().Unix()
-                        db.Mgo_Log.Save("ovipjy_log", res)
-                }
-        } else {
-                if data, ok := db.Mgo.FindById("user", userid, `{"o_vipjy":1,"o_member_jy":1,"o_jy":1}`); len(*data) > 0 && ok && data != nil {
-                        (*data)["userid"] = userid
-                        (*data)["type"] = types
-                        (*data)["createtime"] = time.Now().Unix()
-                        db.Mgo_Log.Save("ovipjy_log", data)
-                }
-        }
+	if power == 1 {
+		query := map[string]interface{}{
+			"i_userid": qutil.IntAll(session.Get("entUserId")),
+			"i_entid":  qutil.IntAll(session.Get("entId")),
+			"i_type":   1,
+		}
+		res, _ := db.Mgo.FindOne("entniche_rule", query)
+		if res != nil && len(*res) > 0 {
+			(*res)["userid"] = userid
+			(*res)["type"] = types
+			(*res)["createtime"] = time.Now().Unix()
+			db.Mgo_Log.Save("ovipjy_log", res)
+		}
+	} else {
+		if data, ok := db.Mgo.FindById("user", userid, `{"o_vipjy":1,"o_member_jy":1,"o_jy":1}`); len(*data) > 0 && ok && data != nil {
+			(*data)["userid"] = userid
+			(*data)["type"] = types
+			(*data)["createtime"] = time.Now().Unix()
+			db.Mgo_Log.Save("ovipjy_log", data)
+		}
+	}
 }

+ 306 - 306
src/jfw/modules/publicapply/src/subscribePush/service/pushList.go

@@ -1,307 +1,307 @@
 package service
 
 import (
-        "encoding/json"
-        "fmt"
-        "jy/src/jfw/modules/publicapply/src/config"
-        "jy/src/jfw/modules/publicapply/src/db"
-        "jy/src/jfw/modules/publicapply/src/me"
-        "jy/src/jfw/modules/publicapply/src/subscribePush/entity"
-        "log"
-        "time"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/publicapply/src/config"
+	"jy/src/jfw/modules/publicapply/src/db"
+	"jy/src/jfw/modules/publicapply/src/me"
+	"jy/src/jfw/modules/publicapply/src/subscribePush/entity"
+	"log"
+	"time"
 
-        . "app.yhyue.com/moapp/jybase/api"
-        util "app.yhyue.com/moapp/jybase/common"
-        "app.yhyue.com/moapp/jybase/encrypt"
-        "app.yhyue.com/moapp/jybase/redis"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	. "app.yhyue.com/moapp/jybase/api"
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 type SubscribePush struct {
-        *xweb.Action
-        hasPushHistory  xweb.Mapper `xweb:"/subscribe/historyPush"`         //推送历史查询
-        historyPaging   xweb.Mapper `xweb:"/subscribe/historyPaging"`       //推送历史翻页
-        setRead         xweb.Mapper `xweb:"/subscribe/setRead"`             //推送记录已读
-        keywordUpdate   xweb.Mapper `xweb:"/subscribe/keywordUpdate"`       //订阅词修改
-        pushSetting     xweb.Mapper `xweb:"/subscribe/pushSetting"`         //推送设置
-        vipSwitch       xweb.Mapper `xweb:"/subscribe/vipSwitch"`           //大会员、超级订阅切换
-        getPushCount    xweb.Mapper `xweb:"/subscribe/keyset/getPushCount"` //近3个月匹配数量【某组关键词】
-        getPushAllCount xweb.Mapper `xweb:"/subscribe/getPushAllCount"`     //全部关键词-推送结果预览总数
+	*xweb.Action
+	hasPushHistory  xweb.Mapper `xweb:"/subscribe/historyPush"`         //推送历史查询
+	historyPaging   xweb.Mapper `xweb:"/subscribe/historyPaging"`       //推送历史翻页
+	setRead         xweb.Mapper `xweb:"/subscribe/setRead"`             //推送记录已读
+	keywordUpdate   xweb.Mapper `xweb:"/subscribe/keywordUpdate"`       //订阅词修改
+	pushSetting     xweb.Mapper `xweb:"/subscribe/pushSetting"`         //推送设置
+	vipSwitch       xweb.Mapper `xweb:"/subscribe/vipSwitch"`           //大会员、超级订阅切换
+	getPushCount    xweb.Mapper `xweb:"/subscribe/keyset/getPushCount"` //近3个月匹配数量【某组关键词】
+	getPushAllCount xweb.Mapper `xweb:"/subscribe/getPushAllCount"`     //全部关键词-推送结果预览总数
 }
 
 // VipSwitch 大会员、超级订阅、商机管理切换
 func (sp *SubscribePush) VipSwitch() {
-        userId, _ := sp.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                if userId == "" {
-                        return nil, fmt.Errorf("未登录")
-                }
-                switchOk := false
-                vt := sp.GetString("vt")
-                if vt == "" {
-                        vt = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo, db.Mysql)
-                } else if vt == jy.SubVipFlag {
-                        vipMsg := jy.GetBigVipUserBaseMsg("10000", sp.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-                        if vipMsg.VipStatus <= 0 {
-                                return nil, fmt.Errorf("未购买超级订阅")
-                        }
-                        sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
-                        switchOk = true
-                } else if vt == jy.MemberFlag {
-                        vipMsg := jy.GetBigVipUserBaseMsg("10000", sp.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-                        if vipMsg.Status <= 0 {
-                                return nil, fmt.Errorf("未购买大会员")
-                        }
-                        sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
-                        switchOk = true
-                } else if vt == jy.EntnicheFlag {
-                        vipMsg := jy.GetEntnicheState(userId, db.Mysql, db.Mgo)
-                        if vipMsg.EntnicheStatus <= 0 {
-                                return nil, fmt.Errorf("未购买商机管理")
-                        }
-                        sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Entniche)
-                        switchOk = true
-                } else {
-                        return nil, fmt.Errorf("未知请求")
-                }
-                return map[string]interface{}{
-                        "vt":   util.ObjToString(sp.GetSession(jy.SwitchService.SessionKey)),
-                        "flag": switchOk,
-                }, nil
-        }()
-        if errMsg != nil {
-                log.Printf("%s SubscribePush VipSwitch异常:%s\n", userId, errMsg.Error())
-        }
-        sp.ServeJson(NewResult(rData, errMsg))
+	userId, _ := sp.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		if userId == "" {
+			return nil, fmt.Errorf("未登录")
+		}
+		switchOk := false
+		vt := sp.GetString("vt")
+		if vt == "" {
+			vt = jy.SwitchService.GetEntniche(sp.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+		} else if vt == jy.SubVipFlag {
+			vipMsg := jy.GetBigVipUserBaseMsg("10000", sp.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+			if vipMsg.VipStatus <= 0 {
+				return nil, fmt.Errorf("未购买超级订阅")
+			}
+			sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
+			switchOk = true
+		} else if vt == jy.MemberFlag {
+			vipMsg := jy.GetBigVipUserBaseMsg("10000", sp.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+			if vipMsg.Status <= 0 {
+				return nil, fmt.Errorf("未购买大会员")
+			}
+			sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
+			switchOk = true
+		} else if vt == jy.EntnicheFlag {
+			vipMsg := jy.GetEntnicheState(userId, db.Mysql, db.Mgo)
+			if vipMsg.EntnicheStatus <= 0 {
+				return nil, fmt.Errorf("未购买商机管理")
+			}
+			sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Entniche)
+			switchOk = true
+		} else {
+			return nil, fmt.Errorf("未知请求")
+		}
+		return map[string]interface{}{
+			"vt":   util.ObjToString(sp.GetSession(jy.SwitchService.SessionKey)),
+			"flag": switchOk,
+		}, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s SubscribePush VipSwitch异常:%s\n", userId, errMsg.Error())
+	}
+	sp.ServeJson(NewResult(rData, errMsg))
 }
 
 // HasPushHistory 大会员、超级订阅,商机管理推送历史 (原wx推送更改)
 func (sp *SubscribePush) HasPushHistory() {
-        userId := util.ObjToString(sp.GetSession("userId"))
-        if userId == "" {
-                return
-        }
-        _userId := userId
-        vipType := sp.GetString("vt")
-        if vipType == "" { //默认取已切换的企业
-                vipType = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo, db.Mysql)
-        }
-        if vipType == jy.SwitchService.Entniche {
-                userId = fmt.Sprint(util.IntAll(sp.GetSession("entUserId")))
-        }
-        //entId := util.IntAll(sp.GetSession("entId"))
-        go entity.HistoryPush.UpdateUserPushUnread(userId, vipType)
-        user, _ := jy.NewSubscribePush().UserInfo(db.Mgo, userId)
-        hasKeyFlag, industry_ := me.GetKeySet(vipType, sp.Session())
-        var isVipFlag, isPassCount, isread, otherFlag bool = false, false, false, false
-        isExpire, isOnTail := -1, 0
-        todayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
-        if user != nil {
-                //超级订阅
-                if util.IntAll((*user)["i_vip_status"]) == 1 || util.IntAll((*user)["i_vip_status"]) == 2 {
-                        var threeRemind = int64(3 * 24 * 60 * 60)
-                        var twoRemind = int64(2 * 24 * 60 * 60)
-                        var oneRemind = int64(1 * 24 * 60 * 60)
-                        if (*user)["isread"] != nil {
-                                isread = (*user)["isread"].(bool)
-                        }
-                        isVipFlag = true
-                        isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 2000
-                        isOnTail = util.IntAll((*user)["i_vip_status"])
-                        _endtime := (*user)["l_vip_endtime"]
-                        //是否到期
-                        if util.Int64All(_endtime)-time.Now().Unix() < threeRemind && util.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
-                                isExpire = 3 //即将到期
-                        } else if util.Int64All(_endtime)-time.Now().Unix() < twoRemind && util.Int64All(_endtime)-time.Now().Unix() >= oneRemind {
-                                isExpire = 2 //即将到期
-                        } else if util.Int64All(_endtime)-time.Now().Unix() < oneRemind && util.Int64All(_endtime)-time.Now().Unix() >= 0 {
-                                isExpire = 1 //即将到期
-                        }
-                        //判断首次用户是否推送的带有”其他“
-                        t, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local)
-                        today_1 := t.Unix()
-                        today_2 := t.AddDate(0, 0, 1).Unix()
-                        if db.MysqlPush.CountBySql("select count(1) as count from pushsubscribe where isvip =1 and userid =? and buyerclass=?  and (date between ? and ? )", userId, 93, today_1, today_2) > 0 {
-                                otherFlag = true
-                        }
-                } else {
-                        if (*user)["i_vip_status"] == nil {
-                                isExpire = 0
-                        } else {
-                                isOnTail = util.IntAll((*user)["i_vip_status"])
-                        }
-                        isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 150
-                }
-        }
-        //推送记录查询
-        /*pageNum, _ := sp.GetInteger("pageNum")
-          spqp := &jy.SubPushQueryParam{
-          	Mgo_bidding:   db.Mgo_Bidding,
-          	Bidding:       db.DbConf.Mongodb.Bidding.Collection,
-          	Bidding_back:  db.DbConf.Mongodb.Bidding.Collection_change,
-          	UserId:        userId,
-          	EntId:         entId,
-          	PageNum:       pageNum,
-          	SelectTime:    sp.GetString("selectTime"),
-          	Area:          sp.GetString("area"),
-          	City:          sp.GetString("city"),
-          	Buyerclass:    sp.GetString("buyerclass"),
-          	Subtype:       sp.GetString("subtype"),
-          	Subscopeclass: sp.GetString("subscopeclass"),
-          	Key:           sp.GetString("key"),
-          	Price:         sp.GetString("price"),      //价格
-          	FileExists:    sp.GetString("fileExists"), //附件
-          }
-          if vipType == jy.SwitchService.Member {
-          	spqp.PushMysql = db.MysqlMemberPush
-          } else if vipType == jy.SwitchService.Entniche {
-          	spqp.PushMysql = db.MysqlEntnichePush
-          } else {
-          	spqp.PushMysql = db.MysqlPush
-          }
-          hasNextPage, _, list := jy.NewSubscribePush(vipType).Datas(spqp)
-          //免费用户无推送记录生成推送记录=>默认推送调整-付费用户默认1000条 免费不变
-          if spqp.PageNum <= 1 && len(list) == 0 && spqp.IsEmpty() {
-          	//flag, data := jy.NewSubscribePush().MakeHistoryDatas(db.Mgo, db.MysqlPush, userId, entity.PushView)
-          	flag, data, _ := jy.NewSubscribePush(vipType).MakeHistoryDatasNew(spqp.PushMysql, userId, entId, entity.DefaultPushList)
-          	if data != nil {
-          		hasNextPage = flag
-          		jsonBytes, err := json.Marshal(data)
-          		err = json.Unmarshal(jsonBytes, &list)
-          		if err != nil {
-          			log.Println("err:", err)
-          		}
-          	}
-          }
-          //查询是否收藏
-          jy.NewSubscribePush().MakeCollection(_userId, db.Mysql, list, config.Config.FileSignBool)
-          //仅表格第一页展示全部字段
-          if !(sp.GetString("format") == "table" && pageNum == 1) && len(list) > 0 {
-          	for i := 0; i < len(list); i++ {
-          		list[i].S_winner = ""
-          		list[i].ProjectName = ""
-          		list[i].Buyer = ""
-          		list[i].Bidopentime = -1
-          	}
-          }*/
-        sp.ServeJson(map[string]interface{}{
-                "userId":      encrypt.EncodeArticleId(_userId),             //用户id
-                "haskey":      hasKeyFlag,                                   //免费用户和超级订阅是否有订阅词
-                "isInTSguide": entity.HistoryPush.IsInTsGuide(sp.Session()), //是否进入向导
-                "isVipSub":    isVipFlag,                                    //是否是超级订阅
-                "isExpire":    isExpire,                                     //超级订阅到期提醒
-                "isOnTail":    isOnTail,                                     //超级订阅状态
-                "isPassCount": isPassCount,                                  //推送数量校验
-                "otherFlag":   otherFlag,                                    //首次用户推送查询“其他”
-                "isread":      isread,                                       //某个通知??是否已读
-                //"data":        list,                                    //推送记录字段 *适配大会员
-                //"hasNextPage": hasNextPage,                             //是否有下一页 *适配大会员
-                "industry": industry_, //会员订阅的行业
-        })
+	userId := util.ObjToString(sp.GetSession("userId"))
+	if userId == "" {
+		return
+	}
+	_userId := userId
+	vipType := sp.GetString("vt")
+	if vipType == "" { //默认取已切换的企业
+		vipType = jy.SwitchService.GetEntniche(sp.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	}
+	if vipType == jy.SwitchService.Entniche {
+		userId = fmt.Sprint(util.IntAll(sp.GetSession("entUserId")))
+	}
+	//entId := util.IntAll(sp.GetSession("entId"))
+	go entity.HistoryPush.UpdateUserPushUnread(userId, vipType)
+	user, _ := jy.NewSubscribePush().UserInfo(db.Mgo, userId)
+	hasKeyFlag, industry_ := me.GetKeySet(vipType, sp.Session())
+	var isVipFlag, isPassCount, isread, otherFlag bool = false, false, false, false
+	isExpire, isOnTail := -1, 0
+	todayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
+	if user != nil {
+		//超级订阅
+		if util.IntAll((*user)["i_vip_status"]) == 1 || util.IntAll((*user)["i_vip_status"]) == 2 {
+			var threeRemind = int64(3 * 24 * 60 * 60)
+			var twoRemind = int64(2 * 24 * 60 * 60)
+			var oneRemind = int64(1 * 24 * 60 * 60)
+			if (*user)["isread"] != nil {
+				isread = (*user)["isread"].(bool)
+			}
+			isVipFlag = true
+			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 2000
+			isOnTail = util.IntAll((*user)["i_vip_status"])
+			_endtime := (*user)["l_vip_endtime"]
+			//是否到期
+			if util.Int64All(_endtime)-time.Now().Unix() < threeRemind && util.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
+				isExpire = 3 //即将到期
+			} else if util.Int64All(_endtime)-time.Now().Unix() < twoRemind && util.Int64All(_endtime)-time.Now().Unix() >= oneRemind {
+				isExpire = 2 //即将到期
+			} else if util.Int64All(_endtime)-time.Now().Unix() < oneRemind && util.Int64All(_endtime)-time.Now().Unix() >= 0 {
+				isExpire = 1 //即将到期
+			}
+			//判断首次用户是否推送的带有”其他“
+			t, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local)
+			today_1 := t.Unix()
+			today_2 := t.AddDate(0, 0, 1).Unix()
+			if db.MysqlPush.CountBySql("select count(1) as count from pushsubscribe where isvip =1 and userid =? and buyerclass=?  and (date between ? and ? )", userId, 93, today_1, today_2) > 0 {
+				otherFlag = true
+			}
+		} else {
+			if (*user)["i_vip_status"] == nil {
+				isExpire = 0
+			} else {
+				isOnTail = util.IntAll((*user)["i_vip_status"])
+			}
+			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+userId) >= 150
+		}
+	}
+	//推送记录查询
+	/*pageNum, _ := sp.GetInteger("pageNum")
+	  spqp := &jy.SubPushQueryParam{
+	  	Mgo_bidding:   db.Mgo_Bidding,
+	  	Bidding:       db.DbConf.Mongodb.Bidding.Collection,
+	  	Bidding_back:  db.DbConf.Mongodb.Bidding.Collection_change,
+	  	UserId:        userId,
+	  	EntId:         entId,
+	  	PageNum:       pageNum,
+	  	SelectTime:    sp.GetString("selectTime"),
+	  	Area:          sp.GetString("area"),
+	  	City:          sp.GetString("city"),
+	  	Buyerclass:    sp.GetString("buyerclass"),
+	  	Subtype:       sp.GetString("subtype"),
+	  	Subscopeclass: sp.GetString("subscopeclass"),
+	  	Key:           sp.GetString("key"),
+	  	Price:         sp.GetString("price"),      //价格
+	  	FileExists:    sp.GetString("fileExists"), //附件
+	  }
+	  if vipType == jy.SwitchService.Member {
+	  	spqp.PushMysql = db.MysqlMemberPush
+	  } else if vipType == jy.SwitchService.Entniche {
+	  	spqp.PushMysql = db.MysqlEntnichePush
+	  } else {
+	  	spqp.PushMysql = db.MysqlPush
+	  }
+	  hasNextPage, _, list := jy.NewSubscribePush(vipType).Datas(spqp)
+	  //免费用户无推送记录生成推送记录=>默认推送调整-付费用户默认1000条 免费不变
+	  if spqp.PageNum <= 1 && len(list) == 0 && spqp.IsEmpty() {
+	  	//flag, data := jy.NewSubscribePush().MakeHistoryDatas(db.Mgo, db.MysqlPush, userId, entity.PushView)
+	  	flag, data, _ := jy.NewSubscribePush(vipType).MakeHistoryDatasNew(spqp.PushMysql, userId, entId, entity.DefaultPushList)
+	  	if data != nil {
+	  		hasNextPage = flag
+	  		jsonBytes, err := json.Marshal(data)
+	  		err = json.Unmarshal(jsonBytes, &list)
+	  		if err != nil {
+	  			log.Println("err:", err)
+	  		}
+	  	}
+	  }
+	  //查询是否收藏
+	  jy.NewSubscribePush().MakeCollection(_userId, db.Mysql, list, config.Config.FileSignBool)
+	  //仅表格第一页展示全部字段
+	  if !(sp.GetString("format") == "table" && pageNum == 1) && len(list) > 0 {
+	  	for i := 0; i < len(list); i++ {
+	  		list[i].S_winner = ""
+	  		list[i].ProjectName = ""
+	  		list[i].Buyer = ""
+	  		list[i].Bidopentime = -1
+	  	}
+	  }*/
+	sp.ServeJson(map[string]interface{}{
+		"userId":      encrypt.EncodeArticleId(_userId),             //用户id
+		"haskey":      hasKeyFlag,                                   //免费用户和超级订阅是否有订阅词
+		"isInTSguide": entity.HistoryPush.IsInTsGuide(sp.Session()), //是否进入向导
+		"isVipSub":    isVipFlag,                                    //是否是超级订阅
+		"isExpire":    isExpire,                                     //超级订阅到期提醒
+		"isOnTail":    isOnTail,                                     //超级订阅状态
+		"isPassCount": isPassCount,                                  //推送数量校验
+		"otherFlag":   otherFlag,                                    //首次用户推送查询“其他”
+		"isread":      isread,                                       //某个通知??是否已读
+		//"data":        list,                                    //推送记录字段 *适配大会员
+		//"hasNextPage": hasNextPage,                             //是否有下一页 *适配大会员
+		"industry": industry_, //会员订阅的行业
+	})
 }
 
 // HistoryPaging 推送历史翻页
 func (sp *SubscribePush) HistoryPaging() {
-        userId, _ := sp.GetSession("userId").(string)
-        if userId == "" {
-                return
-        }
-        vipType := sp.GetString("vt")
-        if vipType == "" { //默认取已切换的企业
-                vipType = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo, db.Mysql)
-        }
-        if vipType == jy.SwitchService.Entniche {
-                userId = fmt.Sprint(util.IntAll(sp.GetSession("entUserId")))
-        }
-        entId := util.IntAll(sp.GetSession("entId"))
-        pageNum, _ := sp.GetInteger("pageNum")
-        PageSize, _ := sp.GetInteger("pageSize")
-        if pageNum == 1 {
-                go entity.HistoryPush.UpdateUserPushUnread(userId, vipType)
-        }
-        spqp := &jy.SubPushQueryParam{
-                Mgo_bidding:   db.Mgo_Bidding,
-                Bidding:       db.DbConf.Mongodb.Bidding.Collection,
-                Bidding_back:  db.DbConf.Mongodb.Bidding.Collection_change,
-                UserId:        userId,
-                PageNum:       pageNum,
-                PageSize:      PageSize,
-                SelectTime:    sp.GetString("selectTime"),
-                Area:          sp.GetString("area"),
-                City:          sp.GetString("city"),
-                Buyerclass:    sp.GetString("buyerclass"),
-                Subtype:       sp.GetString("subtype"),
-                Subscopeclass: sp.GetString("subscopeclass"),
-                Key:           sp.GetString("key"),
-                Price:         sp.GetString("price"),
-                FileExists:    sp.GetString("fileExists"),
-        }
-        if vipType == jy.SwitchService.Member {
-                spqp.PushMysql = db.MysqlMemberPush
-        } else if vipType == jy.SwitchService.Entniche {
-                spqp.PushMysql = db.MysqlEntnichePush
-        } else {
-                spqp.PushMysql = db.MysqlPush
-        }
-        hasNextPage, total, list := jy.NewSubscribePush(vipType).Datas(spqp)
-        //免费用户无推送记录生成推送记录=>默认推送调整-付费用户默认1000条 免费不变
-        if spqp.PageNum <= 1 && len(list) == 0 && spqp.IsEmpty() {
-                flag, data, count := jy.NewSubscribePush(vipType).MakeHistoryDatasNew(spqp.PushMysql, userId, entId, entity.DefaultPushList)
-                if data != nil {
-                        hasNextPage = flag
-                        total = int64(count)
-                        jsonBytes, err := json.Marshal(data)
-                        err = json.Unmarshal(jsonBytes, &list)
-                        if err != nil {
-                                log.Println("err:", err)
-                        }
-                }
-        }
-        //查询是否收藏
-        jy.NewSubscribePush().MakeCollection(userId, db.Mysql, list, config.Config.FileSignBool)
-        //是否有关键词
-        //user, _ := jy.NewSubscribePush(vipType).UserInfo(db.Mgo, userId)
-        hasKeyFlag, _ := me.GetKeySet(vipType, sp.Session())
-        //仅表格第一页展示全部字段
-        if !(sp.GetString("format") == "table" && pageNum == 1 && PageSize <= 20) && len(list) > 0 {
-                for i := 0; i < len(list); i++ {
-                        list[i].Winner = ""
-                        list[i].ProjectName = ""
-                        list[i].Buyer = ""
-                        list[i].BidOpenTime = -1
-                }
-        }
-        sp.ServeJson(map[string]interface{}{
-                "hasNextPage": hasNextPage,
-                "total":       total,
-                "data":        list,
-                "haskey":      hasKeyFlag,
-        })
+	userId, _ := sp.GetSession("userId").(string)
+	if userId == "" {
+		return
+	}
+	vipType := sp.GetString("vt")
+	if vipType == "" { //默认取已切换的企业
+		vipType = jy.SwitchService.GetEntniche(sp.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	}
+	if vipType == jy.SwitchService.Entniche {
+		userId = fmt.Sprint(util.IntAll(sp.GetSession("entUserId")))
+	}
+	entId := util.IntAll(sp.GetSession("entId"))
+	pageNum, _ := sp.GetInteger("pageNum")
+	PageSize, _ := sp.GetInteger("pageSize")
+	if pageNum == 1 {
+		go entity.HistoryPush.UpdateUserPushUnread(userId, vipType)
+	}
+	spqp := &jy.SubPushQueryParam{
+		Mgo_bidding:   db.Mgo_Bidding,
+		Bidding:       db.DbConf.Mongodb.Bidding.Collection,
+		Bidding_back:  db.DbConf.Mongodb.Bidding.Collection_change,
+		UserId:        userId,
+		PageNum:       pageNum,
+		PageSize:      PageSize,
+		SelectTime:    sp.GetString("selectTime"),
+		Area:          sp.GetString("area"),
+		City:          sp.GetString("city"),
+		Buyerclass:    sp.GetString("buyerclass"),
+		Subtype:       sp.GetString("subtype"),
+		Subscopeclass: sp.GetString("subscopeclass"),
+		Key:           sp.GetString("key"),
+		Price:         sp.GetString("price"),
+		FileExists:    sp.GetString("fileExists"),
+	}
+	if vipType == jy.SwitchService.Member {
+		spqp.PushMysql = db.MysqlMemberPush
+	} else if vipType == jy.SwitchService.Entniche {
+		spqp.PushMysql = db.MysqlEntnichePush
+	} else {
+		spqp.PushMysql = db.MysqlPush
+	}
+	hasNextPage, total, list := jy.NewSubscribePush(vipType).Datas(spqp)
+	//免费用户无推送记录生成推送记录=>默认推送调整-付费用户默认1000条 免费不变
+	if spqp.PageNum <= 1 && len(list) == 0 && spqp.IsEmpty() {
+		flag, data, count := jy.NewSubscribePush(vipType).MakeHistoryDatasNew(spqp.PushMysql, userId, entId, entity.DefaultPushList)
+		if data != nil {
+			hasNextPage = flag
+			total = int64(count)
+			jsonBytes, err := json.Marshal(data)
+			err = json.Unmarshal(jsonBytes, &list)
+			if err != nil {
+				log.Println("err:", err)
+			}
+		}
+	}
+	//查询是否收藏
+	jy.NewSubscribePush().MakeCollection(userId, db.Mysql, list, config.Config.FileSignBool)
+	//是否有关键词
+	//user, _ := jy.NewSubscribePush(vipType).UserInfo(db.Mgo, userId)
+	hasKeyFlag, _ := me.GetKeySet(vipType, sp.Session())
+	//仅表格第一页展示全部字段
+	if !(sp.GetString("format") == "table" && pageNum == 1 && PageSize <= 20) && len(list) > 0 {
+		for i := 0; i < len(list); i++ {
+			list[i].Winner = ""
+			list[i].ProjectName = ""
+			list[i].Buyer = ""
+			list[i].BidOpenTime = -1
+		}
+	}
+	sp.ServeJson(map[string]interface{}{
+		"hasNextPage": hasNextPage,
+		"total":       total,
+		"data":        list,
+		"haskey":      hasKeyFlag,
+	})
 }
 
 // SetRead 推送记录设置已读
 func (sp *SubscribePush) SetRead() error {
-        defer util.Catch()
-        vsid, _ := sp.GetInteger("vsid")
-        if vsid <= 0 {
-                return nil
-        }
-        vipType := sp.GetString("vt")
-        if vipType == "" { //默认取已切换的企业
-                vipType = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo, db.Mysql)
-        }
-        if userId := util.ObjToString(sp.GetSession("userId")); userId != "" {
-                if vipType == jy.SwitchService.Member {
-                        jy.NewSubscribePush(vipType).Visit(db.MysqlMemberPush, userId, vsid)
-                } else if vipType == jy.SwitchService.Entniche {
-                        jy.NewSubscribePush(vipType).Visit(db.MysqlEntnichePush, userId, vsid)
-                } else {
-                        jy.NewSubscribePush(vipType).Visit(db.MysqlPush, userId, vsid)
-                }
-        }
-        return nil
+	defer util.Catch()
+	vsid, _ := sp.GetInteger("vsid")
+	if vsid <= 0 {
+		return nil
+	}
+	vipType := sp.GetString("vt")
+	if vipType == "" { //默认取已切换的企业
+		vipType = jy.SwitchService.GetEntniche(sp.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+	}
+	if userId := util.ObjToString(sp.GetSession("userId")); userId != "" {
+		if vipType == jy.SwitchService.Member {
+			jy.NewSubscribePush(vipType).Visit(db.MysqlMemberPush, userId, vsid)
+		} else if vipType == jy.SwitchService.Entniche {
+			jy.NewSubscribePush(vipType).Visit(db.MysqlEntnichePush, userId, vsid)
+		} else {
+			jy.NewSubscribePush(vipType).Visit(db.MysqlPush, userId, vsid)
+		}
+	}
+	return nil
 }
 
 // KeywordUpdate 大会员、超级订阅订阅词修改
@@ -316,35 +316,35 @@ func (sp *SubscribePush) PushSetting() {
 
 // GetPushCount 订阅设置订阅词近三个月推送数量
 func (sp *SubscribePush) GetPushCount() error {
-        defer util.Catch()
-        userId, _ := sp.GetSession("userId").(string)
-        if userId != "" {
-                vipType := sp.GetString("vt")
-                if vipType == "" { //默认取已切换的企业
-                        vipType = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo, db.Mysql)
+	defer util.Catch()
+	userId, _ := sp.GetSession("userId").(string)
+	if userId != "" {
+		vipType := sp.GetString("vt")
+		if vipType == "" { //默认取已切换的企业
+			vipType = jy.SwitchService.GetEntniche(sp.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key)
 
-                }
-                matchway, _ := sp.GetInteger("matchway")
-                sp.ServeJson(map[string]interface{}{
-                        "count": entity.KeysetViewDatasCount(userId, vipType, sp.GetString("key"), sp.GetString("notkey"), matchway,sp.Session()),
-                })
-        }
-        return nil
+		}
+		matchway, _ := sp.GetInteger("matchway")
+		sp.ServeJson(map[string]interface{}{
+			"count": entity.KeysetViewDatasCount(userId, vipType, sp.GetString("key"), sp.GetString("notkey"), matchway, sp.Session()),
+		})
+	}
+	return nil
 }
 
 // getPushAllCount 全部关键词-最近三个月推送结果预览总数
 func (sp *SubscribePush) GetPushAllCount() error {
-        defer util.Catch()
-        userId, _ := sp.GetSession("userId").(string)
-        if userId != "" {
-                index, _ := sp.GetInteger("index")
-                vipType := sp.GetString("vt")
-                if vipType == "" { //默认取已切换的企业
-                        vipType = jy.SwitchService.GetEntniche(sp.Session(), db.Mgo, db.Mysql)
-                }
-                sp.ServeJson(map[string]interface{}{
-                        "count": entity.SubViewDatasCount(userId, vipType, sp.GetString("item"), index, sp.Session()),
-                })
-        }
-        return nil
+	defer util.Catch()
+	userId, _ := sp.GetSession("userId").(string)
+	if userId != "" {
+		index, _ := sp.GetInteger("index")
+		vipType := sp.GetString("vt")
+		if vipType == "" { //默认取已切换的企业
+			vipType = jy.SwitchService.GetEntniche(sp.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+		}
+		sp.ServeJson(map[string]interface{}{
+			"count": entity.SubViewDatasCount(userId, vipType, sp.GetString("item"), index, sp.Session()),
+		})
+	}
+	return nil
 }

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

@@ -5,6 +5,7 @@ import (
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"jy/src/jfw/modules/publicapply/src/config"
 	"jy/src/jfw/modules/publicapply/src/db"
 	"jy/src/jfw/modules/publicapply/src/subscribePush/entity"
 	"log"
@@ -25,7 +26,7 @@ func (s *Subscribe) Update() {
 	entUserId := qutil.IntAll(s.GetSession("entUserId"))
 	vSwitch := s.GetString("vSwitch")
 	if vSwitch == "" {
-		vSwitch = jy.SwitchService.Get(s.Session(), db.Mgo) //v:vip m:member
+		vSwitch = jy.SwitchService.Get(s.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key) //v:vip m:member
 	}
 	sub := &entity.SubscribeSet{
 		Area:      *qutil.ObjToMap(s.GetString("area")),
@@ -51,7 +52,7 @@ func (s *Subscribe) SetUserInfo() {
 	entUserId := qutil.IntAll(s.GetSession("entUserId"))
 	vSwitch := s.GetString("vSwitch")
 	if vSwitch == "" {
-		vSwitch = jy.SwitchService.Get(s.Session(), db.Mgo) //v:vip m:member "":free
+		vSwitch = jy.SwitchService.Get(s.Session(), "10000", config.Config.Etcd.Hosts, config.Config.Etcd.Key) //v:vip m:member "":free
 	}
 	//判断是否有权限
 	power := 0

+ 2 - 2
src/jfw/modules/publicapply/src/userbase/entity/entity.go

@@ -185,7 +185,7 @@ func IsPower(name string, session *httpsession.Session) (b bool) {
 }
 
 // HasIndustryTag  是否有行业标签
-func HasIndustryTag(userId string) bool {
+func HasIndustryTag(session *httpsession.Session, userId string) bool {
 	cacheKey := fmt.Sprintf("industryTag_%s", userId) // 缓存的key
 	cacheTimeout := 60 * 3                            // 缓存的时间-三分钟
 	//// 查缓存
@@ -193,7 +193,7 @@ func HasIndustryTag(userId string) bool {
 		return res.(bool)
 	}
 	var hasTag bool
-	vipStatus := jy.GetVipState(db.Mysql, db.Mgo, userId)
+	vipStatus := jy.GetVipState("10000", session, config.Config.Etcd.Hosts, config.Config.Etcd.Key, userId)
 	if vipStatus.VipState > 0 || vipStatus.BigMember > 0 || vipStatus.EntMember > 0 { // 仅免费用户查询
 		redis.Put("newother", cacheKey, hasTag, cacheTimeout)
 		return hasTag

+ 1 - 1
src/jfw/modules/publicapply/src/userbase/service/service.go

@@ -98,7 +98,7 @@ func (this *ServiceStruct) IndustryTag() {
 		if this.Method() != "POST" {
 			return Result{Data: nil, Error_msg: Error_msg_1005}
 		}
-		return Result{Data: entity.HasIndustryTag(userId)}
+		return Result{Data: entity.HasIndustryTag(this.Session(), userId)}
 	}()
 	this.ServeJson(r)
 }

文件差异内容过多而无法显示
+ 1037 - 1037
src/jfw/modules/subscribepay/src/entity/order.go


+ 16 - 19
src/jfw/modules/subscribepay/src/go.mod

@@ -3,22 +3,23 @@ module jy/src/jfw/modules/subscribepay/src
 go 1.18
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20221230025810-b88f2a62c467
-	app.yhyue.com/moapp/jypkg v0.0.0-20230110033535-d6c3e4b755cf
+	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
+	app.yhyue.com/moapp/jypkg v0.0.0-20230128092104-d8ae3867d2ab
 	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20221230024250-38ee6578aff5
 	github.com/SKatiyar/qr v0.0.0-20151201054752-25b6bdf44e67
 	github.com/dchest/captcha v1.0.0
-	github.com/go-xweb/xweb v0.2.1
 	github.com/shopspring/decimal v1.3.1
 	github.com/tealeg/xlsx v1.0.5
 	go.mongodb.org/mongo-driver v1.11.1
 	gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
 )
 
+require go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
+
 require (
 	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
-	app.yhyue.com/moapp/message v0.0.0-20221202072401-d825fc65512c // indirect
-	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230106052936-bd3ab7edf7a4 // indirect
+	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
 	github.com/cespare/xxhash/v2 v2.1.2 // indirect
@@ -34,9 +35,6 @@ require (
 	github.com/go-logr/stdr v1.2.2 // indirect
 	github.com/go-redis/redis/v8 v8.11.5 // indirect
 	github.com/go-sql-driver/mysql v1.7.0 // indirect
-	github.com/go-xweb/httpsession v0.0.0-20141220075701-356d3b4d38d6 // indirect
-	github.com/go-xweb/log v0.0.0-20140701090824-270d183ad77e // indirect
-	github.com/go-xweb/uuid v0.0.0-20140604020037-d7dce341f851 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
 	github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
 	github.com/golang/mock v1.6.0 // indirect
@@ -53,7 +51,6 @@ require (
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/klauspost/compress v1.13.6 // indirect
-	github.com/lunny/csession v0.0.0-20130910075847-fe53c5de3dfd // indirect
 	github.com/mattn/go-colorable v0.1.9 // indirect
 	github.com/mattn/go-isatty v0.0.14 // indirect
 	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
@@ -75,18 +72,18 @@ require (
 	github.com/xdg-go/scram v1.1.1 // indirect
 	github.com/xdg-go/stringprep v1.0.3 // indirect
 	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
-	github.com/zeromicro/go-zero v1.4.3 // indirect
+	github.com/zeromicro/go-zero v1.4.4 // indirect
 	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
-	go.opentelemetry.io/otel v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
-	go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
-	go.opentelemetry.io/otel/sdk v1.10.0 // indirect
-	go.opentelemetry.io/otel/trace v1.10.0 // indirect
+	go.opentelemetry.io/otel v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
+	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
+	go.opentelemetry.io/otel/trace v1.11.0 // indirect
 	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
 	go.uber.org/atomic v1.9.0 // indirect
 	go.uber.org/automaxprocs v1.5.1 // indirect
@@ -96,7 +93,7 @@ require (
 	golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
 	golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
 	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
+	golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
 	golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
 	golang.org/x/text v0.4.0 // indirect
 	golang.org/x/time v0.3.0 // indirect

+ 3 - 3
src/jfw/modules/subscribepay/src/report/report.go

@@ -8,7 +8,6 @@ import (
 	"time"
 
 	qutil "app.yhyue.com/moapp/jybase/common"
-	. "app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
@@ -501,8 +500,9 @@ func getColl(referer, t string, flag bool) string {
 //
 func getQuery(sess *httpsession.Session) (string, string, interface{}) {
 	sessMap := sess.GetMultiple()
-	if util.IntAll(sessMap["positionType"]) == 1 {
-		return userId, "ent_userid", util.IntAll(sessMap["entUserId"])
+	userId := qutil.ObjToString(sessMap["userId"])
+	if qutil.IntAll(sessMap["positionType"]) == 1 {
+		return userId, "ent_userid", qutil.IntAll(sessMap["entUserId"])
 	} else {
 		return userId, "userid", userId
 	}

+ 427 - 423
src/jfw/modules/subscribepay/src/service/dataexportPack.go

@@ -1,92 +1,92 @@
 package service
 
 import (
-        "encoding/json"
-        "fmt"
-        "io/ioutil"
-        "jy/src/jfw/modules/subscribepay/src/config"
-        "jy/src/jfw/modules/subscribepay/src/entity"
-        "jy/src/jfw/modules/subscribepay/src/pay"
-        "jy/src/jfw/modules/subscribepay/src/util"
-        "log"
-        "math"
-        "net/http"
-        "strconv"
-        "strings"
-        "time"
+	"encoding/json"
+	"fmt"
+	"io/ioutil"
+	"jy/src/jfw/modules/subscribepay/src/config"
+	"jy/src/jfw/modules/subscribepay/src/entity"
+	"jy/src/jfw/modules/subscribepay/src/pay"
+	"jy/src/jfw/modules/subscribepay/src/util"
+	"log"
+	"math"
+	"net/http"
+	"strconv"
+	"strings"
+	"time"
 
-        . "app.yhyue.com/moapp/jybase/api"
-        qutil "app.yhyue.com/moapp/jybase/common"
-        . "app.yhyue.com/moapp/jybase/date"
-        "app.yhyue.com/moapp/jybase/encrypt"
-        "app.yhyue.com/moapp/jybase/go-xweb/xweb"
-        "app.yhyue.com/moapp/jybase/redis"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/dataexport"
-        "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	. "app.yhyue.com/moapp/jybase/api"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/dataexport"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 
 // 数据导出-数据包
 type DataExportPack struct {
-        *xweb.Action
-        packGoodsList  xweb.Mapper `xweb:"/dataExportPack/goodsList"`    //线上自助数据包充值-数据包列表
-        createOrder    xweb.Mapper `xweb:"/dataExportPack/createOrder"`  //线上自助数据包充值-创建订单
-        account        xweb.Mapper `xweb:"/dataExportPack/account"`      //数据导出-账户信息
-        statistics     xweb.Mapper `xweb:"/dataExportPack/statistics"`   //数据导出-选择导出去重统计
-        packPay        xweb.Mapper `xweb:"/dataExportPack/packPay"`      //数据导出-使用流量包扣除
-        fileCheck      xweb.Mapper `xweb:"/dataExportPack/fileCheck"`    //数据导出-使用流量包文件生成完成查询
-        rechargeList   xweb.Mapper `xweb:"/dataExportPack/rechargeList"` //数据导出-流量包充值记录
-        recordList     xweb.Mapper `xweb:"/dataExportPack/recordList"`   //数据导出记录
-        sendExportMail xweb.Mapper `xweb:"/dataExportPack/sendMail"`     //移动端导出记录发送附件邮件
+	*xweb.Action
+	packGoodsList  xweb.Mapper `xweb:"/dataExportPack/goodsList"`    //线上自助数据包充值-数据包列表
+	createOrder    xweb.Mapper `xweb:"/dataExportPack/createOrder"`  //线上自助数据包充值-创建订单
+	account        xweb.Mapper `xweb:"/dataExportPack/account"`      //数据导出-账户信息
+	statistics     xweb.Mapper `xweb:"/dataExportPack/statistics"`   //数据导出-选择导出去重统计
+	packPay        xweb.Mapper `xweb:"/dataExportPack/packPay"`      //数据导出-使用流量包扣除
+	fileCheck      xweb.Mapper `xweb:"/dataExportPack/fileCheck"`    //数据导出-使用流量包文件生成完成查询
+	rechargeList   xweb.Mapper `xweb:"/dataExportPack/rechargeList"` //数据导出-流量包充值记录
+	recordList     xweb.Mapper `xweb:"/dataExportPack/recordList"`   //数据导出记录
+	sendExportMail xweb.Mapper `xweb:"/dataExportPack/sendMail"`     //移动端导出记录发送附件邮件
 }
 
 // PackGoodsList 数据包规格及价格列表
 func (this *DataExportPack) PackGoodsList() {
-        packList, _ := entity.JyDataExportPack.GetPackPriceList()
-        userId, _ := this.GetSession("userId").(string)
-        if userId != "" {
-                getUrl := fmt.Sprintf("%s?useProduct=%s&appId=%s&useProductType=%v&userId=%s", config.CouponConfig.Giveinfo, config.CouponConfig.Products["数据流量包"], config.CouponConfig.AppId, 0, userId)
-                res, err := http.Get(getUrl)
-                if err != nil {
-                        log.Println(err.Error())
-                        this.ServeJson(packList)
-                        return
-                }
-                defer res.Body.Close()
-                bs, _ := ioutil.ReadAll(res.Body)
-                resMap := map[string]interface{}{}
-                err = json.Unmarshal([]byte(bs), &resMap)
-                if err != nil {
-                        log.Println("json.unmarshal err", resMap)
-                } else {
-                        proDuctM := map[string]string{} //产品码对应关系
-                        for k, v := range config.CouponConfig.Products {
-                                proDuctM[v] = k
-                        }
-                        pl, _ := packList.(map[string]interface{})
-                        marr := []map[string]interface{}{}
-                        if qutil.IntAll(resMap["Code"]) == 1 {
-                                for _, vv := range config.ExConf.Packs_showList {
-                                        m := map[string]interface{}{
-                                                "packNum":         vv.PackNum,
-                                                "normal_discount": vv.Normal_discount,
-                                                "senior_discount": vv.Senior_discount,
-                                        }
-                                        if resMap["Data"] != nil {
-                                                for _, v := range qutil.ObjArrToMapArr(resMap["Data"].([]interface{})) {
-                                                        product := strconv.Itoa(qutil.IntAll(v["ProductCode"]))
-                                                        if strings.Contains(proDuctM[product], strconv.Itoa(vv.PackNum)) {
-                                                                m[fmt.Sprintf("%v_num", strings.Split(proDuctM[product], "_")[0])] = v["Time"]
-                                                        }
-                                                }
-                                        }
-                                        marr = append(marr, m)
-                                }
-                                pl["packs_showList"] = marr
-                                packList = pl
-                        }
-                }
-        }
-        this.ServeJson(packList)
+	packList, _ := entity.JyDataExportPack.GetPackPriceList()
+	userId, _ := this.GetSession("userId").(string)
+	if userId != "" {
+		getUrl := fmt.Sprintf("%s?useProduct=%s&appId=%s&useProductType=%v&userId=%s", config.CouponConfig.Giveinfo, config.CouponConfig.Products["数据流量包"], config.CouponConfig.AppId, 0, userId)
+		res, err := http.Get(getUrl)
+		if err != nil {
+			log.Println(err.Error())
+			this.ServeJson(packList)
+			return
+		}
+		defer res.Body.Close()
+		bs, _ := ioutil.ReadAll(res.Body)
+		resMap := map[string]interface{}{}
+		err = json.Unmarshal([]byte(bs), &resMap)
+		if err != nil {
+			log.Println("json.unmarshal err", resMap)
+		} else {
+			proDuctM := map[string]string{} //产品码对应关系
+			for k, v := range config.CouponConfig.Products {
+				proDuctM[v] = k
+			}
+			pl, _ := packList.(map[string]interface{})
+			marr := []map[string]interface{}{}
+			if qutil.IntAll(resMap["Code"]) == 1 {
+				for _, vv := range config.ExConf.Packs_showList {
+					m := map[string]interface{}{
+						"packNum":         vv.PackNum,
+						"normal_discount": vv.Normal_discount,
+						"senior_discount": vv.Senior_discount,
+					}
+					if resMap["Data"] != nil {
+						for _, v := range qutil.ObjArrToMapArr(resMap["Data"].([]interface{})) {
+							product := strconv.Itoa(qutil.IntAll(v["ProductCode"]))
+							if strings.Contains(proDuctM[product], strconv.Itoa(vv.PackNum)) {
+								m[fmt.Sprintf("%v_num", strings.Split(proDuctM[product], "_")[0])] = v["Time"]
+							}
+						}
+					}
+					marr = append(marr, m)
+				}
+				pl["packs_showList"] = marr
+				packList = pl
+			}
+		}
+	}
+	this.ServeJson(packList)
 }
 
 // CreateOrder 购买数据流量包公共方法
@@ -96,148 +96,148 @@ func (this *DataExportPack) PackGoodsList() {
 //
 // return orderCode 订单号
 func (this *DataExportPack) CreateOrder() {
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                packId := this.GetString("packId") //
-                // 获取用户分销口令
-                disWordStr := ""
-                // 查询用户携带的分销口令
-                userfilter, ok := util.MQFW.FindById("user", userId, "")
-                if ok && userfilter != nil {
-                        startTime := qutil.Int64All((*userfilter)["startTime"])
-                        endTime := qutil.Int64All((*userfilter)["endTime"])
-                        if startTime != 0 {
-                                if startTime <= time.Now().Unix() && endTime >= time.Now().Unix() {
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		packId := this.GetString("packId") //
+		// 获取用户分销口令
+		disWordStr := ""
+		// 查询用户携带的分销口令
+		userfilter, ok := util.MQFW.FindById("user", userId, "")
+		if ok && userfilter != nil {
+			startTime := qutil.Int64All((*userfilter)["startTime"])
+			endTime := qutil.Int64All((*userfilter)["endTime"])
+			if startTime != 0 {
+				if startTime <= time.Now().Unix() && endTime >= time.Now().Unix() {
 
-                                        disWordStr = qutil.ObjToString((*userfilter)["disWords"])
-                                }
-                        }
-                }
+					disWordStr = qutil.ObjToString((*userfilter)["disWords"])
+				}
+			}
+		}
 
-                //根据id查询流量包价格
-                packDetail, err := entity.JyDataExportPack.GetPackDetailById(packId)
-                packDetail.GiveCycle = 0
-                packDetail.DisCountId = 0
-                if err != nil {
-                        return nil, err
-                }
-                //卡券折扣
-                orderMoney, discountPrice := packDetail.Price, 0 //订单金额,卡券折扣金额
-                var userLotteryId string                         //用户卡券id
-                var discount float64
-                useProduct, _ := this.GetInteger("useProduct")
-                discountId, _ := this.GetInteger("discountId") //赠品相关
-                if lotteryId := this.GetString("lotteryId"); lotteryId != "" {
-                        products := config.CouponConfig.Products["数据流量包"]
-                        if useProduct > 0 {
-                                products = strconv.Itoa(useProduct)
-                        }
-                        var fullPrice, reducePrice int
-                        fullPrice, reducePrice, discount, userLotteryId = util.GetCouponInfo(userId, lotteryId, products)
-                        if fullPrice <= orderMoney {
-                                if discount == 100 {
-                                        orderMoney = orderMoney - reducePrice
-                                        discountPrice = reducePrice
-                                } else {
-                                        //折扣
-                                        disCount_int := int(math.Ceil(discount * 100))
-                                        discountPrice = orderMoney - orderMoney*disCount_int/1000
-                                        orderMoney = orderMoney * disCount_int / 1000
-                                }
-                                log.Printf("用户%s 购买数据流量包 使用卡券:%s 折扣金额:%d", userId, userLotteryId, discountPrice)
-                        } else {
-                                userLotteryId = ""
-                        }
-                }
-                //赠品相关
-                useProduct, _ = strconv.Atoi(config.CouponConfig.Products[packId])
-                giveArr := entity.GiveInfo(userId, useProduct, 0, 0) //获取满赠时长
-                if giveArr != nil && len(giveArr) > 0 {
-                        packDetail.GiveCycle = qutil.IntAll(giveArr[0]["Time"])
-                        packDetail.DisCountId = qutil.IntAll(giveArr[0]["DiscountId"])
-                        discountId = qutil.IntAll(giveArr[0]["DiscountId"])
-                        if strings.Contains(qutil.ObjToString(giveArr[0]["ActivityName"]), config.Config.ActivityName) {
-                                packDetail.Badge = "202111" //双十一角标展示
-                        }
-                }
-                //
-                orderCode := pay.GetOrderCode()
-                nickname, _ := this.GetSession("s_nickname").(string)
-                openId, _ := this.GetSession("s_m_openid").(string)
-                now := time.Now()
-                filter, err := json.Marshal(packDetail)
-                if err != nil {
-                        return nil, fmt.Errorf("数据异常")
-                }
-                distributionChannel, orderChannel := util.GetJyOrderChannel(disWordStr, this.Header("User-Agent"))
-                entId := qutil.Int64All(this.GetSession("entId"))
-                buy_subject := 1
-                if entId > 0 {
-                        buy_subject = 2
-                }
-                orderid := util.Mysql.Insert("dataexport_order", map[string]interface{}{
-                        "order_money":          orderMoney,
-                        "order_status":         0,
-                        "service_status":       0,
-                        "user_nickname":        nickname,
-                        "user_openid":          openId,
-                        "user_phone":           this.GetString("order_phone"),
-                        "order_code":           orderCode,
-                        "product_type":         "数据流量包",
-                        "create_time":          FormatDate(&now, Date_Full_Layout),
-                        "original_price":       packDetail.Price,
-                        "filter":               string(filter),
-                        "user_id":              userId, //20190719 移动端数据导出 生订单添加用户id
-                        "discount_price":       discountPrice,
-                        "d_relation_id":        userLotteryId,
-                        "dis_word":             disWordStr,
-                        "distribution_channel": distributionChannel, //销售渠道
-                        "order_channel":        orderChannel,        //下单渠道
-                        "audit_status":         3,                   //默认审核通过
-                        "buy_subject":          buy_subject,
-                        "ent_id":               entId,
-                })
-                if orderid <= 0 {
-                        return nil, fmt.Errorf("创建订单异常")
-                }
-                //绑定核销卡券
-                if (userLotteryId != "" && this.GetString("lotteryId") != "") || (discountId > 0) {
-                        go func(userId, userLotteryId, orderCode, discountIdStr string) {
-                                phone, nickname := util.GetMyPhoneAndName(userId)
-                                if !util.UpdateCouponState(userId, userLotteryId, nickname, phone, orderCode, "数据流量包", discountIdStr, 3, 0) {
-                                        log.Println(fmt.Sprintf("单号%s-绑定失败-卡卷%s", orderCode, userLotteryId))
-                                }
-                                if discountId > 0 {
-                                        if ulid := util.FindUserLotteryId(userId, orderid, discountId); ulid != 0 {
-                                                userLotteryId = strconv.Itoa(ulid)
-                                        }
-                                }
-                        }(userId, userLotteryId, orderCode, strconv.Itoa(discountId))
-                }
-                return map[string]interface{}{
-                        "orderCode": orderCode,
-                }, nil
-        }()
-        if errMsg != nil {
-                log.Printf("%s DataExportPack CreateOrder 异常:%s\n", userId, errMsg.Error())
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+		//根据id查询流量包价格
+		packDetail, err := entity.JyDataExportPack.GetPackDetailById(packId)
+		packDetail.GiveCycle = 0
+		packDetail.DisCountId = 0
+		if err != nil {
+			return nil, err
+		}
+		//卡券折扣
+		orderMoney, discountPrice := packDetail.Price, 0 //订单金额,卡券折扣金额
+		var userLotteryId string                         //用户卡券id
+		var discount float64
+		useProduct, _ := this.GetInteger("useProduct")
+		discountId, _ := this.GetInteger("discountId") //赠品相关
+		if lotteryId := this.GetString("lotteryId"); lotteryId != "" {
+			products := config.CouponConfig.Products["数据流量包"]
+			if useProduct > 0 {
+				products = strconv.Itoa(useProduct)
+			}
+			var fullPrice, reducePrice int
+			fullPrice, reducePrice, discount, userLotteryId = util.GetCouponInfo(userId, lotteryId, products)
+			if fullPrice <= orderMoney {
+				if discount == 100 {
+					orderMoney = orderMoney - reducePrice
+					discountPrice = reducePrice
+				} else {
+					//折扣
+					disCount_int := int(math.Ceil(discount * 100))
+					discountPrice = orderMoney - orderMoney*disCount_int/1000
+					orderMoney = orderMoney * disCount_int / 1000
+				}
+				log.Printf("用户%s 购买数据流量包 使用卡券:%s 折扣金额:%d", userId, userLotteryId, discountPrice)
+			} else {
+				userLotteryId = ""
+			}
+		}
+		//赠品相关
+		useProduct, _ = strconv.Atoi(config.CouponConfig.Products[packId])
+		giveArr := entity.GiveInfo(userId, useProduct, 0, 0) //获取满赠时长
+		if giveArr != nil && len(giveArr) > 0 {
+			packDetail.GiveCycle = qutil.IntAll(giveArr[0]["Time"])
+			packDetail.DisCountId = qutil.IntAll(giveArr[0]["DiscountId"])
+			discountId = qutil.IntAll(giveArr[0]["DiscountId"])
+			if strings.Contains(qutil.ObjToString(giveArr[0]["ActivityName"]), config.Config.ActivityName) {
+				packDetail.Badge = "202111" //双十一角标展示
+			}
+		}
+		//
+		orderCode := pay.GetOrderCode()
+		nickname, _ := this.GetSession("s_nickname").(string)
+		openId, _ := this.GetSession("s_m_openid").(string)
+		now := time.Now()
+		filter, err := json.Marshal(packDetail)
+		if err != nil {
+			return nil, fmt.Errorf("数据异常")
+		}
+		distributionChannel, orderChannel := util.GetJyOrderChannel(disWordStr, this.Header("User-Agent"))
+		entId := qutil.Int64All(this.GetSession("entId"))
+		buy_subject := 1
+		if entId > 0 {
+			buy_subject = 2
+		}
+		orderid := util.Mysql.Insert("dataexport_order", map[string]interface{}{
+			"order_money":          orderMoney,
+			"order_status":         0,
+			"service_status":       0,
+			"user_nickname":        nickname,
+			"user_openid":          openId,
+			"user_phone":           this.GetString("order_phone"),
+			"order_code":           orderCode,
+			"product_type":         "数据流量包",
+			"create_time":          FormatDate(&now, Date_Full_Layout),
+			"original_price":       packDetail.Price,
+			"filter":               string(filter),
+			"user_id":              userId, //20190719 移动端数据导出 生订单添加用户id
+			"discount_price":       discountPrice,
+			"d_relation_id":        userLotteryId,
+			"dis_word":             disWordStr,
+			"distribution_channel": distributionChannel, //销售渠道
+			"order_channel":        orderChannel,        //下单渠道
+			"audit_status":         3,                   //默认审核通过
+			"buy_subject":          buy_subject,
+			"ent_id":               entId,
+		})
+		if orderid <= 0 {
+			return nil, fmt.Errorf("创建订单异常")
+		}
+		//绑定核销卡券
+		if (userLotteryId != "" && this.GetString("lotteryId") != "") || (discountId > 0) {
+			go func(userId, userLotteryId, orderCode, discountIdStr string) {
+				phone, nickname := util.GetMyPhoneAndName(userId)
+				if !util.UpdateCouponState(userId, userLotteryId, nickname, phone, orderCode, "数据流量包", discountIdStr, 3, 0) {
+					log.Println(fmt.Sprintf("单号%s-绑定失败-卡卷%s", orderCode, userLotteryId))
+				}
+				if discountId > 0 {
+					if ulid := util.FindUserLotteryId(userId, orderid, discountId); ulid != 0 {
+						userLotteryId = strconv.Itoa(ulid)
+					}
+				}
+			}(userId, userLotteryId, orderCode, strconv.Itoa(discountId))
+		}
+		return map[string]interface{}{
+			"orderCode": orderCode,
+		}, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportPack CreateOrder 异常:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 
 // Account 数据导出数据包账户详情
 func (this *DataExportPack) Account() {
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                accountMap, err := entity.JyDataExportPack.GetAccountMsg(this.Session(), userId)
-                if err != nil {
-                        return nil, err
-                }
-                return accountMap, nil
-        }()
-        if errMsg != nil {
-                log.Printf("%s DataExportPack Account 异常:%s\n", userId, errMsg.Error())
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		accountMap, err := entity.JyDataExportPack.GetAccountMsg(this.Session(), userId)
+		if err != nil {
+			return nil, err
+		}
+		return accountMap, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportPack Account 异常:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 
 // Statistics 数据导出筛选结果使用流量包扣除,去重
@@ -246,53 +246,53 @@ func (this *DataExportPack) Account() {
 //
 //	repeat 去重数量
 func (this *DataExportPack) Statistics() {
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                //企业数据包、个人数据包去重数量查询
-                filterId := encrypt.SE.Decode4Hex(this.GetString("filterId"))
-                if filterId == "" {
-                        return nil, fmt.Errorf("请求参数异常")
-                }
-                selectCount := dataexport.GetDataExportSearchCountByScdId(util.MQFW, util.Mgo_bidding, config.Config.Mongobidding.DbName, config.Config.Elasticsearch, filterId)
-                if selectCount > config.ExConf.MsgMaxCount || selectCount == -1 {
-                        selectCount = config.ExConf.MsgMaxCount
-                }
-                if selectCount <= 0 {
-                        return nil, fmt.Errorf("导出数据异常")
-                }
-                if entId := this.GetString("entId"); entId != "" {
-                        deduct, err := entity.JyDataExportPack.DoEntPackRepeatCheck(this.Session(), userId, entId, filterId, selectCount)
-                        if err != nil {
-                                log.Printf("%s Statistics-DoEntPackRepeatCheck 查询导出id失败 %v\n", userId, err)
-                                return nil, fmt.Errorf("去重查询失败")
-                        }
-                        return map[string]interface{}{
-                                "repeat": selectCount - deduct,
-                                "deduct": deduct,
-                        }, nil
-                } else if packType := this.GetString("packType"); packType != "" {
-                        ids, err := dataexport.GetDataExportIdArrByScdId(util.MQFW, config.Config.Elasticsearch, filterId, selectCount)
-                        if err != nil {
-                                log.Printf("%s Statistics 查询导出id失败 %v\n", userId, err)
-                                return nil, fmt.Errorf("查询去重异常")
-                        }
-                        repeat, deduct, err := entity.JyDataExportPack.DoPerPackRepeatCheck(userId, packType == "senior", ids)
-                        if err != nil {
-                                log.Printf("%s Statistics-DoPerPackRepeatCheck 查询导出id失败 %v\n", userId, err)
-                                return nil, fmt.Errorf("去重查询失败")
-                        }
-                        return map[string]interface{}{
-                                "repeat": repeat,
-                                "deduct": deduct,
-                        }, nil
-                } else {
-                        return nil, fmt.Errorf("未知请求")
-                }
-        }()
-        if errMsg != nil {
-                log.Printf("%s DataExportPack Statistics 异常:%s\n", userId, errMsg.Error())
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		//企业数据包、个人数据包去重数量查询
+		filterId := encrypt.SE.Decode4Hex(this.GetString("filterId"))
+		if filterId == "" {
+			return nil, fmt.Errorf("请求参数异常")
+		}
+		selectCount := dataexport.GetDataExportSearchCountByScdId(util.MQFW, util.Mgo_bidding, config.Config.Mongobidding.DbName, config.Config.Elasticsearch, filterId)
+		if selectCount > config.ExConf.MsgMaxCount || selectCount == -1 {
+			selectCount = config.ExConf.MsgMaxCount
+		}
+		if selectCount <= 0 {
+			return nil, fmt.Errorf("导出数据异常")
+		}
+		if entId := this.GetString("entId"); entId != "" {
+			deduct, err := entity.JyDataExportPack.DoEntPackRepeatCheck(this.Session(), userId, entId, filterId, selectCount)
+			if err != nil {
+				log.Printf("%s Statistics-DoEntPackRepeatCheck 查询导出id失败 %v\n", userId, err)
+				return nil, fmt.Errorf("去重查询失败")
+			}
+			return map[string]interface{}{
+				"repeat": selectCount - deduct,
+				"deduct": deduct,
+			}, nil
+		} else if packType := this.GetString("packType"); packType != "" {
+			ids, err := dataexport.GetDataExportIdArrByScdId(util.MQFW, config.Config.Elasticsearch, filterId, selectCount)
+			if err != nil {
+				log.Printf("%s Statistics 查询导出id失败 %v\n", userId, err)
+				return nil, fmt.Errorf("查询去重异常")
+			}
+			repeat, deduct, err := entity.JyDataExportPack.DoPerPackRepeatCheck(userId, packType == "senior", ids)
+			if err != nil {
+				log.Printf("%s Statistics-DoPerPackRepeatCheck 查询导出id失败 %v\n", userId, err)
+				return nil, fmt.Errorf("去重查询失败")
+			}
+			return map[string]interface{}{
+				"repeat": repeat,
+				"deduct": deduct,
+			}, nil
+		} else {
+			return nil, fmt.Errorf("未知请求")
+		}
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportPack Statistics 异常:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 
 // PackPay 数据流量包扣除
@@ -302,189 +302,193 @@ func (this *DataExportPack) Statistics() {
 //
 // return	serialNumber 流水号(暂定为记录id)
 func (this *DataExportPack) PackPay() {
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                //企业数据包、个人数据包流量包支付
-                //数据总量,扣除量
-                total_req, _ := this.GetInteger("total") //导出总量
-                filterId := encrypt.SE.Decode4Hex(this.GetString("filterId"))
-                if filterId == "" {
-                        return nil, fmt.Errorf("请求参数异常")
-                }
-                selectCount := dataexport.GetDataExportSearchCountByScdId(util.MQFW, util.Mgo_bidding, config.Config.Mongobidding.DbName, config.Config.Elasticsearch, filterId)
-                if selectCount > config.ExConf.MsgMaxCount || selectCount == -1 {
-                        selectCount = config.ExConf.MsgMaxCount
-                }
-                if total_req != selectCount {
-                        return nil, fmt.Errorf("数据总量发生变化请重新导出")
-                }
-                switch this.GetString("doType") {
-                case "entPack": //企业数据包支付
-                        entId := this.GetString("entId")
-                        var userPhone, userMail string
-                        if reqPhone, reqMail := this.GetString("order_phone"), this.GetString("order_email"); reqPhone != "" && reqMail != "" {
-                                user_phone, user_mail, user_mail_status := dataExportPhoneAndMailCheck(this.Session())
-                                if user_phone == "" || user_mail == "" || !user_mail_status || reqMail != user_mail {
-                                        log.Printf("%s 验证手机号邮箱异常 session[phone:%s,mail:%s,mailCheck:%v] request[phone:%s,mail:%s]\n", userId, user_phone, user_mail, user_mail_status, reqPhone, reqMail)
-                                        return nil, fmt.Errorf("验证手机号邮箱异常")
-                                }
-                                userPhone = reqPhone
-                                userMail = reqMail
-                        }
-                        //扣除数量查询
-                        err := entity.JyDataExportPack.UseEntPack(this.Session(), userId, entId, filterId, userPhone, userMail)
-                        if err != nil {
-                                return nil, err
-                        }
-                        return "success", nil
-                case "personalPack": //个人数据包支付
-                        var userPhone, userMail string
-                        if reqPhone, reqMail := this.GetString("order_phone"), this.GetString("order_email"); reqPhone != "" && reqMail != "" {
-                                user_phone, user_mail, user_mail_status := dataExportPhoneAndMailCheck(this.Session())
-                                if user_phone == "" || user_mail == "" || !user_mail_status || reqMail != user_mail {
-                                        log.Printf("%s 验证手机号邮箱异常 session[phone:%s,mail:%s,mailCheck:%v] request[phone:%s,mail:%s]\n", userId, user_phone, user_mail, user_mail_status, reqPhone, reqMail)
-                                        return nil, fmt.Errorf("验证手机号邮箱异常")
-                                }
-                                userPhone = reqPhone
-                                userMail = reqMail
-                        } else {
-                                return nil, fmt.Errorf("验证手机号邮箱不能为空")
-                        }
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		//企业数据包、个人数据包流量包支付
+		//数据总量,扣除量
+		total_req, _ := this.GetInteger("total") //导出总量
+		filterId := encrypt.SE.Decode4Hex(this.GetString("filterId"))
+		if filterId == "" {
+			return nil, fmt.Errorf("请求参数异常")
+		}
+		selectCount := dataexport.GetDataExportSearchCountByScdId(util.MQFW, util.Mgo_bidding, config.Config.Mongobidding.DbName, config.Config.Elasticsearch, filterId)
+		if selectCount > config.ExConf.MsgMaxCount || selectCount == -1 {
+			selectCount = config.ExConf.MsgMaxCount
+		}
+		if total_req != selectCount {
+			return nil, fmt.Errorf("数据总量发生变化请重新导出")
+		}
+		switch this.GetString("doType") {
+		case "entPack": //企业数据包支付
+			entId := qutil.InterfaceToStr(this.GetSession("entId"))
+			positionType := qutil.Int64All(this.GetSession("positionType"))
+			if entId == "" || entId == "0" || positionType == 0 {
+				return nil, fmt.Errorf("当前身份不能使用企业扣减")
+			}
+			var userPhone, userMail string
+			if reqPhone, reqMail := this.GetString("order_phone"), this.GetString("order_email"); reqPhone != "" && reqMail != "" {
+				user_phone, user_mail, user_mail_status := dataExportPhoneAndMailCheck(this.Session())
+				if user_phone == "" || user_mail == "" || !user_mail_status || reqMail != user_mail {
+					log.Printf("%s 验证手机号邮箱异常 session[phone:%s,mail:%s,mailCheck:%v] request[phone:%s,mail:%s]\n", userId, user_phone, user_mail, user_mail_status, reqPhone, reqMail)
+					return nil, fmt.Errorf("验证手机号邮箱异常")
+				}
+				userPhone = reqPhone
+				userMail = reqMail
+			}
+			//扣除数量查询
+			err := entity.JyDataExportPack.UseEntPack(this.Session(), userId, entId, filterId, userPhone, userMail)
+			if err != nil {
+				return nil, err
+			}
+			return "success", nil
+		case "personalPack": //个人数据包支付
+			var userPhone, userMail string
+			if reqPhone, reqMail := this.GetString("order_phone"), this.GetString("order_email"); reqPhone != "" && reqMail != "" {
+				user_phone, user_mail, user_mail_status := dataExportPhoneAndMailCheck(this.Session())
+				if user_phone == "" || user_mail == "" || !user_mail_status || reqMail != user_mail {
+					log.Printf("%s 验证手机号邮箱异常 session[phone:%s,mail:%s,mailCheck:%v] request[phone:%s,mail:%s]\n", userId, user_phone, user_mail, user_mail_status, reqPhone, reqMail)
+					return nil, fmt.Errorf("验证手机号邮箱异常")
+				}
+				userPhone = reqPhone
+				userMail = reqMail
+			} else {
+				return nil, fmt.Errorf("验证手机号邮箱不能为空")
+			}
 
-                        packType := this.GetString("packType") //senior 高级字段;normal 普通字段包
-                        //生成excel扣除,
-                        _ = entity.JyDataExportPack.UsePersonalPack(userId, filterId, userPhone, userMail, packType == "senior", selectCount)
-                        return "success", nil
-                case "dailyPack": //每日限量包扣除
-                        var userPhone, userMail string
-                        if reqPhone, reqMail := this.GetString("order_phone"), this.GetString("order_email"); reqPhone != "" && reqMail != "" {
-                                user_phone, user_mail, user_mail_status := dataExportPhoneAndMailCheck(this.Session())
-                                if user_phone == "" || user_mail == "" || !user_mail_status || reqMail != user_mail {
-                                        log.Printf("%s 验证手机号邮箱异常 session[phone:%s,mail:%s,mailCheck:%v] request[phone:%s,mail:%s]\n", userId, user_phone, user_mail, user_mail_status, reqPhone, reqMail)
-                                        return nil, fmt.Errorf("验证手机号邮箱异常")
-                                }
-                                userPhone = reqPhone
-                                userMail = reqMail
-                        }
-                        err := entity.JyDataExportPack.UseDailyPack(userId, filterId, userPhone, userMail, selectCount, this.Session())
-                        if err != nil {
-                                return nil, err
-                        }
-                        return "success", nil
-                }
-                return nil, fmt.Errorf("未知请求")
-        }()
-        if errMsg != nil {
-                log.Printf("%s DataExportPack PackPay 异常:%s\n", userId, errMsg.Error())
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+			packType := this.GetString("packType") //senior 高级字段;normal 普通字段包
+			//生成excel扣除,
+			_ = entity.JyDataExportPack.UsePersonalPack(userId, filterId, userPhone, userMail, packType == "senior", selectCount)
+			return "success", nil
+		case "dailyPack": //每日限量包扣除
+			var userPhone, userMail string
+			if reqPhone, reqMail := this.GetString("order_phone"), this.GetString("order_email"); reqPhone != "" && reqMail != "" {
+				user_phone, user_mail, user_mail_status := dataExportPhoneAndMailCheck(this.Session())
+				if user_phone == "" || user_mail == "" || !user_mail_status || reqMail != user_mail {
+					log.Printf("%s 验证手机号邮箱异常 session[phone:%s,mail:%s,mailCheck:%v] request[phone:%s,mail:%s]\n", userId, user_phone, user_mail, user_mail_status, reqPhone, reqMail)
+					return nil, fmt.Errorf("验证手机号邮箱异常")
+				}
+				userPhone = reqPhone
+				userMail = reqMail
+			}
+			err := entity.JyDataExportPack.UseDailyPack(userId, filterId, userPhone, userMail, selectCount, this.Session())
+			if err != nil {
+				return nil, err
+			}
+			return "success", nil
+		}
+		return nil, fmt.Errorf("未知请求")
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportPack PackPay 异常:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 
 // FileCheck 流量包导出,文件是否创建完成
 // param	serialNumber 流水号
 // return	filePath 下载文件地址
 func (this *DataExportPack) FileCheck() {
-        userId, _ := this.GetSession("userId").(string)
-        //查询是否完成
-        filterId := encrypt.SE.Decode4Hex(this.GetString("filterId"))
-        doType := this.GetString("doType")
-        var redisKey string
-        if doType == "personalPack" {
-                packType := this.GetString("packType") //senior 高级字段;normal 普通字段包
-                redisKey = fmt.Sprintf("%sResult_%s_%s_%v", doType, userId, filterId, qutil.If(packType == "senior", true, false))
-        } else {
-                redisKey = fmt.Sprintf("%sResult_%s_%s", doType, userId, filterId)
-        }
+	userId, _ := this.GetSession("userId").(string)
+	//查询是否完成
+	filterId := encrypt.SE.Decode4Hex(this.GetString("filterId"))
+	doType := this.GetString("doType")
+	var redisKey string
+	if doType == "personalPack" {
+		packType := this.GetString("packType") //senior 高级字段;normal 普通字段包
+		redisKey = fmt.Sprintf("%sResult_%s_%s_%v", doType, userId, filterId, qutil.If(packType == "senior", true, false))
+	} else {
+		redisKey = fmt.Sprintf("%sResult_%s_%s", doType, userId, filterId)
+	}
 
-        if data := redis.Get("other", redisKey); data != nil {
-                var returnData Result
-                apiStr, _ := data.(string)
-                err := json.Unmarshal([]byte(apiStr), &returnData)
-                if err != nil {
-                        log.Printf("%s FileCheck %v apistr:%s\n", userId, err, apiStr)
-                }
-                this.ServeJson(returnData)
-        } else {
-                this.ServeJson(Result{
-                        Error_code: 1,
-                })
-        }
+	if data := redis.Get("other", redisKey); data != nil {
+		var returnData Result
+		apiStr, _ := data.(string)
+		err := json.Unmarshal([]byte(apiStr), &returnData)
+		if err != nil {
+			log.Printf("%s FileCheck %v apistr:%s\n", userId, err, apiStr)
+		}
+		this.ServeJson(returnData)
+	} else {
+		this.ServeJson(Result{
+			Error_code: 1,
+		})
+	}
 }
 
 // RechargeList 数据流量包充值记录
 func (this *DataExportPack) RechargeList() {
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                pageSize, _ := this.GetInteger("pageSize")
-                pageNum, _ := this.GetInteger("pageNum")
-                total, list, err := entity.JyDataExportPack.PerRechargeList(userId, pageNum, pageSize)
-                if err != nil {
-                        return nil, err
-                }
-                return map[string]interface{}{
-                        "total": total,
-                        "list":  list,
-                }, nil
-        }()
-        if errMsg != nil {
-                log.Printf("%s DataExportPack RechargeList 异常:%s\n", userId, errMsg.Error())
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		pageSize, _ := this.GetInteger("pageSize")
+		pageNum, _ := this.GetInteger("pageNum")
+		total, list, err := entity.JyDataExportPack.PerRechargeList(userId, pageNum, pageSize)
+		if err != nil {
+			return nil, err
+		}
+		return map[string]interface{}{
+			"total": total,
+			"list":  list,
+		}, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportPack RechargeList 异常:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 
 // RecordList 数据导出记录
 func (this *DataExportPack) RecordList() {
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                pageSize, _ := this.GetInteger("pageSize")
-                pageNum, _ := this.GetInteger("pageNum")
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		pageSize, _ := this.GetInteger("pageSize")
+		pageNum, _ := this.GetInteger("pageNum")
 
-                vipMsg := jy.GetBigVipUserBaseMsg("10000", this.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
-                entId := qutil.IntAll(this.GetSession("entId"))
-                entUserId := qutil.IntAll(this.GetSession("entUserId"))
+		vipMsg := jy.GetBigVipUserBaseMsg("10000", this.Session(), config.Config.Etcd.Hosts, config.Config.Etcd.Key)
+		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
-                }
-                returnData := map[string]interface{}{
-                        "list": returnList,
-                }
-                if total != -1 {
-                        returnData["total"] = total
-                }
-                return returnData, nil
-        }()
-        if errMsg != nil {
-                log.Printf("%s DataExportPack RecordList 异常:%s\n", userId, errMsg.Error())
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+		returnList, total, err := entity.JyDataExportPack.GetDataExportRecordList(userId, vipMsg.Pid, entId, entUserId, pageNum, pageSize)
+		if err != nil {
+			return nil, err
+		}
+		returnData := map[string]interface{}{
+			"list": returnList,
+		}
+		if total != -1 {
+			returnData["total"] = total
+		}
+		return returnData, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportPack RecordList 异常:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }
 
 // sendExportMail 发送邮件
 func (this *DataExportPack) SendExportMail() {
-        userId, _ := this.GetSession("userId").(string)
-        rData, errMsg := func() (interface{}, error) {
-                downurl := this.GetString("downurl")
-                userMail := this.GetString("email")
-                if downurl == "" || userMail == "" {
-                        return nil, fmt.Errorf("缺少字段")
-                }
-                mailContent := fmt.Sprintf(config.ExConf.Mail_attach_pack_attachment, downurl)
-                //用户发送邮件
-                sendOk := false
-                if userMail != "" {
-                        if sendOk = util.SendRetryMail(config.ExConf.Mail_retry, userMail, "历史数据", mailContent, "", nil, config.GmailAuth); sendOk {
-                                log.Printf("DataExportPack SendExportMail 地址%s:邮箱%s数据导出邮件发送成功!", downurl, userMail)
-                        } else {
-                                sendErr := fmt.Sprintf("DataExportPack SendExportMail地址%s:邮箱%s数据导出邮件发送失败", downurl, userMail)
-                                log.Printf("%s DataExportPack SendExportMail 发送邮件失败 %v\n", userId, sendErr)
-                        }
-                }
-                return sendOk, nil
-        }()
-        if errMsg != nil {
-                log.Printf("%s DataExportPack SendExportMail 异常:%s\n", userId, errMsg.Error())
-        }
-        this.ServeJson(NewResult(rData, errMsg))
+	userId, _ := this.GetSession("userId").(string)
+	rData, errMsg := func() (interface{}, error) {
+		downurl := this.GetString("downurl")
+		userMail := this.GetString("email")
+		if downurl == "" || userMail == "" {
+			return nil, fmt.Errorf("缺少字段")
+		}
+		mailContent := fmt.Sprintf(config.ExConf.Mail_attach_pack_attachment, downurl)
+		//用户发送邮件
+		sendOk := false
+		if userMail != "" {
+			if sendOk = util.SendRetryMail(config.ExConf.Mail_retry, userMail, "历史数据", mailContent, "", nil, config.GmailAuth); sendOk {
+				log.Printf("DataExportPack SendExportMail 地址%s:邮箱%s数据导出邮件发送成功!", downurl, userMail)
+			} else {
+				sendErr := fmt.Sprintf("DataExportPack SendExportMail地址%s:邮箱%s数据导出邮件发送失败", downurl, userMail)
+				log.Printf("%s DataExportPack SendExportMail 发送邮件失败 %v\n", userId, sendErr)
+			}
+		}
+		return sendOk, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s DataExportPack SendExportMail 异常:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
 }

+ 1 - 1
src/jfw/modules/weixin/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-20230128092104-d8ae3867d2ab
+	app.yhyue.com/moapp/jypkg v0.0.0-20230131063426-ccffb86d71ba
 	github.com/SKatiyar/qr v0.0.0-20151201054752-25b6bdf44e67
 	go.mongodb.org/mongo-driver v1.11.1
 )

+ 2 - 2
src/jfw/modules/weixin/src/go.sum

@@ -4,8 +4,8 @@ app.yhyue.com/moapp/jyPoints v1.1.1/go.mod h1:SvP8p5L3jGrejHiH2LXfgCg/NPlFiKBC5Y
 app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 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-20230128092104-d8ae3867d2ab h1:a9XvegdF3aM0y9v5SHtX03LIGMS3+8J1ofoNeyw5J0Y=
-app.yhyue.com/moapp/jypkg v0.0.0-20230128092104-d8ae3867d2ab/go.mod h1:MqJfBFTSfZhrNDEnE4e19BmaLkaMr+lYActLXm6lrpw=
+app.yhyue.com/moapp/jypkg v0.0.0-20230131063426-ccffb86d71ba h1:qHooCBLdOZy7+HcnKz91t3sBP7Pj9C1HJrTmoIL5Z7Y=
+app.yhyue.com/moapp/jypkg v0.0.0-20230131063426-ccffb86d71ba/go.mod h1:pP5ndkkN1EsVVEL3A+ji/ll1crBtnOAqb2JNw1aAPvI=
 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/BaseService/powerCheckCenter v0.0.0-20230128033309-a6b26e74a68c h1:g49jOlhZlBCJ3IgJA0rotfNf2Gh22pISffUtqxB8XtY=

部分文件因为文件数量过多而无法显示