Selaa lähdekoodia

feat:新增调用权益中台rpc服务

zhangxinlei1996 2 vuotta sitten
vanhempi
commit
0620cdba36
9 muutettua tiedostoa jossa 545 lisäystä ja 296 poistoa
  1. 7 13
      entity/entity.go
  2. 11 11
      go.mod
  3. 16 18
      go.sum
  4. 2 0
      rpc/entmanageapplication.go
  5. 7 2
      rpc/etc/entmanageapplication.yaml
  6. 1 0
      rpc/internal/config/config.go
  7. 163 115
      service/coverage
  8. 322 123
      service/coverage.html
  9. 16 14
      service/service.go

+ 7 - 13
entity/entity.go

@@ -3,21 +3,14 @@ package entity
 import (
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
 const (
-	NewOther                  = "newother"
-	PowerCacheDb              = "other"
-	PowerCacheKey             = "bigmember_power_3_%s"
-	IsGetUserBaseInfoRedisKey = "baseinfo_%s"
-	//1|2|3 用于取分测试环境web123 ,正式环境只有一个
-	RedisMenuKey1       = "jy_workdesktopmenu_10000_PC_menu1_%s" //剑鱼appid:10000   %s职位id
-	RedisMenuKey2       = "jy_workdesktopmenu_10000_WX_menu2_%s" //剑鱼appid:10000   %s职位id
-	RedisMenuKey3       = "jy_workdesktopmenu_10000_APP_menu3_%s" //剑鱼appid:10000   %s职位id
-	UserPowerRedisKey   = "jy_userpowerredis_10000_%d_%s"     //工作桌面 用户功能缓存(类似bigmember_power_3_%s) %s职位id
-	PowerCheckKey       = "user_power_info_%s"                //权益校验中台缓存
+	NewOther            = "newother"
+	PowerCacheDb        = "other"
 	EntnicheInfo        = "entniche_info"
 	EntnicheUser        = "entniche_user"
 	EntnichePower       = "entniche_power"
@@ -53,9 +46,10 @@ type SubvipBuySet struct {
 }
 
 var (
-	JyMysql       *mysql.Mysql
-	Mgo           *mongodb.MongodbSim
-	UserCenterRpc usercenter.UserCenter
+	JyMysql             *mysql.Mysql
+	Mgo                 *mongodb.MongodbSim
+	UserCenterRpc       usercenter.UserCenter
+	PowerCheckCenterRpc powercheck.PowerCheck
 )
 
 func InitMysql(n *mysql.Mysql) {

+ 11 - 11
go.mod

@@ -1,12 +1,12 @@
 module bp.jydev.jianyu360.cn/BaseService/entManageApplication
 
-go 1.18
+go 1.19
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230220025048-5b1650be21b9
-	github.com/zeromicro/go-zero v1.4.4
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230221025500-c75817e849ea
+	github.com/zeromicro/go-zero v1.4.3
 	google.golang.org/grpc v1.53.0
 	google.golang.org/protobuf v1.28.1
 )
@@ -65,15 +65,15 @@ require (
 	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
 	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
 	go.mongodb.org/mongo-driver v1.11.1 // 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 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/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/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/proto/otlp v0.19.0 // indirect
 	go.uber.org/atomic v1.9.0 // indirect
 	go.uber.org/automaxprocs v1.5.1 // indirect

+ 16 - 18
go.sum

@@ -9,13 +9,15 @@ bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4 h1:zl5eZrKDBENVVBUiPpzyQQ0/SBdGUmZS3thXycSEO1g=
 bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4/go.mod h1:BMLd/5wb3BIEGhnEgF9y1sJN9P5/Dw9kYsoiE9V8I9g=
+bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230221025500-c75817e849ea h1:MZyZg1Vo7Y74Rq9kyewXJnwMXwg0lddJqgU1fNRxMHg=
+bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230221025500-c75817e849ea/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-20220420075831-0b59892e9982/go.mod h1:wsHNO91h37H+xE4ZNny0yd7mtpODeDJxbVYhIRMR+qw=
 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-20230220025048-5b1650be21b9 h1:BIPAnDYKSlX9W0qTCirHQm6Gc9JNWLo88gEXhGXWYo0=
-bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230220025048-5b1650be21b9/go.mod h1:vDEKni2rnCraKgKnnCEIwsFmO92GxnpfKmNQ+83wKP0=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230220120914-987d2f396c82 h1:Kf1OfnnX9/Oa22JcdZPP5Yhpg4T4jIPuJat3LI7jqUI=
+bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230220120914-987d2f396c82/go.mod h1:vDEKni2rnCraKgKnnCEIwsFmO92GxnpfKmNQ+83wKP0=
 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.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
@@ -415,6 +417,7 @@ 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.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/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 v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
@@ -728,6 +731,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=
@@ -971,6 +975,8 @@ github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaN
 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.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=
 go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
@@ -1000,43 +1006,35 @@ 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.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.10.0/go.mod h1:n9IGyx0fgyXXZ/i0foLHNxtET9CzXHzZeKCucvRBFgA=
-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 h1:TaB+1rQhddO1sF71MpZOZAuSPW1klK2M8XxfrBMfK7Y=
 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY=
-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 h1:pDDYmo0QadUPal5fwXoY1pmMpFcdyhXOmL5drCrI3vU=
 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0/go.mod h1:Krqnjl22jUJ0HgMzw5eveuCvFDXY4nSYb4F8t5gdrag=
-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 h1:KtiUEhQmj/Pa874bVYKGNVdq8NPKiacPbaRRtgXi+t4=
 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.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=

+ 2 - 0
rpc/entmanageapplication.go

@@ -13,6 +13,7 @@ import (
 	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/internal/server"
 	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/internal/svc"
 	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/pb"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/zrpc"
@@ -32,6 +33,7 @@ func main() {
 	entity.InitMongo(c.Mongo.Qfw.MongodbAddr, c.Mongo.Qfw.DbName, c.Mongo.Qfw.Size)
 	redis.InitRedisBySize(c.RedisAddrs, 100, 30, 300)
 	entity.UserCenterRpc = usercenter.NewUserCenter(zrpc.MustNewClient(c.UserCenterRpc))
+	entity.PowerCheckCenterRpc = powercheck.NewPowerCheck(zrpc.MustNewClient(c.PowerCheckRpc))
 	s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
 		pb.RegisterEntManageApplicationServer(grpcServer, srv)
 	})

+ 7 - 2
rpc/etc/entmanageapplication.yaml

@@ -2,13 +2,18 @@ Name: entmanageapplication.rpc
 ListenOn: 0.0.0.0:9998
 Etcd:
   Hosts:
-  - 192.168.3.240:2379
+  - 127.0.0.1:2379
   Key: entmanageapplication.rpc
 UserCenterRpc:
   Etcd:
     Hosts:
-    - 192.168.3.240:2379
+    - 127.0.0.1:2379
     Key: usercenter.rpc
+PowerCheckCenterRpc:
+  Etcd:
+    Hosts:
+    - 192.168.3.149:2379
+    Key: powercheck.rpc
 Mode: test
 RedisAddrs: newother=192.168.3.206:1712
 Mysql:

+ 1 - 0
rpc/internal/config/config.go

@@ -9,6 +9,7 @@ import (
 type Config struct {
 	zrpc.RpcServerConf
 	UserCenterRpc zrpc.RpcClientConf
+	PowerCheckRpc zrpc.RpcClientConf
 	Logx          logx.LogConf
 	Mysql         struct {
 		JianYu *mysql.Mysql

+ 163 - 115
service/coverage

@@ -1,116 +1,164 @@
 mode: set
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:23.102,27.47 4 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:61.2,62.18 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:65.2,69.3 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:27.47,30.45 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:30.45,33.4 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:33.9,34.30 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:34.30,37.38 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:56.5,57.44 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:37.38,39.26 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:39.26,41.7 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:41.12,44.12 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:46.11,55.6 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:62.18,64.3 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:72.102,78.8 5 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:81.2,84.3 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:78.8,80.3 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:87.105,97.35 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:125.2,128.3 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:97.35,98.27 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:98.27,100.45 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:100.45,111.5 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:111.10,122.5 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:131.108,134.35 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:147.2,150.3 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:134.35,135.27 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:135.27,145.4 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:153.51,155.35 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:155.35,158.46 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:158.46,161.67 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:161.67,163.5 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:163.10,163.41 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:163.41,165.5 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:170.73,183.42 13 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:186.2,197.9 4 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:200.2,200.18 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:324.2,324.13 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:183.42,185.3 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:197.9,199.3 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:200.18,202.39 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:206.3,207.51 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:202.39,205.4 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:207.51,210.32 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:213.4,215.49 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:230.4,232.51 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:210.32,212.5 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:215.49,216.41 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:216.41,217.24 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:217.24,218.25 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:218.25,220.8 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:220.13,222.8 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:223.12,225.7 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:226.11,228.6 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:232.51,235.41 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:240.5,241.20 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:235.41,237.6 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:237.11,239.6 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:241.20,244.6 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:245.10,258.21 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:258.21,260.6 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:260.11,263.6 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:266.8,267.51 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:321.3,322.31 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:267.51,270.32 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:273.4,275.49 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:290.4,292.51 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:270.32,272.5 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:275.49,276.41 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:276.41,277.24 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:277.24,278.25 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:278.25,280.8 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:280.13,282.8 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:283.12,285.7 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:286.11,288.6 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:292.51,296.20 4 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:296.20,299.6 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:300.10,313.21 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:313.21,315.6 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:315.11,318.6 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:327.33,330.37 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:337.2,337.15 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:330.37,331.28 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:331.28,332.25 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:332.25,334.5 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:340.30,354.2 13 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:356.73,367.42 10 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:373.2,374.19 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:377.2,378.13 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:367.42,369.3 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:374.19,376.3 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:381.149,396.12 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:401.2,401.10 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:404.2,404.13 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:396.12,400.3 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:401.10,403.3 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:408.30,409.18 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:412.2,414.41 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:409.18,411.3 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:414.41,417.21 3 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:417.21,421.4 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:425.42,438.2 12 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:440.25,442.35 2 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:442.35,447.40 5 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:447.40,450.47 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:450.47,453.68 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:453.68,456.6 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:456.11,456.42 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:456.42,461.6 4 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:467.38,471.35 4 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:509.2,509.15 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:471.35,474.50 3 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:474.50,476.4 1 1
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:476.9,478.54 2 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:478.54,480.5 1 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:480.10,503.18 6 0
-bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:503.18,505.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:22.102,24.26 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:31.2,33.47 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:80.2,81.18 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:84.2,88.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:24.26,30.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:33.47,36.45 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:36.45,39.4 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:39.9,40.30 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:40.30,42.16 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:46.5,48.38 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:75.5,76.56 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:42.16,43.14 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:48.38,51.26 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:51.26,53.7 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:53.12,57.41 4 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:57.41,60.13 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:61.13,63.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:65.11,74.6 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:81.18,83.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:91.102,97.8 5 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:100.2,103.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:97.8,99.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:106.105,118.35 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:146.2,149.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:118.35,119.27 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:119.27,121.45 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:121.45,132.5 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:132.10,143.5 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:152.108,156.35 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:173.2,176.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:156.35,157.27 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:157.27,159.35 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:162.4,170.26 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:159.35,161.5 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:179.64,181.35 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:181.35,184.46 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:184.46,189.34 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:189.34,192.5 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:192.10,192.41 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:192.41,195.5 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:200.73,213.42 13 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:216.2,227.9 4 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:230.2,230.18 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:352.2,353.13 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:213.42,215.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:227.9,229.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:230.18,232.39 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:236.3,237.51 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:232.39,235.4 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:237.51,240.32 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:243.4,245.49 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:260.4,262.51 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:240.32,242.5 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:245.49,246.41 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:246.41,247.24 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:247.24,248.25 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:248.25,250.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:250.13,252.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:253.12,255.7 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:256.11,258.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:262.51,271.20 4 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:271.20,274.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:275.10,288.21 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:288.21,290.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:290.11,293.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:296.8,297.51 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:297.51,300.32 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:303.4,305.49 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:320.4,322.51 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:300.32,302.5 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:305.49,306.41 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:306.41,307.24 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:307.24,308.25 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:308.25,310.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:310.13,312.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:313.12,315.7 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:316.11,318.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:322.51,326.20 4 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:326.20,329.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:330.10,343.21 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:343.21,345.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:345.11,348.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:356.33,359.37 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:366.2,366.15 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:359.37,360.28 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:360.28,361.25 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:361.25,363.5 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:369.30,383.2 13 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:385.73,396.42 10 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:402.2,403.19 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:406.2,407.13 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:396.42,398.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:403.19,405.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:410.149,425.12 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:429.2,429.10 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:432.2,432.13 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:425.12,428.3 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:429.10,431.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:436.30,437.18 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:440.2,442.41 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:437.18,439.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:442.41,445.21 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:445.21,449.4 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:453.25,455.35 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:455.35,460.40 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:460.40,463.47 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:463.47,467.35 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:467.36,469.6 0 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:469.11,469.42 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:469.43,472.6 0 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:481.41,488.2 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:492.109,502.16 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:508.2,515.12 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:519.2,519.19 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:502.16,504.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:504.8,504.23 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:504.23,506.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:515.13,518.3 0 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:523.114,532.42 8 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:537.2,538.19 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:542.2,559.8 8 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:532.42,534.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:538.19,540.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:562.131,576.42 14 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:579.2,591.18 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:708.2,708.8 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:576.42,578.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:591.18,593.39 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:597.3,598.51 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:593.39,596.4 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:598.51,601.32 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:604.4,606.49 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:621.4,623.51 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:601.32,603.5 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:606.49,607.41 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:607.41,608.24 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:608.24,609.25 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:609.25,611.8 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:611.13,613.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:614.12,616.7 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:617.11,619.6 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:623.51,627.20 4 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:627.20,630.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:631.10,644.21 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:644.21,646.6 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:646.11,649.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:652.8,653.51 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:653.51,656.32 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:659.4,661.49 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:676.4,678.51 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:656.32,658.5 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:661.49,662.41 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:662.41,663.24 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:663.24,664.25 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:664.25,666.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:666.13,668.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:669.12,671.7 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:672.11,674.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:678.51,682.20 4 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:682.20,685.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:686.10,699.21 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:699.21,701.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:701.11,704.6 2 0

+ 322 - 123
service/coverage.html

@@ -55,7 +55,7 @@
 			<div id="nav">
 				<select id="files">
 				
-				<option value="file0">bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go (60.1%)</option>
+				<option value="file0">bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go (28.9%)</option>
 				
 				</select>
 			</div>
@@ -81,7 +81,6 @@ import (
 
         "context"
 
-        "app.yhyue.com/moapp/jybase/mongodb"
         . "bp.jydev.jianyu360.cn/BaseService/entManageApplication/entity"
         "bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/entmanageapplication"
         "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
@@ -93,7 +92,14 @@ import (
 
 func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplication.AddUsePersonResp <span class="cov8" title="1">{
         timeStr, ok, id, msg, code := time.Now().Format("2006-01-02 15:04:05"), false, int64(0), "", int64(0)
-        UserArr := strings.Split(this.EntUserId, ",")
+        if this.EntUserId == "" </span><span class="cov0" title="0">{
+                return &amp;entmanageapplication.AddUsePersonResp{
+                        ErrorCode: -1,
+                        ErrorMsg:  "添加失败",
+                        Data:      &amp;entmanageapplication.AddUsePerson{Status: int64(-1)},
+                }
+        }</span>
+        <span class="cov8" title="1">UserArr := strings.Split(this.EntUserId, ",")
         sourceData := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": this.WaitEmpowerId}, "", "")
         if sourceData != nil &amp;&amp; len(*sourceData) &gt; 0 </span><span class="cov8" title="1">{
                 empower_count := common.IntAll((*sourceData)["empower_count"])
@@ -103,18 +109,31 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
                         code = int64(-1)
                 }</span> else<span class="cov8" title="1"> {
                         for _, v := range UserArr </span><span class="cov8" title="1">{
-                                entUserId, _ := strconv.Atoi(v)
+                                //过滤空值2023-01-04
+                                if v == "" </span><span class="cov0" title="0">{
+                                        continue</span>
+                                }
+                                //
+                                <span class="cov8" title="1">entUserId, _ := strconv.Atoi(v)
                                 data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, "", "")
-                                if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
+                                if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov0" title="0">{
                                         dataStatus := common.IntAll((*data)["status"])
-                                        if dataStatus == -1 </span><span class="cov8" title="1">{
+                                        wait_empower_id := common.Int64All((*data)["wait_empower_id"])
+                                        if dataStatus == -1 </span><span class="cov0" title="0">{
                                                 ok = JyMysql.Update(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, map[string]interface{}{"wait_empower_id": this.WaitEmpowerId, "status": 1, "update_time": timeStr})
                                         }</span> else<span class="cov0" title="0"> {
-                                                msg = "人员已经拥有权限,请先删除原有权限"
-                                                code = int64(-1)
-                                                break</span>
+                                                resdata := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": wait_empower_id}, "", "")
+                                                end_time := common.ObjToString((*resdata)["end_time"])
+                                                res, _ := time.ParseInLocation("2006-01-02 15:04:05", end_time, time.Local)
+                                                if res.Unix() &gt; time.Now().Unix() </span><span class="cov0" title="0">{
+                                                        msg = "人员已经拥有权限,请先删除原有权限"
+                                                        code = int64(-1)
+                                                        break</span>
+                                                } else<span class="cov0" title="0"> {
+                                                        ok = JyMysql.Update(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, map[string]interface{}{"wait_empower_id": this.WaitEmpowerId, "status": 1, "update_time": timeStr})
+                                                }</span>
                                         }
-                                } else<span class="cov0" title="0"> {
+                                } else<span class="cov8" title="1"> {
                                         id = JyMysql.Insert(EntnichePower, map[string]interface{}{
                                                 "wait_empower_id": this.WaitEmpowerId,
                                                 "ent_id":          this.EntId,
@@ -125,7 +144,7 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
                                         })
                                 }</span>
                                 <span class="cov8" title="1">JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count + 1 where id = ?`, this.WaitEmpowerId)
-                                addPower(this.WaitEmpowerId, entUserId)</span>
+                                addPower(this.WaitEmpowerId, entUserId, this.EntId)</span>
                         }
                 }
         }
@@ -156,14 +175,16 @@ func DelUsePerson(this *entmanageapplication.DelUsePersonReq) *entmanageapplicat
 }
 
 func UsePersonList(this *entmanageapplication.UsePersonListReq) *entmanageapplication.UsePersonListResp <span class="cov8" title="1">{
+        nowTime := time.Now().Format("2006-01-02 15:04:05")
         data := JyMysql.SelectBySql(`select a.id,a.wait_empower_id,c.name,c.phone,c.mail,g.name as department,e.name as role from entniche_power a 
                 INNER JOIN entniche_user c on (a.ent_user_id=c.id and a.ent_id = c.ent_id) 
                 LEFT JOIN entniche_user_role d on (c.id=d.user_id) 
                 LEFT JOIN entniche_role e on (d.role_id=e.id) 
                 LEFT JOIN entniche_department_user f on (a.ent_user_id=f.user_id) 
                 LEFT JOIN entniche_department g on (g.id=f.dept_id) 
-                where a.status = 1 and a.ent_id = ?
-                order by a.update_time desc`, this.EntId)
+                LEFT JOIN entniche_wait_empower h on (h.id=a.wait_empower_id) 
+                where a.status = 1 and a.ent_id = ? and end_time &gt;= ? 
+                order by a.update_time desc`, this.EntId, nowTime)
         arr := []*entmanageapplication.UsePersonList{}
         if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
                 for _, v := range *data </span><span class="cov8" title="1">{
@@ -200,20 +221,25 @@ func UsePersonList(this *entmanageapplication.UsePersonListReq) *entmanageapplic
 }
 
 func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageapplication.BuyProductListResp <span class="cov8" title="1">{
-        data := JyMysql.Find(EntnicheWaitEmpower, map[string]interface{}{"ent_id": this.EntId}, "", "create_time desc", 0, 0)
+        nowTime := time.Now().Format("2006-01-02 15:04:05")
+        data := JyMysql.SelectBySql(`select * from `+EntnicheWaitEmpower+` where ent_id = ? and end_time &gt;= ? order by create_time desc`, this.EntId, nowTime)
         arr := []*entmanageapplication.BuyProductList{}
         if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
                 for _, v := range *data </span><span class="cov8" title="1">{
-                        obj := &amp;entmanageapplication.BuyProductList{
+                        product_type := common.ObjToString(v["product_type"])
+                        if product_type == "VIP订阅" </span><span class="cov8" title="1">{
+                                product_type = "超级订阅"
+                        }</span>
+                        <span class="cov8" title="1">obj := &amp;entmanageapplication.BuyProductList{
                                 WaitEmpowerId: common.Int64All(v["id"]),
-                                ProductType:   common.ObjToString(v["product_type"]),
+                                ProductType:   product_type,
                                 UseCount:      common.Int64All(v["use_count"]),
                                 EmpowerCount:  common.Int64All(v["empower_count"]),
                                 ProvinceCount: common.Int64All(v["province_count"]),
                                 EndTime:       common.ObjToString(v["end_time"]),
                         }
-                        arr = append(arr, obj)
-                }</span>
+                        arr = append(arr, obj)</span>
+                }
         }
         <span class="cov8" title="1">return &amp;entmanageapplication.BuyProductListResp{
                 ErrorCode: 0,
@@ -221,24 +247,28 @@ func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageappl
         }</span>
 }
 
-func addPower(waitEmpowerId int64, entUserId int) <span class="cov8" title="1">{
+func addPower(waitEmpowerId int64, entUserId int, entId int64) <span class="cov8" title="1">{
         data := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
         if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
                 orderId := common.Int64All((*data)["order_id"])
                 orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
                 if orderData != nil &amp;&amp; len(*orderData) &gt; 0 </span><span class="cov8" title="1">{
                         productType := common.ObjToString((*orderData)["product_type"])
-                        userId := getUserId(entUserId)
-                        if productType == "VIP订阅" || productType == "超级订阅" </span><span class="cov0" title="0">{
-                                openPowerVip(*orderData, userId)
-                        }</span> else<span class="cov8" title="1"> if productType == "大会员" </span><span class="cov8" title="1">{
-                                openPowerBig(*orderData, userId)
+
+                        posititonId := getPositionId(entUserId)
+
+                        if productType == "VIP订阅" </span><span class="cov8" title="1">{
+                                log.Println("开通超级订阅", posititonId)
+                                setRule(1, int64(entUserId), entId, *orderData, posititonId)
+                        }</span> else<span class="cov0" title="0"> if productType == "大会员" </span><span class="cov0" title="0">{
+                                log.Println("开通大会员", posititonId)
+                                setRule(2, int64(entUserId), entId, *orderData, posititonId)
                         }</span>
                 }
         }
 }
 
-func openPowerBig(orderData map[string]interface{}, userId string) bool <span class="cov8" title="1">{
+func openPowerBig(orderData map[string]interface{}, userId string) bool <span class="cov0" title="0">{
         filterMap := common.ObjToMap(orderData["filter"])
         startTime := common.ObjToString(orderData["vip_starttime"])
         endTime := common.ObjToString(orderData["vip_endtime"])
@@ -247,15 +277,15 @@ func openPowerBig(orderData map[string]interface{}, userId string) bool <span cl
         enddate, _ := time.ParseInLocation(tmp, endTime, time.Local)
         level := common.IntAll((*filterMap)["level"])
         comboId := common.IntAll((*filterMap)["comboId"])
-        payCycle := common.IntAll((*filterMap)["payCycle"])
+        payCycle := common.IntAll((*filterMap)["cycle"])
         serversId := common.ObjToString((*filterMap)["serversId"])
         serverMap := GetServerPid()
         dataType := 1
         if startdate.Unix() &gt; time.Now().Unix() </span><span class="cov0" title="0">{
                 dataType = 2
         }</span>
-        <span class="cov8" title="1">sets := map[string]interface{}{
-                "i_member_status":      level,
+        <span class="cov0" title="0">sets := map[string]interface{}{
+                "i_member_status":      common.If(dataType == 1, level, -level),
                 "i_member_starttime":   startdate.Unix(),
                 "i_member_endtime":     enddate.Unix(),
                 "i_mainaccount":        1,
@@ -268,47 +298,47 @@ func openPowerBig(orderData map[string]interface{}, userId string) bool <span cl
         if !ok </span><span class="cov0" title="0">{
                 log.Println("大会员创建订单user表大会员状态更新失败")
         }</span>
-        <span class="cov8" title="1">if comboId != 0 </span><span class="cov8" title="1">{
+        <span class="cov0" title="0">if comboId != 0 </span><span class="cov0" title="0">{
                 datas := JyMysql.FindOne("bigmember_combo", map[string]interface{}{"id": comboId}, "", "")
                 if datas == nil || len(*datas) == 0 </span><span class="cov0" title="0">{
                         log.Println("未找到此套餐")
                         return false
                 }</span>
-                <span class="cov8" title="1">s_servers := common.ObjToString((*datas)["s_servers"])
-                for _, s := range strings.Split(s_servers, ",") </span><span class="cov8" title="1">{
+                <span class="cov0" title="0">s_servers := common.ObjToString((*datas)["s_servers"])
+                for _, s := range strings.Split(s_servers, ",") </span><span class="cov0" title="0">{
                         serverId, _ := strconv.Atoi(s)
                         mainId := serverId
                         if serverMap[serverId] != 0 </span><span class="cov0" title="0">{
                                 serverId = serverMap[serverId]
                         }</span>
-                        <span class="cov8" title="1">serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
+                        <span class="cov0" title="0">serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
                         frequency := 0
-                        if serverData != nil &amp;&amp; len(*serverData) &gt; 0 </span><span class="cov8" title="1">{
-                                if serverId == 11 || serverId == 15 </span><span class="cov8" title="1">{
-                                        if serverId == 15 </span><span class="cov8" title="1">{
+                        if serverData != nil &amp;&amp; len(*serverData) &gt; 0 </span><span class="cov0" title="0">{
+                                if serverId == 11 || serverId == 15 </span><span class="cov0" title="0">{
+                                        if serverId == 15 </span><span class="cov0" title="0">{
                                                 if payCycle &gt;= 12 </span><span class="cov0" title="0">{
                                                         frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
-                                                }</span> else<span class="cov8" title="1"> {
+                                                }</span> else<span class="cov0" title="0"> {
                                                         frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
                                                 }</span>
                                         } else<span class="cov0" title="0"> {
                                                 frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
                                         }</span>
-                                } else<span class="cov8" title="1"> {
+                                } else<span class="cov0" title="0"> {
                                         frequency = common.IntAll((*serverData)["s_count_month"])
                                 }</span>
                         }
-                        <span class="cov8" title="1">sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
+                        <span class="cov0" title="0">sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
                         serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
-                        if serverDatas != nil &amp;&amp; len(*serverDatas) &gt; 0 </span><span class="cov8" title="1">{
+                        if serverDatas != nil &amp;&amp; len(*serverDatas) &gt; 0 </span><span class="cov0" title="0">{
                                 i_status := common.If(dataType == 1, 0, 1)
-                                sql := ""
-                                if serverId == 17 || serverId == 18 </span><span class="cov0" title="0">{
-                                        sql = "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
-                                }</span> else<span class="cov8" title="1"> {
-                                        sql = "update bigmember_service_user set i_frequency = i_frequency + ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
-                                }</span>
-                                <span class="cov8" title="1">status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
+                                // sql := ""
+                                // if serverId == 17 || serverId == 18 {
+                                sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                // } else {
+                                // sql = "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                // }
+                                status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
                                 if status1 &lt; 0 </span><span class="cov0" title="0">{
                                         log.Println("新建服务-更新服务表出错", userId)
                                         return false
@@ -362,7 +392,7 @@ func openPowerBig(orderData map[string]interface{}, userId string) bool <span cl
                         serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
                         if serverDatas != nil &amp;&amp; len(*serverDatas) &gt; 0 </span><span class="cov0" title="0">{
                                 i_status := common.If(dataType == 1, 0, 1)
-                                sql := "update bigmember_service_user set i_frequency = i_frequency + ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
                                 status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
                                 if status1 &lt; 0 </span><span class="cov0" title="0">{
                                         log.Println("新建服务-更新服务表出错")
@@ -389,27 +419,26 @@ func openPowerBig(orderData map[string]interface{}, userId string) bool <span cl
                                 }</span>
                         }
                 }
-                <span class="cov0" title="0">RedisDel(userId)
-                ClearBigVipUserPower(userId)</span>
         }
-        <span class="cov8" title="1">return true</span>
+        <span class="cov0" title="0">RedisDel(userId)
+        return true</span>
 }
 
-func GetServerPid() map[int]int <span class="cov8" title="1">{
+func GetServerPid() map[int]int <span class="cov0" title="0">{
         pidMap := map[int]int{}
         datas := JyMysql.Find("bigmember_service", map[string]interface{}{"i_status": 0}, "id,i_pid", "", 0, 0)
-        if datas != nil &amp;&amp; len(*datas) &gt; 0 </span><span class="cov8" title="1">{
-                for _, v := range *datas </span><span class="cov8" title="1">{
-                        if v["i_pid"] != nil </span><span class="cov8" title="1">{
+        if datas != nil &amp;&amp; len(*datas) &gt; 0 </span><span class="cov0" title="0">{
+                for _, v := range *datas </span><span class="cov0" title="0">{
+                        if v["i_pid"] != nil </span><span class="cov0" title="0">{
                                 pidMap[common.IntAll(v["id"])] = common.IntAll(v["i_pid"])
                         }</span>
                 }
         }
-        <span class="cov8" title="1">return pidMap</span>
+        <span class="cov0" title="0">return pidMap</span>
 }
 
-func RedisDel(userId string) <span class="cov8" title="1">{
-        redis.Del("newother", BigKey+userId)
+func RedisDel(userId string) <span class="cov0" title="0">{
+        redis.Del(NewOther, "pl_indexMessage_"+userId)
         cacheKey := fmt.Sprintf(PowerCacheKey, userId)
         baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
         redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
@@ -466,8 +495,7 @@ func StartSubVip(phone string, area map[string]interface{}, newBuyset SubvipBuyS
 
         go func() </span><span class="cov0" title="0">{
                 MergeKws(userId)
-                redis.Del(NewOther, "pl_indexMessage_"+userId)
-                ClearBigVipUserPower(userId)
+                RedisDel(userId)
         }</span>()
         <span class="cov0" title="0">if isOk </span><span class="cov0" title="0">{
                 return true
@@ -493,91 +521,262 @@ func MergeKws(userId string) <span class="cov0" title="0">{
         }
 }
 
-func ClearBigVipUserPower(userId string) <span class="cov8" title="1">{
-        cacheKey := fmt.Sprintf(PowerCacheKey, userId)
-        baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
-        redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
-        redisMenuKeyWX := fmt.Sprintf(RedisMenuKeyWX, userId)
-        redisMenuKeyAPP := fmt.Sprintf(RedisMenuKeyAPP, userId)
-        userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, time.Now().Day(), userId)
-        redis.Del(NewOther, cacheKey)
-        redis.Del(NewOther, baseInfoCacheKey)
-        redis.Del(NewOther, redisMenuKeyPC)
-        redis.Del(NewOther, redisMenuKeyWX)
-        redis.Del(NewOther, redisMenuKeyAPP)
-        redis.Del(NewOther, userPowerRedisKey)
-}</span>
-
 func delPower(id int64) <span class="cov8" title="1">{
         data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"id": id}, "", "")
         if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
                 waitEmpowerId := common.Int64All((*data)["wait_empower_id"])
-                entUserId := common.IntAll((*data)["ent_user_id"])
-                JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count - 1 where id = ?`, waitEmpowerId)
+                // entUserId := common.IntAll((*data)["ent_user_id"])
+                JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count - 1 where id = ? and use_count &gt; 0`, waitEmpowerId)
                 eOData := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
                 if eOData != nil &amp;&amp; len(*eOData) &gt; 0 </span><span class="cov8" title="1">{
                         orderId := common.Int64All((*eOData)["order_id"])
                         orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
                         if orderData != nil &amp;&amp; len(*orderData) &gt; 0 </span><span class="cov8" title="1">{
                                 productType := common.ObjToString((*orderData)["product_type"])
-                                userId := getUserId(entUserId)
-                                if productType == "VIP订阅" || productType == "超级订阅" </span><span class="cov0" title="0">{
-                                        Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_vip_status": -2}})
-                                        ClearBigVipUserPower(userId)
-                                }</span> else<span class="cov8" title="1"> if productType == "大会员" </span><span class="cov8" title="1">{
-                                        Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_member_status": -2}})
-                                        RedisDel(userId)
-                                        ClearBigVipUserPower(userId)
-                                        JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": userId}, map[string]interface{}{"i_status": -1})
+                                //userId := getUserId(entUserId)
+                                //TODO 删除
+                                if productType == "VIP订阅" </span>{<span class="cov0" title="0">
+                                        //Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1}})
+                                }</span> else<span class="cov8" title="1"> if productType == "大会员" </span>{<span class="cov8" title="1">
+                                        //Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_member_status": 1, "i_member_starttime": 1, "i_member_endtime": 1}})
+                                        //JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": userId}, map[string]interface{}{"i_status": -1})
                                 }</span>
+                                // RedisDel(userId)
                         }
                 }
         }
 }
 
-func getUserId(entUserId int) string <span class="cov8" title="1">{
-        data := JyMysql.FindOne(EntnicheUser, map[string]interface{}{"id": entUserId}, "", "")
-        userId := ""
-        now := time.Now()
-        if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
-                phone := common.ObjToString((*data)["phone"])
-                userData, ok := Mgo.FindOne("user", map[string]interface{}{"s_phone": phone})
-                if ok &amp;&amp; userData != nil &amp;&amp; len(*userData) &gt; 0 </span><span class="cov8" title="1">{
-                        userId = mongodb.BsonIdToSId((*userData)["_id"])
-                }</span> else<span class="cov0" title="0"> {
-                        userDatas, oks := Mgo.FindOne("user", map[string]interface{}{"s_m_phone": phone})
-                        if oks &amp;&amp; userDatas != nil &amp;&amp; len(*userDatas) &gt; 0 </span><span class="cov0" title="0">{
-                                userId = mongodb.BsonIdToSId((*userDatas)["_id"])
-                        }</span> else<span class="cov0" title="0"> {
-                                ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
-                                res, _ := UserCenterRpc.UserAdd(ctx, &amp;usercenter.UserAddReq{
-                                        Appid: "10000",
-                                        Phone: phone,
-                                })
-                                data := map[string]interface{}{
-                                        "i_appid":       2,
-                                        "s_phone":       phone,
-                                        "s_password":    "",
-                                        "l_registedate": now.Unix(),
-                                        "i_ts_guide":    2,
-                                        "o_jy": map[string]interface{}{
-                                                "i_wxpush":     1,
-                                                "i_apppush":    1,
-                                                "i_ratemode":   2,
-                                                "l_modifydate": now.Unix(),
-                                        },
-                                        "s_regsource":  "qmx_admin",
-                                        "base_user_id": res.Data.Id,
+//获取用户信息
+//return 职位id
+func getPositionId(entUserId int) int64 <span class="cov8" title="1">{
+        ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+        res, _ := UserCenterRpc.IdentityByEntUserId(ctx, &amp;usercenter.IdentityReq{
+                Id: int64(entUserId),
+        })
+        log.Println(res)
+        return res.PositionId
+}</span>
+
+//订阅设置
+//types:1超级订阅 2大会员
+func setRule(types int64, entUserId, entId int64, orderData map[string]interface{}, posititonId int64) bool <span class="cov8" title="1">{
+        //订阅设置
+        query := map[string]interface{}{
+                "i_entid":  entId,
+                "i_userid": entUserId,
+        }
+        //orderData相关权益
+        set := map[string]interface{}{}
+        setEntUser := map[string]interface{}{}
+        //超级订阅
+        if types == 1 </span><span class="cov8" title="1">{
+                set, setEntUser = vipSetMap(orderData)
+        }</span> else<span class="cov0" title="0"> if types == 2 </span><span class="cov0" title="0">{
+                set, setEntUser = memberSetMap(posititonId, orderData)
+        }</span>
+
+        <span class="cov8" title="1">ok1 := Mgo.Update("entniche_rule", query, map[string]interface{}{
+                "$set": set,
+        }, true, false)
+        ok2 := Mgo.Update("ent_user", query, map[string]interface{}{
+                "$set": setEntUser,
+        }, true, false)
+
+        go func() </span>{<span class="cov8" title="1">
+                // MergeKws(userId)
+                // RedisDel(userId)
+        }</span>()
+        <span class="cov8" title="1">return ok1 &amp;&amp; ok2</span>
+}
+
+//
+func vipSetMap(orderData map[string]interface{}) (set map[string]interface{}, setEntUser map[string]interface{}) <span class="cov8" title="1">{
+        set, setEntUser = map[string]interface{}{}, map[string]interface{}{}
+        startTime := common.ObjToString(orderData["vip_starttime"])
+        endTime := common.ObjToString(orderData["vip_endtime"])
+        Date_Full_Layout := "2006-01-02 15:04:05"
+        startdate, _ := time.ParseInLocation(Date_Full_Layout, startTime, time.Local)
+        enddate, _ := time.ParseInLocation(Date_Full_Layout, endTime, time.Local)
+
+        dataType := 1
+        if startdate.Unix() &gt; time.Now().Unix() </span><span class="cov0" title="0">{
+                dataType = 2
+        }</span>
+        //为用户开通超级订阅权限
+        //是否开通超级订阅 -1 试用到期 -2 正式到期 1 试用 2 开通
+        <span class="cov8" title="1">isTrial := false
+        if dataType == 2 </span><span class="cov0" title="0">{
+                isTrial = true
+        }</span>
+
+        <span class="cov8" title="1">setEntUser["l_createtime"] = time.Now().Unix()
+        setEntUser["l_vip_starttime"] = startdate.Unix()
+        setEntUser["l_vip_endtime"] = enddate.Unix()
+        setEntUser["i_vip_status"] = common.If(isTrial, -2, 2) //1试用 2正式 -2 试用到期
+        vms := VipSimpleMsg{}
+        json.Unmarshal([]byte(common.ObjToString(orderData["filter"])), &amp;vms)
+
+        set = map[string]interface{}{
+                "o_entniche": map[string]interface{}{
+                        "i_trial":      -1,              //已激活试用
+                        "o_area":       *vms.Area,       //设置地区
+                        "o_buyset":     *vms.NewBuyset,  //购买内容 城市、省份、行业数量
+                        "a_buyerclass": []interface{}{}, //设置行业
+                },
+                "i_vip_expire_tip": 0, //消息提示初始化
+                "i_type":           1,
+        }
+        return</span>
+}
+
+func memberSetMap(userId int64, orderData map[string]interface{}) (set map[string]interface{}, setEntUser map[string]interface{}) <span class="cov0" title="0">{
+        set, setEntUser = map[string]interface{}{}, map[string]interface{}{}
+        filterMap := common.ObjToMap(orderData["filter"])
+        level := common.IntAll((*filterMap)["level"])
+        comboId := common.IntAll((*filterMap)["comboId"])
+        payCycle := common.IntAll((*filterMap)["cycle"])
+        serversId := common.ObjToString((*filterMap)["serversId"])
+        startTime := common.ObjToString(orderData["vip_starttime"])
+        endTime := common.ObjToString(orderData["vip_endtime"])
+        tmp := "2006-01-02 15:04:05"
+        startdate, _ := time.ParseInLocation(tmp, startTime, time.Local)
+        enddate, _ := time.ParseInLocation(tmp, endTime, time.Local)
+        serverMap := GetServerPid()
+        dataType := 1
+        if startdate.Unix() &gt; time.Now().Unix() </span><span class="cov0" title="0">{
+                dataType = 2
+        }</span>
+        <span class="cov0" title="0">set = map[string]interface{}{
+                "o_member_jy": map[string]interface{}{
+                        "i_wxpush": 1,
+                },
+        }
+        setEntUser = map[string]interface{}{
+                "i_member_status":    common.If(dataType == 1, level, -level),
+                "i_member_starttime": startdate.Unix(),
+                "i_member_endtime":   enddate.Unix(),
+                "i_mainaccount":      1,
+                "l_createtime":       time.Now().Unix(),
+        }
+        if comboId != 0 </span><span class="cov0" title="0">{
+                datas := JyMysql.FindOne("bigmember_combo", map[string]interface{}{"id": comboId}, "", "")
+                if datas == nil || len(*datas) == 0 </span><span class="cov0" title="0">{
+                        log.Println("未找到此套餐")
+                        return
+                }</span>
+                <span class="cov0" title="0">s_servers := common.ObjToString((*datas)["s_servers"])
+                for _, s := range strings.Split(s_servers, ",") </span><span class="cov0" title="0">{
+                        serverId, _ := strconv.Atoi(s)
+                        mainId := serverId
+                        if serverMap[serverId] != 0 </span><span class="cov0" title="0">{
+                                serverId = serverMap[serverId]
+                        }</span>
+                        <span class="cov0" title="0">serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
+                        frequency := 0
+                        if serverData != nil &amp;&amp; len(*serverData) &gt; 0 </span><span class="cov0" title="0">{
+                                if serverId == 11 || serverId == 15 </span><span class="cov0" title="0">{
+                                        if serverId == 15 </span><span class="cov0" title="0">{
+                                                if payCycle &gt;= 12 </span><span class="cov0" title="0">{
+                                                        frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
+                                                }</span> else<span class="cov0" title="0"> {
+                                                        frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                                }</span>
+                                        } else<span class="cov0" title="0"> {
+                                                frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                        }</span>
+                                } else<span class="cov0" title="0"> {
+                                        frequency = common.IntAll((*serverData)["s_count_month"])
+                                }</span>
+                        }
+                        <span class="cov0" title="0">sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
+                        serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
+                        if serverDatas != nil &amp;&amp; len(*serverDatas) &gt; 0 </span><span class="cov0" title="0">{
+                                i_status := common.If(dataType == 1, 0, 1)
+                                sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
+                                if status1 &lt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("新建服务-更新服务表出错", userId)
+                                        return
+                                }</span>
+                        } else<span class="cov0" title="0"> {
+                                insert := map[string]interface{}{
+                                        "s_smainid":    mainId,
+                                        "s_userid":     userId,
+                                        "s_serviceid":  serverId,
+                                        "i_frequency":  frequency,
+                                        "l_starttime":  startdate.Format(tmp),
+                                        "l_endtime":    enddate.Format(tmp),
+                                        "i_status":     common.If(dataType == 1, 0, 1),
+                                        "l_createtime": time.Now().Format(tmp),
+                                        "l_updatetime": time.Now().Format(tmp),
+                                }
+                                order_id := JyMysql.Insert(BigServiceUser, insert)
+                                if order_id &gt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("用户服务表插入成功", userId)
+                                }</span> else<span class="cov0" title="0"> {
+                                        log.Println("用户服务表插入失败", userId)
+                                        return
+                                }</span>
+                        }
+                }
+        } else<span class="cov0" title="0"> {
+                for _, s := range strings.Split(serversId, ",") </span><span class="cov0" title="0">{
+                        serverId, _ := strconv.Atoi(s)
+                        mainId := serverId
+                        if serverMap[serverId] != 0 </span><span class="cov0" title="0">{
+                                serverId = serverMap[serverId]
+                        }</span>
+                        <span class="cov0" title="0">serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
+                        frequency := 0
+                        if serverData != nil &amp;&amp; len(*serverData) &gt; 0 </span><span class="cov0" title="0">{
+                                if serverId == 11 || serverId == 15 </span><span class="cov0" title="0">{
+                                        if serverId == 15 </span><span class="cov0" title="0">{
+                                                if payCycle &gt;= 12 </span><span class="cov0" title="0">{
+                                                        frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
+                                                }</span> else<span class="cov0" title="0"> {
+                                                        frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                                }</span>
+                                        } else<span class="cov0" title="0"> {
+                                                frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                        }</span>
+                                } else<span class="cov0" title="0"> {
+                                        frequency = common.IntAll((*serverData)["s_count_month"])
+                                }</span>
+                        }
+                        <span class="cov0" title="0">sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
+                        serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
+                        if serverDatas != nil &amp;&amp; len(*serverDatas) &gt; 0 </span><span class="cov0" title="0">{
+                                i_status := common.If(dataType == 1, 0, 1)
+                                sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
+                                if status1 &lt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("新建服务-更新服务表出错")
+                                        return
+                                }</span>
+                        } else<span class="cov0" title="0"> {
+                                insert := map[string]interface{}{
+                                        "s_userid":     userId,
+                                        "s_smainid":    mainId,
+                                        "s_serviceid":  serverId,
+                                        "i_frequency":  frequency,
+                                        "l_starttime":  startdate.Format(tmp),
+                                        "l_endtime":    enddate.Format(tmp),
+                                        "i_status":     common.If(dataType == 1, 0, 1),
+                                        "l_createtime": time.Now().Format(tmp),
+                                        "l_updatetime": time.Now().Format(tmp),
                                 }
-                                _id := Mgo.Save("user", data)
-                                log.Println("新增用户", _id)
-                                if _id != "" </span><span class="cov0" title="0">{
-                                        userId = _id
+                                order_id := JyMysql.Insert(BigServiceUser, insert)
+                                if order_id &gt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("用户服务表插入成功", userId)
+                                }</span> else<span class="cov0" title="0"> {
+                                        log.Println("用户服务表插入失败")
+                                        return
                                 }</span>
                         }
                 }
         }
-        <span class="cov8" title="1">return userId</span>
+        <span class="cov0" title="0">return</span>
 }
 </pre>
 		

+ 16 - 14
service/service.go

@@ -14,6 +14,7 @@ import (
 	"app.yhyue.com/moapp/jybase/mongodb"
 	. "bp.jydev.jianyu360.cn/BaseService/entManageApplication/entity"
 	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/entmanageapplication"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
 
 	// "github.com/zeromicro/go-zero/core/logx"
@@ -214,21 +215,8 @@ func GetServerPid() map[int]int {
 
 func RedisDel(userId string) {
 	redis.Del(NewOther, "pl_indexMessage_"+userId)
-	cacheKey := fmt.Sprintf(PowerCacheKey, userId)
-	baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
-	redisMenuKeyPC := fmt.Sprintf(RedisMenuKey1, userId)
-	redisMenuKeyWX := fmt.Sprintf(RedisMenuKey2, userId)
-	redisMenuKeyAPP := fmt.Sprintf(RedisMenuKey3, userId)
-	userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, time.Now().Day(), userId)
-	powerCheckKey := fmt.Sprintf(PowerCheckKey, userId)
-	redis.Del(NewOther, cacheKey)
-	redis.Del(NewOther, baseInfoCacheKey)
-	redis.Del(NewOther, redisMenuKeyPC)
-	redis.Del(NewOther, redisMenuKeyWX)
-	redis.Del(NewOther, redisMenuKeyAPP)
-	redis.Del(NewOther, userPowerRedisKey)
-	redis.Del(NewOther, powerCheckKey)
 	delRedisMenuByUserCenter(userId)
+	delRedisByPowerCheck(userId)
 }
 
 // 初始化vip订阅关键词
@@ -550,3 +538,17 @@ func delRedisMenuByUserCenter(positionId string) bool {
 	}
 	return true
 }
+
+//清除权益中台缓存
+func delRedisByPowerCheck(positionId string) bool {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+	i_positionId, _ := strconv.Atoi(positionId)
+	res, err := PowerCheckCenterRpc.DelCheckRedis(ctx, &powercheck.CheckReq{
+		PositionId: int64(i_positionId),
+		Appid:      "10000",
+	})
+	if err != nil || res == nil {
+		log.Println("delRedisByPowerCheck err", err)
+	}
+	return true
+}