From 9f706c366f73800d31cdb529f1c56981e9974f16 Mon Sep 17 00:00:00 2001 From: yxh Date: Fri, 6 Aug 2021 20:36:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=88=B0?= =?UTF-8?q?=E9=9D=9Esystem=E6=A8=A1=E5=9D=97=E7=BB=86=E8=8A=82=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/system/api/sys_auth_rule.go | 2 +- app/system/api/sys_base.go | 4 ++-- app/system/api/sys_config.go | 2 +- app/system/api/sys_dept.go | 2 +- app/system/api/sys_dict_data.go | 2 +- app/system/api/sys_dict_type.go | 2 +- app/system/api/sys_job.go | 2 +- app/system/api/sys_login_log.go | 2 +- app/system/api/sys_monitor.go | 2 +- app/system/api/sys_oper_log.go | 2 +- app/system/api/sys_post.go | 2 +- app/system/api/sys_role.go | 2 +- app/system/api/sys_user.go | 2 +- app/system/api/sys_user_online.go | 2 +- app/system/api/sys_web_set.go | 2 +- app/system/api/tools_gen_table.go | 2 +- app/system/api/upload.go | 2 +- app/system/api/user_Profile.go | 2 +- template/vm/go/controller.template | 13 ++++++++++--- template/vm/go/service.template | 4 ++-- 20 files changed, 31 insertions(+), 24 deletions(-) diff --git a/app/system/api/sys_auth_rule.go b/app/system/api/sys_auth_rule.go index 1c83bcd..ab09e50 100644 --- a/app/system/api/sys_auth_rule.go +++ b/app/system/api/sys_auth_rule.go @@ -11,7 +11,7 @@ import ( ) type authRule struct { - systemBase + SystemBase } var AuthRule = new(authRule) diff --git a/app/system/api/sys_base.go b/app/system/api/sys_base.go index a154e93..c4a6898 100644 --- a/app/system/api/sys_base.go +++ b/app/system/api/sys_base.go @@ -7,12 +7,12 @@ import ( "gfast/app/system/service" ) -type systemBase struct { +type SystemBase struct { api.CommonBase } // GetCurrentUser 获取当前登陆用户信息 -func (c *systemBase) GetCurrentUser(ctx context.Context) *dao.CtxUser { +func (c *SystemBase) GetCurrentUser(ctx context.Context) *dao.CtxUser { context := service.Context.Get(ctx) if context == nil { return nil diff --git a/app/system/api/sys_config.go b/app/system/api/sys_config.go index aedbf48..6caf6ec 100644 --- a/app/system/api/sys_config.go +++ b/app/system/api/sys_config.go @@ -18,7 +18,7 @@ import ( ) type sysConfig struct { - systemBase + SystemBase } var SysConfig = new(sysConfig) diff --git a/app/system/api/sys_dept.go b/app/system/api/sys_dept.go index dca3a72..a779d51 100644 --- a/app/system/api/sys_dept.go +++ b/app/system/api/sys_dept.go @@ -12,7 +12,7 @@ import ( ) type dept struct { - systemBase + SystemBase } var Dept = new(dept) diff --git a/app/system/api/sys_dict_data.go b/app/system/api/sys_dict_data.go index c552c9d..46cf561 100644 --- a/app/system/api/sys_dict_data.go +++ b/app/system/api/sys_dict_data.go @@ -18,7 +18,7 @@ import ( ) type dictData struct { - systemBase + SystemBase } var DictData = new(dictData) diff --git a/app/system/api/sys_dict_type.go b/app/system/api/sys_dict_type.go index 65a8b2e..f2ec074 100644 --- a/app/system/api/sys_dict_type.go +++ b/app/system/api/sys_dict_type.go @@ -11,7 +11,7 @@ import ( ) type dictType struct { - systemBase + SystemBase } var DictType = new(dictType) diff --git a/app/system/api/sys_job.go b/app/system/api/sys_job.go index 8f066d4..b5fe4c7 100644 --- a/app/system/api/sys_job.go +++ b/app/system/api/sys_job.go @@ -16,7 +16,7 @@ import ( ) type sysJob struct { - systemBase + SystemBase } var SysJob = new(sysJob) diff --git a/app/system/api/sys_login_log.go b/app/system/api/sys_login_log.go index 7391405..39fa84b 100644 --- a/app/system/api/sys_login_log.go +++ b/app/system/api/sys_login_log.go @@ -16,7 +16,7 @@ import ( ) type sysLoginLog struct { - systemBase + SystemBase } var SysLoginLog = new(sysLoginLog) diff --git a/app/system/api/sys_monitor.go b/app/system/api/sys_monitor.go index 8ad819e..689c18a 100644 --- a/app/system/api/sys_monitor.go +++ b/app/system/api/sys_monitor.go @@ -26,7 +26,7 @@ import ( ) type sysMonitor struct { - systemBase + SystemBase startTime *gtime.Time } diff --git a/app/system/api/sys_oper_log.go b/app/system/api/sys_oper_log.go index 43db91e..3d3ca2a 100644 --- a/app/system/api/sys_oper_log.go +++ b/app/system/api/sys_oper_log.go @@ -19,7 +19,7 @@ import ( ) type sysOperLog struct { - systemBase + SystemBase } var SysOperLog = new(sysOperLog) diff --git a/app/system/api/sys_post.go b/app/system/api/sys_post.go index 05a6391..394ccfe 100644 --- a/app/system/api/sys_post.go +++ b/app/system/api/sys_post.go @@ -16,7 +16,7 @@ import ( ) type sysPost struct { - systemBase + SystemBase } var SysPost = new(sysPost) diff --git a/app/system/api/sys_role.go b/app/system/api/sys_role.go index 4696205..7bddbc7 100644 --- a/app/system/api/sys_role.go +++ b/app/system/api/sys_role.go @@ -11,7 +11,7 @@ import ( ) type sysRole struct { - systemBase + SystemBase } var SysRole = new(sysRole) diff --git a/app/system/api/sys_user.go b/app/system/api/sys_user.go index eba58b5..79c49df 100644 --- a/app/system/api/sys_user.go +++ b/app/system/api/sys_user.go @@ -10,7 +10,7 @@ import ( ) type user struct { - systemBase + SystemBase } var User = new(user) diff --git a/app/system/api/sys_user_online.go b/app/system/api/sys_user_online.go index b2e0d54..6dc00cd 100644 --- a/app/system/api/sys_user_online.go +++ b/app/system/api/sys_user_online.go @@ -16,7 +16,7 @@ import ( ) type sysUserOnline struct { - systemBase + SystemBase } var SysUserOnline = new(sysUserOnline) diff --git a/app/system/api/sys_web_set.go b/app/system/api/sys_web_set.go index 1db3dc5..e010d47 100644 --- a/app/system/api/sys_web_set.go +++ b/app/system/api/sys_web_set.go @@ -17,7 +17,7 @@ import ( ) type sysWebSet struct { - systemBase + SystemBase } var SysWebSet = new(sysWebSet) diff --git a/app/system/api/tools_gen_table.go b/app/system/api/tools_gen_table.go index e2fde15..f7dc46e 100644 --- a/app/system/api/tools_gen_table.go +++ b/app/system/api/tools_gen_table.go @@ -21,7 +21,7 @@ import ( ) type toolsGenTable struct { - systemBase + SystemBase } var ToolsGenTable = new(toolsGenTable) diff --git a/app/system/api/upload.go b/app/system/api/upload.go index bb4f90f..c5a651a 100644 --- a/app/system/api/upload.go +++ b/app/system/api/upload.go @@ -14,7 +14,7 @@ import ( ) type upload struct { - systemBase + SystemBase } var Upload = new(upload) diff --git a/app/system/api/user_Profile.go b/app/system/api/user_Profile.go index 8664a3e..916af55 100644 --- a/app/system/api/user_Profile.go +++ b/app/system/api/user_Profile.go @@ -17,7 +17,7 @@ import ( ) type userProfile struct { - systemBase + SystemBase } var UserProfile = new(userProfile) diff --git a/template/vm/go/controller.template b/template/vm/go/controller.template index 4e11146..807fa6a 100644 --- a/template/vm/go/controller.template +++ b/template/vm/go/controller.template @@ -17,8 +17,11 @@ package api {{end}} import ( - "gfast/app/system/dao" - "gfast/app/system/service" + {{if ne $.table.ModuleName "system"}} + sysApi "gfast/app/system/api" + {{end}} + "{{.table.PackageName}}/dao" + "{{.table.PackageName}}/service" "github.com/gogf/gf/frame/g" "github.com/gogf/gf/net/ghttp" "github.com/gogf/gf/util/gvalid" @@ -28,7 +31,11 @@ import ( ) type {{$structName}} struct { - {{.table.ModuleName}}Base + {{if ne $.table.ModuleName "system"}} + sysApi.SystemBase + {{else}} + SystemBase + {{end}} } var {{.table.ClassName}} = new({{$structName}}) diff --git a/template/vm/go/service.template b/template/vm/go/service.template index 313f911..37f5416 100644 --- a/template/vm/go/service.template +++ b/template/vm/go/service.template @@ -13,8 +13,8 @@ import ( {{if ne .table.TplCategory "tree"}} comModel "gfast/app/common/model" {{end}} - "gfast/app/system/dao" - "gfast/app/system/model" + "{{.table.PackageName}}/dao" + "{{.table.PackageName}}/model" {{if eq .table.TplCategory "tree"}} "github.com/gogf/gf/util/gconv" "gfast/library"