From bc495544c83dd7686ea409a1616da337c1686d5e Mon Sep 17 00:00:00 2001 From: Rogee Date: Thu, 4 Dec 2025 11:47:37 +0800 Subject: [PATCH] feat: update go module, add recharge wechat --- backend/app/http/posts.go | 88 +++++++++++---------- backend/app/http/provider.gen.go | 3 + backend/config.prod.toml | 1 + backend/config.toml | 3 +- backend/config.yh.toml | 3 +- backend/go.mod | 4 +- backend/go.sum | 4 +- backend/providers/app/config.go | 13 +-- frontend/wechat/src/api/post_detail.json | 5 +- frontend/wechat/src/views/ArticleDetail.vue | 6 +- 10 files changed, 72 insertions(+), 58 deletions(-) diff --git a/backend/app/http/posts.go b/backend/app/http/posts.go index 58b91b3..33c71cc 100644 --- a/backend/app/http/posts.go +++ b/backend/app/http/posts.go @@ -10,6 +10,7 @@ import ( "quyun/app/requests" "quyun/database/fields" "quyun/providers/ali" + "quyun/providers/app" "quyun/providers/job" "quyun/providers/wepay" @@ -29,6 +30,7 @@ type posts struct { wepay *wepay.Client oss *ali.OSSClient job *job.Job + app *app.Config } // List posts @@ -81,16 +83,17 @@ func (ctl *posts) List( _, bought := userBoughtIds[item.ID] return PostItem{ - ID: item.ID, - Title: item.Title, - Description: item.Description, - Price: item.Price, - Discount: item.Discount, - Views: item.Views, - Likes: item.Likes, - Tags: item.Tags.Data, - HeadImages: mediaUrls, - Bought: bought, + ID: item.ID, + Title: item.Title, + Description: item.Description, + Price: item.Price, + Discount: item.Discount, + Views: item.Views, + Likes: item.Likes, + Tags: item.Tags.Data, + HeadImages: mediaUrls, + Bought: bought, + RechargeWechat: ctl.app.RechargeWechat, }, true }) @@ -101,17 +104,18 @@ func (ctl *posts) List( } type PostItem struct { - ID int64 `json:"id"` - Bought bool `json:"bought"` - Title string `json:"title"` - Description string `json:"description"` - Content string `json:"content"` - Price int64 `json:"price"` - Discount int16 `json:"discount"` - Views int64 `json:"views"` - Likes int64 `json:"likes"` - Tags []string `json:"tags"` - HeadImages []string `json:"head_images"` + ID int64 `json:"id"` + Bought bool `json:"bought"` + Title string `json:"title"` + Description string `json:"description"` + Content string `json:"content"` + Price int64 `json:"price"` + Discount int16 `json:"discount"` + Views int64 `json:"views"` + Likes int64 `json:"likes"` + Tags []string `json:"tags"` + HeadImages []string `json:"head_images"` + RechargeWechat string `json:"recharge_wechat,omitempty"` } // Show @@ -148,17 +152,18 @@ func (ctl *posts) Show(ctx fiber.Ctx, id int64, user *model.Users) (*PostItem, e }) return &PostItem{ - ID: post.ID, - Title: post.Title, - Description: post.Description, - Content: post.Content, - Price: post.Price, - Discount: post.Discount, - Views: post.Views, - Likes: post.Likes, - Tags: post.Tags.Data, - HeadImages: mediaUrls, - Bought: bought, + ID: post.ID, + Title: post.Title, + Description: post.Description, + Content: post.Content, + Price: post.Price, + Discount: post.Discount, + Views: post.Views, + Likes: post.Likes, + Tags: post.Tags.Data, + HeadImages: mediaUrls, + Bought: bought, + RechargeWechat: ctl.app.RechargeWechat, }, nil } @@ -262,15 +267,16 @@ func (ctl *posts) Mine( }) return PostItem{ - ID: item.ID, - Title: item.Title, - Description: item.Description, - Price: item.Price, - Discount: item.Discount, - Views: item.Views, - Likes: item.Likes, - Tags: item.Tags.Data, - HeadImages: mediaUrls, + ID: item.ID, + Title: item.Title, + Description: item.Description, + Price: item.Price, + Discount: item.Discount, + Views: item.Views, + Likes: item.Likes, + Tags: item.Tags.Data, + HeadImages: mediaUrls, + RechargeWechat: ctl.app.RechargeWechat, }, true }) diff --git a/backend/app/http/provider.gen.go b/backend/app/http/provider.gen.go index ca4ec69..d2aa928 100755 --- a/backend/app/http/provider.gen.go +++ b/backend/app/http/provider.gen.go @@ -2,6 +2,7 @@ package http import ( "quyun/providers/ali" + "quyun/providers/app" "quyun/providers/job" "quyun/providers/jwt" "quyun/providers/wechat" @@ -44,11 +45,13 @@ func Provide(opts ...opt.Option) error { job *job.Job, oss *ali.OSSClient, wepay *wepay.Client, + appConfig *app.Config, ) (*posts, error) { obj := &posts{ job: job, oss: oss, wepay: wepay, + app: appConfig, } return obj, nil diff --git a/backend/config.prod.toml b/backend/config.prod.toml index 393fba5..6188954 100644 --- a/backend/config.prod.toml +++ b/backend/config.prod.toml @@ -4,6 +4,7 @@ BaseURI = "https://mp.jdwan.com" StoragePath = "/app/downloads" DistAdmin = "/app/dist/admin" DistWeChat = "/app/dist/wechat" +RechargeWechat = "13932043996" [Http] Port = 9888 diff --git a/backend/config.toml b/backend/config.toml index f6f867d..5b8fada 100644 --- a/backend/config.toml +++ b/backend/config.toml @@ -5,6 +5,7 @@ BaseURI = "baseURI" StoragePath = "/Users/rogee/Projects/self/quyun/fixtures" DistAdmin = "frontend/admin/dist" DistWeChat = "frontend/wechat/dist" +RechargeWechat = "13932043996" [Http] Port = 8088 @@ -84,4 +85,4 @@ tjNmYNK/H5FLuZVVUilEiWn8XskxGEKiGh0KhMEl3YRPPzguADPck9Ip4tgn4UDt fUs5UFrzH3A4cpuc1Je3wJ3vqztu3sr+G3LBSXCvYD7EkDhXMHCv01cJBxBN876T 442YAFX94VJ79/xwwmXOgCLz1QegDd6M+Um0l5BkQoOIqDlEkWsOvRo9iOsZ25H9 kQIDAQAB ------END PUBLIC KEY-----""" \ No newline at end of file +-----END PUBLIC KEY-----""" diff --git a/backend/config.yh.toml b/backend/config.yh.toml index 597c288..601574d 100644 --- a/backend/config.yh.toml +++ b/backend/config.yh.toml @@ -2,6 +2,7 @@ Mode = "development" BaseURI = "baseURI" StoragePath = "/Users/rogee/Projects/self/quyun/fixtures" +RechargeWechat = "13932043996" [Http] Port = 8088 @@ -82,4 +83,4 @@ tjNmYNK/H5FLuZVVUilEiWn8XskxGEKiGh0KhMEl3YRPPzguADPck9Ip4tgn4UDt fUs5UFrzH3A4cpuc1Je3wJ3vqztu3sr+G3LBSXCvYD7EkDhXMHCv01cJBxBN876T 442YAFX94VJ79/xwwmXOgCLz1QegDd6M+Um0l5BkQoOIqDlEkWsOvRo9iOsZ25H9 kQIDAQAB ------END PUBLIC KEY-----""" \ No newline at end of file +-----END PUBLIC KEY-----""" diff --git a/backend/go.mod b/backend/go.mod index 6c86c59..6fa23a0 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -37,7 +37,7 @@ require ( github.com/stretchr/testify v1.10.0 github.com/swaggo/files/v2 v2.0.2 github.com/uber/jaeger-client-go v2.30.0+incompatible - go.ipao.vip/atom v1.1.8 + go.ipao.vip/atom v1.2.1 go.opentelemetry.io/contrib/instrumentation/runtime v0.60.0 go.opentelemetry.io/otel v1.35.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.35.0 @@ -50,6 +50,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.35.0 go.opentelemetry.io/otel/trace v1.35.0 go.uber.org/dig v1.18.1 + golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e golang.org/x/net v0.35.0 golang.org/x/sync v0.12.0 google.golang.org/grpc v1.71.0 @@ -152,7 +153,6 @@ require ( go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.33.0 // indirect - golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect diff --git a/backend/go.sum b/backend/go.sum index 234f9c8..ca2a524 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -337,8 +337,8 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.ipao.vip/atom v1.1.8 h1:xiEpK2RPv/kxwxvN9tzJ8uClsmVskLEjnyZKoGfm04U= -go.ipao.vip/atom v1.1.8/go.mod h1:woAv+rZf0xd+7mEtKWv4PyazQARFLnrV/qA4qlAK008= +go.ipao.vip/atom v1.2.1 h1:7VlDLSkGNVEZLVM/JVcXXdMTO0+sFsxe1vfIM4Xz8uc= +go.ipao.vip/atom v1.2.1/go.mod h1:woAv+rZf0xd+7mEtKWv4PyazQARFLnrV/qA4qlAK008= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/runtime v0.60.0 h1:0NgN/3SYkqYJ9NBlDfl/2lzVlwos/YQLvi8sUrzJRBE= diff --git a/backend/providers/app/config.go b/backend/providers/app/config.go index 9232bbb..15aac2d 100644 --- a/backend/providers/app/config.go +++ b/backend/providers/app/config.go @@ -21,12 +21,13 @@ func DefaultProvider() container.ProviderContainer { type AppMode string type Config struct { - Mode AppMode - Cert *Cert - BaseURI *string - StoragePath string - DistAdmin string - DistWeChat string + Mode AppMode + Cert *Cert + BaseURI *string + StoragePath string + DistAdmin string + DistWeChat string + RechargeWechat string } func (c *Config) IsDevMode() bool { diff --git a/frontend/wechat/src/api/post_detail.json b/frontend/wechat/src/api/post_detail.json index 2a40fb1..318b558 100644 --- a/frontend/wechat/src/api/post_detail.json +++ b/frontend/wechat/src/api/post_detail.json @@ -13,5 +13,6 @@ ], "head_images": [ "https://assets.jdwan.com/quyun/b55adbd05ee96f5c53f9a19ad89a30cc.jpg?x-oss-credential=LTAI5t86SjiP9zRd3q2w7jQN%2F20250425%2Fcn-beijing%2Foss%2Faliyun_v4_request&x-oss-date=20250425T030400Z&x-oss-expires=300&x-oss-signature=fae33ecfc5cfe6d50de858d89798151b137336e3694bdafad78e1cbdb1ebf1c0&x-oss-signature-version=OSS4-HMAC-SHA256" - ] -} \ No newline at end of file + ], + "recharge_wechat": "13932043996" +} diff --git a/frontend/wechat/src/views/ArticleDetail.vue b/frontend/wechat/src/views/ArticleDetail.vue index e9803d5..7a1f214 100644 --- a/frontend/wechat/src/views/ArticleDetail.vue +++ b/frontend/wechat/src/views/ArticleDetail.vue @@ -228,8 +228,8 @@ onUnmounted(() => {
-
- 注意:未购买视频仅可预览 1 分钟,购买后可观看全集。账户充值购买联系微信:13932043996 +
+ 注意:未购买视频仅可预览 1 分钟,购买后可观看全集。账户充值购买联系微信:{{ article.recharge_wechat }}
@@ -263,4 +263,4 @@ onUnmounted(() => {
- \ No newline at end of file +