瀏覽代碼

附件类型新增

WH01243 1 年之前
父節點
當前提交
c2addbac1a

+ 1 - 1
api/integral.api

@@ -64,7 +64,7 @@ type recordReq {
 	Page         int64  `form:"page,optional"`
 	PageSize     int64  `form:"pageSize,optional"`
 	ResourceType string `form:"resourceType,optional"` //资源类型
-	State        int64  `form:"state,optional"`        //0查消耗记录 1 查充值记录
+	State        int64  `form:"state,optional"`        //0查消耗记录 1 查充值记录 2 新增 作废
 	QueryTime    string `form:"queryTime,optional"`    //查询时间
 }
 

+ 3 - 0
api/internal/logic/findbalancelogic.go

@@ -47,6 +47,9 @@ func (l *FindBalanceLogic) FindBalance(req types.BalanceReq) (*types.BalanceRes,
 				"number":       v.Number,
 				"resourceType": v.ResourceType,
 				"thirtyNum":    v.ThirtyNum,
+				"number1":      v.Number1,
+				"number2":      v.Number2,
+				"number3":      v.Number3,
 			})
 		}
 	}

+ 1 - 0
entity/accountResources.go

@@ -12,4 +12,5 @@ type Balance struct {
 	AppId        string `xorm:"appId" form:"appId" json:"appId"`                      //标识
 	EndTime      string `xorm:"endTime" form:"endTime" json:"endTime"`                //截止时间
 	VipTime      string `xorm:"vipTime" form:"vipTime" json:"vipTime"`                //超级订阅截止时间
+	SourceType   int64  `xorm:"sourceType" form:"sourceType" json:"sourceType"`       //1购买2兑换3定期发放
 }

+ 2 - 0
go.mod

@@ -5,6 +5,8 @@ go 1.13
 require (
 	github.com/go-sql-driver/mysql v1.7.1
 	github.com/go-xorm/xorm v0.7.9
+	github.com/gogf/gf/v2 v2.5.5
+	github.com/robfig/cron v1.2.0
 	github.com/zeromicro/go-zero v1.5.5
 	google.golang.org/grpc v1.57.0
 	google.golang.org/protobuf v1.31.0

+ 36 - 8
go.sum

@@ -599,6 +599,8 @@ gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zum
 git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
+github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
+github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
 github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
 github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
@@ -656,6 +658,8 @@ github.com/cespare/xxhash/v2 v2.2.0/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.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME=
+github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
 github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
@@ -719,8 +723,9 @@ github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/
 github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
-github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
+github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
+github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
 github.com/fullstorydev/grpcurl v1.8.7/go.mod h1:pVtM4qe3CMoLaIzYS8uvTuDj2jVYmXqMUkZeijnXp/E=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g=
@@ -746,8 +751,9 @@ github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7
 github.com/go-logr/logr v0.2.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.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
-github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
 github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
+github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
+github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
 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-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
@@ -778,6 +784,8 @@ github.com/go-xorm/xorm v0.7.9/go.mod h1:XiVxrMMIhFkwSkh96BW7PACl7UhLtx2iJIHMdmj
 github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
 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.5.5 h1:av3xMltrJiZWs4lW5KUTTDh45qg3wUV33W5OebE+pYo=
+github.com/gogf/gf/v2 v2.5.5/go.mod h1:17K/gBYrp0bHGC3XYC7bSPoywmZ6MrZHrZakTfh4eIQ=
 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=
 github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@@ -901,7 +909,11 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7
 github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
 github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
 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-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
 github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
@@ -983,6 +995,8 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
 github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
 github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
 github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o=
+github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
+github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
 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=
 github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
@@ -994,10 +1008,13 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
 github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
 github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
 github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
-github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
 github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
+github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
+github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
 github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
 github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
+github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
+github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
 github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
 github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw=
 github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
@@ -1028,6 +1045,7 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
 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.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
 github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
 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=
@@ -1122,6 +1140,10 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn
 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
 github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
+github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
+github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
+github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
+github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
 github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
 github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
@@ -1259,8 +1281,9 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0
 golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
 golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
-golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
 golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
+golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
+golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
 golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1392,8 +1415,9 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
 golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
 golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
 golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
-golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
 golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
+golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
+golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1534,6 +1558,7 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -1544,8 +1569,9 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
 golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
+golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -1557,8 +1583,9 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
 golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
 golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
 golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
-golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
 golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
+golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
+golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
 golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1575,8 +1602,9 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
 golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
-golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
 golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
+golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
+golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
 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=

+ 3 - 2
rpc/etc/resourcescenter.yaml

@@ -4,7 +4,7 @@ Etcd:
   Hosts:
     - 127.0.0.1:2379
   Key: resourcescenter.rpc
-DataSource: root:Topnet123@tcp(192.168.3.11:3366)/jy_user_center?charset=utf8mb4&parseTime=true&loc=Local
+DataSource: root:Topnet123@tcp(192.168.3.149:3306)/jy_user_center?charset=utf8mb4&parseTime=true&loc=Local
 FileSystemConf:
   Etcd:
     Hosts:
@@ -13,4 +13,5 @@ FileSystemConf:
 CalleeId: resourcescenter.rpc
 Node: 1
 DedupUrl: http://192.168.3.206:8888
-ProductStr: "附件下载包,采购单位画像包"
+ProductStr: "附件下载包,采购单位画像包"
+TimeSource: 1 0 0 * * ? *

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

@@ -11,6 +11,7 @@ type Config struct {
 	FileSystemConf zrpc.RpcClientConf
 	ProductMap     map[string]interface{}
 	ProductStr     string
+	TimeSource     string //定时任务
 }
 
 var ConfigJson Config

+ 2 - 1
rpc/internal/server/resourcescenterserver.go

@@ -1,4 +1,4 @@
-// Code generated by goctl. DO NOT EDIT!
+// Code generated by goctl. DO NOT EDIT.
 // Source: resourcesCenter.proto
 
 package server
@@ -13,6 +13,7 @@ import (
 
 type ResourcesCenterServer struct {
 	svcCtx *svc.ServiceContext
+	resourcesCenter.UnimplementedResourcesCenterServer
 }
 
 func NewResourcesCenterServer(svcCtx *svc.ServiceContext) *ResourcesCenterServer {

+ 15 - 8
rpc/resourcesCenter.go

@@ -2,24 +2,25 @@ package main
 
 import (
 	"app.yhyue.com/moapp/jyResourcesCenter/entity"
+	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/config"
+	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/server"
+	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/svc"
 	"app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenter"
+	"app.yhyue.com/moapp/jyResourcesCenter/service"
 	"flag"
 	"fmt"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/go-xorm/xorm"
-	"log"
-	"strings"
-
-	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/config"
-	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/server"
-	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/svc"
-
+	"github.com/robfig/cron"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
+	"log"
+	"strings"
 )
 
 var configFile = flag.String("f", "etc/resourcescenter.yaml", "the config file")
+var balanceService service.BalanceService
 
 func main() {
 	flag.Parse()
@@ -32,9 +33,12 @@ func main() {
 	s := zrpc.MustNewServer(config.ConfigJson.RpcServerConf, func(grpcServer *grpc.Server) {
 		resourcesCenter.RegisterResourcesCenterServer(grpcServer, srv)
 	})
-
 	defer s.Stop()
 	fmt.Printf("Starting rpc server at %s...\n", config.ConfigJson.ListenOn)
+	//timeDask()
+	b := cron.New()
+	b.AddFunc(config.ConfigJson.TimeSource, timeDask)
+	b.Start()
 	s.Start()
 }
 
@@ -49,3 +53,6 @@ func init() {
 	}
 	fmt.Println(config.ConfigJson.DataSource + "链接成功")
 }
+func timeDask() {
+	balanceService.ExpireHandle()
+}

+ 3 - 0
rpc/resourcesCenter.proto

@@ -78,6 +78,9 @@ message ResourceBalance {
     string resourceType = 5; //资源代码
     string spec = 6; //规格
     int64 thirtyNum = 7;
+    int64 number1 =8 ; //购买数量
+    int64 number2 =9; //兑换数量
+    int64 number3 = 10; //定期发放数量
 }
 
 message ConsumeRecord {

+ 153 - 476
rpc/resourcesCenter/resourcesCenter.pb.go

@@ -1,16 +1,12 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.26.0
+// 	protoc-gen-go v1.31.0
 // 	protoc        v3.15.1
 // source: resourcesCenter.proto
 
 package resourcesCenter
 
 import (
-	context "context"
-	grpc "google.golang.org/grpc"
-	codes "google.golang.org/grpc/codes"
-	status "google.golang.org/grpc/status"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
 	reflect "reflect"
@@ -732,6 +728,9 @@ type ResourceBalance struct {
 	ResourceType string `protobuf:"bytes,5,opt,name=resourceType,proto3" json:"resourceType,omitempty"` //资源代码
 	Spec         string `protobuf:"bytes,6,opt,name=spec,proto3" json:"spec,omitempty"`                 //规格
 	ThirtyNum    int64  `protobuf:"varint,7,opt,name=thirtyNum,proto3" json:"thirtyNum,omitempty"`
+	Number1      int64  `protobuf:"varint,8,opt,name=number1,proto3" json:"number1,omitempty"`  //购买数量
+	Number2      int64  `protobuf:"varint,9,opt,name=number2,proto3" json:"number2,omitempty"`  //兑换数量
+	Number3      int64  `protobuf:"varint,10,opt,name=number3,proto3" json:"number3,omitempty"` //定期发放数量
 }
 
 func (x *ResourceBalance) Reset() {
@@ -808,6 +807,27 @@ func (x *ResourceBalance) GetThirtyNum() int64 {
 	return 0
 }
 
+func (x *ResourceBalance) GetNumber1() int64 {
+	if x != nil {
+		return x.Number1
+	}
+	return 0
+}
+
+func (x *ResourceBalance) GetNumber2() int64 {
+	if x != nil {
+		return x.Number2
+	}
+	return 0
+}
+
+func (x *ResourceBalance) GetNumber3() int64 {
+	if x != nil {
+		return x.Number3
+	}
+	return 0
+}
+
 type ConsumeRecord struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1124,7 +1144,7 @@ func (x *PreviewRes) GetRemainNum() int64 {
 	return 0
 }
 
-//根据账户标识查询资源权限请求参数
+// 根据账户标识查询资源权限请求参数
 type ResourcesAuthRes struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1188,7 +1208,7 @@ func (x *ResourcesAuthRes) GetData() []*ResourcesAuth {
 	return nil
 }
 
-//根据账户标识查询账户余额
+// 根据账户标识查询账户余额
 type AccountBalanceRes struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1252,7 +1272,7 @@ func (x *AccountBalanceRes) GetData() []*ResourceBalance {
 	return nil
 }
 
-//查询流水账
+// 查询流水账
 type RecordReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1583,7 +1603,7 @@ var file_resourcesCenter_proto_rawDesc = []byte{
 	0x05, 0x71, 0x75, 0x6f, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18,
 	0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x14, 0x0a, 0x05,
 	0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61,
-	0x74, 0x65, 0x22, 0xa3, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42,
+	0x74, 0x65, 0x22, 0xf1, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42,
 	0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
 	0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03,
 	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75,
@@ -1593,131 +1613,136 @@ var file_resourcesCenter_proto_rawDesc = []byte{
 	0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x06,
 	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68,
 	0x69, 0x72, 0x74, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74,
-	0x68, 0x69, 0x72, 0x74, 0x79, 0x4e, 0x75, 0x6d, 0x22, 0x9b, 0x02, 0x0a, 0x0d, 0x43, 0x6f, 0x6e,
-	0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73,
+	0x68, 0x69, 0x72, 0x74, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x75, 0x6d, 0x62,
+	0x65, 0x72, 0x31, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65,
+	0x72, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x18, 0x09, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x12, 0x18, 0x0a, 0x07,
+	0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x33, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6e,
+	0x75, 0x6d, 0x62, 0x65, 0x72, 0x33, 0x22, 0x9b, 0x02, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x73, 0x75,
+	0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72,
+	0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
+	0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+	0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+	0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f,
+	0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62,
+	0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72,
+	0x12, 0x24, 0x0a, 0x0d, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d,
+	0x62, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69,
+	0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x64,
+	0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1e,
+	0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a,
+	0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65,
+	0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d,
+	0x61, 0x72, 0x6b, 0x73, 0x22, 0x50, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+	0x73, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
+	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
+	0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79,
+	0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
+	0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x66, 0x0a, 0x0a, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65,
+	0x77, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09,
+	0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65,
+	0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x9e,
+	0x01, 0x0a, 0x0a, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x12, 0x12, 0x0a,
+	0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64,
+	0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72,
+	0x65, 0x70, 0x65, 0x61, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x0a, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x12, 0x24, 0x0a, 0x0d, 0x64,
+	0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x18, 0x04, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x0d, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d,
+	0x62, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x4e, 0x75, 0x6d, 0x18, 0x05,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x4e, 0x75, 0x6d, 0x22,
+	0x74, 0x0a, 0x10, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x41, 0x75, 0x74, 0x68,
+	0x52, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+	0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
+	0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
+	0x65, 0x12, 0x32, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
+	0x1e, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65,
+	0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x41, 0x75, 0x74, 0x68, 0x52,
+	0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x77, 0x0a, 0x11, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
+	0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
+	0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18,
+	0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
+	0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
+	0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
+	0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc9,
+	0x01, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09,
+	0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73,
 	0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
-	0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
-	0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65,
-	0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75,
-	0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62,
-	0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e,
-	0x75, 0x6d, 0x62, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x64, 0x65, 0x64, 0x75, 0x63,
-	0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x75, 0x6c, 0x65,
-	0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x64,
-	0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65,
-	0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07,
-	0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72,
-	0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x22, 0x50, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
-	0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
-	0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75,
-	0x6e, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
-	0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f,
-	0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x66, 0x0a, 0x0a, 0x50, 0x72, 0x65, 0x76,
-	0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x12, 0x1c,
-	0x0a, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c,
-	0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
-	0x22, 0x9e, 0x01, 0x0a, 0x0a, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x12,
+	0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12,
+	0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61,
+	0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
+	0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x6f,
+	0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
+	0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09,
+	0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x10, 0x43,
+	0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x12,
 	0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63,
 	0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a,
-	0x0a, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x12, 0x24, 0x0a,
-	0x0d, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x18, 0x04,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e,
-	0x75, 0x6d, 0x62, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x4e, 0x75, 0x6d,
-	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x4e, 0x75,
-	0x6d, 0x22, 0x74, 0x0a, 0x10, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x41, 0x75,
-	0x74, 0x68, 0x52, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73,
-	0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
-	0x61, 0x67, 0x65, 0x12, 0x32, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28,
-	0x0b, 0x32, 0x1e, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e,
-	0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x41, 0x75, 0x74,
-	0x68, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x77, 0x0a, 0x11, 0x41, 0x63, 0x63, 0x6f, 0x75,
-	0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04,
-	0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
-	0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x64, 0x61,
-	0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75,
-	0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75,
-	0x72, 0x63, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
-	0x22, 0xc9, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1c,
-	0x0a, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06,
-	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73,
-	0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
-	0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
-	0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04,
-	0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65,
-	0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c,
-	0x0a, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x8a, 0x01, 0x0a,
-	0x10, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
-	0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
-	0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
-	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12,
-	0x32, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e,
-	0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e,
-	0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x04, 0x64,
-	0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5f, 0x0a, 0x09, 0x6d, 0x65, 0x72,
-	0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x55,
-	0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x72, 0x67, 0x65,
-	0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x55, 0x73,
-	0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64,
-	0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x03, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x32, 0x87, 0x05, 0x0a, 0x0f, 0x52,
-	0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x56,
-	0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x41,
-	0x75, 0x74, 0x68, 0x12, 0x1d, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43,
-	0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52,
-	0x65, 0x71, 0x1a, 0x22, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65,
-	0x6e, 0x74, 0x65, 0x72, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61,
-	0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x63,
-	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1d, 0x2e, 0x72,
-	0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52,
-	0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x72, 0x65,
-	0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x41, 0x63,
-	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x12,
-	0x52, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65,
-	0x63, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
-	0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71,
-	0x1a, 0x21, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74,
-	0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
-	0x52, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x55,
-	0x73, 0x65, 0x72, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x32, 0x0a,
+	0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x72, 0x65,
+	0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f,
+	0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x04, 0x64, 0x61, 0x74,
+	0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5f, 0x0a, 0x09, 0x6d, 0x65, 0x72, 0x67, 0x65,
+	0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x55, 0x73, 0x65,
+	0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x55, 0x73,
+	0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x55, 0x73,
+	0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x32, 0x87, 0x05, 0x0a, 0x0f, 0x52, 0x65, 0x73,
+	0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x56, 0x0a, 0x11,
+	0x66, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x41, 0x75, 0x74,
+	0x68, 0x12, 0x1d, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e,
+	0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71,
+	0x1a, 0x22, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74,
+	0x65, 0x72, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
+	0x65, 0x52, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x63, 0x63, 0x6f,
+	0x75, 0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1d, 0x2e, 0x72, 0x65, 0x73,
 	0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73,
-	0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
-	0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
-	0x65, 0x12, 0x4f, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61,
-	0x69, 0x6c, 0x65, 0x64, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
-	0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
-	0x1a, 0x20, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74,
-	0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
-	0x73, 0x65, 0x12, 0x47, 0x0a, 0x0b, 0x66, 0x69, 0x6e, 0x64, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65,
-	0x77, 0x12, 0x1b, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e,
-	0x74, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x1a, 0x1b,
+	0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x72, 0x65, 0x73, 0x6f,
+	0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x41, 0x63, 0x63, 0x6f,
+	0x75, 0x6e, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x12, 0x52, 0x0a,
+	0x11, 0x66, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f,
+	0x72, 0x64, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65,
+	0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x21,
 	0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72,
-	0x2e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x75,
-	0x73, 0x65, 0x72, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75,
-	0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x6d, 0x65, 0x72, 0x67, 0x65,
-	0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
+	0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
+	0x73, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65,
+	0x72, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75,
+	0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75,
+	0x72, 0x63, 0x65, 0x73, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
 	0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
-	0x43, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x69, 0x70, 0x54, 0x69, 0x6d, 0x65,
-	0x12, 0x17, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74,
-	0x65, 0x72, 0x2e, 0x56, 0x69, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f,
-	0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70,
-	0x6f, 0x6e, 0x73, 0x65, 0x42, 0x12, 0x5a, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
-	0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x4f, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c,
+	0x65, 0x64, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65,
+	0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x20,
+	0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72,
+	0x2e, 0x55, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+	0x12, 0x47, 0x0a, 0x0b, 0x66, 0x69, 0x6e, 0x64, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12,
+	0x1b, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65,
+	0x72, 0x2e, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x72,
+	0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x50,
+	0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x75, 0x73, 0x65,
+	0x72, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
+	0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x49, 0x6e,
+	0x66, 0x6f, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65,
+	0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a,
+	0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x69, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x17,
+	0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72,
+	0x2e, 0x56, 0x69, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
+	0x63, 0x65, 0x73, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+	0x73, 0x65, 0x42, 0x12, 0x5a, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x43,
+	0x65, 0x6e, 0x74, 0x65, 0x72, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -2009,351 +2034,3 @@ func file_resourcesCenter_proto_init() {
 	file_resourcesCenter_proto_goTypes = nil
 	file_resourcesCenter_proto_depIdxs = nil
 }
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConnInterface
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion6
-
-// ResourcesCenterClient is the client API for ResourcesCenter service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
-type ResourcesCenterClient interface {
-	//查询账户资源权限
-	FindResourcesAuth(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error)
-	//查询账户资源余额
-	FindAccountBalance(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error)
-	//查询流水账
-	FindConsumeRecord(ctx context.Context, in *RecordReq, opts ...grpc.CallOption) (*ConsumeRecordRes, error)
-	//根据账户标识购买资源
-	PurchaseUserBalance(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*Response, error)
-	//根据账户标识使用资源
-	UseUserDetailed(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*UseUserResponse, error)
-	//预览信息
-	FindPreview(ctx context.Context, in *PreviewReq, opts ...grpc.CallOption) (*PreviewRes, error)
-	//合并账号
-	UserMerge(ctx context.Context, in *MergeInfo, opts ...grpc.CallOption) (*Response, error)
-	//超级订阅时间修改
-	UpdateVipTime(ctx context.Context, in *VipReq, opts ...grpc.CallOption) (*Response, error)
-}
-
-type resourcesCenterClient struct {
-	cc grpc.ClientConnInterface
-}
-
-func NewResourcesCenterClient(cc grpc.ClientConnInterface) ResourcesCenterClient {
-	return &resourcesCenterClient{cc}
-}
-
-func (c *resourcesCenterClient) FindResourcesAuth(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error) {
-	out := new(AccountBalanceRes)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/findResourcesAuth", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *resourcesCenterClient) FindAccountBalance(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error) {
-	out := new(AccountBalanceRes)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/findAccountBalance", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *resourcesCenterClient) FindConsumeRecord(ctx context.Context, in *RecordReq, opts ...grpc.CallOption) (*ConsumeRecordRes, error) {
-	out := new(ConsumeRecordRes)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/findConsumeRecord", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *resourcesCenterClient) PurchaseUserBalance(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*Response, error) {
-	out := new(Response)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/purchaseUserBalance", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *resourcesCenterClient) UseUserDetailed(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*UseUserResponse, error) {
-	out := new(UseUserResponse)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/useUserDetailed", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *resourcesCenterClient) FindPreview(ctx context.Context, in *PreviewReq, opts ...grpc.CallOption) (*PreviewRes, error) {
-	out := new(PreviewRes)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/findPreview", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *resourcesCenterClient) UserMerge(ctx context.Context, in *MergeInfo, opts ...grpc.CallOption) (*Response, error) {
-	out := new(Response)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/userMerge", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *resourcesCenterClient) UpdateVipTime(ctx context.Context, in *VipReq, opts ...grpc.CallOption) (*Response, error) {
-	out := new(Response)
-	err := c.cc.Invoke(ctx, "/resourcesCenter.ResourcesCenter/updateVipTime", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-// ResourcesCenterServer is the server API for ResourcesCenter service.
-type ResourcesCenterServer interface {
-	//查询账户资源权限
-	FindResourcesAuth(context.Context, *ResourcesReq) (*AccountBalanceRes, error)
-	//查询账户资源余额
-	FindAccountBalance(context.Context, *ResourcesReq) (*AccountBalanceRes, error)
-	//查询流水账
-	FindConsumeRecord(context.Context, *RecordReq) (*ConsumeRecordRes, error)
-	//根据账户标识购买资源
-	PurchaseUserBalance(context.Context, *Resources) (*Response, error)
-	//根据账户标识使用资源
-	UseUserDetailed(context.Context, *Resources) (*UseUserResponse, error)
-	//预览信息
-	FindPreview(context.Context, *PreviewReq) (*PreviewRes, error)
-	//合并账号
-	UserMerge(context.Context, *MergeInfo) (*Response, error)
-	//超级订阅时间修改
-	UpdateVipTime(context.Context, *VipReq) (*Response, error)
-}
-
-// UnimplementedResourcesCenterServer can be embedded to have forward compatible implementations.
-type UnimplementedResourcesCenterServer struct {
-}
-
-func (*UnimplementedResourcesCenterServer) FindResourcesAuth(context.Context, *ResourcesReq) (*AccountBalanceRes, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method FindResourcesAuth not implemented")
-}
-func (*UnimplementedResourcesCenterServer) FindAccountBalance(context.Context, *ResourcesReq) (*AccountBalanceRes, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method FindAccountBalance not implemented")
-}
-func (*UnimplementedResourcesCenterServer) FindConsumeRecord(context.Context, *RecordReq) (*ConsumeRecordRes, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method FindConsumeRecord not implemented")
-}
-func (*UnimplementedResourcesCenterServer) PurchaseUserBalance(context.Context, *Resources) (*Response, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method PurchaseUserBalance not implemented")
-}
-func (*UnimplementedResourcesCenterServer) UseUserDetailed(context.Context, *Resources) (*UseUserResponse, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method UseUserDetailed not implemented")
-}
-func (*UnimplementedResourcesCenterServer) FindPreview(context.Context, *PreviewReq) (*PreviewRes, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method FindPreview not implemented")
-}
-func (*UnimplementedResourcesCenterServer) UserMerge(context.Context, *MergeInfo) (*Response, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method UserMerge not implemented")
-}
-func (*UnimplementedResourcesCenterServer) UpdateVipTime(context.Context, *VipReq) (*Response, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method UpdateVipTime not implemented")
-}
-
-func RegisterResourcesCenterServer(s *grpc.Server, srv ResourcesCenterServer) {
-	s.RegisterService(&_ResourcesCenter_serviceDesc, srv)
-}
-
-func _ResourcesCenter_FindResourcesAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(ResourcesReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).FindResourcesAuth(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/FindResourcesAuth",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).FindResourcesAuth(ctx, req.(*ResourcesReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _ResourcesCenter_FindAccountBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(ResourcesReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).FindAccountBalance(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/FindAccountBalance",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).FindAccountBalance(ctx, req.(*ResourcesReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _ResourcesCenter_FindConsumeRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(RecordReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).FindConsumeRecord(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/FindConsumeRecord",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).FindConsumeRecord(ctx, req.(*RecordReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _ResourcesCenter_PurchaseUserBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(Resources)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).PurchaseUserBalance(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/PurchaseUserBalance",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).PurchaseUserBalance(ctx, req.(*Resources))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _ResourcesCenter_UseUserDetailed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(Resources)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).UseUserDetailed(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/UseUserDetailed",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).UseUserDetailed(ctx, req.(*Resources))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _ResourcesCenter_FindPreview_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(PreviewReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).FindPreview(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/FindPreview",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).FindPreview(ctx, req.(*PreviewReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _ResourcesCenter_UserMerge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(MergeInfo)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).UserMerge(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/UserMerge",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).UserMerge(ctx, req.(*MergeInfo))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _ResourcesCenter_UpdateVipTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(VipReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(ResourcesCenterServer).UpdateVipTime(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/resourcesCenter.ResourcesCenter/UpdateVipTime",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ResourcesCenterServer).UpdateVipTime(ctx, req.(*VipReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-var _ResourcesCenter_serviceDesc = grpc.ServiceDesc{
-	ServiceName: "resourcesCenter.ResourcesCenter",
-	HandlerType: (*ResourcesCenterServer)(nil),
-	Methods: []grpc.MethodDesc{
-		{
-			MethodName: "findResourcesAuth",
-			Handler:    _ResourcesCenter_FindResourcesAuth_Handler,
-		},
-		{
-			MethodName: "findAccountBalance",
-			Handler:    _ResourcesCenter_FindAccountBalance_Handler,
-		},
-		{
-			MethodName: "findConsumeRecord",
-			Handler:    _ResourcesCenter_FindConsumeRecord_Handler,
-		},
-		{
-			MethodName: "purchaseUserBalance",
-			Handler:    _ResourcesCenter_PurchaseUserBalance_Handler,
-		},
-		{
-			MethodName: "useUserDetailed",
-			Handler:    _ResourcesCenter_UseUserDetailed_Handler,
-		},
-		{
-			MethodName: "findPreview",
-			Handler:    _ResourcesCenter_FindPreview_Handler,
-		},
-		{
-			MethodName: "userMerge",
-			Handler:    _ResourcesCenter_UserMerge_Handler,
-		},
-		{
-			MethodName: "updateVipTime",
-			Handler:    _ResourcesCenter_UpdateVipTime_Handler,
-		},
-	},
-	Streams:  []grpc.StreamDesc{},
-	Metadata: "resourcesCenter.proto",
-}

+ 384 - 0
rpc/resourcesCenter/resourcesCenter_grpc.pb.go

@@ -0,0 +1,384 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc             v3.15.1
+// source: resourcesCenter.proto
+
+package resourcesCenter
+
+import (
+	context "context"
+	grpc "google.golang.org/grpc"
+	codes "google.golang.org/grpc/codes"
+	status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+	ResourcesCenter_FindResourcesAuth_FullMethodName   = "/resourcesCenter.ResourcesCenter/findResourcesAuth"
+	ResourcesCenter_FindAccountBalance_FullMethodName  = "/resourcesCenter.ResourcesCenter/findAccountBalance"
+	ResourcesCenter_FindConsumeRecord_FullMethodName   = "/resourcesCenter.ResourcesCenter/findConsumeRecord"
+	ResourcesCenter_PurchaseUserBalance_FullMethodName = "/resourcesCenter.ResourcesCenter/purchaseUserBalance"
+	ResourcesCenter_UseUserDetailed_FullMethodName     = "/resourcesCenter.ResourcesCenter/useUserDetailed"
+	ResourcesCenter_FindPreview_FullMethodName         = "/resourcesCenter.ResourcesCenter/findPreview"
+	ResourcesCenter_UserMerge_FullMethodName           = "/resourcesCenter.ResourcesCenter/userMerge"
+	ResourcesCenter_UpdateVipTime_FullMethodName       = "/resourcesCenter.ResourcesCenter/updateVipTime"
+)
+
+// ResourcesCenterClient is the client API for ResourcesCenter service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type ResourcesCenterClient interface {
+	// 查询账户资源权限
+	FindResourcesAuth(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error)
+	// 查询账户资源余额
+	FindAccountBalance(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error)
+	// 查询流水账
+	FindConsumeRecord(ctx context.Context, in *RecordReq, opts ...grpc.CallOption) (*ConsumeRecordRes, error)
+	// 根据账户标识购买资源
+	PurchaseUserBalance(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*Response, error)
+	// 根据账户标识使用资源
+	UseUserDetailed(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*UseUserResponse, error)
+	// 预览信息
+	FindPreview(ctx context.Context, in *PreviewReq, opts ...grpc.CallOption) (*PreviewRes, error)
+	// 合并账号
+	UserMerge(ctx context.Context, in *MergeInfo, opts ...grpc.CallOption) (*Response, error)
+	// 超级订阅时间修改
+	UpdateVipTime(ctx context.Context, in *VipReq, opts ...grpc.CallOption) (*Response, error)
+}
+
+type resourcesCenterClient struct {
+	cc grpc.ClientConnInterface
+}
+
+func NewResourcesCenterClient(cc grpc.ClientConnInterface) ResourcesCenterClient {
+	return &resourcesCenterClient{cc}
+}
+
+func (c *resourcesCenterClient) FindResourcesAuth(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error) {
+	out := new(AccountBalanceRes)
+	err := c.cc.Invoke(ctx, ResourcesCenter_FindResourcesAuth_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *resourcesCenterClient) FindAccountBalance(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error) {
+	out := new(AccountBalanceRes)
+	err := c.cc.Invoke(ctx, ResourcesCenter_FindAccountBalance_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *resourcesCenterClient) FindConsumeRecord(ctx context.Context, in *RecordReq, opts ...grpc.CallOption) (*ConsumeRecordRes, error) {
+	out := new(ConsumeRecordRes)
+	err := c.cc.Invoke(ctx, ResourcesCenter_FindConsumeRecord_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *resourcesCenterClient) PurchaseUserBalance(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*Response, error) {
+	out := new(Response)
+	err := c.cc.Invoke(ctx, ResourcesCenter_PurchaseUserBalance_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *resourcesCenterClient) UseUserDetailed(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*UseUserResponse, error) {
+	out := new(UseUserResponse)
+	err := c.cc.Invoke(ctx, ResourcesCenter_UseUserDetailed_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *resourcesCenterClient) FindPreview(ctx context.Context, in *PreviewReq, opts ...grpc.CallOption) (*PreviewRes, error) {
+	out := new(PreviewRes)
+	err := c.cc.Invoke(ctx, ResourcesCenter_FindPreview_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *resourcesCenterClient) UserMerge(ctx context.Context, in *MergeInfo, opts ...grpc.CallOption) (*Response, error) {
+	out := new(Response)
+	err := c.cc.Invoke(ctx, ResourcesCenter_UserMerge_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *resourcesCenterClient) UpdateVipTime(ctx context.Context, in *VipReq, opts ...grpc.CallOption) (*Response, error) {
+	out := new(Response)
+	err := c.cc.Invoke(ctx, ResourcesCenter_UpdateVipTime_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+// ResourcesCenterServer is the server API for ResourcesCenter service.
+// All implementations must embed UnimplementedResourcesCenterServer
+// for forward compatibility
+type ResourcesCenterServer interface {
+	// 查询账户资源权限
+	FindResourcesAuth(context.Context, *ResourcesReq) (*AccountBalanceRes, error)
+	// 查询账户资源余额
+	FindAccountBalance(context.Context, *ResourcesReq) (*AccountBalanceRes, error)
+	// 查询流水账
+	FindConsumeRecord(context.Context, *RecordReq) (*ConsumeRecordRes, error)
+	// 根据账户标识购买资源
+	PurchaseUserBalance(context.Context, *Resources) (*Response, error)
+	// 根据账户标识使用资源
+	UseUserDetailed(context.Context, *Resources) (*UseUserResponse, error)
+	// 预览信息
+	FindPreview(context.Context, *PreviewReq) (*PreviewRes, error)
+	// 合并账号
+	UserMerge(context.Context, *MergeInfo) (*Response, error)
+	// 超级订阅时间修改
+	UpdateVipTime(context.Context, *VipReq) (*Response, error)
+	mustEmbedUnimplementedResourcesCenterServer()
+}
+
+// UnimplementedResourcesCenterServer must be embedded to have forward compatible implementations.
+type UnimplementedResourcesCenterServer struct {
+}
+
+func (UnimplementedResourcesCenterServer) FindResourcesAuth(context.Context, *ResourcesReq) (*AccountBalanceRes, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method FindResourcesAuth not implemented")
+}
+func (UnimplementedResourcesCenterServer) FindAccountBalance(context.Context, *ResourcesReq) (*AccountBalanceRes, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method FindAccountBalance not implemented")
+}
+func (UnimplementedResourcesCenterServer) FindConsumeRecord(context.Context, *RecordReq) (*ConsumeRecordRes, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method FindConsumeRecord not implemented")
+}
+func (UnimplementedResourcesCenterServer) PurchaseUserBalance(context.Context, *Resources) (*Response, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method PurchaseUserBalance not implemented")
+}
+func (UnimplementedResourcesCenterServer) UseUserDetailed(context.Context, *Resources) (*UseUserResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method UseUserDetailed not implemented")
+}
+func (UnimplementedResourcesCenterServer) FindPreview(context.Context, *PreviewReq) (*PreviewRes, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method FindPreview not implemented")
+}
+func (UnimplementedResourcesCenterServer) UserMerge(context.Context, *MergeInfo) (*Response, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method UserMerge not implemented")
+}
+func (UnimplementedResourcesCenterServer) UpdateVipTime(context.Context, *VipReq) (*Response, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method UpdateVipTime not implemented")
+}
+func (UnimplementedResourcesCenterServer) mustEmbedUnimplementedResourcesCenterServer() {}
+
+// UnsafeResourcesCenterServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to ResourcesCenterServer will
+// result in compilation errors.
+type UnsafeResourcesCenterServer interface {
+	mustEmbedUnimplementedResourcesCenterServer()
+}
+
+func RegisterResourcesCenterServer(s grpc.ServiceRegistrar, srv ResourcesCenterServer) {
+	s.RegisterService(&ResourcesCenter_ServiceDesc, srv)
+}
+
+func _ResourcesCenter_FindResourcesAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ResourcesReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).FindResourcesAuth(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_FindResourcesAuth_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).FindResourcesAuth(ctx, req.(*ResourcesReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ResourcesCenter_FindAccountBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ResourcesReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).FindAccountBalance(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_FindAccountBalance_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).FindAccountBalance(ctx, req.(*ResourcesReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ResourcesCenter_FindConsumeRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(RecordReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).FindConsumeRecord(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_FindConsumeRecord_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).FindConsumeRecord(ctx, req.(*RecordReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ResourcesCenter_PurchaseUserBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(Resources)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).PurchaseUserBalance(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_PurchaseUserBalance_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).PurchaseUserBalance(ctx, req.(*Resources))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ResourcesCenter_UseUserDetailed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(Resources)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).UseUserDetailed(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_UseUserDetailed_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).UseUserDetailed(ctx, req.(*Resources))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ResourcesCenter_FindPreview_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(PreviewReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).FindPreview(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_FindPreview_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).FindPreview(ctx, req.(*PreviewReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ResourcesCenter_UserMerge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(MergeInfo)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).UserMerge(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_UserMerge_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).UserMerge(ctx, req.(*MergeInfo))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _ResourcesCenter_UpdateVipTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(VipReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourcesCenterServer).UpdateVipTime(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: ResourcesCenter_UpdateVipTime_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourcesCenterServer).UpdateVipTime(ctx, req.(*VipReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+// ResourcesCenter_ServiceDesc is the grpc.ServiceDesc for ResourcesCenter service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var ResourcesCenter_ServiceDesc = grpc.ServiceDesc{
+	ServiceName: "resourcesCenter.ResourcesCenter",
+	HandlerType: (*ResourcesCenterServer)(nil),
+	Methods: []grpc.MethodDesc{
+		{
+			MethodName: "findResourcesAuth",
+			Handler:    _ResourcesCenter_FindResourcesAuth_Handler,
+		},
+		{
+			MethodName: "findAccountBalance",
+			Handler:    _ResourcesCenter_FindAccountBalance_Handler,
+		},
+		{
+			MethodName: "findConsumeRecord",
+			Handler:    _ResourcesCenter_FindConsumeRecord_Handler,
+		},
+		{
+			MethodName: "purchaseUserBalance",
+			Handler:    _ResourcesCenter_PurchaseUserBalance_Handler,
+		},
+		{
+			MethodName: "useUserDetailed",
+			Handler:    _ResourcesCenter_UseUserDetailed_Handler,
+		},
+		{
+			MethodName: "findPreview",
+			Handler:    _ResourcesCenter_FindPreview_Handler,
+		},
+		{
+			MethodName: "userMerge",
+			Handler:    _ResourcesCenter_UserMerge_Handler,
+		},
+		{
+			MethodName: "updateVipTime",
+			Handler:    _ResourcesCenter_UpdateVipTime_Handler,
+		},
+	},
+	Streams:  []grpc.StreamDesc{},
+	Metadata: "resourcesCenter.proto",
+}

+ 39 - 40
rpc/resourcesCenterclient/resourcescenter.go

@@ -1,8 +1,6 @@
-// Code generated by goctl. DO NOT EDIT!
+// Code generated by goctl. DO NOT EDIT.
 // Source: resourcesCenter.proto
 
-//go:generate mockgen -destination ./resourcescenter_mock.go -package resourcescenter -source $GOFILE
-
 package resourcesCenterclient
 
 import (
@@ -11,44 +9,45 @@ import (
 	"app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenter"
 
 	"github.com/zeromicro/go-zero/zrpc"
+	"google.golang.org/grpc"
 )
 
 type (
-	Response          = resourcesCenter.Response
 	AccountBalanceRes = resourcesCenter.AccountBalanceRes
-	RecordReq         = resourcesCenter.RecordReq
-	UseUserResponse   = resourcesCenter.UseUserResponse
-	VipReq            = resourcesCenter.VipReq
-	Detailed          = resourcesCenter.Detailed
-	ResourcesAuth     = resourcesCenter.ResourcesAuth
-	ResourcesReq      = resourcesCenter.ResourcesReq
-	PreviewRes        = resourcesCenter.PreviewRes
-	MergeInfo         = resourcesCenter.MergeInfo
-	ResourcesAuthRes  = resourcesCenter.ResourcesAuthRes
-	ConsumeRecordRes  = resourcesCenter.ConsumeRecordRes
 	Balance           = resourcesCenter.Balance
-	Resources         = resourcesCenter.Resources
-	ResourceBalance   = resourcesCenter.ResourceBalance
 	ConsumeRecord     = resourcesCenter.ConsumeRecord
+	ConsumeRecordRes  = resourcesCenter.ConsumeRecordRes
+	Detailed          = resourcesCenter.Detailed
+	MergeInfo         = resourcesCenter.MergeInfo
 	PreviewReq        = resourcesCenter.PreviewReq
+	PreviewRes        = resourcesCenter.PreviewRes
+	RecordReq         = resourcesCenter.RecordReq
+	ResourceBalance   = resourcesCenter.ResourceBalance
+	Resources         = resourcesCenter.Resources
+	ResourcesAuth     = resourcesCenter.ResourcesAuth
+	ResourcesAuthRes  = resourcesCenter.ResourcesAuthRes
+	ResourcesReq      = resourcesCenter.ResourcesReq
+	Response          = resourcesCenter.Response
+	UseUserResponse   = resourcesCenter.UseUserResponse
+	VipReq            = resourcesCenter.VipReq
 
 	ResourcesCenter interface {
 		// 查询账户资源权限
-		FindResourcesAuth(ctx context.Context, in *ResourcesReq) (*AccountBalanceRes, error)
+		FindResourcesAuth(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error)
 		// 查询账户资源余额
-		FindAccountBalance(ctx context.Context, in *ResourcesReq) (*AccountBalanceRes, error)
+		FindAccountBalance(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error)
 		// 查询流水账
-		FindConsumeRecord(ctx context.Context, in *RecordReq) (*ConsumeRecordRes, error)
+		FindConsumeRecord(ctx context.Context, in *RecordReq, opts ...grpc.CallOption) (*ConsumeRecordRes, error)
 		// 根据账户标识购买资源
-		PurchaseUserBalance(ctx context.Context, in *Resources) (*Response, error)
+		PurchaseUserBalance(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*Response, error)
 		// 根据账户标识使用资源
-		UseUserDetailed(ctx context.Context, in *Resources) (*UseUserResponse, error)
+		UseUserDetailed(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*UseUserResponse, error)
 		// 预览信息
-		FindPreview(ctx context.Context, in *PreviewReq) (*PreviewRes, error)
+		FindPreview(ctx context.Context, in *PreviewReq, opts ...grpc.CallOption) (*PreviewRes, error)
 		// 合并账号
-		UserMerge(ctx context.Context, in *MergeInfo) (*Response, error)
+		UserMerge(ctx context.Context, in *MergeInfo, opts ...grpc.CallOption) (*Response, error)
 		// 超级订阅时间修改
-		UpdateVipTime(ctx context.Context, in *VipReq) (*Response, error)
+		UpdateVipTime(ctx context.Context, in *VipReq, opts ...grpc.CallOption) (*Response, error)
 	}
 
 	defaultResourcesCenter struct {
@@ -63,49 +62,49 @@ func NewResourcesCenter(cli zrpc.Client) ResourcesCenter {
 }
 
 // 查询账户资源权限
-func (m *defaultResourcesCenter) FindResourcesAuth(ctx context.Context, in *ResourcesReq) (*AccountBalanceRes, error) {
+func (m *defaultResourcesCenter) FindResourcesAuth(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.FindResourcesAuth(ctx, in)
+	return client.FindResourcesAuth(ctx, in, opts...)
 }
 
 // 查询账户资源余额
-func (m *defaultResourcesCenter) FindAccountBalance(ctx context.Context, in *ResourcesReq) (*AccountBalanceRes, error) {
+func (m *defaultResourcesCenter) FindAccountBalance(ctx context.Context, in *ResourcesReq, opts ...grpc.CallOption) (*AccountBalanceRes, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.FindAccountBalance(ctx, in)
+	return client.FindAccountBalance(ctx, in, opts...)
 }
 
 // 查询流水账
-func (m *defaultResourcesCenter) FindConsumeRecord(ctx context.Context, in *RecordReq) (*ConsumeRecordRes, error) {
+func (m *defaultResourcesCenter) FindConsumeRecord(ctx context.Context, in *RecordReq, opts ...grpc.CallOption) (*ConsumeRecordRes, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.FindConsumeRecord(ctx, in)
+	return client.FindConsumeRecord(ctx, in, opts...)
 }
 
 // 根据账户标识购买资源
-func (m *defaultResourcesCenter) PurchaseUserBalance(ctx context.Context, in *Resources) (*Response, error) {
+func (m *defaultResourcesCenter) PurchaseUserBalance(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*Response, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.PurchaseUserBalance(ctx, in)
+	return client.PurchaseUserBalance(ctx, in, opts...)
 }
 
 // 根据账户标识使用资源
-func (m *defaultResourcesCenter) UseUserDetailed(ctx context.Context, in *Resources) (*UseUserResponse, error) {
+func (m *defaultResourcesCenter) UseUserDetailed(ctx context.Context, in *Resources, opts ...grpc.CallOption) (*UseUserResponse, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.UseUserDetailed(ctx, in)
+	return client.UseUserDetailed(ctx, in, opts...)
 }
 
 // 预览信息
-func (m *defaultResourcesCenter) FindPreview(ctx context.Context, in *PreviewReq) (*PreviewRes, error) {
+func (m *defaultResourcesCenter) FindPreview(ctx context.Context, in *PreviewReq, opts ...grpc.CallOption) (*PreviewRes, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.FindPreview(ctx, in)
+	return client.FindPreview(ctx, in, opts...)
 }
 
 // 合并账号
-func (m *defaultResourcesCenter) UserMerge(ctx context.Context, in *MergeInfo) (*Response, error) {
+func (m *defaultResourcesCenter) UserMerge(ctx context.Context, in *MergeInfo, opts ...grpc.CallOption) (*Response, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.UserMerge(ctx, in)
+	return client.UserMerge(ctx, in, opts...)
 }
 
 // 超级订阅时间修改
-func (m *defaultResourcesCenter) UpdateVipTime(ctx context.Context, in *VipReq) (*Response, error) {
+func (m *defaultResourcesCenter) UpdateVipTime(ctx context.Context, in *VipReq, opts ...grpc.CallOption) (*Response, error) {
 	client := resourcesCenter.NewResourcesCenterClient(m.cli.Conn())
-	return client.UpdateVipTime(ctx, in)
+	return client.UpdateVipTime(ctx, in, opts...)
 }

+ 130 - 51
service/balanceService.go

@@ -6,6 +6,7 @@ import (
 	"bytes"
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
 	"io/ioutil"
 	"log"
 	"net/http"
@@ -20,15 +21,36 @@ const (
 	AccountResources = "account_resources" //结存表
 )
 
-//根据账户标识新增资源
+// 根据账户标识新增资源
 func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.Balance, detailedData *resourcesCenter.Detailed, producMap map[string]interface{}) (int64, string) {
 	orm := entity.Engine.NewSession()
 	err := orm.Begin()
 	balance := entity.Balance{}
+	userType := int64(1)
+	remarks := detailedData.Remarks
+	if detailedData.ResourceType == "附件下载包" {
+		remarksMap := map[string]interface{}{}
+		switch balanceData.Model {
+		case 0:
+			remarksMap["describe"] = fmt.Sprintf("购买附件下载包,获得%v(读取购买数量)个附件下载权益。\n附件下载权益当月有效。\n", balanceData.Number)
+		case 2:
+			userType = 2
+			remarksMap["describe"] = "剑鱼币兑换成功\n兑换剑鱼币30天内有效。\n"
+		case 3:
+			userType = 3
+			remarksMap["describe"] = fmt.Sprintf("超级订阅用户每月享有下载%v个附件的权限,每月1号上余额清零重新计算。", balanceData.Number)
+		}
+		jsonData, err := json.Marshal(remarksMap)
+		if err != nil {
+			fmt.Println(err)
+		}
+		remarks = string(jsonData)
+	}
 	if producMap[balanceData.ResourceType] != nil {
 		fool, err := orm.Table(AccountResources).
 			Select("*").
-			Where("accountId=? and  companyId=? and  departmentId=? and  ResourceType=? and  endTime=? and vipTime=?", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, balanceData.EndTime, balanceData.VipTime).
+			Where("accountId=? and  companyId=? and  departmentId=? and  ResourceType=? and  endTime=? and vipTime=? and  sourceType=?",
+				balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, balanceData.EndTime, balanceData.VipTime, userType).
 			Get(&balance)
 		if err != nil && !fool {
 			fmt.Println("结存查询失败:", err)
@@ -37,14 +59,13 @@ func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.
 	} else {
 		fool, err := orm.Table(AccountResources).
 			Select("*").
-			Where("accountId=? and  companyId=? and  departmentId=? and  ResourceType=? and  endTime=? ", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, balanceData.EndTime).
+			Where("accountId=? and  companyId=? and  departmentId=? and  ResourceType=? and  endTime=?  and  sourceType=?", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, balanceData.EndTime, userType).
 			Get(&balance)
 		if err != nil && !fool {
 			fmt.Println("结存查询失败:", err)
 			return entity.ErrorCode, "企业下的组织查询失败"
 		}
 	}
-
 	//新增流水记录
 	detailed := entity.Detailed{
 		AccountId:    detailedData.AccountId,
@@ -55,8 +76,8 @@ func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.
 		RuleId:       detailedData.RuleId,
 		Name:         detailedData.Name,
 		CreateTime:   time.Now().Local(),
-		Remarks:      detailedData.Remarks,
-		UserType:     1,
+		Remarks:      remarks,
+		UserType:     userType,
 	}
 	insertNumb, err := orm.Table(ConsumeRecord).Insert(&detailed)
 	if err != nil {
@@ -68,6 +89,8 @@ func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.
 		orm.Rollback()
 		return entity.ErrorCode, "新增流水失败"
 	}
+	//资源流水新增
+	//orm.Table(AccountResources).Insert(&balance)
 	if balance.Id == 0 {
 		//新增结存记录
 		balance = entity.Balance{
@@ -80,7 +103,9 @@ func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.
 			Spec:         balanceData.Spec,
 			AppId:        balanceData.AppId,
 			EndTime:      balanceData.EndTime,
-			VipTime:      balanceData.VipTime}
+			VipTime:      balanceData.VipTime,
+			SourceType:   userType,
+		}
 		insertNumb, err = orm.Table(AccountResources).Insert(&balance)
 		if err != nil || insertNumb <= 0 {
 			fmt.Println("结存查询失败:", err)
@@ -91,8 +116,8 @@ func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.
 		return entity.SuccessCode, "结存新增成功"
 	}
 	balance.Number = balance.Number + balanceData.Number
-	updateNumb, err := orm.Table(AccountResources).
-		Where("accountId=? and  companyId=? and  departmentId=? and  resourceType=? and endTime=? and  vipTime=?", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, balanceData.EndTime, balanceData.VipTime).
+	updateNumb, err := orm.Table(AccountResources).Cols("number").
+		Where(" id=?", balance.Id).
 		Update(&balance)
 	if err != nil || updateNumb <= 0 {
 		orm.Rollback()
@@ -103,7 +128,7 @@ func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.
 	return entity.SuccessCode, "结存修改成功"
 }
 
-//根据账户标识使用资源
+// 根据账户标识使用资源
 func (service *BalanceService) UseUserDetailed(duplicateRemoval int64, balanceData *resourcesCenter.Balance, detailedData *resourcesCenter.Detailed, infoId, url string, producMap map[string]interface{}) (int64, string, int64) {
 	orm := entity.Engine.NewSession()
 	err := orm.Begin()
@@ -141,17 +166,29 @@ func (service *BalanceService) UseUserDetailed(duplicateRemoval int64, balanceDa
 		Age int `xorm:"age"`
 	}
 	sumStruct := "0"
+	now1 := time.Now()
+	currentYear, currentMonth, _ := now1.Date()
+	currentLocation := now1.Location()
+	firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
+	lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
+	endTime := lastOfMonth.Format("2006-01-02")
+	starteTime := lastOfMonth.Format("2006-01-02")
+	nowTime := now1.Format("2006-01-02")
 	if producMap[balanceData.ResourceType] != nil {
-		now1 := time.Now()
-		currentYear, currentMonth, _ := now1.Date()
-		currentLocation := now1.Location()
-		firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
-		lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
-		endTime := lastOfMonth.Format("2006-01-02")
-		_, err = orm.Table(AccountResources).
-			Select("sum(number) as  number").
-			Where("accountId=? and  companyId=? and  departmentId=? and  ResourceType=? and  endTime=? and vipTime>?", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, endTime, time.Now().Unix()).
-			Get(&sumStruct)
+		if balanceData.ResourceType == "附件下载包" {
+			_, err = orm.Table(AccountResources).
+				Select("sum(number) as  number").
+				Where("accountId=? and  companyId=? and  departmentId=? and  ResourceType=? "+
+					"and (( endTime>= ? and endTime<=? and vipTime>? )or  (endTime>= ? and endTime<=? and (vipTime = '' or  vipTime is NULL )  ))  ",
+					balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, starteTime, endTime, nowTime, starteTime, endTime).
+				Get(&sumStruct)
+		} else {
+			_, err = orm.Table(AccountResources).
+				Select("sum(number) as  number").
+				Where("accountId=? and  companyId=? and  departmentId=? and  ResourceType=? and  endTime=? and vipTime>?", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, endTime, nowTime).
+				Get(&sumStruct)
+		}
+
 	} else {
 		_, err = orm.Table(AccountResources).
 			Select("sum(number) as  number").
@@ -195,17 +232,21 @@ func (service *BalanceService) UseUserDetailed(duplicateRemoval int64, balanceDa
 	//修改结存
 	balanceList := []entity.Balance{}
 	if producMap[balanceData.ResourceType] != nil {
-		now1 := time.Now()
-		currentYear, currentMonth, _ := now1.Date()
-		currentLocation := now1.Location()
-		firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
-		lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
-		endTime := lastOfMonth.Format("2006-01-02")
-		err = orm.Table(AccountResources).
-			Select("*").
-			Where("accountId=? and  companyId=? and  departmentId=? and  number>0 and  ResourceType=? and  endTime=?  and vipTime>?  ", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, endTime, time.Now().Unix()).
-			OrderBy("endTime").
-			Find(&balanceList)
+		if balanceData.ResourceType == "附件下载包" {
+			err = orm.Table(AccountResources).
+				Select("*").
+				Where("accountId=? and  companyId=? and  departmentId=? and  number>0 and  ResourceType=?"+
+					" and (( endTime>= ? and endTime<=? and vipTime>=? )or  (endTime>= ?  and (vipTime='' or  vipTime is NULL )  ))  ",
+					balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, starteTime, endTime, nowTime, nowTime).
+				OrderBy("endTime").
+				Find(&balanceList)
+		} else {
+			err = orm.Table(AccountResources).
+				Select("*").
+				Where("accountId=? and  companyId=? and  departmentId=? and  number>0 and  ResourceType=? and  endTime=?  and vipTime>?  ", balanceData.AccountId, balanceData.CompanyId, balanceData.DepartmentId, balanceData.ResourceType, endTime, nowTime).
+				OrderBy("endTime").
+				Find(&balanceList)
+		}
 	} else {
 		err = orm.Table(AccountResources).
 			Select("*").
@@ -213,7 +254,6 @@ func (service *BalanceService) UseUserDetailed(duplicateRemoval int64, balanceDa
 			OrderBy("endTime").
 			Find(&balanceList)
 	}
-
 	if err != nil {
 		fmt.Println("结存查询失败:", err)
 		orm.Rollback()
@@ -243,7 +283,7 @@ func (service *BalanceService) UseUserDetailed(duplicateRemoval int64, balanceDa
 	return entity.SuccessCode, "使用结存成功", deductionNumbs
 }
 
-//去重查询
+// 去重查询
 func (service *BalanceService) FindPreview(in *resourcesCenter.PreviewReq, url string) (int64, string, int64, int64) {
 	orm := entity.Engine
 	balance := []entity.AccountBalance{}
@@ -296,7 +336,7 @@ func HttpPost_M(href, contentType, param string, timeout int) (map[string]interf
 	return resData, resp.StatusCode, t2 - t1
 }
 
-//账号合并
+// 账号合并
 func (service *BalanceService) UserMerge(mergeUser, mergedUser, appId string, producMap map[string]interface{}) (int64, string) {
 	orm := entity.Engine.NewSession()
 	err := orm.Begin()
@@ -373,20 +413,11 @@ func (service *BalanceService) UserMerge(mergeUser, mergedUser, appId string, pr
 		}
 		//结存操作
 		balance := entity.Balance{}
-		if producMap[value.ResourceType] != nil {
-			_, err = orm.Table(AccountResources).
-				Select("*").
-				Where("accountId=? and resourceType=?  endTime=? and vipTime=?", mergeUser, value.ResourceType, value.EndTime, value.VipTime).
-				OrderBy("endTime").
-				Get(&balance)
-		} else {
-			_, err = orm.Table(AccountResources).
-				Select("*").
-				Where("accountId=? and resourceType=?  endTime=?", mergeUser, value.ResourceType, value.EndTime).
-				OrderBy("endTime").
-				Get(&balance)
-		}
-
+		_, err = orm.Table(AccountResources).
+			Select("*").
+			Where("accountId=? and resourceType=?  endTime=? and vipTime=?", mergeUser, value.ResourceType, value.EndTime, value.VipTime).
+			OrderBy("endTime").
+			Get(&balance)
 		if balance.Id != 0 {
 			//增加结存数量
 			balance.Number += value.Number
@@ -436,7 +467,7 @@ func (service *BalanceService) UserMerge(mergeUser, mergedUser, appId string, pr
 
 }
 
-//超级订阅时间修改
+// 超级订阅时间修改
 func (service *BalanceService) UpdateVipTime(data *resourcesCenter.VipReq, productValue string) (int64, string) {
 	orm := entity.Engine.NewSession()
 	err := orm.Begin()
@@ -451,11 +482,10 @@ func (service *BalanceService) UpdateVipTime(data *resourcesCenter.VipReq, produ
 	dataMap := map[string]interface{}{
 		"vipTime": data.VipTime,
 	}
-	//productValue, _ := entity.GetInForComma(producMap)
 	resourceTypeStr := `FIND_IN_SET(resourceType,%s)`
 	resourceTypeStr = fmt.Sprintf(` FIND_IN_SET(resourceType,"%s")`, productValue)
 	updateNumb, err = orm.Table(AccountResources).
-		Cols("vipTime").Where("endTime = ? and  accountId=? and  "+resourceTypeStr, endTime, data.AccountId).
+		Cols("vipTime").Where("endTime = ? and  accountId=?  and  sourceType in(1,3)  and  "+resourceTypeStr, endTime, data.AccountId).
 		Update(&dataMap)
 	if err != nil || updateNumb < 0 {
 		fmt.Println("结存修改失败:", err)
@@ -465,3 +495,52 @@ func (service *BalanceService) UpdateVipTime(data *resourcesCenter.VipReq, produ
 	orm.Commit()
 	return entity.SuccessCode, "超级订阅时间修改成功"
 }
+func (service *BalanceService) ExpireHandle() {
+	orm := entity.Engine.NewSession()
+	endTime := time.Now().Format("2006-01-02")
+	expireList := []map[string]interface{}{}
+	endTime = "2023-10-21"
+	orm.Table(AccountResources).Where("resourceType=? and  (endTime=? or  vipTime=?) and  number >0  ", "附件下载包", endTime, endTime).Find(&expireList)
+	for _, m := range expireList {
+		//流水生成
+		sourceType := gconv.Int64(m["sourceType"])
+		accountId := gconv.String(m["accountId"])
+		number := gconv.Int64(m["number"])
+		resourcesId := gconv.Int64(m["id"])
+		userType := int64(1)
+		remarks := ""
+		remarksMap := map[string]interface{}{}
+		switch sourceType {
+		case 1:
+			remarksMap["describe"] = "购买附件下载包权益未使用失效。"
+		case 2:
+			userType = 2
+			remarksMap["describe"] = "剑鱼币兑换权益未使用失效。"
+		case 3:
+			userType = 3
+			remarksMap["describe"] = fmt.Sprintf("超级订阅%s附件下载权益未使用失效。", time.Now().Format("2006年01"))
+		}
+		jsonData, err := json.Marshal(remarksMap)
+		if err != nil {
+			fmt.Println(err)
+		}
+		remarks = string(jsonData)
+		detailed := entity.Detailed{
+			AccountId:    accountId,
+			ResourceType: "附件下载包",
+			Number:       number,
+			Name:         "附件下载包",
+			CreateTime:   time.Now().Local(),
+			Remarks:      remarks,
+			UserType:     userType,
+		}
+		orm.Table(ConsumeRecord).Insert(&detailed)
+		//jie结存清空
+		updataMap := map[string]interface{}{
+			"number": 0,
+		}
+		orm.Table(AccountResources).
+			Cols("number").Where("id =? ", resourcesId).
+			Update(&updataMap)
+	}
+}

+ 49 - 26
service/resourceManageService.go

@@ -8,7 +8,7 @@ import (
 
 type ResourceManageService struct{}
 
-//查询用户资源权限
+// 查询用户资源权限
 func (service *ResourceManageService) FindResourcesAuth(data *resourcesCenter.ResourcesReq) ([]*resourcesCenter.ResourceBalance, error) {
 	orm := entity.Engine.NewSession()
 	var authArr []*entity.AccountBalance
@@ -31,7 +31,7 @@ func (service *ResourceManageService) FindResourcesAuth(data *resourcesCenter.Re
 	return authList, nil
 }
 
-//查询账户资源余额
+// 查询账户资源余额
 func (service *ResourceManageService) FindAccountBalance(in *resourcesCenter.ResourcesReq, producMap map[string]interface{}) ([]*resourcesCenter.ResourceBalance, error) {
 	now := time.Now().Format("2006-01-02")
 	now1 := time.Now()
@@ -46,12 +46,11 @@ func (service *ResourceManageService) FindAccountBalance(in *resourcesCenter.Res
 	var err error
 	if producMap[in.ResourceType] != nil {
 		err = orm.Table("account_resources").Select("ANY_VALUE(id) as id,ANY_VALUE(name) as name,resourceType,ANY_VALUE(spec)").
-			Where("accountId = ? and endTime =? and  vipTime>? and  resourceType=?  ", in.AccountId, endTime, time.Now().Unix(), in.ResourceType).GroupBy("resourceType").Find(&accountBalanceArr)
+			Where("accountId = ? and ( ( endTime =? and vipTime>=?) or (endTime >=? and (vipTime = '' or  vipTime is NULL )) ) and  resourceType=?  ", in.AccountId, endTime, time.Now().Format("2006-01-02"), endTime, in.ResourceType).GroupBy("resourceType").Find(&accountBalanceArr)
 	} else {
 		err = orm.Table("account_resources").Select("ANY_VALUE(id) as id,ANY_VALUE(name) as name,resourceType,ANY_VALUE(spec)").
 			Where("accountId = ? and endTime >= ? and resourceType like  ?", in.AccountId, now, "%字段包%").GroupBy("resourceType").Find(&accountBalanceArr)
 	}
-
 	if err != nil {
 		return dataList, err
 	}
@@ -62,6 +61,7 @@ func (service *ResourceManageService) FindAccountBalance(in *resourcesCenter.Res
 		firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
 		lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
 		endTime := lastOfMonth.Format("2006-01-02")
+		startTime := firstOfMonth.Format("2006-01-02")
 		//统计30内到期数量
 		b := false
 		var err error
@@ -69,9 +69,30 @@ func (service *ResourceManageService) FindAccountBalance(in *resourcesCenter.Res
 		c := int64(0)
 		//统计总数量
 		isOk := false
+		number1 := int64(0)
+		number2 := int64(0)
+		number3 := int64(0)
 		if producMap[v.ResourceType] != nil {
-			isOk, err = orm.Table("account_resources").Select("sum(number) as number").
-				Where("accountId = ? and resourceType = ? and endTime = ? and  vipTime>=?", in.AccountId, v.ResourceType, endTime, time.Now().Unix()).Get(&number)
+			numberList := []map[string]int64{}
+			//分别查询每种剩余数量
+			err = orm.Table("account_resources").Select("sourceType,sum(number) as number").
+				Where("accountId = ? and resourceType = ? and "+
+					"((endTime <= ? and endTime>=?  and  vipTime>=?) or (endTime <= ? and endTime>=? and (vipTime = '' or  vipTime is NULL )))",
+					in.AccountId, v.ResourceType, endTime, startTime, time.Now().Format("2006-01-02"), endTime, startTime).GroupBy("sourceType").Find(&numberList)
+
+			for _, v := range numberList {
+				sourceType := v["sourceType"]
+				switch sourceType {
+				case 1:
+					number1 = v["number"]
+				case 2:
+					number2 = v["number"]
+				case 3:
+					number3 = v["number"]
+
+				}
+			}
+			number = number1 + number2 + number3
 		} else {
 			var c int64
 			b, err = orm.Table("account_resources").Select("sum(number) as number").
@@ -84,18 +105,18 @@ func (service *ResourceManageService) FindAccountBalance(in *resourcesCenter.Res
 			return dataList, err
 		}
 		dataList = append(dataList, &resourcesCenter.ResourceBalance{
-			Id:           v.Id,
-			Name:         v.Name,
-			ResourceType: v.ResourceType,
-			Number:       number,
-			Spec:         v.Spec,
-			ThirtyNum:    c,
+			Number:    number,
+			Spec:      v.Spec,
+			ThirtyNum: c,
+			Number1:   number1,
+			Number2:   number2,
+			Number3:   number3,
 		})
 	}
 	return dataList, nil
 }
 
-//查询流水账
+// 查询流水账
 func (service *ResourceManageService) FindConsumeRecord(in *resourcesCenter.RecordReq) ([]*resourcesCenter.ConsumeRecord, int64, error) {
 	orm := entity.Engine.NewSession()
 	var recordArr []*entity.ConsumeRecord
@@ -105,7 +126,8 @@ func (service *ResourceManageService) FindConsumeRecord(in *resourcesCenter.Reco
 	if in.ResourceType == "" {
 		in.ResourceType = "字段包"
 	}
-	if in.State == 0 {
+	switch in.State {
+	case 0:
 		if in.QueryTime != "" {
 			count, err = orm.Table("consume_record").
 				Where("accountId = ? and userId = ? and userType = 0  and resourceType like  ?  and DATE_FORMAT( createTime, '%Y-%m' ) = ?", in.AccountId, in.UserId, "%"+in.ResourceType+"%", in.QueryTime).
@@ -115,13 +137,8 @@ func (service *ResourceManageService) FindConsumeRecord(in *resourcesCenter.Reco
 			count, err = orm.Table("consume_record").
 				Where("accountId = ? and userId = ? and userType = 0  and resourceType like  ? ", in.AccountId, in.UserId, "%"+in.ResourceType+"%").
 				Limit(int(in.PageSize), (int(in.Page)-1)*int(in.PageSize)).OrderBy("id desc").FindAndCount(&recordArr)
-
-		}
-
-		if err != nil && count == 0 {
-			return dataList, 0, err
 		}
-	} else {
+	case 1:
 		if in.QueryTime != "" {
 			count, err = orm.Table("consume_record").
 				Where("accountId = ? and userType = 1 and   resourceType like ? and DATE_FORMAT( createTime, '%Y-%m' ) = ?", in.AccountId, "%"+in.ResourceType+"%", in.QueryTime).
@@ -131,19 +148,25 @@ func (service *ResourceManageService) FindConsumeRecord(in *resourcesCenter.Reco
 				Where("accountId = ? and userType = 1 and   resourceType like ? ", in.AccountId, "%"+in.ResourceType+"%").
 				Limit(int(in.PageSize), (int(in.Page)-1)*int(in.PageSize)).OrderBy("id desc").FindAndCount(&recordArr)
 		}
-
-		if err != nil && count == 0 {
-			return dataList, 0, err
+	case 2:
+		if in.QueryTime != "" {
+			count, err = orm.Table("consume_record").
+				Where("accountId = ? and userType>0 and   resourceType like ? and DATE_FORMAT( createTime, '%Y-%m' ) = ?", in.AccountId, "%"+in.ResourceType+"%", in.QueryTime).
+				Limit(int(in.PageSize), (int(in.Page)-1)*int(in.PageSize)).OrderBy("id desc").FindAndCount(&recordArr)
+		} else {
+			count, err = orm.Table("consume_record").
+				Where("accountId = ? and userType>0 and   resourceType like ? ", in.AccountId, "%"+in.ResourceType+"%").
+				Limit(int(in.PageSize), (int(in.Page)-1)*int(in.PageSize)).OrderBy("id desc").FindAndCount(&recordArr)
 		}
 	}
-
+	if err != nil && count == 0 {
+		return dataList, 0, err
+	}
 	for _, v := range recordArr {
 		dataList = append(dataList, &resourcesCenter.ConsumeRecord{
-			Id:            v.Id,
 			Name:          v.Name,
 			ResourceType:  v.ResourceType,
 			Number:        v.Number,
-			RuleId:        v.RuleId,
 			CreateTime:    v.CreateTime,
 			UserType:      v.UserType,
 			DeductionNumb: v.DeductionNumb,