refactor: 文件行数超标拆解(7个文件→14个文件,全部≤200行)
- 移动本地接口定义到 interfaces.go 和 admin/interfaces.go - favorite_controller.go → favorite_item_controller.go - space_controller.go → space_loaders.go - settings_controller.go → settings_api_audit.go - admin_energy_controller.go → admin_energy_api_controller.go - admin_post_controller.go → admin_post_action_controller.go - comment_repo.go → comment_mention_repo.go - post_repo.go → post_stats_repo.go
This commit is contained in:
28
internal/controller/settings_api_audit.go
Normal file
28
internal/controller/settings_api_audit.go
Normal file
@ -0,0 +1,28 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"metazone.cc/metalab/internal/common"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// AuditStatus 查询当前用户的待审核类型(需登录)
|
||||
func (sc *SettingsController) AuditStatus(c *gin.Context) {
|
||||
uid, exists := c.Get("uid")
|
||||
if !exists {
|
||||
common.Error(c, http.StatusUnauthorized, "请先登录")
|
||||
return
|
||||
}
|
||||
|
||||
types, err := sc.auditService.GetPendingTypes(uid.(uint))
|
||||
if err != nil {
|
||||
common.Ok(c, gin.H{"pending_types": []string{}})
|
||||
return
|
||||
}
|
||||
if types == nil {
|
||||
types = []string{}
|
||||
}
|
||||
common.Ok(c, gin.H{"pending_types": types})
|
||||
}
|
||||
Reference in New Issue
Block a user