From 4ceb8f3b9a828035fd450dda32e3e1aaa64b70dc Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 23 Nov 2024 16:42:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E9=85=8D=E7=BD=AE=20?= =?UTF-8?q?=E5=B9=BF=E5=91=8A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_advertising.go | 35 +++++ app/hdl/hdl_article.go | 32 +++++ app/hdl/hdl_config.go | 45 ++++++ app/hdl/hdl_login.go | 6 +- app/hdl/hdl_user.go | 9 +- app/md/md_advertising.go | 37 +++++ app/md/md_config.go | 10 ++ app/md/md_user.go | 1 + app/router/router.go | 21 ++- app/svc/svc_advertising.go | 103 +++++++++++++ app/svc/svc_common.go | 23 ++- docs/docs.go | 287 ++++++++++++++++++++++++++++++++++++- docs/swagger.json | 282 +++++++++++++++++++++++++++++++++++- docs/swagger.yaml | 193 ++++++++++++++++++++++++- go.mod | 2 +- static/html/article.html | 64 ++++----- 16 files changed, 1099 insertions(+), 51 deletions(-) create mode 100644 app/hdl/hdl_advertising.go create mode 100644 app/hdl/hdl_article.go create mode 100644 app/hdl/hdl_config.go create mode 100644 app/md/md_advertising.go create mode 100644 app/md/md_config.go create mode 100644 app/svc/svc_advertising.go diff --git a/app/hdl/hdl_advertising.go b/app/hdl/hdl_advertising.go new file mode 100644 index 0000000..36bfeac --- /dev/null +++ b/app/hdl/hdl_advertising.go @@ -0,0 +1,35 @@ +package hdl + +import ( + "applet/app/svc" + "github.com/gin-gonic/gin" +) + +// Advertising +// @Summary 广告位 +// @Tags 广告位 +// @Description 广告位 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.AdvertisingResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/advertising [get] +func Advertising(c *gin.Context) { + svc.Advertising(c) +} + +// AdvertisingDetail +// @Summary 广告位详情 +// @Tags 广告位详情 +// @Description 广告位详情 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingReq true "注册参数" +// @Success 200 {object} md.AdvertisingSpace "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/advertising/detail [post] +func AdvertisingDetail(c *gin.Context) { + svc.AdvertisingDetail(c) +} diff --git a/app/hdl/hdl_article.go b/app/hdl/hdl_article.go new file mode 100644 index 0000000..facdd88 --- /dev/null +++ b/app/hdl/hdl_article.go @@ -0,0 +1,32 @@ +package hdl + +import ( + "applet/app/db" + "applet/app/e" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "github.com/gin-gonic/gin" + "html/template" + "net/http" +) + +func ArticleHtml(c *gin.Context) { + articleId := c.Query("article_id") + if articleId == "" { + e.OutErr(c, e.ERR_INVALID_ARGS) + return + } + NewArticleDb := implement.NewArticleDb(db.Db) + article, err := NewArticleDb.GetArticle(articleId) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM) + return + } + if article.Id == 0 { + e.OutErr(c, e.ERR_NO_DATA) + return + } + c.HTML(http.StatusOK, "article.html", gin.H{ + "title": template.HTML(article.Title), + "content": article.Content, + }) +} diff --git a/app/hdl/hdl_config.go b/app/hdl/hdl_config.go new file mode 100644 index 0000000..427c2fb --- /dev/null +++ b/app/hdl/hdl_config.go @@ -0,0 +1,45 @@ +package hdl + +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" + "fmt" + "github.com/gin-gonic/gin" +) + +// Config +// @Summary 基本配置 +// @Tags 基本配置 +// @Description 基本配置 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.ConfigResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/config [get] +func Config(c *gin.Context) { + res := md.ConfigResp{} + eg := db.Db + NewArticleDb := implement.NewArticleDb(eg) + article, _ := NewArticleDb.ArticleCateByTypeId("1") + if article != nil { + res.Title = article.Title + res.Content = article.Content + } + userArticle, _ := NewArticleDb.ArticleCateByTypeId("2") + if userArticle != nil { + res.UserTitle = userArticle.Title + res.UserUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id)) + } + privacyArticle, _ := NewArticleDb.ArticleCateByTypeId("3") + if privacyArticle != nil { + res.PrivacyTitle = privacyArticle.Title + res.PrivacyUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id)) + } + e.OutSuc(c, res, nil) + return +} diff --git a/app/hdl/hdl_login.go b/app/hdl/hdl_login.go index 21f1acf..fb25b35 100644 --- a/app/hdl/hdl_login.go +++ b/app/hdl/hdl_login.go @@ -154,7 +154,11 @@ func WechatLogin(c *gin.Context) { userModel.OpenId = req.OpenID userModel.Avatar = req.Avatar userModel.Nickname = req.Nickname - newUserDb.UpdateUser(userModel, "open_id,avatar,nickname") + now := time.Now() + userModel.LastLoginAt = now.Format("2006-01-02 15:04:05") + userModel.LastLoginIp = utils.GetIP(c.Request) + userModel.UpdateAt = now.Format("2006-01-02 15:04:05") + newUserDb.UpdateUser(userModel, "open_id,avatar,nickname,last_login_ip,last_login_at,update_at") token, err = svc.HandleLoginToken(userModel) if err != nil { e.OutErr(c, e.ERR, err.Error()) diff --git a/app/hdl/hdl_user.go b/app/hdl/hdl_user.go index 21c343b..7a029ea 100644 --- a/app/hdl/hdl_user.go +++ b/app/hdl/hdl_user.go @@ -5,7 +5,6 @@ import ( "applet/app/md" "applet/app/svc" "applet/app/utils" - "fmt" "github.com/gin-gonic/gin" ) @@ -21,7 +20,6 @@ import ( // @Router /api/v1/userInfo [get] func UserInfo(c *gin.Context) { user := svc.GetUser(c) - fmt.Println(1233333) res := md.UserInfoResp{ Id: utils.Int64ToStr(user.Id), Phone: user.Phone, @@ -29,6 +27,12 @@ func UserInfo(c *gin.Context) { InviteCode: user.SystemInviteCode, IsBindExtend: "0", } + if user.Avatar == "" { + user.Avatar = svc.GetSysCfgStr("default_avatar") + } + if user.Avatar != "" { + res.HeadImg = svc.GetOssUrl(user.Avatar) + } if user.CustomInviteCode != "" { res.InviteCode = user.CustomInviteCode } @@ -36,6 +40,5 @@ func UserInfo(c *gin.Context) { res.IsBindExtend = "1" } e.OutSuc(c, res, nil) - fmt.Println(1111111) return } diff --git a/app/md/md_advertising.go b/app/md/md_advertising.go new file mode 100644 index 0000000..1539343 --- /dev/null +++ b/app/md/md_advertising.go @@ -0,0 +1,37 @@ +package md + +type AdvertisingReq struct { + Id string `json:"id"` +} +type AdvertisingResp struct { + Basic AdvertisingBasic `json:"basic" ` + Space []AdvertisingSpace `json:"space" ` + Function []AdvertisingFunction `json:"function" ` + Pop AdvertisingLimit `json:"pop" ` +} +type AdvertisingBasic struct { + Info map[string]interface{} `json:"info" ` + AndroidAdIsOpen string `json:"android_ad_is_open" example:"安卓广告是否开启(1:开启 0:不开启)"` + IosAdIsOpen string `json:"ios_ad_is_open" example:"ios广告是否开启(1:开启 0:不开启)"` + AndroidOpenAdIsOpen string `json:"android_open_ad_is_open" example:"安卓开屏广告是否开启(1:开启 0:不开启)"` + IosOpenAdIsOpen string `json:"ios_open_ad_is_open" example:"ios开屏广告是否开启(1:开启 0:不开启)"` + Voice string `json:"voice" example:"领取声音"` +} +type AdvertisingSpace struct { + Id string `json:"id" example:"id"` + Name string `json:"name" example:"名称"` + Kind string `json:"kind" example:"广告类型(1:开屏广告 2:插屏广告 3:激励视频 4:信息流广告)"` + Info map[string]interface{} `json:"info" ` + CountingDown string `json:"counting_down" example:"倒计时 x秒"` +} +type AdvertisingFunction struct { + Name string `json:"name" example:"名称"` + Type string `json:"type" example:"位置"` + AdId string `json:"ad_id" example:"广告id"` +} +type AdvertisingLimit struct { + PublicImg string `json:"public_img" example:"公共弹窗图"` + PublicStr string `json:"public_str" example:"公共弹窗文字"` + WithdrawImg string `json:"withdraw_img" example:"提现弹窗图"` + WithdrawStr string `json:"withdraw_str" example:"提现弹窗文字"` +} diff --git a/app/md/md_config.go b/app/md/md_config.go new file mode 100644 index 0000000..7f40ef9 --- /dev/null +++ b/app/md/md_config.go @@ -0,0 +1,10 @@ +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:"隐私协议链接"` +} diff --git a/app/md/md_user.go b/app/md/md_user.go index 71301a3..53103a7 100644 --- a/app/md/md_user.go +++ b/app/md/md_user.go @@ -5,5 +5,6 @@ type UserInfoResp struct { Phone string `json:"phone"` Nickname string `json:"nickname"` InviteCode string `json:"invite_code"` + HeadImg string `json:"head_img"` IsBindExtend string `json:"is_bind_extend" example:"是否绑定了上级 0否 1是"` } diff --git a/app/router/router.go b/app/router/router.go index 43b83c8..3bdda1b 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -9,6 +9,7 @@ import ( "github.com/gin-gonic/gin" swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" + "net/http" ) // 初始化路由 @@ -31,6 +32,7 @@ func Init() *gin.Engine { r.Use(gin.Logger()) } r.Use(gin.Recovery()) + r.Delims("<<<", ">>>").LoadHTMLGlob("static/html/*") r.GET("/favicon.ico", func(c *gin.Context) { c.Status(204) @@ -47,18 +49,23 @@ func Init() *gin.Engine { } func route(r *gin.RouterGroup) { + r.StaticFS("/static", http.Dir("./static")) r.GET("/test", hdl.Demo) r.Any("/createSign", hdl.CreateSign) r.Any("/aesDecryptByECB", hdl.AesDecryptByECB) + r.GET("/article/html", hdl.ArticleHtml) //H5渲染的文章 r.Use(mw.CheckSign) r.Any("/testCreateSign", hdl.TestCreateSign) - r.POST("/smsSend", hdl.SmsSend) //发送短信 - r.POST("/fastLogin", hdl.FastLogin) //一键登录 - r.POST("/wechatLogin", hdl.WechatLogin) //微信登录 - r.POST("/register", hdl.Register) //注册 - r.POST("/login", hdl.Login) //登录 - r.POST("/findPassword", hdl.FindPassword) //找回密码 - r.Use(mw.Auth) // 以下接口需要JWT验证 + r.GET("/config", hdl.Config) //基本配置 + r.GET("/advertising", hdl.Advertising) //广告位 + r.POST("/advertising/detail", hdl.AdvertisingDetail) //广告位 + r.POST("/smsSend", hdl.SmsSend) //发送短信 + r.POST("/fastLogin", hdl.FastLogin) //一键登录 + r.POST("/wechatLogin", hdl.WechatLogin) //微信登录 + r.POST("/register", hdl.Register) //注册 + r.POST("/login", hdl.Login) //登录 + r.POST("/findPassword", hdl.FindPassword) //找回密码 + r.Use(mw.Auth) // 以下接口需要JWT验证 rComm(r.Group("/comm")) r.GET("/userInfo", hdl.UserInfo) //用户基础信息 rHomePage := r.Group("/homePage") diff --git a/app/svc/svc_advertising.go b/app/svc/svc_advertising.go new file mode 100644 index 0000000..2a77aa8 --- /dev/null +++ b/app/svc/svc_advertising.go @@ -0,0 +1,103 @@ +package svc + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "encoding/json" + "github.com/gin-gonic/gin" +) + +func Advertising(c *gin.Context) { + eg := db.Db + + var res = md.AdvertisingResp{} + NewAdvertisingBasicDb := implement.NewAdvertisingBasicDb(eg) + NewAdvertisingBasic, _ := NewAdvertisingBasicDb.GetAdvertisingBasicDb() + if NewAdvertisingBasic != nil { + var info = make(map[string]interface{}) + json.Unmarshal([]byte(NewAdvertisingBasic.Info), &info) + res.Basic = md.AdvertisingBasic{ + Info: info, + AndroidAdIsOpen: utils.IntToStr(NewAdvertisingBasic.AndroidOpenAdIsOpen), + IosAdIsOpen: utils.IntToStr(NewAdvertisingBasic.IosAdIsOpen), + AndroidOpenAdIsOpen: utils.IntToStr(NewAdvertisingBasic.AndroidOpenAdIsOpen), + IosOpenAdIsOpen: utils.IntToStr(NewAdvertisingBasic.IosOpenAdIsOpen), + Voice: GetOssUrl(NewAdvertisingBasic.Voice), + } + } + NewAdvertisingLimitDb := implement.NewAdvertisingLimitDb(eg) + NewAdvertisingLimit, _ := NewAdvertisingLimitDb.GetAdvertisingLimit() + if NewAdvertisingLimit != nil { + res.Pop = md.AdvertisingLimit{ + PublicImg: GetOssUrl(NewAdvertisingLimit.PublicImg), + PublicStr: NewAdvertisingLimit.PublicStr, + WithdrawImg: GetOssUrl(NewAdvertisingLimit.WithdrawImg), + WithdrawStr: NewAdvertisingLimit.WithdrawStr, + } + } + NewAdvertisingFunctionDb := implement.NewAdvertisingFunctionDb(eg) + NewAdvertisingFunction, _ := NewAdvertisingFunctionDb.AdvertisingFunctionAll() + AdvertisingFunctionTmp := make([]md.AdvertisingFunction, 0) + if NewAdvertisingFunction != nil { + for _, v := range *NewAdvertisingFunction { + tmp := md.AdvertisingFunction{ + Name: v.Name, + Type: v.Type, + AdId: utils.IntToStr(v.AdId), + } + AdvertisingFunctionTmp = append(AdvertisingFunctionTmp, tmp) + } + } + res.Function = AdvertisingFunctionTmp + NewAdvertisingSpaceDb := implement.NewAdvertisingSpaceDb(eg) + NewAdvertisingSpace, _ := NewAdvertisingSpaceDb.AdvertisingSpaceAll() + NewAdvertisingSpaceTmp := make([]md.AdvertisingSpace, 0) + if NewAdvertisingSpace != nil { + for _, v := range *NewAdvertisingSpace { + var info = make(map[string]interface{}) + json.Unmarshal([]byte(v.Info), &info) + tmp := md.AdvertisingSpace{ + Id: utils.IntToStr(v.Id), + Name: v.Name, + Kind: utils.IntToStr(v.Kind), + Info: info, + CountingDown: utils.IntToStr(v.CountingDown), + } + NewAdvertisingSpaceTmp = append(NewAdvertisingSpaceTmp, tmp) + } + } + res.Space = NewAdvertisingSpaceTmp + e.OutSuc(c, res, nil) + return +} +func AdvertisingDetail(c *gin.Context) { + eg := db.Db + var req md.AdvertisingReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + var res = md.AdvertisingSpace{} + NewAdvertisingSpaceDb := implement.NewAdvertisingSpaceDb(eg) + NewAdvertisingSpace, _ := NewAdvertisingSpaceDb.GetAdvertisingSpace(req.Id) + if NewAdvertisingSpace != nil { + var info = make(map[string]interface{}) + json.Unmarshal([]byte(NewAdvertisingSpace.Info), &info) + tmp := md.AdvertisingSpace{ + Id: utils.IntToStr(NewAdvertisingSpace.Id), + Name: NewAdvertisingSpace.Name, + Kind: utils.IntToStr(NewAdvertisingSpace.Kind), + Info: info, + CountingDown: utils.IntToStr(NewAdvertisingSpace.CountingDown), + } + res = tmp + } + e.OutSuc(c, res, nil) + return +} diff --git a/app/svc/svc_common.go b/app/svc/svc_common.go index 358a00e..adb5c64 100644 --- a/app/svc/svc_common.go +++ b/app/svc/svc_common.go @@ -1,6 +1,12 @@ package svc -import "applet/app/utils/logx" +import ( + "applet/app/db" + "applet/app/utils/cache" + "applet/app/utils/logx" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "strings" +) // 简单的recover func Rev() { @@ -8,3 +14,18 @@ func Rev() { _ = logx.Error(err) } } +func GetOssUrl(img string) string { + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + sysCfg := sysCfgDb.SysCfgFindWithDb("file_bucket_scheme", "file_bucket_host") + if strings.Contains(img, "http") == false && img != "" { + img = sysCfg["file_bucket_scheme"] + "://" + sysCfg["file_bucket_host"] + img + } + return img +} +func GetSysCfgStr(key string) string { + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + return sysCfgDb.SysCfgGetWithDb(key) + +} diff --git a/docs/docs.go b/docs/docs.go index 3772b9d..751c52d 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,4 +1,5 @@ -// Package docs Code generated by swaggo/swag. DO NOT EDIT +// Code generated by swaggo/swag. DO NOT EDIT. + package docs import "github.com/swaggo/swag" @@ -322,6 +323,91 @@ const docTemplate = `{ } } }, + "/api/v1/advertising": { + "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.AdvertisingResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/advertising/detail": { + "post": { + "description": "广告位详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "广告位详情" + ], + "summary": "广告位详情", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "注册参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AdvertisingReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.AdvertisingSpace" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/comm/getOssUrl": { "get": { "description": "上传许可链接(获取)", @@ -360,6 +446,44 @@ const docTemplate = `{ } } }, + "/api/v1/config": { + "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.ConfigResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/fastLogin": { "post": { "description": "一键登录", @@ -1026,7 +1150,9 @@ const docTemplate = `{ "name": "req", "in": "body", "required": true, - "schema": {} + "schema": { + "type": "object" + } } ], "responses": { @@ -1143,6 +1269,129 @@ const docTemplate = `{ } } }, + "md.AdvertisingBasic": { + "type": "object", + "properties": { + "android_ad_is_open": { + "type": "string", + "example": "安卓广告是否开启(1:开启 0:不开启)" + }, + "android_open_ad_is_open": { + "type": "string", + "example": "安卓开屏广告是否开启(1:开启 0:不开启)" + }, + "info": { + "type": "object", + "additionalProperties": true + }, + "ios_ad_is_open": { + "type": "string", + "example": "ios广告是否开启(1:开启 0:不开启)" + }, + "ios_open_ad_is_open": { + "type": "string", + "example": "ios开屏广告是否开启(1:开启 0:不开启)" + }, + "voice": { + "type": "string", + "example": "领取声音" + } + } + }, + "md.AdvertisingFunction": { + "type": "object", + "properties": { + "ad_id": { + "type": "string", + "example": "广告id" + }, + "name": { + "type": "string", + "example": "名称" + }, + "type": { + "type": "string", + "example": "位置" + } + } + }, + "md.AdvertisingLimit": { + "type": "object", + "properties": { + "public_img": { + "type": "string", + "example": "公共弹窗图" + }, + "public_str": { + "type": "string", + "example": "公共弹窗文字" + }, + "withdraw_img": { + "type": "string", + "example": "提现弹窗图" + }, + "withdraw_str": { + "type": "string", + "example": "提现弹窗文字" + } + } + }, + "md.AdvertisingReq": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "md.AdvertisingResp": { + "type": "object", + "properties": { + "basic": { + "$ref": "#/definitions/md.AdvertisingBasic" + }, + "function": { + "type": "array", + "items": { + "$ref": "#/definitions/md.AdvertisingFunction" + } + }, + "pop": { + "$ref": "#/definitions/md.AdvertisingLimit" + }, + "space": { + "type": "array", + "items": { + "$ref": "#/definitions/md.AdvertisingSpace" + } + } + } + }, + "md.AdvertisingSpace": { + "type": "object", + "properties": { + "counting_down": { + "type": "string", + "example": "倒计时 x秒" + }, + "id": { + "type": "string", + "example": "id" + }, + "info": { + "type": "object", + "additionalProperties": true + }, + "kind": { + "type": "string", + "example": "广告类型(1:开屏广告 2:插屏广告 3:激励视频 4:信息流广告)" + }, + "name": { + "type": "string", + "example": "名称" + } + } + }, "md.BasalRateResp": { "type": "object", "properties": { @@ -1180,6 +1429,35 @@ const docTemplate = `{ } } }, + "md.ConfigResp": { + "type": "object", + "properties": { + "content": { + "type": "string", + "example": "软件使用协议内容" + }, + "privacy_title": { + "type": "string", + "example": "隐私协议标题" + }, + "privacy_url": { + "type": "string", + "example": "隐私协议链接" + }, + "title": { + "type": "string", + "example": "软件使用协议标题" + }, + "user_title": { + "type": "string", + "example": "用户协议标题" + }, + "user_url": { + "type": "string", + "example": "用户协议链接" + } + } + }, "md.ContributionValueFlowNode": { "type": "object", "properties": { @@ -1899,6 +2177,9 @@ const docTemplate = `{ "md.UserInfoResp": { "type": "object", "properties": { + "head_img": { + "type": "string" + }, "id": { "type": "string" }, @@ -1951,8 +2232,6 @@ var SwaggerInfo = &swag.Spec{ Description: "APP客户端-Api接口", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, - LeftDelim: "{{", - RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index d15d976..108e984 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -316,6 +316,91 @@ } } }, + "/api/v1/advertising": { + "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.AdvertisingResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/v1/advertising/detail": { + "post": { + "description": "广告位详情", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "广告位详情" + ], + "summary": "广告位详情", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "注册参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AdvertisingReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.AdvertisingSpace" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/comm/getOssUrl": { "get": { "description": "上传许可链接(获取)", @@ -354,6 +439,44 @@ } } }, + "/api/v1/config": { + "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.ConfigResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/fastLogin": { "post": { "description": "一键登录", @@ -1020,7 +1143,9 @@ "name": "req", "in": "body", "required": true, - "schema": {} + "schema": { + "type": "object" + } } ], "responses": { @@ -1137,6 +1262,129 @@ } } }, + "md.AdvertisingBasic": { + "type": "object", + "properties": { + "android_ad_is_open": { + "type": "string", + "example": "安卓广告是否开启(1:开启 0:不开启)" + }, + "android_open_ad_is_open": { + "type": "string", + "example": "安卓开屏广告是否开启(1:开启 0:不开启)" + }, + "info": { + "type": "object", + "additionalProperties": true + }, + "ios_ad_is_open": { + "type": "string", + "example": "ios广告是否开启(1:开启 0:不开启)" + }, + "ios_open_ad_is_open": { + "type": "string", + "example": "ios开屏广告是否开启(1:开启 0:不开启)" + }, + "voice": { + "type": "string", + "example": "领取声音" + } + } + }, + "md.AdvertisingFunction": { + "type": "object", + "properties": { + "ad_id": { + "type": "string", + "example": "广告id" + }, + "name": { + "type": "string", + "example": "名称" + }, + "type": { + "type": "string", + "example": "位置" + } + } + }, + "md.AdvertisingLimit": { + "type": "object", + "properties": { + "public_img": { + "type": "string", + "example": "公共弹窗图" + }, + "public_str": { + "type": "string", + "example": "公共弹窗文字" + }, + "withdraw_img": { + "type": "string", + "example": "提现弹窗图" + }, + "withdraw_str": { + "type": "string", + "example": "提现弹窗文字" + } + } + }, + "md.AdvertisingReq": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "md.AdvertisingResp": { + "type": "object", + "properties": { + "basic": { + "$ref": "#/definitions/md.AdvertisingBasic" + }, + "function": { + "type": "array", + "items": { + "$ref": "#/definitions/md.AdvertisingFunction" + } + }, + "pop": { + "$ref": "#/definitions/md.AdvertisingLimit" + }, + "space": { + "type": "array", + "items": { + "$ref": "#/definitions/md.AdvertisingSpace" + } + } + } + }, + "md.AdvertisingSpace": { + "type": "object", + "properties": { + "counting_down": { + "type": "string", + "example": "倒计时 x秒" + }, + "id": { + "type": "string", + "example": "id" + }, + "info": { + "type": "object", + "additionalProperties": true + }, + "kind": { + "type": "string", + "example": "广告类型(1:开屏广告 2:插屏广告 3:激励视频 4:信息流广告)" + }, + "name": { + "type": "string", + "example": "名称" + } + } + }, "md.BasalRateResp": { "type": "object", "properties": { @@ -1174,6 +1422,35 @@ } } }, + "md.ConfigResp": { + "type": "object", + "properties": { + "content": { + "type": "string", + "example": "软件使用协议内容" + }, + "privacy_title": { + "type": "string", + "example": "隐私协议标题" + }, + "privacy_url": { + "type": "string", + "example": "隐私协议链接" + }, + "title": { + "type": "string", + "example": "软件使用协议标题" + }, + "user_title": { + "type": "string", + "example": "用户协议标题" + }, + "user_url": { + "type": "string", + "example": "用户协议链接" + } + } + }, "md.ContributionValueFlowNode": { "type": "object", "properties": { @@ -1893,6 +2170,9 @@ "md.UserInfoResp": { "type": "object", "properties": { + "head_img": { + "type": "string" + }, "id": { "type": "string" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 76cf49e..59857db 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -12,6 +12,92 @@ definitions: description: 总数据量 type: integer type: object + md.AdvertisingBasic: + properties: + android_ad_is_open: + example: 安卓广告是否开启(1:开启 0:不开启) + type: string + android_open_ad_is_open: + example: 安卓开屏广告是否开启(1:开启 0:不开启) + type: string + info: + additionalProperties: true + type: object + ios_ad_is_open: + example: ios广告是否开启(1:开启 0:不开启) + type: string + ios_open_ad_is_open: + example: ios开屏广告是否开启(1:开启 0:不开启) + type: string + voice: + example: 领取声音 + type: string + type: object + md.AdvertisingFunction: + properties: + ad_id: + example: 广告id + type: string + name: + example: 名称 + type: string + type: + example: 位置 + type: string + type: object + md.AdvertisingLimit: + properties: + public_img: + example: 公共弹窗图 + type: string + public_str: + example: 公共弹窗文字 + type: string + withdraw_img: + example: 提现弹窗图 + type: string + withdraw_str: + example: 提现弹窗文字 + type: string + type: object + md.AdvertisingReq: + properties: + id: + type: string + type: object + md.AdvertisingResp: + properties: + basic: + $ref: '#/definitions/md.AdvertisingBasic' + function: + items: + $ref: '#/definitions/md.AdvertisingFunction' + type: array + pop: + $ref: '#/definitions/md.AdvertisingLimit' + space: + items: + $ref: '#/definitions/md.AdvertisingSpace' + type: array + type: object + md.AdvertisingSpace: + properties: + counting_down: + example: 倒计时 x秒 + type: string + id: + example: id + type: string + info: + additionalProperties: true + type: object + kind: + example: 广告类型(1:开屏广告 2:插屏广告 3:激励视频 4:信息流广告) + type: string + name: + example: 名称 + type: string + type: object md.BasalRateResp: properties: basal_rate: @@ -39,6 +125,27 @@ definitions: description: 收益倒计时 type: string type: object + md.ConfigResp: + properties: + content: + example: 软件使用协议内容 + type: string + privacy_title: + example: 隐私协议标题 + type: string + privacy_url: + example: 隐私协议链接 + type: string + title: + example: 软件使用协议标题 + type: string + user_title: + example: 用户协议标题 + type: string + user_url: + example: 用户协议链接 + type: string + type: object md.ContributionValueFlowNode: properties: amount: @@ -534,6 +641,8 @@ definitions: type: object md.UserInfoResp: properties: + head_img: + type: string id: type: string invite_code: @@ -772,6 +881,62 @@ paths: summary: 蛋蛋星球-添加好友-总速率(获取) tags: - 添加好友 + /api/v1/advertising: + 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.AdvertisingResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 广告位 + tags: + - 广告位 + /api/v1/advertising/detail: + post: + consumes: + - application/json + description: 广告位详情 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 注册参数 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.AdvertisingReq' + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.AdvertisingSpace' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 广告位详情 + tags: + - 广告位详情 /api/v1/comm/getOssUrl: get: consumes: @@ -797,6 +962,31 @@ paths: summary: 通用请求-对象存储-上传许可链接(获取) tags: - 对象存储 + /api/v1/config: + 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.ConfigResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 基本配置 + tags: + - 基本配置 /api/v1/fastLogin: post: consumes: @@ -1232,7 +1422,8 @@ paths: in: body name: req required: true - schema: {} + schema: + type: object produces: - application/json responses: diff --git a/go.mod b/go.mod index 7ac4a35..611c654 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241122113411-25d1f2bb1ad8 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241123072806-2fc832067f77 code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241123034858-48fbf35fcb21 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 diff --git a/static/html/article.html b/static/html/article.html index ad76ce5..538566d 100644 --- a/static/html/article.html +++ b/static/html/article.html @@ -1,22 +1,26 @@ -
-