dengbiao 2 meses atrás
pai
commit
37968c35ed
7 arquivos alterados com 372 adições e 0 exclusões
  1. +19
    -0
      app/enum/enum_sys_cfg.go
  2. +64
    -0
      app/hdl/hdl_set_center.go
  3. +11
    -0
      app/md/md_set_center.go
  4. +6
    -0
      app/router/router.go
  5. +102
    -0
      docs/docs.go
  6. +102
    -0
      docs/swagger.json
  7. +68
    -0
      docs/swagger.yaml

+ 19
- 0
app/enum/enum_sys_cfg.go Ver arquivo

@@ -0,0 +1,19 @@
package enum

type SysCfg string

const (
AppName = "app_name"
AppLogo = "app_logo"
)

func (gt SysCfg) String() string {
switch gt {
case AppName:
return "项目名称"
case AppLogo:
return "项目logo"
default:
return "未知"
}
}

+ 64
- 0
app/hdl/hdl_set_center.go Ver arquivo

@@ -0,0 +1,64 @@
package hdl

import (
implement2 "applet/app/db/implement"
"applet/app/e"
"applet/app/enum"
"applet/app/lib/validate"
"applet/app/md"
"applet/app/svc"
db "code.fnuoos.com/zhimeng/model.git/src"
"github.com/gin-gonic/gin"
)

// BasicSet
// @Summary 基础设置
// @Tags 设置中心-基础设置
// @Description 基础设置-设置
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.BasicSetReq true "请求参数"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/setCenter/basicSet [POST]
func BasicSet(c *gin.Context) {
var req md.BasicSetReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
masterId := svc.GetMasterId(c)
engine := db.DBs[masterId]
sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
sysCfgDb.SysCfgUpdate(enum.AppName, req.AppName)
sysCfgDb.SysCfgUpdate(enum.AppLogo, req.AppLogo)
e.OutSuc(c, "success", nil)
return
}

// BasicGet
// @Summary 基础设置
// @Tags 设置中心-基础设置
// @Description 基础设置-获取
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/setCenter/basicGet [GET]
func BasicGet(c *gin.Context) {
masterId := svc.GetMasterId(c)
engine := db.DBs[masterId]
sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
res := sysCfgDb.SysCfgFindWithDb(enum.AppLogo, enum.AppName)

e.OutSuc(c, md.BasicSetResp{
AppName: res[enum.AppName],
AppLogo: res[enum.AppLogo],
}, nil)
return
}

+ 11
- 0
app/md/md_set_center.go Ver arquivo

@@ -0,0 +1,11 @@
package md

type BasicSetReq struct {
AppName string `json:"app_name" binding:"required" example:"项目名称"`
AppLogo string `json:"app_logo" binding:"required" example:"项目logo"`
}

type BasicSetResp struct {
AppName string `json:"app_name" example:"项目名称"`
AppLogo string `json:"app_logo" example:"项目logo"`
}

+ 6
- 0
app/router/router.go Ver arquivo

@@ -76,12 +76,18 @@ func route(r *gin.RouterGroup) {
rRole(r.Group("/role")) // 权限管理
rDataCenter(r.Group("/dataCenter")) // 数据中心
rSmsCenter(r.Group("/smsCenter")) // 短信中心
rSetCenter(r.Group("/setCenter")) // 设置中心
}

func rComm(r *gin.RouterGroup) {
r.POST("/getMenuList", hdl.MenuList) // 获取菜单栏列表
}

func rSetCenter(r *gin.RouterGroup) {
r.POST("/basicSet", hdl.BasicSet)
r.GET("/basicGet", hdl.BasicGet)
}

func rRole(r *gin.RouterGroup) {
r.GET("/roleList", hdl.RoleList) // 角色列表
r.POST("/addRole", hdl.AddRole) // 角色添加


+ 102
- 0
docs/docs.go Ver arquivo

@@ -835,6 +835,91 @@ const docTemplate = `{
}
}
},
"/api/setCenter/basicGet": {
"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": "success",
"schema": {
"type": "string"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/setCenter/basicSet": {
"post": {
"description": "基础设置-设置",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"设置中心-基础设置"
],
"summary": "基础设置",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "请求参数",
"name": "args",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.BasicSetReq"
}
}
],
"responses": {
"200": {
"description": "success",
"schema": {
"type": "string"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/smsCenter/detail": {
"post": {
"description": "短信中心-详情",
@@ -1028,6 +1113,23 @@ const docTemplate = `{
}
}
},
"md.BasicSetReq": {
"type": "object",
"required": [
"app_logo",
"app_name"
],
"properties": {
"app_logo": {
"type": "string",
"example": "项目logo"
},
"app_name": {
"type": "string",
"example": "项目名称"
}
}
},
"md.BindAdminRoleReq": {
"type": "object",
"required": [


+ 102
- 0
docs/swagger.json Ver arquivo

@@ -827,6 +827,91 @@
}
}
},
"/api/setCenter/basicGet": {
"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": "success",
"schema": {
"type": "string"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/setCenter/basicSet": {
"post": {
"description": "基础设置-设置",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"设置中心-基础设置"
],
"summary": "基础设置",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "请求参数",
"name": "args",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.BasicSetReq"
}
}
],
"responses": {
"200": {
"description": "success",
"schema": {
"type": "string"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/smsCenter/detail": {
"post": {
"description": "短信中心-详情",
@@ -1020,6 +1105,23 @@
}
}
},
"md.BasicSetReq": {
"type": "object",
"required": [
"app_logo",
"app_name"
],
"properties": {
"app_logo": {
"type": "string",
"example": "项目logo"
},
"app_name": {
"type": "string",
"example": "项目名称"
}
}
},
"md.BindAdminRoleReq": {
"type": "object",
"required": [


+ 68
- 0
docs/swagger.yaml Ver arquivo

@@ -32,6 +32,18 @@ definitions:
username:
type: string
type: object
md.BasicSetReq:
properties:
app_logo:
example: 项目logo
type: string
app_name:
example: 项目名称
type: string
required:
- app_logo
- app_name
type: object
md.BindAdminRoleReq:
properties:
adm_id:
@@ -1015,6 +1027,62 @@ paths:
summary: 修改角色状态
tags:
- 权限管理
/api/setCenter/basicGet:
get:
consumes:
- application/json
description: 基础设置-获取
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: success
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 基础设置
tags:
- 设置中心-基础设置
/api/setCenter/basicSet:
post:
consumes:
- application/json
description: 基础设置-设置
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 请求参数
in: body
name: args
required: true
schema:
$ref: '#/definitions/md.BasicSetReq'
produces:
- application/json
responses:
"200":
description: success
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 基础设置
tags:
- 设置中心-基础设置
/api/smsCenter/detail:
post:
consumes:


Carregando…
Cancelar
Salvar