From 38131b7858556ba2590eafa469e6ce23a145423c Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Mon, 23 Oct 2023 11:44:52 +0800 Subject: [PATCH] 1 --- database/admindb.sql | 31 ++++++ .../adminserver/api/v1/system/announcement.go | 104 ++++++++++++++++++ server/adminserver/api/v1/system/audit.go | 96 ++++++++++++++++ server/adminserver/api/v1/system/email.go | 70 ++++++++++++ server/adminserver/api/v1/system/enter.go | 3 + server/adminserver/api/v1/system/sys_user.go | 80 +++++++++----- server/adminserver/app/app.go | 14 ++- server/adminserver/common/types.go | 3 +- server/adminserver/constant/constant.go | 8 +- server/adminserver/middleware/auth.go | 6 +- server/adminserver/middleware/cors.go | 24 ++++ .../adminserver/model/system/announcement.go | 15 +++ server/adminserver/model/system/audit.go | 12 ++ server/adminserver/model/system/sys_user.go | 7 +- server/adminserver/router/routermgr.go | 13 ++- server/adminserver/router/system/enter.go | 3 + server/adminserver/router/system/sys_annc.go | 18 +++ server/adminserver/router/system/sys_audit.go | 18 +++ server/adminserver/router/system/sys_email.go | 16 +++ server/adminserver/router/system/sys_user.go | 2 + 20 files changed, 502 insertions(+), 41 deletions(-) create mode 100644 server/adminserver/api/v1/system/announcement.go create mode 100644 server/adminserver/api/v1/system/audit.go create mode 100644 server/adminserver/api/v1/system/email.go create mode 100644 server/adminserver/middleware/cors.go create mode 100644 server/adminserver/model/system/announcement.go create mode 100644 server/adminserver/model/system/audit.go create mode 100644 server/adminserver/router/system/sys_annc.go create mode 100644 server/adminserver/router/system/sys_audit.go create mode 100644 server/adminserver/router/system/sys_email.go diff --git a/database/admindb.sql b/database/admindb.sql index b72baf79..fe303ded 100644 --- a/database/admindb.sql +++ b/database/admindb.sql @@ -21,4 +21,35 @@ CREATE TABLE `t_user` ( PRIMARY KEY (`idx`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +DROP TABLE IF EXISTS `t_announcement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_announcement` ( +`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', +`title` varchar(255) NOT NULL DEFAULT '' COMMENT '标题', +`version` varchar(32) NOT NULL DEFAULT '' COMMENT '版本', +`model` int(11) NOT NULL DEFAULT '0' COMMENT '型号 1:Android 2:ios', +`type` int(11) NOT NULL DEFAULT '0' COMMENT ' 1:停服公告 2:普通公告', +`is_effect` int(11) NOT NULL DEFAULT '0' COMMENT '是否生效', +`content` text DEFAULT '' COMMENT '内容', +PRIMARY KEY (`idx`), +UNIQUE KEY `model_type` (`model`,`type`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +DROP TABLE IF EXISTS `t_audit`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_audit` ( +`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', +`version` varchar(32) NOT NULL DEFAULT '' COMMENT '版本', +`model` int(11) NOT NULL DEFAULT '0' COMMENT '型号 1:Android 2:ios', +`is_auditing` int(11) NOT NULL DEFAULT '0' COMMENT '是否审核中', +PRIMARY KEY (`idx`), +UNIQUE KEY `model` (`model`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; \ No newline at end of file diff --git a/server/adminserver/api/v1/system/announcement.go b/server/adminserver/api/v1/system/announcement.go new file mode 100644 index 00000000..0925b79c --- /dev/null +++ b/server/adminserver/api/v1/system/announcement.go @@ -0,0 +1,104 @@ +package system + +import ( + "adminsever/constant" + "adminsever/model/system" + "f5" + "github.com/gin-gonic/gin" + "net/http" + "strconv" +) + +type AnncApi struct { +} + +func (this *AnncApi) AnncList(c *gin.Context) { + var anncList []system.Annc + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Find(&anncList).Error + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + "data": anncList, + }) +} + +func (this *AnncApi) AddAnnc(c *gin.Context) { + //type form struct { + // Title string `binding:"required" json:"title"` + // Version string `binding:"required" json:"version"` + // Model uint `binding:"required" json:"model"` + // Type uint `json:"type"` + // Content string `binding:"required" json:"content"` + //} + //formReq := form{} + annc := system.Annc{} + if err := c.ShouldBindJSON(&annc); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + var count int64 + f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_announcement").Where("model = ?", annc.Model).Where("type = ?", annc.Type).Count(&count) + if count > 0 { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": "无法再插入同类型的公告", + }) + return + } + + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Create(&annc).Error + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + }) +} + +func (this *AnncApi) UpdateAnnc(c *gin.Context) { + idx, _ := strconv.ParseUint(c.Param("idx"), 10, 64) + var count int64 + f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_announcement").Where("idx = ?", idx).Count(&count) + if count < 1 { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": "不存在的数据", + }) + return + } + annc := system.Annc{} + if err := c.ShouldBindJSON(&annc); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Select("*").Omit("idx").Where("idx = ?", idx).Updates(&annc).Error + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + }) +} diff --git a/server/adminserver/api/v1/system/audit.go b/server/adminserver/api/v1/system/audit.go new file mode 100644 index 00000000..65b10eaa --- /dev/null +++ b/server/adminserver/api/v1/system/audit.go @@ -0,0 +1,96 @@ +package system + +import ( + "adminsever/constant" + "adminsever/model/system" + "f5" + "github.com/gin-gonic/gin" + "net/http" + "strconv" +) + +type AuditApi struct { +} + +func (this *AuditApi) AuditList(c *gin.Context) { + var auditList []system.Audit + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Find(&auditList).Error + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + "data": auditList, + }) +} + +func (this *AuditApi) AddAudit(c *gin.Context) { + audit := system.Audit{} + if err := c.ShouldBindJSON(&audit); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + var count int64 + f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_audit").Where("model = ?", audit.Model).Count(&count) + if count > 0 { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": "无法再插入", + }) + return + } + + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Create(&audit).Error + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + }) +} + +func (this *AuditApi) UpdateAudit(c *gin.Context) { + idx, _ := strconv.ParseUint(c.Param("idx"), 10, 64) + var count int64 + f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_audit").Where("idx = ?", idx).Count(&count) + if count < 1 { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": "不存在的数据", + }) + return + } + audit := system.Audit{} + if err := c.ShouldBindJSON(&audit); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Select("*").Omit("idx").Where("idx = ?", idx).Updates(&audit).Error + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + }) +} diff --git a/server/adminserver/api/v1/system/email.go b/server/adminserver/api/v1/system/email.go new file mode 100644 index 00000000..b5539fda --- /dev/null +++ b/server/adminserver/api/v1/system/email.go @@ -0,0 +1,70 @@ +package system + +import ( + "adminsever/constant" + "f5" + "fmt" + "github.com/gin-gonic/gin" + "net/http" + "q5" +) + +type EmailApi struct { +} +type emailReq struct { + Mailtype int `binding:"required" json:"mailtype"` + Usertype int `json:"usertype"` + To string `json:"to"` + From string `json:"from"` + Subject string `binding:"required" json:"subject"` + Mailsubtype int `binding:"required" json:"mailsubtype"` + Sendtime int `binding:"required" json:"sendtime"` + Expiretime int `binding:"required" json:"expiretime"` + Content string `binding:"required" json:"content"` + Attachments string `json:"attachments"` + Ext string `json:"ext"` +} + +func (this *EmailApi) SendEmail(c *gin.Context) { + emailMgr := emailReq{} + if err := c.ShouldBindJSON(&emailMgr); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + params := map[string]string{ + "gameid": constant.GAMEID, + "to": emailMgr.To, + "from": emailMgr.From, + "mailtype": q5.ToString(emailMgr.Mailtype), + "mailsubtype": q5.ToString(emailMgr.Mailsubtype), + "usertype": q5.ToString(emailMgr.Usertype), + "content": emailMgr.Content, + "subject": emailMgr.Subject, + "sendtime": q5.ToString(emailMgr.Sendtime), + "expiretime": q5.ToString(emailMgr.Expiretime), + "attachments": emailMgr.Attachments, + "ext": "", + "key": constant.EMAIL_KEY, + } + + url := "https://" + constant.EMAIL_URL_DEV + "/webapp/index.php" + f5.GetHttpCliMgr().SyncSendGoStyleRequest(url, params, func(response f5.HttpCliResponse) { + err := response.GetErr() + data := response.GetRawData() + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), + }) + return + } + fmt.Println(data) + }) + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + }) +} diff --git a/server/adminserver/api/v1/system/enter.go b/server/adminserver/api/v1/system/enter.go index bfafd18b..710c0828 100644 --- a/server/adminserver/api/v1/system/enter.go +++ b/server/adminserver/api/v1/system/enter.go @@ -2,4 +2,7 @@ package system type ApiGroup struct { UserApi + AnncApi + AuditApi + EmailApi } diff --git a/server/adminserver/api/v1/system/sys_user.go b/server/adminserver/api/v1/system/sys_user.go index 485a8801..ac95b50a 100644 --- a/server/adminserver/api/v1/system/sys_user.go +++ b/server/adminserver/api/v1/system/sys_user.go @@ -7,60 +7,90 @@ import ( . "main/global" "main/model/system" "net/http" + "strings" ) type UserApi struct { } func (this *UserApi) Login(c *gin.Context) { - username := c.PostForm("username") - password := c.PostForm("password") - if username == "" || password == "" { - c.JSON(http.StatusOK, gin.H{ - "errcode": 1, - "errmsg": "请求参数不正确", + //username := c.PostForm("username") + //password := c.PostForm("password") + //if username == "" || password == "" { + // c.JSON(http.StatusOK, gin.H{ + // "errcode": 1, + // "errmsg": "请求参数不正确", + // }) + // return + //} + type loginForm struct { + Username string `binding:"required" json:"username"` + Password string `binding:"required" json:"password"` + } + reqJson := loginForm{} + if err := c.ShouldBindJSON(&reqJson); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 1, + "message": err.Error(), }) return } user := system.SysUser{} - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Where("username = ?", username).Where("password = ?", password).First(&user).Error + //err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Where("username = ?", username).Where("password = ?", password).First(&user).Error + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Where("username = ?", reqJson.Username).Where("password = ?", reqJson.Password).First(&user).Error if err != nil { c.JSON(http.StatusOK, gin.H{ - "errcode": 1, - "errmsg": "用户名或密码错误", + "code": 1, + "message": "用户名或密码错误", }) return } - token := GetApp().AddSession(username) + //token := GetApp().AddSession(username) + token := GetApp().AddSession(reqJson.Username) c.JSON(http.StatusOK, gin.H{ - "errcode": 0, - "errmsg": "登录成功", + "code": 0, + "message": "登录成功", "data": user, "token": token, }) } func (this *UserApi) Info(c *gin.Context) { - username := c.Query("username") - if username == "" { - c.JSON(http.StatusOK, gin.H{ - "errcode": 1, - "errmsg": "请求参数为空", - }) - return - } + token := c.Request.Header.Get("Authorization") + strArr := strings.Split(token, "|") + //username := c.Query("username") + //if username == "" { + // c.JSON(http.StatusOK, gin.H{ + // "code": 1, + // "message": "请求参数为空", + // }) + // return + //} + user := system.SysUser{} - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Where("username = ?", username).First(&user).Error + err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Where("username = ?", strArr[0]).First(&user).Error if err != nil { c.JSON(http.StatusOK, gin.H{ - "errcode": 1, - "errmsg": "暂无此用户", + "code": 1, + "message": "暂无此用户", }) return } + user.Roles = append(user.Roles, "admin") + c.JSON(http.StatusOK, gin.H{ - "errcode": 0, - "errmsg": "success", + "code": 0, + "message": "success", "data": user, }) } + +func (this *UserApi) Logout(c *gin.Context) { + token := c.Request.Header.Get("Authorization") + strArr := strings.Split(token, "|") + GetApp().RemoveSession(strArr[0]) + c.JSON(http.StatusOK, gin.H{ + "code": 0, + "message": "success", + }) +} diff --git a/server/adminserver/app/app.go b/server/adminserver/app/app.go index 6ac7b8a6..d45b4b52 100644 --- a/server/adminserver/app/app.go +++ b/server/adminserver/app/app.go @@ -105,12 +105,20 @@ func randStringBytes(n int) string { return string(b) } -func (this *app) GetSessionAccountId(sessionId string) string { +func (this *app) GetSessionAccountId(accountId string) string { this.sessionLock.Lock() defer this.sessionLock.Unlock() - if accountId, ok := this.sessionHash[sessionId]; ok { - return accountId + if session, ok := this.sessionHash[accountId]; ok { + return session } else { return "nil" } } + +func (this *app) RemoveSession(accountId string) { + this.sessionLock.Lock() + defer this.sessionLock.Unlock() + if _, ok := this.sessionHash[accountId]; ok { + delete(this.sessionHash, accountId) + } +} diff --git a/server/adminserver/common/types.go b/server/adminserver/common/types.go index 78c9ad67..dd06b34c 100644 --- a/server/adminserver/common/types.go +++ b/server/adminserver/common/types.go @@ -3,5 +3,6 @@ package common type App interface { Run(func(), func()) AddSession(accountId string) string - GetSessionAccountId(sessionId string) string + GetSessionAccountId(accountId string) string + RemoveSession(accountId string) } diff --git a/server/adminserver/constant/constant.go b/server/adminserver/constant/constant.go index 50760b87..72411eae 100644 --- a/server/adminserver/constant/constant.go +++ b/server/adminserver/constant/constant.go @@ -7,7 +7,7 @@ const ( const ( GAME_DB = "gamedb" FRIEND_DB = "firenddb" - ADMIN_DB = "admindb" + ADMIN_DB = "admindb" ) const ( @@ -15,3 +15,9 @@ const ( ROUTER_MODULE_IDX MAX_MODULE_IDX ) + +const ( + GAMEID = "2006" + EMAIL_URL_DEV = "gamemail-test.kingsome.cn" + EMAIL_KEY = "520d8eeb8cf1d833a42c820432c020b2fd60f4b7|" + EMAIL_URL_DEV +) diff --git a/server/adminserver/middleware/auth.go b/server/adminserver/middleware/auth.go index 510e4c58..3727533d 100644 --- a/server/adminserver/middleware/auth.go +++ b/server/adminserver/middleware/auth.go @@ -13,9 +13,9 @@ func Auth() gin.HandlerFunc { strArr := strings.Split(token, "|") authToken := GetApp().GetSessionAccountId(strArr[0]) if token == "" || token != authToken { - c.JSON(http.StatusOK, gin.H{ - "errcode": 1, - "errmsg": "未登录或非法访问", + c.JSON(http.StatusUnauthorized, gin.H{ + "code": 1, + "message": "未登录或非法访问", }) /* response.FailWithDetailed(gin.H{"reload": true}, "未登录或非法访问", c)*/ diff --git a/server/adminserver/middleware/cors.go b/server/adminserver/middleware/cors.go new file mode 100644 index 00000000..bce6048e --- /dev/null +++ b/server/adminserver/middleware/cors.go @@ -0,0 +1,24 @@ +package middleware + +import ( + "github.com/gin-gonic/gin" + "net/http" +) + +func Cors() gin.HandlerFunc { + return func(c *gin.Context) { + method := c.Request.Method + //origin := c.Request.Header.Get("Origin") + //if origin != "" { + c.Header("Access-Control-Allow-Origin", "*") // 可将将 * 替换为指定的域名 + c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE") + c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization") + c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type") + c.Header("Access-Control-Allow-Credentials", "true") + //} + if method == "OPTIONS" { + c.AbortWithStatus(http.StatusNoContent) + } + c.Next() + } +} diff --git a/server/adminserver/model/system/announcement.go b/server/adminserver/model/system/announcement.go new file mode 100644 index 00000000..95dd90ed --- /dev/null +++ b/server/adminserver/model/system/announcement.go @@ -0,0 +1,15 @@ +package system + +type Annc struct { + Idx uint64 `json:"idx" ` + Title string `json:"title" binding:"required" ` + Version string `json:"version" binding:"required" ` + Model uint `json:"model" binding:"required" ` + Type uint `json:"type" binding:"required"` + IsEffect uint `json:"is_effect"` + Content string `json:"content" binding:"required" ` +} + +func (this Annc) TableName() string { + return "t_announcement" +} diff --git a/server/adminserver/model/system/audit.go b/server/adminserver/model/system/audit.go new file mode 100644 index 00000000..f8c33db5 --- /dev/null +++ b/server/adminserver/model/system/audit.go @@ -0,0 +1,12 @@ +package system + +type Audit struct { + Idx uint `json:"idx" ` + Version string `json:"version" binding:"required" ` + Model uint `json:"model" binding:"required" ` + IsAuditing uint `json:"is_auditing" ` +} + +func (this Audit) TableName() string { + return "t_audit" +} diff --git a/server/adminserver/model/system/sys_user.go b/server/adminserver/model/system/sys_user.go index ee3a1946..df2d8749 100644 --- a/server/adminserver/model/system/sys_user.go +++ b/server/adminserver/model/system/sys_user.go @@ -1,9 +1,10 @@ package system type SysUser struct { - Idx uint64 `json:"idx"` - Username string `gorm:"uniqueIndex;comment:用户登录名" json:"username"` - Password string `gorm:"comment:用户登录密码" json:"password"` + Idx uint64 `json:"idx"` + Username string `gorm:"uniqueIndex;comment:用户登录名" json:"username"` + Password string `gorm:"comment:用户登录密码" json:"password"` + Roles []string `json:"roles" gorm:"-"'` } func (SysUser) TableName() string { diff --git a/server/adminserver/router/routermgr.go b/server/adminserver/router/routermgr.go index 37e48b92..44c93591 100644 --- a/server/adminserver/router/routermgr.go +++ b/server/adminserver/router/routermgr.go @@ -2,24 +2,27 @@ package router import ( "f5" + "main/middleware" //. "main/global" "main/router/system" - "main/middleware" ) type routerMgr struct { - system system.RouterGroup + system system.RouterGroup } - -func (this* routerMgr) Init() { +func (this *routerMgr) Init() { + f5.GetApp().GetGinEngine().Use(middleware.Cors()) priGroup := f5.GetApp().GetGinEngine().Group("api/v1") pubGroup := f5.GetApp().GetGinEngine().Group("api/v1") priGroup.Use(middleware.Auth()) this.system.InitUserRouter(priGroup, pubGroup) + this.system.InitAnncRouter(priGroup) + this.system.InitAuditRouter(priGroup) + this.system.InitEmailRouter(priGroup) f5.GetSysLog().Info("routerMgr.init") } -func (this* routerMgr) UnInit() { +func (this *routerMgr) UnInit() { } diff --git a/server/adminserver/router/system/enter.go b/server/adminserver/router/system/enter.go index d7215b3a..7b340d91 100644 --- a/server/adminserver/router/system/enter.go +++ b/server/adminserver/router/system/enter.go @@ -2,4 +2,7 @@ package system type RouterGroup struct { UserRouter + AnncRouter + AuditRouter + EmailRoute } diff --git a/server/adminserver/router/system/sys_annc.go b/server/adminserver/router/system/sys_annc.go new file mode 100644 index 00000000..36bbcd39 --- /dev/null +++ b/server/adminserver/router/system/sys_annc.go @@ -0,0 +1,18 @@ +package system + +import ( + "github.com/gin-gonic/gin" + "main/api/v1" +) + +type AnncRouter struct{} + +func (this *AnncRouter) InitAnncRouter(priRouter *gin.RouterGroup) { + priUserRouter := priRouter.Group("annc") + anncApi := v1.ApiGroupApp.SystemApiGroup.AnncApi + { + priUserRouter.GET("anncList", anncApi.AnncList) + priUserRouter.POST("addAnnc", anncApi.AddAnnc) + priUserRouter.PUT("updateAnnc/:idx", anncApi.UpdateAnnc) + } +} diff --git a/server/adminserver/router/system/sys_audit.go b/server/adminserver/router/system/sys_audit.go new file mode 100644 index 00000000..81eb5732 --- /dev/null +++ b/server/adminserver/router/system/sys_audit.go @@ -0,0 +1,18 @@ +package system + +import ( + "github.com/gin-gonic/gin" + "main/api/v1" +) + +type AuditRouter struct{} + +func (this *AnncRouter) InitAuditRouter(priRouter *gin.RouterGroup) { + priUserRouter := priRouter.Group("audit") + auditApi := v1.ApiGroupApp.SystemApiGroup.AuditApi + { + priUserRouter.GET("auditList", auditApi.AuditList) + priUserRouter.POST("addAudit", auditApi.AddAudit) + priUserRouter.PUT("updateAudit/:idx", auditApi.UpdateAudit) + } +} diff --git a/server/adminserver/router/system/sys_email.go b/server/adminserver/router/system/sys_email.go new file mode 100644 index 00000000..817c1352 --- /dev/null +++ b/server/adminserver/router/system/sys_email.go @@ -0,0 +1,16 @@ +package system + +import ( + "github.com/gin-gonic/gin" + "main/api/v1" +) + +type EmailRoute struct{} + +func (this *AnncRouter) InitEmailRouter(priRouter *gin.RouterGroup) { + priUserRouter := priRouter.Group("email") + emailApi := v1.ApiGroupApp.SystemApiGroup.EmailApi + { + priUserRouter.POST("send", emailApi.SendEmail) + } +} diff --git a/server/adminserver/router/system/sys_user.go b/server/adminserver/router/system/sys_user.go index 1409f4d2..112ce70d 100644 --- a/server/adminserver/router/system/sys_user.go +++ b/server/adminserver/router/system/sys_user.go @@ -17,5 +17,7 @@ func (this *UserRouter) InitUserRouter(priRouter *gin.RouterGroup, } { priUserRouter.GET("info", userApi.Info) + priUserRouter.GET("logout", userApi.Logout) + } }