From 34b7598b3108a9a05dbafcef8c63def86b0ee5bf Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 27 Nov 2024 16:21:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E5=AF=BC=E9=A1=B5=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=AE=B0=E5=BD=95=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_config.go | 35 +++++++++++ app/hdl/hdl_login.go | 8 ++- app/hdl/hdl_member_center.go | 12 ++++ app/md/md_config.go | 34 +++++++--- app/md/md_member_center.go | 5 ++ app/router/router.go | 2 +- app/svc/svc_common.go | 4 +- docs/docs.go | 117 +++++++++++++++++++++++++++++++++++ docs/swagger.json | 117 +++++++++++++++++++++++++++++++++++ docs/swagger.yaml | 77 +++++++++++++++++++++++ go.mod | 2 +- 11 files changed, 401 insertions(+), 12 deletions(-) diff --git a/app/hdl/hdl_config.go b/app/hdl/hdl_config.go index a376726..e9aa6dd 100644 --- a/app/hdl/hdl_config.go +++ b/app/hdl/hdl_config.go @@ -8,8 +8,10 @@ import ( "applet/app/svc" "applet/app/utils" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "encoding/json" "fmt" "github.com/gin-gonic/gin" + "github.com/tidwall/gjson" ) // Config @@ -42,6 +44,39 @@ func Config(c *gin.Context) { res.PrivacyUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id)) } res.OssUrl = svc.GetOssDomain() + appCloudBundleData := svc.GetSysCfgStr("app_cloud_bundle_data") + guideStr := gjson.Get(appCloudBundleData, "guide").String() + Guide := make([]md.Guide, 0) + json.Unmarshal([]byte(guideStr), &Guide) + res.Guide = Guide + e.OutSuc(c, res, nil) + return +} + +// Version +// @Summary 版本记录 +// @Tags 基本配置 +// @Description 版本记录 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.VersionResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/version [get] +func Version(c *gin.Context) { + appVersion := svc.GetSysCfgStr("app_version") + version := make([]md.Version, 0) + json.Unmarshal([]byte(appVersion), &version) + res := md.VersionResp{Version: version, IsAuditVersion: "0"} + NewCloudBundleDb := implement.NewCloudBundleDb(db.Db) + os := "1" + if c.GetHeader("platform") == "iOS" { + os = "2" + } + data, _ := NewCloudBundleDb.GetCloudBundleVersion(os, c.GetHeader("appversionname")) + if data != nil { + res.IsAuditVersion = utils.IntToStr(data.IsAuditing) + } e.OutSuc(c, res, nil) return } diff --git a/app/hdl/hdl_login.go b/app/hdl/hdl_login.go index cc69d95..8dcaf53 100644 --- a/app/hdl/hdl_login.go +++ b/app/hdl/hdl_login.go @@ -356,7 +356,13 @@ func commReq(c *gin.Context, req md.RegisterReq) { } return 0 }() - + if req.Nickname == "" && req.Mobile != "" { + appName := svc.GetSysCfgStr("app_name") + req.Nickname = appName + req.Mobile[len(req.Mobile)-4:] + } + if req.Avatar == "" { + req.Avatar = svc.GetSysCfgStr("default_avatar") + } user = &model.User{ Phone: req.Mobile, UnionId: req.UnionId, diff --git a/app/hdl/hdl_member_center.go b/app/hdl/hdl_member_center.go index 723f8cb..c1b88bf 100644 --- a/app/hdl/hdl_member_center.go +++ b/app/hdl/hdl_member_center.go @@ -4,6 +4,7 @@ import ( "applet/app/db" "applet/app/e" "applet/app/md" + "applet/app/svc" "applet/app/utils" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" @@ -153,6 +154,17 @@ func MemberCenterGetBasic(c *gin.Context) { Date: "29", Ratio: "1:1000", Amount: wallet.Amount, + Id: utils.Int64ToStr(user.Id), + Phone: user.Phone, + InviteCode: user.SystemInviteCode, + IsBindExtend: "0", + HeadImg: svc.GetOssUrl(user.Avatar), + } + if user.CustomInviteCode != "" { + resp.InviteCode = user.CustomInviteCode + } + if user.ParentUid > 0 { + resp.IsBindExtend = "1" } e.OutSuc(c, resp, nil) return diff --git a/app/md/md_config.go b/app/md/md_config.go index c3a8a77..ec2eac5 100644 --- a/app/md/md_config.go +++ b/app/md/md_config.go @@ -1,11 +1,31 @@ package md type ConfigResp struct { - Title string `json:"title" example:"软件使用协议标题"` - Content string `json:"content" example:"软件使用协议内容"` - UserTitle string `json:"user_title" example:"用户协议标题"` - UserUrl string `json:"user_url" example:"用户协议链接"` - PrivacyTitle string `json:"privacy_title" example:"隐私协议标题"` - PrivacyUrl string `json:"privacy_url" example:"隐私协议链接"` - OssUrl string `json:"oss_url" example:"阿里云图片链接"` + Title string `json:"title" example:"软件使用协议标题"` + Content string `json:"content" example:"软件使用协议内容"` + UserTitle string `json:"user_title" example:"用户协议标题"` + UserUrl string `json:"user_url" example:"用户协议链接"` + PrivacyTitle string `json:"privacy_title" example:"隐私协议标题"` + PrivacyUrl string `json:"privacy_url" example:"隐私协议链接"` + OssUrl string `json:"oss_url" example:"阿里云图片链接"` + Guide []Guide `json:"guide"` +} +type VersionResp struct { + Version []Version `json:"version"` + IsAuditVersion string `json:"is_audit_version"` +} +type Version struct { + Type string `json:"type"` + Img string `json:"img"` + Name string `json:"name"` + Version string `json:"version"` + Url string `json:"url"` + Content string `json:"content"` + IsMust string `json:"is_must"` +} +type Guide struct { + BgImage string `json:"bg_image"` + BgImageUrl string `json:"bg_image_url"` + ContentImage string `json:"content_image"` + ContentImageUrl string `json:"content_image_url"` } diff --git a/app/md/md_member_center.go b/app/md/md_member_center.go index cfdc233..60e699e 100644 --- a/app/md/md_member_center.go +++ b/app/md/md_member_center.go @@ -11,6 +11,11 @@ type MemberCenterGetBasicResp struct { Date string `json:"date"` // 兑换时间(每月x日) Ratio string `json:"ratio"` // 兑换比例(x:y) Amount string `json:"amount"` // 账户余额 + Id string `json:"id"` + Phone string `json:"phone"` + InviteCode string `json:"invite_code"` + HeadImg string `json:"head_img"` + IsBindExtend string `json:"is_bind_extend" example:"是否绑定了上级 0否 1是"` } type UserEggFlowReqRespList struct { diff --git a/app/router/router.go b/app/router/router.go index 00d979d..29b616b 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -58,6 +58,7 @@ func route(r *gin.RouterGroup) { r.Any("/testCreateSign", hdl.TestCreateSign) r.GET("/openApp/start", hdl.Start) //打开app调用 r.GET("/config", hdl.Config) //基本配置 + r.GET("/version", hdl.Version) //版本数据 { r.GET("/advertising", hdl.Advertising) //广告位 r.POST("/advertising/detail", hdl.AdvertisingDetail) //广告位 @@ -75,7 +76,6 @@ func route(r *gin.RouterGroup) { r.Use(mw.Auth) // 以下接口需要JWT验证 rComm(r.Group("/comm")) r.POST("/advertising/check", hdl.AdvertisingCheck) //广告位判断能不能看 - r.GET("/userInfo", hdl.UserInfo) //用户基础信息 rHomePage := r.Group("/homePage") { rHomePage.GET("/index", hdl.HomePage) // 主页 diff --git a/app/svc/svc_common.go b/app/svc/svc_common.go index 0686226..1141349 100644 --- a/app/svc/svc_common.go +++ b/app/svc/svc_common.go @@ -29,7 +29,7 @@ func GetOssDomain() string { sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) sysCfg := sysCfgDb.SysCfgFindWithDb("oss_domain", "oss_bucket_scheme") http := sysCfg["oss_bucket_scheme"] - return http + "://" + sysCfg["oss_domain"] + return http + "://" + sysCfg["oss_domain"] + "/" } func GetOssUrl(img string) string { redisConn := cache.GetPool().Get() @@ -37,7 +37,7 @@ func GetOssUrl(img string) string { sysCfg := sysCfgDb.SysCfgFindWithDb("oss_domain", "oss_bucket_scheme") if strings.Contains(img, "http") == false && img != "" { http := sysCfg["oss_bucket_scheme"] - img = http + "://" + sysCfg["oss_domain"] + img + img = http + "://" + sysCfg["oss_domain"] + "/" + img } return img } diff --git a/docs/docs.go b/docs/docs.go index 717f77e..98d440a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2310,6 +2310,44 @@ const docTemplate = `{ } } }, + "/api/v1/version": { + "get": { + "description": "版本记录", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "基本配置" + ], + "summary": "版本记录", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.VersionResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/wallet/amountFlow": { "get": { "description": "余额明细(获取)", @@ -2831,6 +2869,12 @@ const docTemplate = `{ "type": "string", "example": "软件使用协议内容" }, + "guide": { + "type": "array", + "items": { + "$ref": "#/definitions/md.Guide" + } + }, "oss_url": { "type": "string", "example": "阿里云图片链接" @@ -3340,6 +3384,23 @@ const docTemplate = `{ } } }, + "md.Guide": { + "type": "object", + "properties": { + "bg_image": { + "type": "string" + }, + "bg_image_url": { + "type": "string" + }, + "content_image": { + "type": "string" + }, + "content_image_url": { + "type": "string" + } + } + }, "md.HomePageResp": { "type": "object", "properties": { @@ -3559,6 +3620,19 @@ const docTemplate = `{ "description": "蛋蛋分", "type": "string" }, + "head_img": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invite_code": { + "type": "string" + }, + "is_bind_extend": { + "type": "string", + "example": "是否绑定了上级 0否 1是" + }, "level_name": { "description": "会员等级名称", "type": "string" @@ -3567,6 +3641,9 @@ const docTemplate = `{ "description": "会员名称", "type": "string" }, + "phone": { + "type": "string" + }, "ratio": { "description": "兑换比例(x:y)", "type": "string" @@ -4173,6 +4250,46 @@ const docTemplate = `{ } } }, + "md.Version": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "img": { + "type": "string" + }, + "is_must": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "url": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "md.VersionResp": { + "type": "object", + "properties": { + "is_audit_version": { + "type": "string" + }, + "version": { + "type": "array", + "items": { + "$ref": "#/definitions/md.Version" + } + } + } + }, "md.WalletFlowNode": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 1e9985a..830c572 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2303,6 +2303,44 @@ } } }, + "/api/v1/version": { + "get": { + "description": "版本记录", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "基本配置" + ], + "summary": "版本记录", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.VersionResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/wallet/amountFlow": { "get": { "description": "余额明细(获取)", @@ -2824,6 +2862,12 @@ "type": "string", "example": "软件使用协议内容" }, + "guide": { + "type": "array", + "items": { + "$ref": "#/definitions/md.Guide" + } + }, "oss_url": { "type": "string", "example": "阿里云图片链接" @@ -3333,6 +3377,23 @@ } } }, + "md.Guide": { + "type": "object", + "properties": { + "bg_image": { + "type": "string" + }, + "bg_image_url": { + "type": "string" + }, + "content_image": { + "type": "string" + }, + "content_image_url": { + "type": "string" + } + } + }, "md.HomePageResp": { "type": "object", "properties": { @@ -3552,6 +3613,19 @@ "description": "蛋蛋分", "type": "string" }, + "head_img": { + "type": "string" + }, + "id": { + "type": "string" + }, + "invite_code": { + "type": "string" + }, + "is_bind_extend": { + "type": "string", + "example": "是否绑定了上级 0否 1是" + }, "level_name": { "description": "会员等级名称", "type": "string" @@ -3560,6 +3634,9 @@ "description": "会员名称", "type": "string" }, + "phone": { + "type": "string" + }, "ratio": { "description": "兑换比例(x:y)", "type": "string" @@ -4166,6 +4243,46 @@ } } }, + "md.Version": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "img": { + "type": "string" + }, + "is_must": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "url": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "md.VersionResp": { + "type": "object", + "properties": { + "is_audit_version": { + "type": "string" + }, + "version": { + "type": "array", + "items": { + "$ref": "#/definitions/md.Version" + } + } + } + }, "md.WalletFlowNode": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index fb2d34a..48dc2d6 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -256,6 +256,10 @@ definitions: content: example: 软件使用协议内容 type: string + guide: + items: + $ref: '#/definitions/md.Guide' + type: array oss_url: example: 阿里云图片链接 type: string @@ -608,6 +612,17 @@ definitions: - $ref: '#/definitions/pb.SendRedPacketResp' description: im 返回体 type: object + md.Guide: + properties: + bg_image: + type: string + bg_image_url: + type: string + content_image: + type: string + content_image_url: + type: string + type: object md.HomePageResp: properties: egg_energy_now_price: @@ -763,12 +778,23 @@ definitions: egg_score: description: 蛋蛋分 type: string + head_img: + type: string + id: + type: string + invite_code: + type: string + is_bind_extend: + example: 是否绑定了上级 0否 1是 + type: string level_name: description: 会员等级名称 type: string nickname: description: 会员名称 type: string + phone: + type: string ratio: description: 兑换比例(x:y) type: string @@ -1185,6 +1211,32 @@ definitions: phone: type: string type: object + md.Version: + properties: + content: + type: string + img: + type: string + is_must: + type: string + name: + type: string + type: + type: string + url: + type: string + version: + type: string + type: object + md.VersionResp: + properties: + is_audit_version: + type: string + version: + items: + $ref: '#/definitions/md.Version' + type: array + type: object md.WalletFlowNode: properties: after_amount: @@ -2778,6 +2830,31 @@ paths: summary: 用户信息 tags: - 用户信息 + /api/v1/version: + get: + consumes: + - application/json + description: 版本记录 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.VersionResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 版本记录 + tags: + - 基本配置 /api/v1/wallet/amountFlow: get: consumes: diff --git a/go.mod b/go.mod index f640585..f333c81 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241127023000-629023eee8c6 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241127081813-15aa08a421b0 code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241126134228-b1047bfb8475 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5