Skip to content

Commit

Permalink
Merge branch 'main' into i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHassanNasr committed Jan 14, 2025
2 parents 04a127c + 831bd61 commit 60b290e
Show file tree
Hide file tree
Showing 13 changed files with 416 additions and 253 deletions.
2 changes: 1 addition & 1 deletion server/core/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func RunWindowsServer() {

fmt.Printf(`
%s gin-vue-admin
%s: v2.7.8-beta1
%s: v2.7.8
%s
%s: https://github.com/flipped-aurora/gin-vue-admin
%s: https://plugin.gin-vue-admin.com
Expand Down
2 changes: 1 addition & 1 deletion server/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions server/initialize/internal/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"gorm.io/gorm"
"gorm.io/gorm/logger"
"gorm.io/gorm/schema"
"log"
"os"
"time"
)

Expand All @@ -34,7 +32,7 @@ func (g *_gorm) Config(prefix string, singular bool) *gorm.Config {
general = global.GVA_CONFIG.Mysql.GeneralDB
}
return &gorm.Config{
Logger: logger.New(NewWriter(general, log.New(os.Stdout, "\r\n", log.LstdFlags)), logger.Config{
Logger: logger.New(NewWriter(general), logger.Config{
SlowThreshold: 200 * time.Millisecond,
LogLevel: general.LogLevel(),
Colorful: true,
Expand Down
22 changes: 13 additions & 9 deletions server/initialize/internal/gorm_logger_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package internal
import (
"fmt"
"github.com/flipped-aurora/gin-vue-admin/server/config"
"go.uber.org/zap"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"gorm.io/gorm/logger"
)

Expand All @@ -12,26 +12,30 @@ type Writer struct {
writer logger.Writer
}

func NewWriter(config config.GeneralDB, writer logger.Writer) *Writer {
return &Writer{config: config, writer: writer}
func NewWriter(config config.GeneralDB) *Writer {
return &Writer{config: config}
}

// Printf 格式化打印日志
func (c *Writer) Printf(message string, data ...any) {

// 当有日志时候均需要输出到控制台
fmt.Printf(message, data...)

// 当开启了zap的情况,会打印到日志记录
if c.config.LogZap {
switch c.config.LogLevel() {
case logger.Silent:
zap.L().Debug(fmt.Sprintf(message, data...))
global.GVA_LOG.Debug(fmt.Sprintf(message, data...))
case logger.Error:
zap.L().Error(fmt.Sprintf(message, data...))
global.GVA_LOG.Error(fmt.Sprintf(message, data...))
case logger.Warn:
zap.L().Warn(fmt.Sprintf(message, data...))
global.GVA_LOG.Warn(fmt.Sprintf(message, data...))
case logger.Info:
zap.L().Info(fmt.Sprintf(message, data...))
global.GVA_LOG.Info(fmt.Sprintf(message, data...))
default:
zap.L().Info(fmt.Sprintf(message, data...))
global.GVA_LOG.Info(fmt.Sprintf(message, data...))
}
return
}
c.writer.Printf(message, data...)
}
2 changes: 1 addition & 1 deletion server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// @Tag.Description 用户

// @title Gin-Vue-Admin Swagger API接口文档
// @version v2.7.8-beta1
// @version v2.7.8
// @description 使用gin+vue进行极速开发的全栈开发基础平台
// @securityDefinitions.apikey ApiKeyAuth
// @in header
Expand Down
2 changes: 1 addition & 1 deletion server/resource/package/server/api/api.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data query {{.PrimaryField.FieldType}} true "用id查询{{.Description}}"
// @Param {{.PrimaryField.FieldJson}} query {{.PrimaryField.FieldType}} true "用id查询{{.Description}}"
// @Success 200 {object} response.Response{data={{.Package}}.{{.StructName}},msg=string} "查询成功"
// @Router /{{.Abbreviation}}/find{{.StructName}} [get]
func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Context) {
Expand Down
2 changes: 1 addition & 1 deletion server/resource/plugin/server/api/api.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (a *{{.Abbreviation}}) Update{{.StructName}}(c *gin.Context) {
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
// @Param {{.PrimaryField.FieldJson}} query {{.PrimaryField.FieldType}} true "用id查询{{.Description}}"
// @Success 200 {object} response.Response{data=model.{{.StructName}},msg=string} "查询成功"
// @Router /{{.Abbreviation}}/find{{.StructName}} [get]
func (a *{{.Abbreviation}}) Find{{.StructName}}(c *gin.Context) {
Expand Down
5 changes: 4 additions & 1 deletion server/service/system/sys_authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ func (authorityService *AuthorityService) GetStructAuthorityList(authorityID uin
if len(authorities) > 0 {
for k := range authorities {
list = append(list, authorities[k].AuthorityId)
_, err = authorityService.GetStructAuthorityList(authorities[k].AuthorityId)
childrenList, err := authorityService.GetStructAuthorityList(authorities[k].AuthorityId)
if err == nil {
list = append(list, childrenList...)
}
}
}
if *auth.ParentId == 0 {
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gin-vue-admin",
"version": "2.7.8-beta1",
"version": "2.7.8",
"private": true,
"scripts": {
"serve": "node openDocument.js && vite --host --mode development",
Expand Down
10 changes: 10 additions & 0 deletions web/src/api/fileUploadAndDownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@ export const importURL = (data) => {
data
})
}


// 上传文件 暂时用于头像上传
export const uploadFile = (data) => {
return service({
url: "/fileUploadAndDownload/upload",
method: "post",
data,
});
};
2 changes: 1 addition & 1 deletion web/src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const viteLogo = (env) => {
`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`
)
)
console.log(greenText(`> 当前版本:vv2.7.8-beta1`))
console.log(greenText(`> 当前版本:v2.7.8`))
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`))
console.log(
greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)
Expand Down
2 changes: 1 addition & 1 deletion web/src/core/gin-vue-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
register(app)
console.log(`
欢迎使用 Gin-Vue-Admin
当前版本:v2.7.8-beta1
当前版本:v2.7.8
加群方式:微信:shouzi_1994 QQ群:622360840
项目地址:https://github.com/flipped-aurora/gin-vue-admin
插件市场:https://plugin.gin-vue-admin.com
Expand Down
Loading

0 comments on commit 60b290e

Please sign in to comment.