上传论坛模块

This commit is contained in:
liwei1dao 2022-08-10 13:38:11 +08:00
parent 5b9b73f76b
commit c03ba65bf6
21 changed files with 422 additions and 127 deletions

View File

@ -1 +1,22 @@
[] [
{
"msgid": "notify.getlist",
"routrules": "~/worker",
"describe": "公告获取接口"
},
{
"msgid": "forum.getlist",
"routrules": "~/worker",
"describe": "论坛评论获取接口"
},
{
"msgid": "forum.releasecomment",
"routrules": "~/worker",
"describe": "论坛发布评论接口"
},
{
"msgid": "forum.watchhero",
"routrules": "~/worker",
"describe": "论坛查看目标英雄接口"
}
]

View File

@ -28,7 +28,7 @@ var res string
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
if err := cache.OnInit(nil, cache.Set_Redis_Addr([]string{ if err := cache.OnInit(nil, cache.Set_Redis_Addr([]string{
// "10.0.0.9:6986", // "10.0.0.9:6986",
"10.0.0.9:9001","10.0.0.9:9002","10.0.0.9:9003","10.0.0.9:9004","10.0.0.9:9005","10.0.0.9:9006", "10.0.0.9:9001", "10.0.0.9:9002", "10.0.0.9:9003", "10.0.0.9:9004", "10.0.0.9:9005", "10.0.0.9:9006",
}), }),
cache.Set_Redis_Password(""), cache.Set_Redis_Password(""),
// cache.Set_Redis_Password("li13451234"), // cache.Set_Redis_Password("li13451234"),

7
go.mod
View File

@ -17,7 +17,7 @@ require (
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
github.com/json-iterator/go v1.1.12 github.com/json-iterator/go v1.1.12
github.com/modern-go/reflect2 v1.0.2 github.com/modern-go/reflect2 v1.0.2
github.com/nacos-group/nacos-sdk-go v1.0.8 github.com/nacos-group/nacos-sdk-go v1.1.2
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/rs/xid v1.3.0 github.com/rs/xid v1.3.0
@ -101,8 +101,6 @@ require (
github.com/klauspost/cpuid/v2 v2.0.12 // indirect github.com/klauspost/cpuid/v2 v2.0.12 // indirect
github.com/klauspost/reedsolomon v1.9.16 // indirect github.com/klauspost/reedsolomon v1.9.16 // indirect
github.com/leodido/go-urn v1.2.1 // indirect github.com/leodido/go-urn v1.2.1 // indirect
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f // indirect
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect
github.com/lucas-clemente/quic-go v0.27.0 // indirect github.com/lucas-clemente/quic-go v0.27.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.5 // indirect github.com/magiconair/properties v1.8.5 // indirect
@ -158,7 +156,7 @@ require (
go.opentelemetry.io/otel v1.6.3 // indirect go.opentelemetry.io/otel v1.6.3 // indirect
go.opentelemetry.io/otel/trace v1.6.3 // indirect go.opentelemetry.io/otel/trace v1.6.3 // indirect
go.uber.org/atomic v1.7.0 // indirect go.uber.org/atomic v1.7.0 // indirect
go.uber.org/zap v1.21.0 // indirect go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 // indirect golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 // indirect
golang.org/x/image v0.0.0-20220601225756-64ec528b34cd // indirect golang.org/x/image v0.0.0-20220601225756-64ec528b34cd // indirect
golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee // indirect golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee // indirect
@ -169,6 +167,7 @@ require (
golang.org/x/tools v0.1.10 // indirect golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect

30
go.sum
View File

@ -51,6 +51,7 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy
github.com/BabySid/gobase v0.0.0-20220614103908-39ac0a583c02 h1:4VkwDX+9araWz3MeAx/3EAWuQTu+dYnJqBlYrk86i4k= github.com/BabySid/gobase v0.0.0-20220614103908-39ac0a583c02 h1:4VkwDX+9araWz3MeAx/3EAWuQTu+dYnJqBlYrk86i4k=
github.com/BabySid/gobase v0.0.0-20220614103908-39ac0a583c02/go.mod h1:psRlcjEywZdxNf9jp6IdYY7VcAsYPtcnLHYQ+dWG5uw= github.com/BabySid/gobase v0.0.0-20220614103908-39ac0a583c02/go.mod h1:psRlcjEywZdxNf9jp6IdYY7VcAsYPtcnLHYQ+dWG5uw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChimeraCoder/gojson v1.1.0/go.mod h1:nYbTQlu6hv8PETM15J927yM0zGj3njIldp72UT1MqSw= github.com/ChimeraCoder/gojson v1.1.0/go.mod h1:nYbTQlu6hv8PETM15J927yM0zGj3njIldp72UT1MqSw=
@ -86,8 +87,6 @@ github.com/aws/aws-sdk-go v1.34.28 h1:sscPpn/Ns3i0F4HPEWAVcwdIRaZZCuL7llJ2/60yPI
github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+IrOD63t4i/RW7RqrAVl9LTZ9UqQ= github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+IrOD63t4i/RW7RqrAVl9LTZ9UqQ=
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg= github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
@ -95,6 +94,7 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/cenk/backoff v2.2.1+incompatible h1:djdFT7f4gF2ttuzRKPbMOWgZajgesItGLwG5FTQKmmE= github.com/cenk/backoff v2.2.1+incompatible h1:djdFT7f4gF2ttuzRKPbMOWgZajgesItGLwG5FTQKmmE=
github.com/cenk/backoff v2.2.1+incompatible/go.mod h1:7FtoeaSnHoZnmZzz47cM35Y9nSW7tNyaidugnHTaFDE= github.com/cenk/backoff v2.2.1+incompatible/go.mod h1:7FtoeaSnHoZnmZzz47cM35Y9nSW7tNyaidugnHTaFDE=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
@ -142,8 +142,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw=
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA=
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 h1:Ghm4eQYC0nEPnSJdVkTrXpu9KtoVCSo1hg7mtI7G9KU=
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
@ -404,8 +402,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs= github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs=
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jackmordaunt/icns/v2 v2.2.1/go.mod h1:6aYIB9eSzyfHHMKqDf17Xrs1zetQPReAkiUSHzdw4cI= github.com/jackmordaunt/icns/v2 v2.2.1/go.mod h1:6aYIB9eSzyfHHMKqDf17Xrs1zetQPReAkiUSHzdw4cI=
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
@ -413,8 +409,6 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY= github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@ -463,12 +457,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570 h1:0iQektZGS248WXmGIYOwRXSQhD4qn3icjMpuxwO7qlo=
github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570/go.mod h1:BLt8L9ld7wVsvEWQbuLrUZnCMnUmLZ+CGDzKtclrTlE=
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f h1:sgUSP4zdTUZYZgAGGtN5Lxk92rK+JUFOwf+FT99EEI4=
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f/go.mod h1:UGmTpUd3rjbtfIpwAPrcfmGf/Z1HS95TATB+m57TPB8=
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 h1:Bvq8AziQ5jFF4BHGAEDSqwPW1NJS3XshxbRCxtjFAZc=
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPpsiPUEh0zFL1Snz4crhMlBe60PYxRHr5oFF3rRYg0=
github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0=
github.com/lucas-clemente/quic-go v0.27.0 h1:v6WY87q9zD4dKASbG8hy/LpzAVNzEQzw8sEIeloJsc4= github.com/lucas-clemente/quic-go v0.27.0 h1:v6WY87q9zD4dKASbG8hy/LpzAVNzEQzw8sEIeloJsc4=
github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI=
@ -539,8 +527,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nacos-group/nacos-sdk-go v1.0.8 h1:8pEm05Cdav9sQgJSv5kyvlgfz0SzFUUGI3pWX6SiSnM= github.com/nacos-group/nacos-sdk-go v1.1.2 h1:lWTpf5SXLetQetS7p31eGic/ncqsnn0Zbau1i3eC25Y=
github.com/nacos-group/nacos-sdk-go v1.0.8/go.mod h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA= github.com/nacos-group/nacos-sdk-go v1.1.2/go.mod h1:I8Vj4M8ZLpBk7EY2A8RXQE1SbfCA7b56TJBPIFTrUYE=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
@ -716,8 +704,6 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/tebeka/strftime v0.1.3 h1:5HQXOqWKYRFfNyBMNVc9z5+QzuBtIXy03psIhtdJYto=
github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU= github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b h1:fj5tQ8acgNUr6O8LEplsxDhUIe2573iLkJc+PqnzZTI= github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b h1:fj5tQ8acgNUr6O8LEplsxDhUIe2573iLkJc+PqnzZTI=
@ -739,7 +725,6 @@ github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ= github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
@ -801,16 +786,13 @@ go.opentelemetry.io/otel/trace v1.6.3/go.mod h1:GNJQusJlUgZl9/TQBPKU/Y/ty+0iVB5f
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@ -1260,6 +1242,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -187,15 +187,14 @@ Redis Rpush 命令用于将一个或多个值插入到列表的尾部(最右边)
如果列表不存在一个空列表会被创建并执行 RPUSH 操作 当列表存在但不是列表类型时返回一个错误 如果列表不存在一个空列表会被创建并执行 RPUSH 操作 当列表存在但不是列表类型时返回一个错误
注意 Redis 2.4 版本以前的 RPUSH 命令都只接受单个 value 注意 Redis 2.4 版本以前的 RPUSH 命令都只接受单个 value
*/ */
func (this *RedisPipe) RPush(key string, values ...interface{}) (err error) { func (this *RedisPipe) RPush(key string, values ...interface{}) *redis.IntCmd {
agrs := make([]interface{}, 0) agrs := make([]interface{}, 0)
agrs = append(agrs, "RPUSH") agrs = append(agrs, "RPUSH")
for _, v := range values { for _, v := range values {
result, _ := this.codec.Marshal(v) result, _ := this.codec.Marshal(v)
agrs = append(agrs, result) agrs = append(agrs, result)
} }
err = this.client.Do(this.ctx, agrs...).Err() return this.client.RPush(this.ctx, key, agrs...)
return
} }
/* /*
@ -203,14 +202,8 @@ Redis Rpush 命令用于将一个或多个值插入到列表的尾部(最右边)
如果列表不存在一个空列表会被创建并执行 RPUSH 操作 当列表存在但不是列表类型时返回一个错误 如果列表不存在一个空列表会被创建并执行 RPUSH 操作 当列表存在但不是列表类型时返回一个错误
注意 Redis 2.4 版本以前的 RPUSH 命令都只接受单个 value 注意 Redis 2.4 版本以前的 RPUSH 命令都只接受单个 value
*/ */
func (this *RedisPipe) RPushForStringSlice(key string, values ...string) (err error) { func (this *RedisPipe) RPushForStringSlice(key string, values ...string) *redis.IntCmd {
agrs := make([]interface{}, 0) return this.client.RPush(this.ctx, key, values)
agrs = append(agrs, "RPUSH")
for _, v := range values {
agrs = append(agrs, v)
}
err = this.client.Do(this.ctx, agrs...).Err()
return
} }
/* /*

View File

@ -312,7 +312,7 @@ func (this *Client) getclient(ctx *context.Context, clusterTag string, servicePa
} }
if c, ok = clients[spath[0]]; !ok { if c, ok = clients[spath[0]]; !ok {
if d, err = client.NewConsulDiscovery(this.options.ServiceTag, spath[0], this.options.ConsulServers, nil); err != nil { if d, err = client.NewConsulDiscovery(clusterTag, spath[0], this.options.ConsulServers, nil); err != nil {
return return
} }
c = client.NewBidirectionalXClient(spath[0], client.Failfast, client.RandomSelect, d, client.DefaultOption, this.msgChan) c = client.NewBidirectionalXClient(spath[0], client.Failfast, client.RandomSelect, d, client.DefaultOption, this.msgChan)

View File

@ -248,10 +248,10 @@ func (this *modelChatComp) addChatMsg(key string, count int64, msgs ...*pb.DBCha
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
if _, err = this.DB.InsertMany(core.SqlTable(this.TableName), values); err != nil { // if _, err = this.DB.InsertMany(core.SqlTable(this.TableName), values); err != nil {
this.module.Errorf("err:%v", err) // this.module.Errorf("err:%v", err)
return // return
} // }
if len(outkey) > 0 { if len(outkey) > 0 {
delkeys := make([]string, 0) delkeys := make([]string, 0)
for _, v := range outkey { for _, v := range outkey {

View File

@ -24,7 +24,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ForumGetListReq)
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success { if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success {
return return
} }
if list, err = this.module.modelForum.GetComment(req.Herocid); err != nil { if list, err = this.module.modelForum.getComment(req.Herocid); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }

View File

@ -0,0 +1,32 @@
package forum
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) WatchHeroCheck(session comm.IUserSession, req *pb.ForumWatchHeroReq) (code pb.ErrorCode) {
if req.Uid == "" || req.HerocId == "" || req.HerooId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
///获取本服聊天消息记录
func (this *apiComp) WatchHero(session comm.IUserSession, req *pb.ForumWatchHeroReq) (code pb.ErrorCode, data proto.Message) {
var (
hero *pb.DBHero
err error
)
if code = this.WatchHeroCheck(session, req); code != pb.ErrorCode_Success {
return
}
if hero, err = this.module.modelForum.watchHero(req.Stag, req.Uid, req.HerocId); err != nil {
code = pb.ErrorCode_HeroNoExist
}
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ForumWatchHeroResp{Hero: hero})
return
}

View File

@ -1,11 +1,16 @@
package forum package forum
import ( import (
"context"
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx" "go.mongodb.org/mongo-driver/x/bsonx"
) )
@ -30,15 +35,90 @@ func (this *modelForumComp) Init(service core.IService, module core.IModule, com
} }
//查询用户未读消息 //查询用户未读消息
func (this *modelForumComp) GetComment(herocId string) (result []*pb.DBComment, err error) { func (this *modelForumComp) getComment(herocId string) (result []*pb.DBComment, err error) {
var (
key string
c *mongo.Cursor
n int
max_chat int32
)
result = make([]*pb.DBComment, 0)
key = fmt.Sprintf("%s:%s", this.TableName, herocId)
err = this.GetQueues(key, 10, &result)
if err == redis.RedisNil {
//query from mgo
if c, err = this.DB.Find(core.SqlTable(this.TableName), bson.M{"heroid": herocId}); err != nil {
return
} else {
result = make([]*pb.DBComment, c.RemainingBatchLength())
for c.Next(context.Background()) {
chat := &pb.DBComment{}
if err = c.Decode(chat); err != nil {
this.module.Errorf("err:%v", err)
}
result[n] = chat
n++
}
if len(result) > 0 {
this.addCommentChache(key, int64(max_chat), result...)
}
}
}
return return
} }
///发布评论 ///发布评论
func (this *modelForumComp) releaseComment(comment *pb.DBComment) (err error) { func (this *modelForumComp) releaseComment(comment *pb.DBComment) (err error) {
key := fmt.Sprintf("%s:%s", this.TableName, comment.Heroid)
if err = this.addCommentChache(key, 99, comment); err != nil {
this.module.Errorln(err)
return
}
if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), comment); err != nil { if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), comment); err != nil {
this.module.Errorln(err) this.module.Errorln(err)
return
}
return
}
//添加评论到缓存中
func (this *modelForumComp) addCommentChache(key string, count int64, msgs ...*pb.DBComment) (err error) {
var (
data map[string]*pb.DBComment = make(map[string]*pb.DBComment, len(msgs))
)
for _, v := range msgs {
data[fmt.Sprintf("%s-%s", key, v.Id)] = v
}
if _, err = this.AddQueues(key, count, data); err != nil {
this.module.Errorln(err)
return
}
return
}
func (this *modelForumComp) watchHero(stage string, uid string, herocid string) (hero *pb.DBHero, err error) {
tcoon := db.ServerDBConn(stage)
var (
c *mongo.Cursor
)
if c, err = tcoon.Mgo.Find(comm.TableHero, bson.M{"uid": uid, "heroID": herocid}); err != nil {
return
} else {
n := 0
result := make([]*pb.DBHero, c.RemainingBatchLength())
for c.Next(context.Background()) {
hero := &pb.DBHero{}
if err = c.Decode(hero); err != nil {
this.module.Errorf("err:%v", err)
}
result[n] = hero
n++
}
for _, v := range result {
if hero == nil || hero.Lv < v.Lv {
hero = v
}
}
} }
return return
} }

View File

@ -25,7 +25,7 @@ type Forum struct {
//模块名 //模块名
func (this *Forum) GetType() core.M_Modules { func (this *Forum) GetType() core.M_Modules {
return comm.ModuleEquipment return comm.ModuleForum
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件

View File

@ -238,13 +238,23 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
SubType: msg.SubType, SubType: msg.SubType,
Message: msg.Data, Message: msg.Data,
} }
if rule, ok = this.gateway.GetMsgDistribute(msg.MainType, msg.SubType); ok { msgid := strings.ToLower(fmt.Sprintf("%s.%s", msg.MainType, msg.SubType))
if rule, ok = this.gateway.GetMsgDistribute(msgid); ok {
paths := strings.Split(rule, "/") paths := strings.Split(rule, "/")
if len(paths) == 3 { if len(paths) == 3 {
serviceTag = paths[0] if paths[0] == "~" {
serviceTag = this.gateway.CrossServiceTag()
} else {
serviceTag = paths[0]
}
servicePath = fmt.Sprintf("%s/%s", paths[1], paths[2]) servicePath = fmt.Sprintf("%s/%s", paths[1], paths[2])
} else if len(paths) < 3 && len(paths) > 0 { } else if len(paths) == 2 {
servicePath = rule if paths[0] == "~" {
serviceTag = this.gateway.CrossServiceTag()
servicePath = paths[1]
} else {
servicePath = rule
}
} else { } else {
this.gateway.Errorf("messageDistribution rule is empty!") this.gateway.Errorf("messageDistribution rule is empty!")
return return

View File

@ -24,20 +24,18 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
} }
// GetMsgDistribute 获取消息分发规则读取配置表 // GetMsgDistribute 获取消息分发规则读取配置表
func (this *configureComp) GetMsgDistribute(mtype, stype string) (rule string, ok bool) { func (this *configureComp) GetMsgDistribute(msgid string) (rule string, ok bool) {
var ( var (
err error err error
v interface{} v interface{}
item *cfg.Game_msgdistribData
) )
if v, err = this.GetConfigure(game_msgdistrib); err != nil { if v, err = this.GetConfigure(game_msgdistrib); err != nil {
ok = false
return return
} else { } else {
for _, v := range v.(*cfg.Game_msgdistrib).GetDataMap() { if item, ok = v.(*cfg.Game_msgdistrib).GetDataMap()[msgid]; ok {
if v.Mtype == mtype && v.Stype == stype { rule = item.Routrules
rule = v.Routrules
ok = true
return
}
} }
} }
return return

View File

@ -25,8 +25,9 @@ type (
core.IModule core.IModule
log.Ilogf log.Ilogf
Service() base.IRPCXService Service() base.IRPCXService
CrossServiceTag() string
Connect(a IAgent) Connect(a IAgent)
DisConnect(a IAgent) DisConnect(a IAgent)
GetMsgDistribute(mtype, stype string) (rule string, ok bool) GetMsgDistribute(msgid string) (rule string, ok bool)
} }
) )

View File

@ -44,6 +44,11 @@ func (this *Gateway) Service() base.IRPCXService {
return this.service return this.service
} }
//跨服集群标签
func (this *Gateway) CrossServiceTag() string {
return this.options.SpanServiceTag
}
// Init 模块初始化函数 // Init 模块初始化函数
func (this *Gateway) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *Gateway) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options) err = this.ModuleBase.Init(service, module, options)
@ -97,8 +102,8 @@ func (this *Gateway) DisConnect(a IAgent) {
} }
// GetMsgDistribute 读取消息分发规则 // GetMsgDistribute 读取消息分发规则
func (this *Gateway) GetMsgDistribute(mtype, stype string) (rule string, ok bool) { func (this *Gateway) GetMsgDistribute(msgid string) (rule string, ok bool) {
return this.configure.GetMsgDistribute(mtype, stype) return this.configure.GetMsgDistribute(msgid)
} }
//日志 //日志

View File

@ -76,12 +76,13 @@ type DBComment struct {
Heroid string `protobuf:"bytes,2,opt,name=heroid,proto3" json:"heroid"` //英雄id Heroid string `protobuf:"bytes,2,opt,name=heroid,proto3" json:"heroid"` //英雄id
Heroobjid string `protobuf:"bytes,3,opt,name=heroobjid,proto3" json:"heroobjid"` //目标英雄的实例id Heroobjid string `protobuf:"bytes,3,opt,name=heroobjid,proto3" json:"heroobjid"` //目标英雄的实例id
Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid"` //发送用户id Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid"` //发送用户id
Avatar int32 `protobuf:"varint,5,opt,name=avatar,proto3" json:"avatar"` //用户头像 Stage string `protobuf:"bytes,5,opt,name=stage,proto3" json:"stage"` //区服id
Uname string `protobuf:"bytes,6,opt,name=uname,proto3" json:"uname"` //用户名 Avatar int32 `protobuf:"varint,6,opt,name=avatar,proto3" json:"avatar"` //用户头像
State CommentState `protobuf:"varint,7,opt,name=state,proto3,enum=CommentState" json:"state"` //状态 Uname string `protobuf:"bytes,7,opt,name=uname,proto3" json:"uname"` //用户名
Ctime int64 `protobuf:"varint,8,opt,name=ctime,proto3" json:"ctime"` //发布时间 State CommentState `protobuf:"varint,8,opt,name=state,proto3,enum=CommentState" json:"state"` //状态
Content string `protobuf:"bytes,9,opt,name=content,proto3" json:"content"` //内容 Ctime int64 `protobuf:"varint,9,opt,name=ctime,proto3" json:"ctime"` //发布时间
Starlist int32 `protobuf:"varint,10,opt,name=starlist,proto3" json:"starlist"` //点赞数 Content string `protobuf:"bytes,10,opt,name=content,proto3" json:"content"` //内容
Starlist int32 `protobuf:"varint,11,opt,name=starlist,proto3" json:"starlist"` //点赞数
} }
func (x *DBComment) Reset() { func (x *DBComment) Reset() {
@ -144,6 +145,13 @@ func (x *DBComment) GetUid() string {
return "" return ""
} }
func (x *DBComment) GetStage() string {
if x != nil {
return x.Stage
}
return ""
}
func (x *DBComment) GetAvatar() int32 { func (x *DBComment) GetAvatar() int32 {
if x != nil { if x != nil {
return x.Avatar return x.Avatar
@ -190,27 +198,28 @@ var File_forum_forum_db_proto protoreflect.FileDescriptor
var file_forum_forum_db_proto_rawDesc = []byte{ var file_forum_forum_db_proto_rawDesc = []byte{
0x0a, 0x14, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x64, 0x62, 0x0a, 0x14, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x64, 0x62,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x82, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x43, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x43, 0x6f, 0x6d,
0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, 0x02, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09,
0x68, 0x65, 0x72, 0x6f, 0x6f, 0x62, 0x6a, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x68, 0x65, 0x72, 0x6f, 0x6f, 0x62, 0x6a, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x68, 0x65, 0x72, 0x6f, 0x6f, 0x62, 0x6a, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x6f, 0x62, 0x6a, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05,
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x73, 0x74, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61,
0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x06, 0x20, 0x01,
0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e,
0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65,
0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x0d, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05,
0x63, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09,
0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x1a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
0x05, 0x52, 0x08, 0x73, 0x74, 0x61, 0x72, 0x6c, 0x69, 0x73, 0x74, 0x2a, 0x28, 0x0a, 0x0c, 0x43, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x6c, 0x69, 0x73,
0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73, 0x74, 0x61, 0x72, 0x6c, 0x69, 0x73,
0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x66, 0x66, 0x6c, 0x74, 0x2a, 0x28, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74,
0x69, 0x6e, 0x65, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x10, 0x00, 0x12, 0x0b,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0a, 0x07, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -244,33 +244,165 @@ func (x *ForumReleaseCommentResp) GetComment() *DBComment {
return nil return nil
} }
//查看英雄信息请求
type ForumWatchHeroReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //用户id
Stag string `protobuf:"bytes,2,opt,name=stag,proto3" json:"stag"` //区服id
HerocId string `protobuf:"bytes,3,opt,name=herocId,proto3" json:"herocId"` //用户cid
HerooId string `protobuf:"bytes,4,opt,name=herooId,proto3" json:"herooId"` //英雄实例id
}
func (x *ForumWatchHeroReq) Reset() {
*x = ForumWatchHeroReq{}
if protoimpl.UnsafeEnabled {
mi := &file_forum_forum_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ForumWatchHeroReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ForumWatchHeroReq) ProtoMessage() {}
func (x *ForumWatchHeroReq) ProtoReflect() protoreflect.Message {
mi := &file_forum_forum_msg_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ForumWatchHeroReq.ProtoReflect.Descriptor instead.
func (*ForumWatchHeroReq) Descriptor() ([]byte, []int) {
return file_forum_forum_msg_proto_rawDescGZIP(), []int{4}
}
func (x *ForumWatchHeroReq) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *ForumWatchHeroReq) GetStag() string {
if x != nil {
return x.Stag
}
return ""
}
func (x *ForumWatchHeroReq) GetHerocId() string {
if x != nil {
return x.HerocId
}
return ""
}
func (x *ForumWatchHeroReq) GetHerooId() string {
if x != nil {
return x.HerooId
}
return ""
}
//查看英雄信息回应
type ForumWatchHeroResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hero *DBHero `protobuf:"bytes,1,opt,name=hero,proto3" json:"hero"`
}
func (x *ForumWatchHeroResp) Reset() {
*x = ForumWatchHeroResp{}
if protoimpl.UnsafeEnabled {
mi := &file_forum_forum_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ForumWatchHeroResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ForumWatchHeroResp) ProtoMessage() {}
func (x *ForumWatchHeroResp) ProtoReflect() protoreflect.Message {
mi := &file_forum_forum_msg_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ForumWatchHeroResp.ProtoReflect.Descriptor instead.
func (*ForumWatchHeroResp) Descriptor() ([]byte, []int) {
return file_forum_forum_msg_proto_rawDescGZIP(), []int{5}
}
func (x *ForumWatchHeroResp) GetHero() *DBHero {
if x != nil {
return x.Hero
}
return nil
}
var File_forum_forum_msg_proto protoreflect.FileDescriptor var File_forum_forum_msg_proto protoreflect.FileDescriptor
var file_forum_forum_msg_proto_rawDesc = []byte{ var file_forum_forum_msg_proto_rawDesc = []byte{
0x0a, 0x15, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x6d, 0x73, 0x0a, 0x15, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x6d, 0x73,
0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66,
0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x68,
0x0f, 0x46, 0x6f, 0x72, 0x75, 0x6d, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x65, 0x72, 0x6f, 0x2f, 0x68, 0x65, 0x72, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x6f, 0x22, 0x2b, 0x0a, 0x0f, 0x46, 0x6f, 0x72, 0x75, 0x6d, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73,
0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x22, 0x38, 0x0a, 0x10, 0x46, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x18,
0x72, 0x75, 0x6d, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x22, 0x38,
0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x10, 0x46, 0x6f, 0x72, 0x75, 0x6d, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
0x0a, 0x2e, 0x44, 0x42, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20,
0x6d, 0x65, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x16, 0x46, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52,
0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x16, 0x46, 0x6f, 0x72,
0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x01, 0x20,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75,
0x07, 0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d,
0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x6f, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x6f, 0x69, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x63, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68,
0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x65, 0x72, 0x6f, 0x6f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65,
0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x3f, 0x0a, 0x17, 0x46, 0x72, 0x6f, 0x6f, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22,
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x3f, 0x0a, 0x17, 0x46, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x6f,
0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
0x22, 0x6d, 0x0a, 0x11, 0x46, 0x6f, 0x72, 0x75, 0x6d, 0x57, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65,
0x72, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x67, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x61, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x68,
0x65, 0x72, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65,
0x72, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x6f, 0x49, 0x64,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x6f, 0x49, 0x64, 0x22,
0x31, 0x0a, 0x12, 0x46, 0x6f, 0x72, 0x75, 0x6d, 0x57, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65, 0x72,
0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65,
0x72, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
} }
var ( var (
@ -285,22 +417,26 @@ func file_forum_forum_msg_proto_rawDescGZIP() []byte {
return file_forum_forum_msg_proto_rawDescData return file_forum_forum_msg_proto_rawDescData
} }
var file_forum_forum_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_forum_forum_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_forum_forum_msg_proto_goTypes = []interface{}{ var file_forum_forum_msg_proto_goTypes = []interface{}{
(*ForumGetListReq)(nil), // 0: ForumGetListReq (*ForumGetListReq)(nil), // 0: ForumGetListReq
(*ForumGetListResp)(nil), // 1: ForumGetListResp (*ForumGetListResp)(nil), // 1: ForumGetListResp
(*ForumReleaseCommentReq)(nil), // 2: ForumReleaseCommentReq (*ForumReleaseCommentReq)(nil), // 2: ForumReleaseCommentReq
(*ForumReleaseCommentResp)(nil), // 3: ForumReleaseCommentResp (*ForumReleaseCommentResp)(nil), // 3: ForumReleaseCommentResp
(*DBComment)(nil), // 4: DBComment (*ForumWatchHeroReq)(nil), // 4: ForumWatchHeroReq
(*ForumWatchHeroResp)(nil), // 5: ForumWatchHeroResp
(*DBComment)(nil), // 6: DBComment
(*DBHero)(nil), // 7: DBHero
} }
var file_forum_forum_msg_proto_depIdxs = []int32{ var file_forum_forum_msg_proto_depIdxs = []int32{
4, // 0: ForumGetListResp.comment:type_name -> DBComment 6, // 0: ForumGetListResp.comment:type_name -> DBComment
4, // 1: ForumReleaseCommentResp.comment:type_name -> DBComment 6, // 1: ForumReleaseCommentResp.comment:type_name -> DBComment
2, // [2:2] is the sub-list for method output_type 7, // 2: ForumWatchHeroResp.hero:type_name -> DBHero
2, // [2:2] is the sub-list for method input_type 3, // [3:3] is the sub-list for method output_type
2, // [2:2] is the sub-list for extension type_name 3, // [3:3] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension extendee 3, // [3:3] is the sub-list for extension type_name
0, // [0:2] is the sub-list for field type_name 3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
} }
func init() { file_forum_forum_msg_proto_init() } func init() { file_forum_forum_msg_proto_init() }
@ -309,6 +445,7 @@ func file_forum_forum_msg_proto_init() {
return return
} }
file_forum_forum_db_proto_init() file_forum_forum_db_proto_init()
file_hero_hero_db_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_forum_forum_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_forum_forum_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ForumGetListReq); i { switch v := v.(*ForumGetListReq); i {
@ -358,6 +495,30 @@ func file_forum_forum_msg_proto_init() {
return nil return nil
} }
} }
file_forum_forum_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ForumWatchHeroReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_forum_forum_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ForumWatchHeroResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -365,7 +526,7 @@ func file_forum_forum_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_forum_forum_msg_proto_rawDesc, RawDescriptor: file_forum_forum_msg_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 4, NumMessages: 6,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"go_dreamfactory/modules/chat" "go_dreamfactory/modules/chat"
"go_dreamfactory/modules/equipment" "go_dreamfactory/modules/equipment"
"go_dreamfactory/modules/forum"
"go_dreamfactory/modules/friend" "go_dreamfactory/modules/friend"
"go_dreamfactory/modules/gm" "go_dreamfactory/modules/gm"
"go_dreamfactory/modules/hero" "go_dreamfactory/modules/hero"
@ -55,6 +56,7 @@ func main() {
notify.NewModule(), notify.NewModule(),
chat.NewModule(), chat.NewModule(),
gm.NewModule(), gm.NewModule(),
forum.NewModule(),
) )
} }

View File

@ -21,7 +21,7 @@ func NewGame_msgdistrib(_buf []map[string]interface{}) (*Game_msgdistrib, error)
return nil, err2 return nil, err2
} else { } else {
_dataList = append(_dataList, _v) _dataList = append(_dataList, _v)
dataMap[_v.Mtype] = _v dataMap[_v.Msgid] = _v
} }
} }
return &Game_msgdistrib{_dataList:_dataList, _dataMap:dataMap}, nil return &Game_msgdistrib{_dataList:_dataList, _dataMap:dataMap}, nil

View File

@ -11,9 +11,9 @@ package cfg
import "errors" import "errors"
type Game_msgdistribData struct { type Game_msgdistribData struct {
Mtype string Msgid string
Stype string
Routrules string Routrules string
Describe string
} }
func (Game_msgdistribData) GetTypeId() int { func (Game_msgdistribData) GetTypeId() int {
@ -22,8 +22,8 @@ func (Game_msgdistribData) GetTypeId() int {
func NewGame_msgdistribData(_buf map[string]interface{}) (_v *Game_msgdistribData, err error) { func NewGame_msgdistribData(_buf map[string]interface{}) (_v *Game_msgdistribData, err error) {
_v = &Game_msgdistribData{} _v = &Game_msgdistribData{}
{ var _ok_ bool; if _v.Mtype, _ok_ = _buf["mtype"].(string); !_ok_ { err = errors.New("mtype error"); return } } { var _ok_ bool; if _v.Msgid, _ok_ = _buf["msgid"].(string); !_ok_ { err = errors.New("msgid error"); return } }
{ var _ok_ bool; if _v.Stype, _ok_ = _buf["stype"].(string); !_ok_ { err = errors.New("stype error"); return } }
{ var _ok_ bool; if _v.Routrules, _ok_ = _buf["routrules"].(string); !_ok_ { err = errors.New("routrules error"); return } } { var _ok_ bool; if _v.Routrules, _ok_ = _buf["routrules"].(string); !_ok_ { err = errors.New("routrules error"); return } }
{ var _ok_ bool; if _v.Describe, _ok_ = _buf["describe"].(string); !_ok_ { err = errors.New("describe error"); return } }
return return
} }

View File

@ -240,8 +240,8 @@ func (this *DBModel) AddQueues(key string, uplimit int64, data interface{}) (out
} }
pipe.RPushForStringSlice(key, keys...) pipe.RPushForStringSlice(key, keys...)
lcmd := pipe.Llen(key) lcmd := pipe.Llen(key)
pipe.Exec()
if lcmd.Err() == nil { if _, err = pipe.Exec(); err == nil {
if lcmd.Val() > uplimit*3 { //操作3倍上限移除多余数据 if lcmd.Val() > uplimit*3 { //操作3倍上限移除多余数据
off := uplimit - lcmd.Val() off := uplimit - lcmd.Val()
if outkey, err = this.Redis.LRangeToStringSlice(key, 0, int(off-1)).Result(); err != nil { if outkey, err = this.Redis.LRangeToStringSlice(key, 0, int(off-1)).Result(); err != nil {
@ -457,7 +457,7 @@ func (this *DBModel) GetQueues(key string, count int, data interface{}) (err err
sliceelemType = sliceelemType.(*reflect2.UnsafePtrType).Elem() sliceelemType = sliceelemType.(*reflect2.UnsafePtrType).Elem()
pipe := this.Redis.RedisPipe(context.TODO()) pipe := this.Redis.RedisPipe(context.TODO())
if err = this.Redis.LRange(key, -1*count, -1, keys); err == nil { if keys, err = this.Redis.LRangeToStringSlice(key, -1*count, -1).Result(); err == nil {
result = make([]*redis.StringStringMapCmd, 0) result = make([]*redis.StringStringMapCmd, 0)
for _, v := range keys { for _, v := range keys {
cmd := pipe.HGetAllToMapString(v) cmd := pipe.HGetAllToMapString(v)