clear:formatting code
This commit is contained in:
1 parent
426cec1b62
commit
8c554d7ee7
21 files changed
+35
-51
No files matched your search
@@ -7,3 +7,4 @@ temp/
|
||||
vendor
|
||||
config/settings.dev.yml
|
||||
go-admin
|
||||
middleware/demo.go
|
||||
@@ -47,7 +47,6 @@ func ServerInfo(c *gin.Context) {
|
||||
cpuDic := make(map[string]interface{}, 0)
|
||||
cpuDic["cpuNum"], _ = cpu.Counts(false)
|
||||
|
||||
|
||||
app.Custum(c, gin.H{
|
||||
"code": 200,
|
||||
"os": osDic,
|
||||
|
||||
@@ -145,5 +145,3 @@ func DeleteConfig(c *gin.Context) {
|
||||
tools.HasError(err, "修改失败", 500)
|
||||
app.OK(c, result, msg.DeletedSuccess)
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ $(function(){
|
||||
</html>
|
||||
`
|
||||
|
||||
|
||||
func HelloWorld(c *gin.Context) {
|
||||
c.Header("Content-Type", "text/html; charset=utf-8")
|
||||
c.String(200, INDEX)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package database
|
||||
|
||||
|
||||
func Setup(driver string) {
|
||||
dbType := driver
|
||||
if dbType == "mysql" {
|
||||
|
||||
@@ -6,8 +6,6 @@ import (
|
||||
|
||||
var RequestLogger = &logrus.Entry{}
|
||||
|
||||
|
||||
|
||||
func init() {
|
||||
// TODO: requestLogger log format
|
||||
// RequestLogger = logrus.WithFields(logrus.Fields{"request_id": request_id, "user_ip": user_ip})
|
||||
|
||||
@@ -153,7 +153,6 @@ func RAMCheck(c *gin.Context) {
|
||||
text = "WARNING"
|
||||
}
|
||||
|
||||
|
||||
app.Custum(c, gin.H{
|
||||
"code": 200,
|
||||
"msg": text,
|
||||
|
||||
@@ -59,7 +59,6 @@ type SysUserB struct {
|
||||
BaseModel
|
||||
}
|
||||
|
||||
|
||||
type SysUser struct {
|
||||
SysUserId
|
||||
SysUserB
|
||||
|
||||
@@ -24,8 +24,6 @@ e = some(where (p.eft == allow))
|
||||
m = r.sub == p.sub && (keyMatch2(r.obj, p.obj) || keyMatch(r.obj, p.obj)) && (r.act == p.act || p.act == "*")
|
||||
`
|
||||
|
||||
|
||||
|
||||
func Setup() {
|
||||
Apter, err := gormAdapter.NewAdapterByDB(global.Eloquent)
|
||||
if err != nil {
|
||||
|
||||
@@ -9,5 +9,3 @@ var (
|
||||
Warning *log.Logger
|
||||
Error *log.Logger
|
||||
)
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
|
||||
|
||||
// 路由示例
|
||||
func InitExamplesRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Engine {
|
||||
|
||||
@@ -36,6 +34,3 @@ func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddle
|
||||
|
||||
// {{认证路由自动补充在此处请勿删除}}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+33
-17
@@ -7,9 +7,11 @@
|
||||
{{- if ($x) -}}
|
||||
<el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}">
|
||||
{{if eq .DictType "" -}}
|
||||
<el-input v-model="queryParams.{{.JsonField}}" placeholder="请输入{{.ColumnComment}}" clearable size="small" @keyup.enter.native="handleQuery" />
|
||||
<el-input v-model="queryParams.{{.JsonField}}" placeholder="请输入{{.ColumnComment}}" clearable
|
||||
size="small" @keyup.enter.native="handleQuery"/>
|
||||
{{- else -}}
|
||||
<el-select v-model="queryParams.{{.JsonField}}" placeholder="{{$tableComment}}{{.ColumnComment}}" clearable size="small">
|
||||
<el-select v-model="queryParams.{{.JsonField}}"
|
||||
placeholder="{{$tableComment}}{{.ColumnComment}}" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in {{.JsonField}}Options"
|
||||
:key="dict.dictValue"
|
||||
@@ -35,7 +37,8 @@
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@@ -45,7 +48,8 @@
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@@ -55,7 +59,8 @@
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@@ -65,14 +70,16 @@
|
||||
{{- $x := .IsList -}}
|
||||
{{- if ($x) }}
|
||||
{{- if ne .DictType "" -}}
|
||||
<el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}" :formatter="{{.JsonField}}Format" width="100">
|
||||
<el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}"
|
||||
:formatter="{{.JsonField}}Format" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ "{{" }} {{.JsonField}}Format(scope.row) {{"}}"}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
{{- end -}}
|
||||
{{- if eq .DictType "" -}}
|
||||
<el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}"
|
||||
:show-overflow-tooltip="true"/>
|
||||
{{- end -}}
|
||||
|
||||
{{- end }}
|
||||
@@ -85,14 +92,16 @@
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
v-permisaction="['{{.PackageName}}:{{.ModuleName}}:remove']"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -120,9 +129,11 @@
|
||||
{{- else }}
|
||||
<el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}">
|
||||
{{ if eq "input" .HtmlType -}}
|
||||
<el-input v-model="form.{{.JsonField}}" placeholder="{{.ColumnComment}}" {{if eq .IsEdit "false" -}}:disabled="isEdit" {{- end}}/>
|
||||
<el-input v-model="form.{{.JsonField}}" placeholder="{{.ColumnComment}}"
|
||||
{{if eq .IsEdit "false" -}}:disabled="isEdit" {{- end}}/>
|
||||
{{- else if eq "select" .HtmlType -}}
|
||||
<el-select v-model="form.{{.JsonField}}" {{if eq .IsEdit "false" -}} :disabled="isEdit" {{- end }}>
|
||||
<el-select
|
||||
v-model="form.{{.JsonField}}" {{if eq .IsEdit "false" -}} :disabled="isEdit" {{- end }}>
|
||||
<el-option label="demo1" value="demo1"/>
|
||||
<el-option label="demo2" value="demo2"/>
|
||||
</el-select>
|
||||
@@ -149,7 +160,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list{{.ClassName}}, get{{.ClassName}}, del{{.ClassName}}, add{{.ClassName}}, update{{.ClassName}} } from '@/api/{{.PackageName}}'
|
||||
import {add, del, get, list, update} from '@/api/'
|
||||
|
||||
export default {
|
||||
name: 'Config',
|
||||
@@ -184,13 +195,15 @@
|
||||
pageSize: 10,
|
||||
{{ range .Columns }}
|
||||
{{- if (.IsQuery) -}}
|
||||
{{.JsonField}}:undefined,
|
||||
{{.JsonField}}:
|
||||
undefined,
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
},
|
||||
}
|
||||
,
|
||||
// 表单校验
|
||||
rules: {
|
||||
{{- range .Columns -}}
|
||||
@@ -243,7 +256,8 @@
|
||||
{{- else if eq .GoField "UpdateBy" -}}
|
||||
{{- else if eq .GoField "CreateBy" -}}
|
||||
{{- else }}
|
||||
{{.JsonField}}: undefined,
|
||||
{{.JsonField}}:
|
||||
undefined,
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
@@ -285,7 +299,8 @@
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const {{.PkJsonField}} = row.{{.PkJsonField}} || this.ids
|
||||
const {{.PkJsonField}} =
|
||||
row.{{.PkJsonField}} || this.ids
|
||||
get{{.ClassName}}({{.PkJsonField}}).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
@@ -333,7 +348,8 @@
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(function() {})
|
||||
}).catch(function () {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
|
||||
func TestGoModelTemplate(t *testing.T) {
|
||||
t1, err := template.ParseFiles("model.go.template")
|
||||
if err != nil {
|
||||
|
||||
@@ -25,7 +25,6 @@ type PageResponse struct {
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
|
||||
func (res *Response) ReturnOK() *Response {
|
||||
res.Code = 200
|
||||
return res
|
||||
@@ -36,11 +35,7 @@ func (res *Response) ReturnError(code int) *Response {
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
func (res *PageResponse) ReturnOK() *PageResponse {
|
||||
res.Code = 200
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ type configJsonBody struct {
|
||||
DriverDigit *base64Captcha.DriverDigit
|
||||
}
|
||||
|
||||
|
||||
func DriverStringFunc() (id, b64s string, err error) {
|
||||
e := configJsonBody{}
|
||||
e.Id = uuid.New().String()
|
||||
@@ -30,7 +29,6 @@ func DriverStringFunc() (id, b64s string, err error) {
|
||||
return cap.Generate()
|
||||
}
|
||||
|
||||
|
||||
func DriverDigitFunc() (id, b64s string, err error) {
|
||||
e := configJsonBody{}
|
||||
e.Id = uuid.New().String()
|
||||
|
||||
@@ -16,7 +16,6 @@ var cfgLog *viper.Viper
|
||||
var cfgSsl *viper.Viper
|
||||
var cfgGen *viper.Viper
|
||||
|
||||
|
||||
//载入配置文件
|
||||
func ConfigSetup(path string) {
|
||||
viper.SetConfigFile(path)
|
||||
@@ -25,7 +24,6 @@ func ConfigSetup(path string) {
|
||||
log.Fatal(fmt.Sprintf("Read config file fail: %s", err.Error()))
|
||||
}
|
||||
|
||||
|
||||
//Replace environment variables
|
||||
err = viper.ReadConfig(strings.NewReader(os.ExpandEnv(string(content))))
|
||||
if err != nil {
|
||||
@@ -69,7 +67,6 @@ func ConfigSetup(path string) {
|
||||
GenConfig = InitGen(cfgGen)
|
||||
}
|
||||
|
||||
|
||||
func SetConfig(configPath string, key string, value interface{}) {
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.Set(key, value)
|
||||
|
||||
@@ -19,4 +19,3 @@ func InitDatabase(cfg *viper.Viper) *Database {
|
||||
}
|
||||
|
||||
var DatabaseConfig = new(Database)
|
||||
|
||||
@@ -119,6 +119,7 @@ type ReplaceHelper struct {
|
||||
OldText string //需要替换的文本
|
||||
NewText string //新的文本
|
||||
}
|
||||
|
||||
func (h *ReplaceHelper) DoWrok() error {
|
||||
|
||||
return filepath.Walk(h.Root, h.walkCallback)
|
||||
|
||||
@@ -14,7 +14,6 @@ func InitLogger() {
|
||||
log.FieldKeyLevel: "@level",
|
||||
log.FieldKeyMsg: "@message"}})
|
||||
|
||||
|
||||
switch Mode(config2.ApplicationConfig.Mode) {
|
||||
case ModeDev, ModeTest:
|
||||
log.SetOutput(os.Stdout)
|
||||
|
||||
@@ -17,7 +17,6 @@ func StringToInt(e string) (int, error) {
|
||||
return strconv.Atoi(e)
|
||||
}
|
||||
|
||||
|
||||
func GetCurrentTimeStr() string {
|
||||
return time.Now().Format("2006/01/02 15:04:05")
|
||||
}
|
||||
@@ -26,7 +25,6 @@ func GetCurrentTime() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
|
||||
func StructToJsonStr(e interface{}) (string, error) {
|
||||
if b, err := json.Marshal(e); err == nil {
|
||||
return string(b), err
|
||||
|
||||
@@ -10,7 +10,6 @@ func IdsStrToIdsIntGroup(key string, c *gin.Context) []int {
|
||||
return idsStrToIdsIntGroup(c.Param(key))
|
||||
}
|
||||
|
||||
|
||||
func idsStrToIdsIntGroup(keys string) []int {
|
||||
IDS := make([]int, 0)
|
||||
ids := strings.Split(keys, ",")
|
||||
|
||||
Reference in new issue
Block a user