From 49bc0fa050a1d119fee3f53e1a67f88644ec617d Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 19 Sep 2024 11:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_set_center.go | 41 +++++++++++++++++++++++++++++++++++++++ app/md/md_set_center.go | 6 ++++++ app/router/router.go | 9 +++++++++ 3 files changed, 56 insertions(+) create mode 100644 app/hdl/hdl_set_center.go create mode 100644 app/md/md_set_center.go diff --git a/app/hdl/hdl_set_center.go b/app/hdl/hdl_set_center.go new file mode 100644 index 0000000..4d4a021 --- /dev/null +++ b/app/hdl/hdl_set_center.go @@ -0,0 +1,41 @@ +package hdl + +import ( + "applet/app/e" + "applet/app/md" + "applet/app/svc" + "applet/app/utils" + db "code.fnuoos.com/zhimeng/model.git/src" + "code.fnuoos.com/zhimeng/model.git/src/super/implement" + "github.com/gin-gonic/gin" +) + +// ShareIndex +// @Summary 邀请链接 +// @Tags 基本配置-邀请链接 +// @Description 邀请链接界面接口 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Success 200 {object} md.ShareIndexResp +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/setCenter/share/index [GET] +func ShareIndex(c *gin.Context) { + masterId := svc.GetMasterId(c) + userAppDomainDb := implement.NewUserAppDomainDb(db.Db) + agent, err := userAppDomainDb.GetAppDomainByType("agent", masterId) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + agentDomain := "" + if agent != nil { + agentDomain = agent.Domain + } + user := svc.GetUser(c) + e.OutSuc(c, md.ShareIndexResp{ + MasterId: masterId, + AgentDomain: agentDomain + "?agent_id=" + utils.IntToStr(user.AgentId), + }, nil) + return +} diff --git a/app/md/md_set_center.go b/app/md/md_set_center.go new file mode 100644 index 0000000..4434d8d --- /dev/null +++ b/app/md/md_set_center.go @@ -0,0 +1,6 @@ +package md + +type ShareIndexResp struct { + MasterId string `json:"master_id"` + AgentDomain string `json:"agent_domain" example:"代理分享地址"` +} diff --git a/app/router/router.go b/app/router/router.go index 2e6a47a..43e5729 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -72,6 +72,7 @@ func route(r *gin.RouterGroup) { rDataCenter(r.Group("/dataCenter")) //数据中心 rSettleCenter(r.Group("/settleCenter")) //结算中心 rFinancialDynamics(r.Group("/financialDynamics")) //资产动态 + rSetCenter(r.Group("/setCenter")) //基本配置 } func rRole(r *gin.RouterGroup) { @@ -102,6 +103,14 @@ func rAccount(r *gin.RouterGroup) { r.POST("/qualification/bank/save", hdl.QualificationBankSave) //资质认证-银行资质保存 r.POST("/qualification/contact/save", hdl.QualificationContactSave) //资质认证-联系方式保存 } +func rSetCenter(r *gin.RouterGroup) { + rShareSetCenter := r.Group("/share") + { + rShareSetCenter.GET("/index", hdl.ShareIndex) + } + +} + func rIndex(r *gin.RouterGroup) { r.GET("/base", hdl.Base) //首页-基本信息 r.GET("/total", hdl.IndexTotal) //首页-统计数据