feat: vue-mobile => 完成用户信息修改功能,前后端都添加文件上传功能。

This commit is contained in:
RockYang
2023-06-27 12:11:55 +08:00
parent c3d62bb8d8
commit 3efd5fb77a
20 changed files with 353 additions and 73 deletions

View File

@@ -17,6 +17,7 @@ import (
)
type AppServer struct {
Debug bool
AppConfig *types.AppConfig
Engine *gin.Engine
ChatContexts *types.LMap[string, []types.Message] // 聊天上下文 Map [chatId] => []Message
@@ -33,6 +34,7 @@ func NewServer(appConfig *types.AppConfig) *AppServer {
gin.SetMode(gin.ReleaseMode)
gin.DefaultWriter = io.Discard
return &AppServer{
Debug: false,
AppConfig: appConfig,
Engine: gin.Default(),
ChatContexts: types.NewLMap[string, []types.Message](),
@@ -44,9 +46,11 @@ func NewServer(appConfig *types.AppConfig) *AppServer {
func (s *AppServer) Init(debug bool) {
if debug { // 调试模式允许跨域请求 API
s.Debug = debug
logger.Info("Enabled debug mode")
s.Engine.Use(corsMiddleware())
}
s.Engine.Use(sessionMiddleware(s.AppConfig))
s.Engine.Use(authorizeMiddleware(s))
s.Engine.Use(errorHandler)

View File

@@ -19,6 +19,7 @@ func NewDefaultConfig() *types.AppConfig {
ProxyURL: "",
Manager: types.Manager{Username: "admin", Password: "admin123"},
StaticDir: "./static",
StaticUrl: "http://localhost/5678/static",
Session: types.Session{
SecretKey: utils.RandString(64),

View File

@@ -12,6 +12,7 @@ type AppConfig struct {
MysqlDns string // mysql 连接地址
Manager Manager // 后台管理员账户信息
StaticDir string // 静态资源目录
StaticUrl string // 静态资源 URL
}
// Manager 管理员