From fb9f052317433ca2158be7e5949e2313d9104554 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 13:58:22 +0000 Subject: [PATCH 01/10] mod: bump github.com/gin-contrib/cors from 1.7.2 to 1.7.6 Bumps [github.com/gin-contrib/cors](https://github.com/gin-contrib/cors) from 1.7.2 to 1.7.6. - [Release notes](https://github.com/gin-contrib/cors/releases) - [Changelog](https://github.com/gin-contrib/cors/blob/master/.goreleaser.yaml) - [Commits](https://github.com/gin-contrib/cors/compare/v1.7.2...v1.7.6) --- updated-dependencies: - dependency-name: github.com/gin-contrib/cors dependency-version: 1.7.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 16 ++++++++-------- go.sum | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index 4ce9d713..6fe595ce 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/getsentry/sentry-go v0.33.0 github.com/getsentry/sentry-go/gin v0.33.0 github.com/getsentry/sentry-go/logrus v0.31.1 - github.com/gin-contrib/cors v1.7.2 + github.com/gin-contrib/cors v1.7.6 github.com/gin-gonic/gin v1.10.1 github.com/go-resty/resty/v2 v2.16.5 github.com/goccy/go-json v0.10.5 @@ -82,14 +82,14 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.3 // indirect - github.com/gin-contrib/sse v0.1.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.9 // indirect + github.com/gin-contrib/sse v1.1.0 // indirect github.com/go-ini/ini v1.67.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-playground/validator/v10 v10.26.0 // indirect github.com/go-sql-driver/mysql v1.8.1 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/go-viper/mapstructure/v2 v2.2.1 // indirect @@ -114,7 +114,7 @@ require ( github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/klauspost/compress v1.17.11 // indirect - github.com/klauspost/cpuid/v2 v2.2.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.10 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect @@ -130,7 +130,7 @@ require ( github.com/mozillazg/go-httpheader v0.2.1 // indirect github.com/mschoch/smat v0.2.0 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect - github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.48.0 // indirect @@ -147,7 +147,7 @@ require ( github.com/spf13/pflag v1.0.6 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.12 // indirect + github.com/ugorji/go/codec v1.3.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.52.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect @@ -159,7 +159,7 @@ require ( go.opentelemetry.io/proto/otlp v1.6.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/arch v0.8.0 // indirect + golang.org/x/arch v0.18.0 // indirect golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect golang.org/x/image v0.0.0-20210216034530-4410531fe030 // indirect golang.org/x/mod v0.27.0 // indirect diff --git a/go.sum b/go.sum index 0c9d5b40..9e3a661a 100644 --- a/go.sum +++ b/go.sum @@ -75,18 +75,18 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= -github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= +github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= github.com/getsentry/sentry-go v0.33.0 h1:YWyDii0KGVov3xOaamOnF0mjOrqSjBqwv48UEzn7QFg= github.com/getsentry/sentry-go v0.33.0/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE= github.com/getsentry/sentry-go/gin v0.33.0 h1:8oH2ydD/EeKlDMoENhCtq3rJ7EcQtjfdzrMM1Ku2J3I= github.com/getsentry/sentry-go/gin v0.33.0/go.mod h1:uwqds9mMjBCn/+WcgtX0z+mBq487macTzDxNljM+/g8= github.com/getsentry/sentry-go/logrus v0.31.1 h1:561777lxQWZl4qpte67Wp4zQB7V1oNVriZNN5hiOooI= github.com/getsentry/sentry-go/logrus v0.31.1/go.mod h1:UHhxir22yymjeM8dBN0LM+7Z98+cYFEev8V3AV1+UYU= -github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw= -github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY= +github.com/gin-contrib/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk= +github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= +github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= @@ -104,8 +104,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= -github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= +github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM= github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= @@ -187,8 +187,8 @@ github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IX github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= -github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= +github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= +github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -244,8 +244,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -320,8 +320,8 @@ github.com/tencentyun/cos-go-sdk-v5 v0.7.65 h1:+WBbfwThfZSbxpf1Dw6fyMwyzVtWBBExq github.com/tencentyun/cos-go-sdk-v5 v0.7.65/go.mod h1:8+hG+mQMuRP/OIS9d83syAvXvrMj9HhkND6Q1fLghw0= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= -github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= +github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.37.1-0.20220607072126-8a320890c08d/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= @@ -376,8 +376,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= -golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= -golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc= +golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= From 92b18af3e0babb7df5037ebc939848d7d0205cb0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:14:40 +0000 Subject: [PATCH 02/10] mod: bump github.com/grafana/pyroscope-go from 1.2.2 to 1.2.4 Bumps [github.com/grafana/pyroscope-go](https://github.com/grafana/pyroscope-go) from 1.2.2 to 1.2.4. - [Release notes](https://github.com/grafana/pyroscope-go/releases) - [Commits](https://github.com/grafana/pyroscope-go/compare/v1.2.2...v1.2.4) --- updated-dependencies: - dependency-name: github.com/grafana/pyroscope-go dependency-version: 1.2.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4ce9d713..f55a0b13 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/gofrs/uuid/v5 v5.3.2 github.com/golang-jwt/jwt/v5 v5.2.2 github.com/golang-migrate/migrate/v4 v4.18.3 - github.com/grafana/pyroscope-go v1.2.2 + github.com/grafana/pyroscope-go v1.2.4 github.com/huaweicloud/huaweicloud-sdk-go-obs v3.25.4+incompatible github.com/json-iterator/go v1.1.12 github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 diff --git a/go.sum b/go.sum index 0c9d5b40..6c391308 100644 --- a/go.sum +++ b/go.sum @@ -144,8 +144,8 @@ github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grafana/pyroscope-go v1.2.2 h1:uvKCyZMD724RkaCEMrSTC38Yn7AnFe8S2wiAIYdDPCE= -github.com/grafana/pyroscope-go v1.2.2/go.mod h1:zzT9QXQAp2Iz2ZdS216UiV8y9uXJYQiGE1q8v1FyhqU= +github.com/grafana/pyroscope-go v1.2.4 h1:B22GMXz+O0nWLatxLuaP7o7L9dvP0clLvIpmeEQQM0Q= +github.com/grafana/pyroscope-go v1.2.4/go.mod h1:zzT9QXQAp2Iz2ZdS216UiV8y9uXJYQiGE1q8v1FyhqU= github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= From 144d83e9c4cc96677a5d0034999e41b81233c09b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:46:25 +0000 Subject: [PATCH 03/10] mod: bump go.opentelemetry.io/otel from 1.36.0 to 1.37.0 Bumps [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) from 1.36.0 to 1.37.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.36.0...v1.37.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel dependency-version: 1.37.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 4ce9d713..e5adb092 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/yinheli/mahonia v0.0.0-20131226213531-0eef680515cc go.opentelemetry.io/contrib/bridges/otellogrus v0.11.0 go.opentelemetry.io/contrib/instrumentation/runtime v0.61.0 - go.opentelemetry.io/otel v1.36.0 + go.opentelemetry.io/otel v1.37.0 go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.36.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0 @@ -153,9 +153,9 @@ require ( go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 // indirect go.opentelemetry.io/otel/log/logtest v0.0.0-20250602073710-889a4862b40f // indirect - go.opentelemetry.io/otel/metric v1.36.0 // indirect + go.opentelemetry.io/otel/metric v1.37.0 // indirect go.opentelemetry.io/otel/sdk/log/logtest v0.0.0-20250602073710-889a4862b40f // indirect - go.opentelemetry.io/otel/trace v1.36.0 // indirect + go.opentelemetry.io/otel/trace v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.6.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect diff --git a/go.sum b/go.sum index 0c9d5b40..eec15806 100644 --- a/go.sum +++ b/go.sum @@ -340,8 +340,8 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+n go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= go.opentelemetry.io/contrib/instrumentation/runtime v0.61.0 h1:oIZsTHd0YcrvvUCN2AaQqyOcd685NQ+rFmrajveCIhA= go.opentelemetry.io/contrib/instrumentation/runtime v0.61.0/go.mod h1:X4KSPIvxnY/G5c9UOGXtFoL91t1gmlHpDQzeK5Zc/Bw= -go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg= -go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E= +go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= +go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 h1:5dTKu4I5Dn4P2hxyW3l3jTaZx9ACgg0ECos1eAVrheY= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0/go.mod h1:P5HcUI8obLrCCmM3sbVBohZFH34iszk/+CPWuakZWL8= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.36.0 h1:zwdo1gS2eH26Rg+CoqVQpEK1h8gvt5qyU5Kk5Bixvow= @@ -354,8 +354,8 @@ go.opentelemetry.io/otel/log v0.12.2 h1:yob9JVHn2ZY24byZeaXpTVoPS6l+UrrxmxmPKohX go.opentelemetry.io/otel/log v0.12.2/go.mod h1:ShIItIxSYxufUMt+1H5a2wbckGli3/iCfuEbVZi/98E= go.opentelemetry.io/otel/log/logtest v0.0.0-20250602073710-889a4862b40f h1:9Pi4jxdmTyGsCi5eOvNHKLw3GiUyRdG9EA7EIj6WMYk= go.opentelemetry.io/otel/log/logtest v0.0.0-20250602073710-889a4862b40f/go.mod h1:DqYX8Lp2A/RnuxXuoVtsRqYvx6Io0PtSxF5v9MnHJyU= -go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE= -go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs= +go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= +go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs= go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY= go.opentelemetry.io/otel/sdk/log v0.12.2 h1:yNoETvTByVKi7wHvYS6HMcZrN5hFLD7I++1xIZ/k6W0= @@ -364,8 +364,8 @@ go.opentelemetry.io/otel/sdk/log/logtest v0.0.0-20250602073710-889a4862b40f h1:D go.opentelemetry.io/otel/sdk/log/logtest v0.0.0-20250602073710-889a4862b40f/go.mod h1:FaVwnf8BvLN80gFy4T+wMovR87QQonsHsGFFn0R+jw8= go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis= go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4= -go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w= -go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA= +go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= +go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= go.opentelemetry.io/proto/otlp v1.6.0 h1:jQjP+AQyTf+Fe7OKj/MfkDrmK4MNVtw2NpXsf9fefDI= go.opentelemetry.io/proto/otlp v1.6.0/go.mod h1:cicgGehlFuNdgZkcALOCh3VE6K/u2tAjzlRhDwmVpZc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= From d358b9d1d2d0bba65e62d5862ea8e22f5d025358 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:52:59 +0000 Subject: [PATCH 04/10] mod: bump github.com/redis/rueidis from 1.0.53 to 1.0.64 Bumps [github.com/redis/rueidis](https://github.com/redis/rueidis) from 1.0.53 to 1.0.64. - [Release notes](https://github.com/redis/rueidis/releases) - [Commits](https://github.com/redis/rueidis/compare/v1.0.53...v1.0.64) --- updated-dependencies: - dependency-name: github.com/redis/rueidis dependency-version: 1.0.64 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4ce9d713..f96cb749 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/onsi/ginkgo/v2 v2.23.4 github.com/onsi/gomega v1.37.0 github.com/prometheus/client_golang v1.19.1 - github.com/redis/rueidis v1.0.53 + github.com/redis/rueidis v1.0.64 github.com/robfig/cron/v3 v3.0.1 github.com/sirupsen/logrus v1.9.3 github.com/smartwalle/alipay/v3 v3.2.20 diff --git a/go.sum b/go.sum index 0c9d5b40..351afa82 100644 --- a/go.sum +++ b/go.sum @@ -263,8 +263,8 @@ github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSz github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/redis/rueidis v1.0.53 h1:r3eT4bp7Nyt+kSldT2po/EO9YeawHfZDY9TJBrHRLD4= -github.com/redis/rueidis v1.0.53/go.mod h1:by+34b0cFXndxtYmPAHpoTHO5NkosDlBvhexoTURIxM= +github.com/redis/rueidis v1.0.64 h1:XqgbueDuNV3qFdVdQwAHJl1uNt90zUuAJuzqjH4cw6Y= +github.com/redis/rueidis v1.0.64/go.mod h1:Lkhr2QTgcoYBhxARU7kJRO8SyVlgUuEkcJO1Y8MCluA= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= From 474fa79d932ef7d442950dcd0296f1ccdd287b8f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 20:34:26 +0000 Subject: [PATCH 05/10] mod: bump github.com/prometheus/client_golang from 1.19.1 to 1.23.0 Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.19.1 to 1.23.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.19.1...v1.23.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-version: 1.23.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 11 ++++++----- go.sum | 24 ++++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 72da4b71..509c42b9 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/minio/minio-go/v7 v7.0.84 github.com/onsi/ginkgo/v2 v2.23.4 github.com/onsi/gomega v1.37.0 - github.com/prometheus/client_golang v1.19.1 + github.com/prometheus/client_golang v1.23.0 github.com/redis/rueidis v1.0.64 github.com/robfig/cron/v3 v3.0.1 github.com/sirupsen/logrus v1.9.3 @@ -113,7 +113,7 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/klauspost/compress v1.17.11 // indirect + github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -129,12 +129,13 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mozillazg/go-httpheader v0.2.1 // indirect github.com/mschoch/smat v0.2.0 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.65.0 // indirect + github.com/prometheus/procfs v0.16.1 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.13.1 // indirect github.com/rs/xid v1.6.0 // indirect diff --git a/go.sum b/go.sum index 238b586c..d2df8e83 100644 --- a/go.sum +++ b/go.sum @@ -183,8 +183,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= -github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= @@ -194,6 +194,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= @@ -234,6 +236,8 @@ github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSr github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60= github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus= @@ -255,14 +259,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= -github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc= +github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE= +github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/redis/rueidis v1.0.64 h1:XqgbueDuNV3qFdVdQwAHJl1uNt90zUuAJuzqjH4cw6Y= github.com/redis/rueidis v1.0.64/go.mod h1:Lkhr2QTgcoYBhxARU7kJRO8SyVlgUuEkcJO1Y8MCluA= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= From 334f2582f6a0bf02514b965046c5e3261fbe8586 Mon Sep 17 00:00:00 2001 From: alimy Date: Tue, 2 Dec 2025 16:18:05 +0800 Subject: [PATCH 06/10] optimize use constant time comparision for use password valid check --- internal/servants/web/utils.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/servants/web/utils.go b/internal/servants/web/utils.go index 24eaabc3..48361a0b 100644 --- a/internal/servants/web/utils.go +++ b/internal/servants/web/utils.go @@ -5,6 +5,7 @@ package web import ( + "crypto/subtle" "image" "math/rand" "strings" @@ -88,15 +89,19 @@ func checkPassword(password string) error { } // ValidPassword 检查密码是否一致 -func validPassword(dbPassword, password, salt string) bool { - return strings.Compare(dbPassword, utils.EncodeMD5(utils.EncodeMD5(password)+salt)) == 0 +func validPassword(secret, password, salt string) bool { + expected := utils.EncodeMD5(utils.EncodeMD5(password) + salt) + + // Check that the secret matches the expected value. + // Use constant time comparison to avoid timing attacks. + return subtle.ConstantTimeCompare([]byte(secret), []byte(expected)) == 1 } // encryptPasswordAndSalt 密码加密&生成salt func encryptPasswordAndSalt(password string) (string, string) { salt := uuid.Must(uuid.NewV4()).String()[:8] - password = utils.EncodeMD5(utils.EncodeMD5(password) + salt) - return password, salt + secret := utils.EncodeMD5(utils.EncodeMD5(password) + salt) + return secret, salt } // deleteOssObjects 删除推文的媒体内容, 宽松处理错误(就是不处理), 后续完善 From 50a772d4b083a8b51909e734964e0850960c9036 Mon Sep 17 00:00:00 2001 From: ROC Date: Tue, 30 Dec 2025 15:33:11 +0800 Subject: [PATCH 07/10] update readme --- INSTALL.md | 4 ++-- README.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 840218d9..ab736be1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -570,5 +570,5 @@ x/sqlx [license-shield]: https://img.shields.io/github/license/rocboss/paopao-ce.svg?style=flat [license-url]: https://github.com/rocboss/paopao-ce/blob/master/LICENSE.txt [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat&logo=linkedin&colorB=555 -[product-light-screenshot]: https://cdn.rocs.me/static/paopao-light.jpeg -[product-dark-screenshot]: https://cdn.rocs.me/static/paopao-dark.jpeg +[product-light-screenshot]: https://assets.paopao.info/static/paopao-light.jpeg +[product-dark-screenshot]: https://assets.paopao.info/static/paopao-dark.jpeg diff --git a/README.md b/README.md index 975a9a80..a0ac0a92 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@
- Logo + Logo

PaoPao

@@ -262,5 +262,5 @@ Distributed under the MIT License. See `LICENSE` for more information. [license-shield]: https://img.shields.io/github/license/rocboss/paopao-ce.svg?style=flat [license-url]: https://github.com/rocboss/paopao-ce/blob/master/LICENSE.txt [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat&logo=linkedin&colorB=555 -[product-light-screenshot]: https://cdn.rocs.me/static/paopao-light.jpeg -[product-dark-screenshot]: https://cdn.rocs.me/static/paopao-dark.jpeg +[product-light-screenshot]: https://assets.paopao.info/static/paopao-light.jpeg +[product-dark-screenshot]: https://assets.paopao.info/static/paopao-dark.jpeg From 24f35a18d5cd5af84111e6f757725e20af1e7624 Mon Sep 17 00:00:00 2001 From: alimy Date: Fri, 6 Feb 2026 11:25:15 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=8F=90=E5=8F=96updateCommentThumbsUpCo?= =?UTF-8?q?unt()=E5=88=B0=E5=8C=85=E5=86=85=E8=BE=85=E7=BB=84=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=BB=A5=E8=BF=9B=E8=A1=8C=E4=BA=8B=E5=8A=A1=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/jinzhu/comments.go | 17 +---------------- internal/dao/jinzhu/utils.go | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/internal/dao/jinzhu/comments.go b/internal/dao/jinzhu/comments.go index c30fda69..262c3007 100644 --- a/internal/dao/jinzhu/comments.go +++ b/internal/dao/jinzhu/comments.go @@ -423,20 +423,5 @@ func (s *commentManageSrv) ThumbsDownReply(userId int64, tweetId, commentId, rep } func (s *commentManageSrv) updateCommentThumbsUpCount(obj any, id int64, thumbsUpCount, thumbsDownCount int32) error { - updateColumns := make(map[string]any, 2) - if thumbsUpCount == 1 { - updateColumns["thumbs_up_count"] = gorm.Expr("thumbs_up_count + 1") - } else if thumbsUpCount == -1 { - updateColumns["thumbs_up_count"] = gorm.Expr("thumbs_up_count - 1") - } - if thumbsDownCount == 1 { - updateColumns["thumbs_down_count"] = gorm.Expr("thumbs_down_count + 1") - } else if thumbsDownCount == -1 { - updateColumns["thumbs_down_count"] = gorm.Expr("thumbs_down_count - 1") - } - if len(updateColumns) > 0 { - updateColumns["modified_on"] = time.Now().Unix() - return s.db.Model(obj).Where("id=?", id).UpdateColumns(updateColumns).Error - } - return nil + return updateCommentThumbsUpCount(s.db, obj, id, thumbsUpCount, thumbsDownCount) } diff --git a/internal/dao/jinzhu/utils.go b/internal/dao/jinzhu/utils.go index 9d97b4b8..6d7ef850 100644 --- a/internal/dao/jinzhu/utils.go +++ b/internal/dao/jinzhu/utils.go @@ -5,6 +5,8 @@ package jinzhu import ( + "time" + "github.com/rocboss/paopao-ce/internal/core/cs" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" @@ -78,3 +80,22 @@ func getUsersByIDs(db *gorm.DB, ids []int64) ([]*dbr.User, error) { "id IN ?": ids, }, 0, 0) } + +func updateCommentThumbsUpCount(db *gorm.DB, obj any, id int64, thumbsUpCount, thumbsDownCount int32) error { + updateColumns := make(map[string]any, 2) + if thumbsUpCount == 1 { + updateColumns["thumbs_up_count"] = gorm.Expr("thumbs_up_count + 1") + } else if thumbsUpCount == -1 { + updateColumns["thumbs_up_count"] = gorm.Expr("thumbs_up_count - 1") + } + if thumbsDownCount == 1 { + updateColumns["thumbs_down_count"] = gorm.Expr("thumbs_down_count + 1") + } else if thumbsDownCount == -1 { + updateColumns["thumbs_down_count"] = gorm.Expr("thumbs_down_count - 1") + } + if len(updateColumns) > 0 { + updateColumns["modified_on"] = time.Now().Unix() + return db.Model(obj).Where("id=?", id).UpdateColumns(updateColumns).Error + } + return nil +} From 4fb7beb25d32c01cae0fcdaba3001bc235dd8544 Mon Sep 17 00:00:00 2001 From: alimy Date: Fri, 6 Feb 2026 11:52:00 +0800 Subject: [PATCH 09/10] just use gofumpt instead to fmt source code --- Makefile | 17 ++++++++++------- auto/rpc/core/v1/auth.pb.go | 2 +- auto/rpc/core/v1/auth_grpc.pb.go | 10 +++++----- auto/rpc/greet/v1/greet.pb.go | 2 +- auto/rpc/greet/v1/greet_grpc.pb.go | 6 +++--- cmd/root.go | 12 +++++------- internal/dao/cache/bigcache.go | 4 +--- internal/dao/cache/cache.go | 4 +--- internal/dao/jinzhu/authority.go | 4 +--- internal/dao/jinzhu/contacts.go | 4 +--- internal/dao/jinzhu/dbr/model.go | 6 ++++-- internal/dao/jinzhu/dbr/post_content.go | 16 +++++++--------- internal/dao/jinzhu/following.go | 4 +--- internal/dao/jinzhu/messages.go | 4 +--- internal/dao/jinzhu/security.go | 4 +--- internal/dao/jinzhu/tweets.go | 3 +-- internal/dao/jinzhu/user.go | 4 +--- internal/dao/jinzhu/wallet.go | 5 ++--- internal/dao/search/bridge.go | 4 +--- internal/dao/security/attachment_check.go | 4 +--- internal/dao/security/phone_verify_juhe.go | 4 +--- internal/dao/storage/cos.go | 1 - internal/dao/storage/localoss.go | 6 +++--- internal/model/enum/builtin_enum.go | 16 ++++++++++++---- internal/model/web/core.go | 12 ++++++++---- internal/model/web/web.go | 4 +--- internal/servants/admin/user.go | 4 +--- internal/servants/base/base.go | 1 - internal/servants/bot/user.go | 4 +--- internal/servants/localoss/user.go | 4 +--- internal/servants/mobile/greet.go | 4 +--- internal/servants/space/user.go | 4 +--- internal/servants/web/admin.go | 4 +--- internal/servants/web/core.go | 5 +---- internal/servants/web/events.go | 2 +- internal/servants/web/followship.go | 4 +--- internal/servants/web/friendship.go | 4 +--- internal/servants/web/loose.go | 4 +--- internal/servants/web/priv.go | 3 ++- internal/servants/web/pub.go | 4 +--- internal/servants/web/relax.go | 4 +--- internal/servants/web/site.go | 4 +--- internal/servants/web/trends.go | 4 +--- internal/service/admin.go | 4 +--- internal/service/bot.go | 4 +--- internal/service/docs.go | 4 +--- internal/service/frontend_web.go | 4 +--- internal/service/grpc_server.go | 4 +--- internal/service/http_server.go | 4 +--- internal/service/localoss.go | 4 +--- internal/service/metrics.go | 4 +--- internal/service/mobile.go | 4 +--- internal/service/pprof.go | 4 +--- internal/service/space.go | 4 +--- internal/service/web.go | 4 +--- pkg/debug/errors.go | 4 +--- pkg/http/client.go | 4 +--- pkg/naming/snake_ns.go | 3 ++- pkg/obx/obx.go | 4 +--- pkg/types/json_box.go | 1 - pkg/utils/banner.go | 1 - pkg/utils/str.go | 6 ++++-- pkg/version/build.go | 4 +--- pkg/xerror/xerror.go | 6 ++---- pkg/zinc/zinc.go | 1 - 65 files changed, 115 insertions(+), 192 deletions(-) diff --git a/Makefile b/Makefile index 1b103821..9e05128c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all build build-web run test clean fmt pre-commit help +.PHONY: all build build-web run test clean fmt vet pre-commit help PROJECT = paopao-ce TARGET = paopao @@ -22,6 +22,7 @@ BUILD_VERSION := $(shell git describe --tags --always) BUILD_DATE := $(shell date +'%Y-%m-%d %H:%M:%S %Z') SHA_SHORT := $(shell git rev-parse --short HEAD) +GOFMT ?= gofumpt -l -w MOD_NAME = github.com/rocboss/paopao-ce LDFLAGS = -X "${MOD_NAME}/pkg/version.version=${BUILD_VERSION}" \ -X "${MOD_NAME}/pkg/version.buildDate=${BUILD_DATE}" \ @@ -84,18 +85,18 @@ generate: gen-mir gen-rpc gen-enum .PHONY: gen-mir gen-mir: @go generate mirc/gen.go - @go fmt ./auto/api/... + $(GOFMT) ./auto/api .PHONY: gen-rpc gen-rpc: @rm -rf auto/rpc - @buf generate proto - @go fmt ./auto/rpc/... + buf generate proto + $(GOFMT) ./auto/rpc .PHONY: gen-enum gen-enum: @go generate ./internal/model/enum/... - go fmt ./internal/model/enum/... + $(GOFMT) ./internal/model/enum .PHONY: proto-mod proto-mod: @@ -111,8 +112,9 @@ clean: fmt: @echo Formatting... - @go fmt ./internal/... - @go fmt ./pkg/... + $(GOFMT) . + +vet: @go vet -composites=false ./internal/... @go vet -composites=false ./pkg/... @@ -125,6 +127,7 @@ pre-commit: fmt .PHONY: install-tools install-tools: install-protobuf-plugins @go install github.com/abice/go-enum@latest + @go install mvdan.cc/gofumpt@latest .PHONY: install-protobuf-plugins install-protobuf-plugins: diff --git a/auto/rpc/core/v1/auth.pb.go b/auto/rpc/core/v1/auth.pb.go index b5779cc4..1adae5d3 100644 --- a/auto/rpc/core/v1/auth.pb.go +++ b/auto/rpc/core/v1/auth.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.6 +// protoc-gen-go v1.36.11 // protoc (unknown) // source: core/v1/auth.proto diff --git a/auto/rpc/core/v1/auth_grpc.pb.go b/auto/rpc/core/v1/auth_grpc.pb.go index ea3b07bf..0d58a38a 100644 --- a/auto/rpc/core/v1/auth_grpc.pb.go +++ b/auto/rpc/core/v1/auth_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc (unknown) // source: core/v1/auth.proto @@ -89,13 +89,13 @@ type AuthenticateServiceServer interface { type UnimplementedAuthenticateServiceServer struct{} func (UnimplementedAuthenticateServiceServer) PreLogin(context.Context, *User) (*ActionReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PreLogin not implemented") + return nil, status.Error(codes.Unimplemented, "method PreLogin not implemented") } func (UnimplementedAuthenticateServiceServer) Login(context.Context, *User) (*LoginReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") + return nil, status.Error(codes.Unimplemented, "method Login not implemented") } func (UnimplementedAuthenticateServiceServer) Logout(context.Context, *User) (*ActionReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") + return nil, status.Error(codes.Unimplemented, "method Logout not implemented") } func (UnimplementedAuthenticateServiceServer) mustEmbedUnimplementedAuthenticateServiceServer() {} func (UnimplementedAuthenticateServiceServer) testEmbeddedByValue() {} @@ -108,7 +108,7 @@ type UnsafeAuthenticateServiceServer interface { } func RegisterAuthenticateServiceServer(s grpc.ServiceRegistrar, srv AuthenticateServiceServer) { - // If the following call pancis, it indicates UnimplementedAuthenticateServiceServer was + // If the following call panics, it indicates UnimplementedAuthenticateServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/auto/rpc/greet/v1/greet.pb.go b/auto/rpc/greet/v1/greet.pb.go index ed3d3cce..af7a938d 100644 --- a/auto/rpc/greet/v1/greet.pb.go +++ b/auto/rpc/greet/v1/greet.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.6 +// protoc-gen-go v1.36.11 // protoc (unknown) // source: greet/v1/greet.proto diff --git a/auto/rpc/greet/v1/greet_grpc.pb.go b/auto/rpc/greet/v1/greet_grpc.pb.go index be277a6b..29786031 100644 --- a/auto/rpc/greet/v1/greet_grpc.pb.go +++ b/auto/rpc/greet/v1/greet_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc (unknown) // source: greet/v1/greet.proto @@ -63,7 +63,7 @@ type GreetServiceServer interface { type UnimplementedGreetServiceServer struct{} func (UnimplementedGreetServiceServer) Greet(context.Context, *GreetRequest) (*GreetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented") + return nil, status.Error(codes.Unimplemented, "method Greet not implemented") } func (UnimplementedGreetServiceServer) mustEmbedUnimplementedGreetServiceServer() {} func (UnimplementedGreetServiceServer) testEmbeddedByValue() {} @@ -76,7 +76,7 @@ type UnsafeGreetServiceServer interface { } func RegisterGreetServiceServer(s grpc.ServiceRegistrar, srv GreetServiceServer) { - // If the following call pancis, it indicates UnimplementedGreetServiceServer was + // If the following call panics, it indicates UnimplementedGreetServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/cmd/root.go b/cmd/root.go index e0e59974..cc1af061 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -8,13 +8,11 @@ import ( "github.com/spf13/cobra" ) -var ( - rootCmd = &cobra.Command{ - Use: "paopao", - Short: `an artistic "twitter like" community`, - Long: `an artistic "twitter like" community`, - } -) +var rootCmd = &cobra.Command{ + Use: "paopao", + Short: `an artistic "twitter like" community`, + Long: `an artistic "twitter like" community`, +} // Setup set root command name,short-describe, long-describe // return &cobra.Command to custom other options diff --git a/internal/dao/cache/bigcache.go b/internal/dao/cache/bigcache.go index 259ab660..1fb5130f 100644 --- a/internal/dao/cache/bigcache.go +++ b/internal/dao/cache/bigcache.go @@ -9,9 +9,7 @@ import ( "github.com/allegro/bigcache/v3" ) -var ( - _ tweetsCache = (*bigCacheTweetsCache)(nil) -) +var _ tweetsCache = (*bigCacheTweetsCache)(nil) type bigCacheTweetsCache struct { bc *bigcache.BigCache diff --git a/internal/dao/cache/cache.go b/internal/dao/cache/cache.go index 2cee6684..29dbba57 100644 --- a/internal/dao/cache/cache.go +++ b/internal/dao/cache/cache.go @@ -15,9 +15,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _onceInit sync.Once -) +var _onceInit sync.Once func NewRedisCache() core.RedisCache { return &redisCache{ diff --git a/internal/dao/jinzhu/authority.go b/internal/dao/jinzhu/authority.go index 9921f214..caef4438 100644 --- a/internal/dao/jinzhu/authority.go +++ b/internal/dao/jinzhu/authority.go @@ -12,9 +12,7 @@ import ( "gorm.io/gorm" ) -var ( - _ core.AuthorizationManageService = (*authorizationManageSrv)(nil) -) +var _ core.AuthorizationManageService = (*authorizationManageSrv)(nil) type authorizationManageSrv struct { db *gorm.DB diff --git a/internal/dao/jinzhu/contacts.go b/internal/dao/jinzhu/contacts.go index 6d415be3..349c605d 100644 --- a/internal/dao/jinzhu/contacts.go +++ b/internal/dao/jinzhu/contacts.go @@ -14,9 +14,7 @@ import ( "gorm.io/gorm" ) -var ( - _ core.ContactManageService = (*contactManageSrv)(nil) -) +var _ core.ContactManageService = (*contactManageSrv)(nil) type contactManageSrv struct { db *gorm.DB diff --git a/internal/dao/jinzhu/dbr/model.go b/internal/dao/jinzhu/dbr/model.go index 75e66561..c8339be6 100644 --- a/internal/dao/jinzhu/dbr/model.go +++ b/internal/dao/jinzhu/dbr/model.go @@ -20,8 +20,10 @@ type Model struct { IsDel soft_delete.DeletedAt `gorm:"softDelete:flag" json:"is_del"` } -type ConditionsT map[string]any -type Predicates map[string][]any +type ( + ConditionsT map[string]any + Predicates map[string][]any +) func (m *Model) BeforeCreate(tx *gorm.DB) (err error) { nowTime := time.Now().Unix() diff --git a/internal/dao/jinzhu/dbr/post_content.go b/internal/dao/jinzhu/dbr/post_content.go index 5f257630..79c279b1 100644 --- a/internal/dao/jinzhu/dbr/post_content.go +++ b/internal/dao/jinzhu/dbr/post_content.go @@ -24,15 +24,13 @@ const ( ContentTypeChargeAttachment ) -var ( - mediaContentType = []PostContentT{ - ContentTypeImage, - ContentTypeVideo, - ContentTypeAudio, - ContentTypeAttachment, - ContentTypeChargeAttachment, - } -) +var mediaContentType = []PostContentT{ + ContentTypeImage, + ContentTypeVideo, + ContentTypeAudio, + ContentTypeAttachment, + ContentTypeChargeAttachment, +} type PostContent struct { *Model diff --git a/internal/dao/jinzhu/following.go b/internal/dao/jinzhu/following.go index a71ee2d6..19787008 100644 --- a/internal/dao/jinzhu/following.go +++ b/internal/dao/jinzhu/following.go @@ -12,9 +12,7 @@ import ( "gorm.io/gorm" ) -var ( - _ core.FollowingManageService = (*followingManageSrv)(nil) -) +var _ core.FollowingManageService = (*followingManageSrv)(nil) type followingManageSrv struct { db *gorm.DB diff --git a/internal/dao/jinzhu/messages.go b/internal/dao/jinzhu/messages.go index 105618e9..0eb83cf3 100644 --- a/internal/dao/jinzhu/messages.go +++ b/internal/dao/jinzhu/messages.go @@ -12,9 +12,7 @@ import ( "gorm.io/gorm" ) -var ( - _ core.MessageService = (*messageSrv)(nil) -) +var _ core.MessageService = (*messageSrv)(nil) type messageSrv struct { db *gorm.DB diff --git a/internal/dao/jinzhu/security.go b/internal/dao/jinzhu/security.go index 18a8ccae..4980763e 100644 --- a/internal/dao/jinzhu/security.go +++ b/internal/dao/jinzhu/security.go @@ -15,9 +15,7 @@ import ( "gorm.io/gorm" ) -var ( - _ core.SecurityService = (*securitySrv)(nil) -) +var _ core.SecurityService = (*securitySrv)(nil) type securitySrv struct { db *gorm.DB diff --git a/internal/dao/jinzhu/tweets.go b/internal/dao/jinzhu/tweets.go index 8139b1c1..8074d28e 100644 --- a/internal/dao/jinzhu/tweets.go +++ b/internal/dao/jinzhu/tweets.go @@ -250,7 +250,6 @@ func (s *tweetManageSrv) DeletePost(post *ms.Post) ([]string, error) { return nil }, ) - if err != nil { return nil, err } @@ -472,7 +471,7 @@ func (s *tweetSrv) ListFollowingTweets(userId int64, limit, offset int) (res []* } beFriendCount, beFollowCount := len(beFriendIds), len(beFollowIds) db := s.db.Model(&dbr.Post{}) - //可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开', + // 可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开', switch { case beFriendCount > 0 && beFollowCount > 0: db = db.Where("user_id=? OR (visibility>=50 AND user_id IN(?)) OR (visibility>=60 AND user_id IN(?))", userId, beFriendIds, beFollowIds) diff --git a/internal/dao/jinzhu/user.go b/internal/dao/jinzhu/user.go index 6f5c2c71..66e6d158 100644 --- a/internal/dao/jinzhu/user.go +++ b/internal/dao/jinzhu/user.go @@ -15,9 +15,7 @@ import ( "gorm.io/gorm" ) -var ( - _ core.UserManageService = (*userManageSrv)(nil) -) +var _ core.UserManageService = (*userManageSrv)(nil) type userManageSrv struct { db *gorm.DB diff --git a/internal/dao/jinzhu/wallet.go b/internal/dao/jinzhu/wallet.go index e657deca..e479bc92 100644 --- a/internal/dao/jinzhu/wallet.go +++ b/internal/dao/jinzhu/wallet.go @@ -12,9 +12,7 @@ import ( "gorm.io/gorm" ) -var ( - _ core.WalletService = (*walletSrv)(nil) -) +var _ core.WalletService = (*walletSrv)(nil) type walletSrv struct { db *gorm.DB @@ -35,6 +33,7 @@ func (s *walletSrv) GetRechargeByID(id int64) (*ms.WalletRecharge, error) { return recharge.Get(s.db) } + func (s *walletSrv) CreateRecharge(userId, amount int64) (*ms.WalletRecharge, error) { recharge := &dbr.WalletRecharge{ UserID: userId, diff --git a/internal/dao/search/bridge.go b/internal/dao/search/bridge.go index 6c9ed164..43028c95 100644 --- a/internal/dao/search/bridge.go +++ b/internal/dao/search/bridge.go @@ -12,9 +12,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ core.TweetSearchService = (*bridgeTweetSearchServant)(nil) -) +var _ core.TweetSearchService = (*bridgeTweetSearchServant)(nil) type documents struct { primaryKey []string diff --git a/internal/dao/security/attachment_check.go b/internal/dao/security/attachment_check.go index aa077aca..591554e8 100644 --- a/internal/dao/security/attachment_check.go +++ b/internal/dao/security/attachment_check.go @@ -12,9 +12,7 @@ import ( "github.com/rocboss/paopao-ce/internal/core" ) -var ( - _ core.AttachmentCheckService = (*attachmentCheckServant)(nil) -) +var _ core.AttachmentCheckService = (*attachmentCheckServant)(nil) type attachmentCheckServant struct { domain string diff --git a/internal/dao/security/phone_verify_juhe.go b/internal/dao/security/phone_verify_juhe.go index c213d380..25dfd553 100644 --- a/internal/dao/security/phone_verify_juhe.go +++ b/internal/dao/security/phone_verify_juhe.go @@ -12,9 +12,7 @@ import ( "gopkg.in/resty.v1" ) -var ( - _ core.PhoneVerifyService = (*juheSmsServant)(nil) -) +var _ core.PhoneVerifyService = (*juheSmsServant)(nil) type juhePhoneCaptchaRsp struct { ErrorCode int `json:"error_code"` diff --git a/internal/dao/storage/cos.go b/internal/dao/storage/cos.go index 3c2ea65f..bb2790f4 100644 --- a/internal/dao/storage/cos.go +++ b/internal/dao/storage/cos.go @@ -120,7 +120,6 @@ func (s *cosServant) IsObjectExist(objectKey string) (bool, error) { func (s *cosServant) SignURL(objectKey string, expiredInSec int64) (string, error) { signedURL, err := s.client.Object.GetPresignedURL(context.Background(), http.MethodGet, objectKey, conf.COSSetting.SecretID, conf.COSSetting.SecretKey, time.Second*time.Duration(expiredInSec), nil) - if err != nil { logrus.Errorf("client.SignURL err: %v", err) return "", err diff --git a/internal/dao/storage/localoss.go b/internal/dao/storage/localoss.go index 10131d29..d110b371 100644 --- a/internal/dao/storage/localoss.go +++ b/internal/dao/storage/localoss.go @@ -45,7 +45,7 @@ type localossServant struct { func (s *localossCreateServant) PutObject(objectKey string, reader io.Reader, objectSize int64, contentType string, _persistance bool) (string, error) { saveDir := s.savePath + filepath.Dir(objectKey) - err := os.MkdirAll(saveDir, 0750) + err := os.MkdirAll(saveDir, 0o750) if err != nil && !os.IsExist(err) { return "", err } @@ -80,7 +80,7 @@ func (s *localossCreateTempDirServant) PutObject(objectKey string, reader io.Rea objectName = s.tempDir + objectKey } saveDir := s.savePath + filepath.Dir(objectName) - err := os.MkdirAll(saveDir, 0750) + err := os.MkdirAll(saveDir, 0o750) if err != nil && !os.IsExist(err) { return "", err } @@ -112,7 +112,7 @@ func (s *localossCreateTempDirServant) PersistObject(objectKey string) error { } saveDir := s.savePath + filepath.Dir(objectKey) - if err = os.MkdirAll(saveDir, 0750); err != nil && !os.IsExist(err) { + if err = os.MkdirAll(saveDir, 0o750); err != nil && !os.IsExist(err) { return err } diff --git a/internal/model/enum/builtin_enum.go b/internal/model/enum/builtin_enum.go index 149a747f..05e4134a 100644 --- a/internal/model/enum/builtin_enum.go +++ b/internal/model/enum/builtin_enum.go @@ -1,8 +1,8 @@ // Code generated by go-enum DO NOT EDIT. -// Version: v0.7.0 -// Revision: 03ade876e762757c985a1cde66576bd63f75d7cd -// Build Date: 2025-04-20T09:27:58+0000 -// Built By: alimy +// Version: 0.9.2 +// Revision: 9d73c76728916582359433d1eb0b27340a8268b7 +// Build Date: 2025-10-17T20:10:48Z +// Built By: goreleaser package enum @@ -112,6 +112,14 @@ func (x *Boolean) UnmarshalText(text []byte) error { return nil } +// AppendText appends the textual representation of itself to the end of b +// (allocating a larger slice if necessary) and returns the updated slice. +// +// Implementations must not retain b, nor mutate any bytes within b[:len(b)]. +func (x *Boolean) AppendText(b []byte) ([]byte, error) { + return append(b, x.String()...), nil +} + var errBooleanNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. diff --git a/internal/model/web/core.go b/internal/model/web/core.go index 63ab1939..9a07a515 100644 --- a/internal/model/web/core.go +++ b/internal/model/web/core.go @@ -69,11 +69,15 @@ type SendWhisperReq struct { Content string `json:"content" binding:"required"` } -type GetCollectionsReq BasePageReq -type GetCollectionsResp base.PageResp +type ( + GetCollectionsReq BasePageReq + GetCollectionsResp base.PageResp +) -type GetStarsReq BasePageReq -type GetStarsResp base.PageResp +type ( + GetStarsReq BasePageReq + GetStarsResp base.PageResp +) type UserPhoneBindReq struct { BaseInfo `json:"-" binding:"-"` diff --git a/internal/model/web/web.go b/internal/model/web/web.go index 513da35e..01ee4cc8 100644 --- a/internal/model/web/web.go +++ b/internal/model/web/web.go @@ -13,9 +13,7 @@ import ( "github.com/rocboss/paopao-ce/pkg/xerror" ) -var ( - bindAny = base.NewBindAnyFn() -) +var bindAny = base.NewBindAnyFn() type BaseInfo struct { User *ms.User diff --git a/internal/servants/admin/user.go b/internal/servants/admin/user.go index 5713a205..1233e715 100644 --- a/internal/servants/admin/user.go +++ b/internal/servants/admin/user.go @@ -9,9 +9,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants/base" ) -var ( - _ api.User = (*userSrv)(nil) -) +var _ api.User = (*userSrv)(nil) type userSrv struct { *base.BaseServant diff --git a/internal/servants/base/base.go b/internal/servants/base/base.go index 3c381487..0489846a 100644 --- a/internal/servants/base/base.go +++ b/internal/servants/base/base.go @@ -137,7 +137,6 @@ func bindAnySentry(c *gin.Context, obj any) error { setter.SetPageInfo(page, pageSize) } return nil - } func RenderAny(c *gin.Context, data any, err error) { diff --git a/internal/servants/bot/user.go b/internal/servants/bot/user.go index 5ea239bd..714f299b 100644 --- a/internal/servants/bot/user.go +++ b/internal/servants/bot/user.go @@ -9,9 +9,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants/base" ) -var ( - _ api.User = (*userSrv)(nil) -) +var _ api.User = (*userSrv)(nil) type userSrv struct { *base.BaseServant diff --git a/internal/servants/localoss/user.go b/internal/servants/localoss/user.go index 2d45f5b9..d0cfe93e 100644 --- a/internal/servants/localoss/user.go +++ b/internal/servants/localoss/user.go @@ -9,9 +9,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants/base" ) -var ( - _ api.User = (*userSrv)(nil) -) +var _ api.User = (*userSrv)(nil) type userSrv struct { *base.BaseServant diff --git a/internal/servants/mobile/greet.go b/internal/servants/mobile/greet.go index 1d714a9d..0e5a1f10 100644 --- a/internal/servants/mobile/greet.go +++ b/internal/servants/mobile/greet.go @@ -8,9 +8,7 @@ import ( api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1" ) -var ( - _ api.GreetServiceServer = (*greetServiceSrv)(nil) -) +var _ api.GreetServiceServer = (*greetServiceSrv)(nil) type greetServiceSrv struct { api.UnimplementedGreetServiceServer diff --git a/internal/servants/space/user.go b/internal/servants/space/user.go index 505b6f30..c83b98d1 100644 --- a/internal/servants/space/user.go +++ b/internal/servants/space/user.go @@ -9,9 +9,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants/base" ) -var ( - _ api.User = (*userSrv)(nil) -) +var _ api.User = (*userSrv)(nil) type userSrv struct { *base.BaseServant diff --git a/internal/servants/web/admin.go b/internal/servants/web/admin.go index 6810e89a..f38d4aaf 100644 --- a/internal/servants/web/admin.go +++ b/internal/servants/web/admin.go @@ -18,9 +18,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ api.Admin = (*adminSrv)(nil) -) +var _ api.Admin = (*adminSrv)(nil) type adminSrv struct { api.UnimplementedAdminServant diff --git a/internal/servants/web/core.go b/internal/servants/web/core.go index d3c0ef4a..d0fbeb79 100644 --- a/internal/servants/web/core.go +++ b/internal/servants/web/core.go @@ -7,7 +7,6 @@ package web import ( "context" "fmt" - "time" "unicode/utf8" @@ -30,9 +29,7 @@ var ( _maxCaptchaTimes int = 2 ) -var ( - _ api.Core = (*coreSrv)(nil) -) +var _ api.Core = (*coreSrv)(nil) type coreSrv struct { api.UnimplementedCoreServant diff --git a/internal/servants/web/events.go b/internal/servants/web/events.go index 0e129fdd..6834f744 100644 --- a/internal/servants/web/events.go +++ b/internal/servants/web/events.go @@ -273,7 +273,7 @@ func (e *messageActionEvent) Action() (err error) { default: // TODO } - //清除该用户所有消息缓存 + // 清除该用户所有消息缓存 err = e.wc.DelAny(fmt.Sprintf("%s%d:*", conf.PrefixMessages, userId)) } return diff --git a/internal/servants/web/followship.go b/internal/servants/web/followship.go index a66bac0d..bd9caf34 100644 --- a/internal/servants/web/followship.go +++ b/internal/servants/web/followship.go @@ -15,9 +15,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ api.Followship = (*followshipSrv)(nil) -) +var _ api.Followship = (*followshipSrv)(nil) type followshipSrv struct { api.UnimplementedFollowshipServant diff --git a/internal/servants/web/friendship.go b/internal/servants/web/friendship.go index 68ab7953..1851fc21 100644 --- a/internal/servants/web/friendship.go +++ b/internal/servants/web/friendship.go @@ -14,9 +14,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ api.Friendship = (*friendshipSrv)(nil) -) +var _ api.Friendship = (*friendshipSrv)(nil) type friendshipSrv struct { api.UnimplementedFriendshipServant diff --git a/internal/servants/web/loose.go b/internal/servants/web/loose.go index e8ca4b63..66f9335d 100644 --- a/internal/servants/web/loose.go +++ b/internal/servants/web/loose.go @@ -21,9 +21,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ api.Loose = (*looseSrv)(nil) -) +var _ api.Loose = (*looseSrv)(nil) type looseSrv struct { api.UnimplementedLooseServant diff --git a/internal/servants/web/priv.go b/internal/servants/web/priv.go index 0c8cc199..9835bf24 100644 --- a/internal/servants/web/priv.go +++ b/internal/servants/web/priv.go @@ -748,7 +748,8 @@ func (s *privSrv) deletePostCommentReply(reply *ms.CommentReply) error { } func (s *privSrv) createPostPreHandler(commentID int64, userID, atUserID int64) (*ms.Post, *ms.Comment, int64, - error) { + error, +) { // 加载Comment comment, err := s.Ds.GetCommentByID(commentID) if err != nil { diff --git a/internal/servants/web/pub.go b/internal/servants/web/pub.go index fa81cae5..59bbff04 100644 --- a/internal/servants/web/pub.go +++ b/internal/servants/web/pub.go @@ -27,9 +27,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ api.Pub = (*pubSrv)(nil) -) +var _ api.Pub = (*pubSrv)(nil) const ( _MaxLoginErrTimes = 10 diff --git a/internal/servants/web/relax.go b/internal/servants/web/relax.go index b92f167d..468c033c 100644 --- a/internal/servants/web/relax.go +++ b/internal/servants/web/relax.go @@ -15,9 +15,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ api.Relax = (*relaxSrv)(nil) -) +var _ api.Relax = (*relaxSrv)(nil) type relaxSrv struct { api.UnimplementedRelaxServant diff --git a/internal/servants/web/site.go b/internal/servants/web/site.go index 1dbc1832..54636afa 100644 --- a/internal/servants/web/site.go +++ b/internal/servants/web/site.go @@ -12,9 +12,7 @@ import ( "github.com/rocboss/paopao-ce/pkg/version" ) -var ( - _ api.Site = (*siteSrv)(nil) -) +var _ api.Site = (*siteSrv)(nil) type siteSrv struct { api.UnimplementedSiteServant diff --git a/internal/servants/web/trends.go b/internal/servants/web/trends.go index 0b5ccf66..bf04fd1a 100644 --- a/internal/servants/web/trends.go +++ b/internal/servants/web/trends.go @@ -18,9 +18,7 @@ import ( "github.com/sirupsen/logrus" ) -var ( - _ api.Trends = (*trendsSrv)(nil) -) +var _ api.Trends = (*trendsSrv)(nil) type trendsSrv struct { api.UnimplementedTrendsServant diff --git a/internal/service/admin.go b/internal/service/admin.go index 451a551f..47ac6659 100644 --- a/internal/service/admin.go +++ b/internal/service/admin.go @@ -16,9 +16,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants" ) -var ( - _ Service = (*adminService)(nil) -) +var _ Service = (*adminService)(nil) type adminService struct { *baseHttpService diff --git a/internal/service/bot.go b/internal/service/bot.go index ff2bd615..62d245e6 100644 --- a/internal/service/bot.go +++ b/internal/service/bot.go @@ -16,9 +16,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants" ) -var ( - _ Service = (*botService)(nil) -) +var _ Service = (*botService)(nil) type botService struct { *baseHttpService diff --git a/internal/service/docs.go b/internal/service/docs.go index 86983dbd..013ecec1 100644 --- a/internal/service/docs.go +++ b/internal/service/docs.go @@ -14,9 +14,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants" ) -var ( - _ Service = (*docsService)(nil) -) +var _ Service = (*docsService)(nil) type docsService struct { *baseHttpService diff --git a/internal/service/frontend_web.go b/internal/service/frontend_web.go index 2ed1e116..7873c8a5 100644 --- a/internal/service/frontend_web.go +++ b/internal/service/frontend_web.go @@ -14,9 +14,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants" ) -var ( - _ Service = (*frontendWebService)(nil) -) +var _ Service = (*frontendWebService)(nil) type frontendWebService struct { *baseHttpService diff --git a/internal/service/grpc_server.go b/internal/service/grpc_server.go index 6b8589db..23d92da5 100644 --- a/internal/service/grpc_server.go +++ b/internal/service/grpc_server.go @@ -10,9 +10,7 @@ import ( "google.golang.org/grpc" ) -var ( - _ server = (*grpcServer)(nil) -) +var _ server = (*grpcServer)(nil) // grpcServer wraper for grpc.Server type grpcServer struct { diff --git a/internal/service/http_server.go b/internal/service/http_server.go index 1a412ce9..f34eef2a 100644 --- a/internal/service/http_server.go +++ b/internal/service/http_server.go @@ -11,9 +11,7 @@ import ( "github.com/gin-gonic/gin" ) -var ( - _ server = (*httpServer)(nil) -) +var _ server = (*httpServer)(nil) // httpServer wraper for gin.engine and http.Server type httpServer struct { diff --git a/internal/service/localoss.go b/internal/service/localoss.go index 0a561ed4..b0789acc 100644 --- a/internal/service/localoss.go +++ b/internal/service/localoss.go @@ -15,9 +15,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants" ) -var ( - _ Service = (*localossService)(nil) -) +var _ Service = (*localossService)(nil) type localossService struct { *baseHttpService diff --git a/internal/service/metrics.go b/internal/service/metrics.go index 57c7c625..fb81bfb6 100644 --- a/internal/service/metrics.go +++ b/internal/service/metrics.go @@ -17,9 +17,7 @@ import ( "github.com/rocboss/paopao-ce/internal/infra/metrics/statistics" ) -var ( - _ Service = (*metricsService)(nil) -) +var _ Service = (*metricsService)(nil) type metricsService struct { *baseHttpService diff --git a/internal/service/mobile.go b/internal/service/mobile.go index 8d88056e..8b74b06f 100644 --- a/internal/service/mobile.go +++ b/internal/service/mobile.go @@ -16,9 +16,7 @@ import ( "google.golang.org/grpc" ) -var ( - _ Service = (*mobileService)(nil) -) +var _ Service = (*mobileService)(nil) type mobileService struct { *baseGRPCService diff --git a/internal/service/pprof.go b/internal/service/pprof.go index 97501c32..731c70c1 100644 --- a/internal/service/pprof.go +++ b/internal/service/pprof.go @@ -13,9 +13,7 @@ import ( "github.com/rocboss/paopao-ce/internal/conf" ) -var ( - _ Service = (*pprofService)(nil) -) +var _ Service = (*pprofService)(nil) type pprofService struct { *baseHttpService diff --git a/internal/service/space.go b/internal/service/space.go index 989defe1..f4c7ae0b 100644 --- a/internal/service/space.go +++ b/internal/service/space.go @@ -16,9 +16,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants" ) -var ( - _ Service = (*spaceXService)(nil) -) +var _ Service = (*spaceXService)(nil) type spaceXService struct { *baseHttpService diff --git a/internal/service/web.go b/internal/service/web.go index ec1c353e..3c1ec97e 100644 --- a/internal/service/web.go +++ b/internal/service/web.go @@ -17,9 +17,7 @@ import ( "github.com/rocboss/paopao-ce/internal/servants" ) -var ( - _ Service = (*webService)(nil) -) +var _ Service = (*webService)(nil) type webService struct { *baseHttpService diff --git a/pkg/debug/errors.go b/pkg/debug/errors.go index 04a404ca..bed99e4a 100644 --- a/pkg/debug/errors.go +++ b/pkg/debug/errors.go @@ -8,6 +8,4 @@ import ( "errors" ) -var ( - ErrNotImplemented = errors.New("not implemented") -) +var ErrNotImplemented = errors.New("not implemented") diff --git a/pkg/http/client.go b/pkg/http/client.go index 150b23b1..feb12c16 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -11,9 +11,7 @@ import ( gp "github.com/alimy/tryst/pool" ) -var ( - _ AsyncClient = (*wormClient)(nil) -) +var _ AsyncClient = (*wormClient)(nil) const ( _minRequestBuf = 10 diff --git a/pkg/naming/snake_ns.go b/pkg/naming/snake_ns.go index 0c870931..5316d3f6 100644 --- a/pkg/naming/snake_ns.go +++ b/pkg/naming/snake_ns.go @@ -62,7 +62,8 @@ func NewSnakeNamingStrategy() NamingStrategy { "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "LHS", "QPS", "RAM", "RHS", "RPC", "SLA", "SMTP", "SSH", "TLS", "TTL", "UID", "UI", "UUID", "URI", "URL", "UTF8", - "VM", "XML", "XSRF", "XSS"} + "VM", "XML", "XSRF", "XSS", + } var oldnews []string for _, initialism := range initialisms { diff --git a/pkg/obx/obx.go b/pkg/obx/obx.go index 0a6b2c0f..661b0ad2 100644 --- a/pkg/obx/obx.go +++ b/pkg/obx/obx.go @@ -12,9 +12,7 @@ import ( hx "github.com/rocboss/paopao-ce/pkg/http" ) -var ( - _ OpenObserveClient = (*obxClient)(nil) -) +var _ OpenObserveClient = (*obxClient)(nil) const ( _userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" diff --git a/pkg/types/json_box.go b/pkg/types/json_box.go index 7a83e950..8d8b7478 100644 --- a/pkg/types/json_box.go +++ b/pkg/types/json_box.go @@ -47,7 +47,6 @@ func (j *JsonBox[T]) UnmarshalJSON(data []byte) error { return errors.New("JsonBox.UnmarshalJSON: on nil pointer") } return json.Unmarshal(data, &j.data) - } func (j *JsonBox[T]) Value() (driver.Value, error) { diff --git a/pkg/utils/banner.go b/pkg/utils/banner.go index 6862273d..2e4d6195 100644 --- a/pkg/utils/banner.go +++ b/pkg/utils/banner.go @@ -11,7 +11,6 @@ import ( ) func PrintHelloBanner(text string) { - fmt.Println(" ____ __ __ ____ __ __ ") fmt.Println("( _ \\ / _\\ / \\( _ \\ / _\\ / \\ ") fmt.Println(" ) __// \\( O )) __// \\( O )") diff --git a/pkg/utils/str.go b/pkg/utils/str.go index 199ad092..c5943283 100644 --- a/pkg/utils/str.go +++ b/pkg/utils/str.go @@ -20,8 +20,10 @@ const ( CLEAR // 去除部分易混淆的字符 ) -var fontKinds = [][]int{{10, 48}, {26, 97}, {26, 65}} -var letters = []byte("34578acdefghjkmnpqstwxyABCDEFGHJKMNPQRSVWXY") +var ( + fontKinds = [][]int{{10, 48}, {26, 97}, {26, 65}} + letters = []byte("34578acdefghjkmnpqstwxyABCDEFGHJKMNPQRSVWXY") +) // 生成随机字符串 // size 个数 kind 模式 diff --git a/pkg/version/build.go b/pkg/version/build.go index 6f156cc6..69e435bf 100644 --- a/pkg/version/build.go +++ b/pkg/version/build.go @@ -10,9 +10,7 @@ import ( "time" ) -var ( - BuildTime = time.Now() -) +var BuildTime = time.Now() func init() { exe, err := os.Executable() diff --git a/pkg/xerror/xerror.go b/pkg/xerror/xerror.go index 6f575732..c7295164 100644 --- a/pkg/xerror/xerror.go +++ b/pkg/xerror/xerror.go @@ -12,11 +12,9 @@ import ( "github.com/alimy/mir/v5" ) -var ( - _ mir.Error = (*Error)(nil) +var _ mir.Error = (*Error)(nil) - // codes = map[int]string{} -) +// codes = map[int]string{} type Error struct { code int diff --git a/pkg/zinc/zinc.go b/pkg/zinc/zinc.go index 4f44bb78..76c6ad8e 100644 --- a/pkg/zinc/zinc.go +++ b/pkg/zinc/zinc.go @@ -126,7 +126,6 @@ func (c *ZincClient) ExistIndex(name string) bool { // 新增/更新文档 func (c *ZincClient) PutDoc(name string, id int64, doc any) (bool, error) { resp, err := c.request().SetBody(doc).Put(fmt.Sprintf("/api/%s/_doc/%d", name, id)) - if err != nil { return false, err } From f09846789c4b3e8efd5afe7191bf27b6a52d77b4 Mon Sep 17 00:00:00 2001 From: yoclo <3286108868@qq.com> Date: Wed, 4 Feb 2026 19:50:36 +0800 Subject: [PATCH 10/10] fix: unify thumbs transactions for comments and replies --- internal/dao/jinzhu/comments.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/dao/jinzhu/comments.go b/internal/dao/jinzhu/comments.go index 262c3007..7660dc16 100644 --- a/internal/dao/jinzhu/comments.go +++ b/internal/dao/jinzhu/comments.go @@ -201,7 +201,7 @@ func (s *commentManageSrv) CreateCommentReply(reply *ms.CommentReply) (res *ms.C func (s *commentManageSrv) DeleteCommentReply(reply *ms.CommentReply) (err error) { db := s.db.Begin() defer db.Rollback() - err = reply.Delete(s.db) + err = reply.Delete(db) if err != nil { return } @@ -233,7 +233,7 @@ func (s *commentManageSrv) ThumbsUpComment(userId int64, tweetId, commentId int6 ) commentThumbs := &dbr.TweetCommentThumbs{} // 检查thumbs状态 - err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND comment_type=0", userId, tweetId, commentId).Take(commentThumbs).Error + err := db.Where("user_id=? AND tweet_id=? AND comment_id=? AND comment_type=0", userId, tweetId, commentId).Take(commentThumbs).Error if err == nil { switch { case commentThumbs.IsThumbsUp == types.Yes && commentThumbs.IsThumbsDown == types.No: @@ -261,11 +261,11 @@ func (s *commentManageSrv) ThumbsUpComment(userId int64, tweetId, commentId int6 thumbsUpCount, thumbsDownCount = 1, 0 } // 更新thumbs状态 - if err = s.db.Save(commentThumbs).Error; err != nil { + if err = db.Save(commentThumbs).Error; err != nil { return err } // 更新thumbsUpCount - if err = s.updateCommentThumbsUpCount(&dbr.Comment{}, commentId, thumbsUpCount, thumbsDownCount); err != nil { + if err = updateCommentThumbsUpCount(db, &dbr.Comment{}, commentId, thumbsUpCount, thumbsDownCount); err != nil { return err } db.Commit() @@ -282,7 +282,7 @@ func (s *commentManageSrv) ThumbsDownComment(userId int64, tweetId, commentId in ) commentThumbs := &dbr.TweetCommentThumbs{} // 检查thumbs状态 - err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND comment_type=0", userId, tweetId, commentId).Take(commentThumbs).Error + err := db.Where("user_id=? AND tweet_id=? AND comment_id=? AND comment_type=0", userId, tweetId, commentId).Take(commentThumbs).Error if err == nil { switch { case commentThumbs.IsThumbsDown == types.Yes: @@ -311,11 +311,11 @@ func (s *commentManageSrv) ThumbsDownComment(userId int64, tweetId, commentId in thumbsUpCount, thumbsDownCount = 0, 1 } // 更新thumbs状态 - if err = s.db.Save(commentThumbs).Error; err != nil { + if err = db.Save(commentThumbs).Error; err != nil { return err } // 更新thumbsUpCount - if err = s.updateCommentThumbsUpCount(&dbr.Comment{}, commentId, thumbsUpCount, thumbsDownCount); err != nil { + if err = updateCommentThumbsUpCount(db, &dbr.Comment{}, commentId, thumbsUpCount, thumbsDownCount); err != nil { return err } db.Commit() @@ -332,7 +332,7 @@ func (s *commentManageSrv) ThumbsUpReply(userId int64, tweetId, commentId, reply ) commentThumbs := &dbr.TweetCommentThumbs{} // 检查thumbs状态 - err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND reply_id=? AND comment_type=1", userId, tweetId, commentId, replyId).Take(commentThumbs).Error + err := db.Where("user_id=? AND tweet_id=? AND comment_id=? AND reply_id=? AND comment_type=1", userId, tweetId, commentId, replyId).Take(commentThumbs).Error if err == nil { switch { case commentThumbs.IsThumbsUp == types.Yes: @@ -361,11 +361,11 @@ func (s *commentManageSrv) ThumbsUpReply(userId int64, tweetId, commentId, reply thumbsUpCount, thumbsDownCount = 1, 0 } // 更新thumbs状态 - if err = s.db.Save(commentThumbs).Error; err != nil { + if err = db.Save(commentThumbs).Error; err != nil { return err } // 更新thumbsUpCount - if err = s.updateCommentThumbsUpCount(&dbr.CommentReply{}, replyId, thumbsUpCount, thumbsDownCount); err != nil { + if err = updateCommentThumbsUpCount(db, &dbr.CommentReply{}, replyId, thumbsUpCount, thumbsDownCount); err != nil { return err } db.Commit() @@ -382,7 +382,7 @@ func (s *commentManageSrv) ThumbsDownReply(userId int64, tweetId, commentId, rep ) commentThumbs := &dbr.TweetCommentThumbs{} // 检查thumbs状态 - err := s.db.Where("user_id=? AND tweet_id=? AND comment_id=? AND reply_id=? AND comment_type=1", userId, tweetId, commentId, replyId).Take(commentThumbs).Error + err := db.Where("user_id=? AND tweet_id=? AND comment_id=? AND reply_id=? AND comment_type=1", userId, tweetId, commentId, replyId).Take(commentThumbs).Error if err == nil { switch { case commentThumbs.IsThumbsDown == types.Yes: @@ -411,11 +411,11 @@ func (s *commentManageSrv) ThumbsDownReply(userId int64, tweetId, commentId, rep thumbsUpCount, thumbsDownCount = 0, 1 } // 更新thumbs状态 - if err = s.db.Save(commentThumbs).Error; err != nil { + if err = db.Save(commentThumbs).Error; err != nil { return err } // 更新thumbsUpCount - if err = s.updateCommentThumbsUpCount(&dbr.CommentReply{}, replyId, thumbsUpCount, thumbsDownCount); err != nil { + if err = updateCommentThumbsUpCount(db, &dbr.CommentReply{}, replyId, thumbsUpCount, thumbsDownCount); err != nil { return err } db.Commit()