diff --git a/admin/index.html b/admin/index.html
index 6ab1d3a..7b84156 100644
--- a/admin/index.html
+++ b/admin/index.html
@@ -13,6 +13,21 @@
padding: 0;
}
+
+
+
diff --git a/admin/public/XErr.umd.js b/admin/public/XErr.umd.js
new file mode 100644
index 0000000..73d3d35
--- /dev/null
+++ b/admin/public/XErr.umd.js
@@ -0,0 +1,3 @@
+(function(a,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(a=typeof globalThis<"u"?globalThis:a||self,s(a.XErr={}))})(this,function(a){"use strict";var v=Object.defineProperty;var P=(a,s,d)=>s in a?v(a,s,{enumerable:!0,configurable:!0,writable:!0,value:d}):a[s]=d;var r=(a,s,d)=>P(a,typeof s!="symbol"?s+"":s,d);const s=[];for(let t=0;t<256;++t)s.push((t+256).toString(16).slice(1));function d(t,e=0){return(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase()}let m;const g=new Uint8Array(16);function y(){if(!m){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");m=crypto.getRandomValues.bind(crypto)}return m(g)}const h={};function w(t,e,i){let n;{const l=Date.now(),o=y();_(h,l,o),n=S(o,h.msecs,h.nsecs,h.clockseq,h.node,e,i)}return e?n:d(n)}function _(t,e,i){return t.msecs??(t.msecs=-1/0),t.nsecs??(t.nsecs=0),e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e>>24&255,o[c++]=u>>>16&255,o[c++]=u>>>8&255,o[c++]=u&255;const p=e/4294967296*1e4&268435455;o[c++]=p>>>8&255,o[c++]=p&255,o[c++]=p>>>24&15|16,o[c++]=p>>>16&255,o[c++]=n>>>8|128,o[c++]=n&255;for(let f=0;f<6;++f)o[c++]=l[f];return o}class x{constructor(e,i){r(this,"Dns","");r(this,"client_id","");r(this,"Pid","");r(this,"Uid","");r(this,"platform",null);r(this,"MessageList",[]);r(this,"timer",0);r(this,"Push",e=>{var i;this.MessageList.push({...e,ProjectKey:this.Pid,ClientId:this.client_id}),this.MessageList.length>5?this.upload():(i=this.platform)==null||i.setCache("x_err_message_list",this.MessageList)});r(this,"uploadInfo",e=>{var i;if(this.Dns)try{(i=this.platform)==null||i.upload(this.Dns+"/admin/monitor_client/add",{ProjectKey:this.Pid,ClientId:this.client_id,UserId:this.Uid,Width:e.ScreenWidth,Height:e.ScreenHeight}).catch(n=>{})}catch{}});r(this,"uploadSlow",e=>{var i;if(this.Dns)try{(i=this.platform)==null||i.upload(this.Dns+"/admin/monitor_slow/add",{ProjectKey:this.Pid,ClientId:this.client_id,UserId:this.Uid,Path:e.Path,Time:e.Time}).catch(n=>{})}catch{}});if(!e){console.error("props is null");return}if(!i){console.error("platform is null");return}if(this.platform=i,e.Dns&&e.Pid)this.Dns=e.Dns,this.Pid=e.Pid;else{console.error("props.Dns and props.Pid cannot be null");return}e.Uid&&(this.Uid=String(e.Uid)),this.setClientID(),this.SetUid(),this.getLocalMessage(),i.listen(n=>{if(console.log("listenCallback",n),n.Type=="onloadTime"){let l=n;this.uploadSlow(l)}else this.Push(n)}),this.timer=setInterval(()=>{this.upload()},1e3*10)}SetUid(e){var i,n;if(e)this.Uid=String(e),(i=this.platform)==null||i.setCache("x_err_uid",this.Uid);else{const l=(n=this.platform)==null?void 0:n.getCache("x_err_uid");l&&(this.Uid=l)}this.initEnv()}initEnv(){var i;let e=(i=this.platform)==null?void 0:i.getEnvInfo();e&&this.uploadInfo(e)}setClientID(){var i,n;const e=(i=this.platform)==null?void 0:i.getCache("x_err_client_id");e?this.client_id=e:(this.client_id=w(),(n=this.platform)==null||n.setCache("x_err_client_id",this.client_id))}getLocalMessage(){var i;let e=(i=this.platform)==null?void 0:i.getCache("x_err_message_list");e?this.MessageList=e:this.MessageList=[]}upload(){var e,i;if(this.Dns&&this.MessageList.length)try{(e=this.platform)==null||e.upload(this.Dns+"/admin/monitor_error/add",this.MessageList).catch(n=>{}),this.MessageList=[],(i=this.platform)==null||i.delCache("x_err_message_list")}catch{}}unListen(){var e;clearInterval(this.timer),(e=this.platform)==null||e.unListen()}}class T{constructor(e){r(this,"props");r(this,"listenError",e=>{var n;console.error([e]);let i=e.target;i!=null&&i.localName?(i==null?void 0:i.localName)==="img"||(i==null?void 0:i.localName)==="script"?this.callback({Type:"resources",EventType:i==null?void 0:i.localName,Path:i.src,Message:"",Stack:""}):(i==null?void 0:i.localName)==="link"&&this.callback({Type:"resources",EventType:i==null?void 0:i.localName,Path:i.href}):this.callback({Type:"error",EventType:e.type,Path:window.location.href,Message:e.message,Stack:this.handleStack(((n=e.error)==null?void 0:n.stack)||"")})});r(this,"unhandledrejection",e=>{var i,n;console.error(e),e&&typeof e.reason=="string"?this.callback({Type:"error",EventType:e.type,Path:window.location.href,Message:e.reason,Stack:""}):e&&typeof e.reason=="object"&&this.callback({Type:"error",EventType:e.type,Path:window.location.href,Message:((i=e.reason)==null?void 0:i.message)||"",Stack:this.handleStack(((n=e.reason)==null?void 0:n.stack)||"")})});r(this,"onLoad",()=>{const e=performance.getEntriesByType("navigation");if(e.length>0){const i=e[0];console.log("performanceData",i);let n=i.loadEventStart-i.startTime;this.props.onloadTimeOut&&n>this.props.onloadTimeOut&&this.callback({Type:"onloadTime",Path:window.location.href,Time:n})}});this.props={onloadTimeOut:5e3,...e}}upload(e,i){return new Promise(n=>{try{let l=new Image;l.onload=function(o){var c=o;c.preventDefault()},l.onerror=function(){},l.src=e+"?data="+encodeURIComponent(JSON.stringify(i)),n()}catch{n()}})}setCache(e,i){localStorage.setItem(e,JSON.stringify(i))}getCache(e){try{let i=localStorage.getItem(e);return i?JSON.parse(i):null}catch{return null}}delCache(e){localStorage.removeItem(e)}getEnvInfo(){const e={Type:"env",ScreenHeight:0,ScreenWidth:0};return window&&(e.ScreenHeight=window.innerHeight||0,e.ScreenWidth=window.innerWidth||0),e}callback(e){}handleStack(e){let i=[];return e&&e.split(`
+`).map((n,l)=>{l<4&&i.push(n)}),i.join(`
+`)}listen(e){this.callback=e,window.addEventListener("unhandledrejection",this.unhandledrejection),window.addEventListener("error",this.listenError,!0),window.addEventListener("load",this.onLoad)}unListen(){this.callback=()=>{},window.removeEventListener("error",this.listenError),window.removeEventListener("unhandledrejection",this.unhandledrejection)}}a.Base=x,a.Web=T,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
diff --git a/admin/src/api/monitor/client.ts b/admin/src/api/monitor/client.ts
index 6470a41..69aae28 100644
--- a/admin/src/api/monitor/client.ts
+++ b/admin/src/api/monitor/client.ts
@@ -13,7 +13,11 @@ export type type_monitor_client = {
UserId?: string
Os?: string
Browser?: string
+ Country?: string
+ Province?: string
City?: string
+ Operator?: string
+ Ip?: string
Width?: number
Height?: number
Ua?: string
@@ -26,14 +30,16 @@ export type type_monitor_client_query = {
UserId?: string
Os?: string
Browser?: string
+ Country?: string
+ Province?: string
City?: string
+ Operator?: string
+ Ip?: string
Width?: number
Height?: number
Ua?: string
CreateTimeStart?: string
CreateTimeEnd?: string
- ClientTimeStart?: string
- ClientTimeEnd?: string
}
// 添加编辑
export type type_monitor_client_edit = {
@@ -43,7 +49,11 @@ export type type_monitor_client_edit = {
UserId?: string
Os?: string
Browser?: string
+ Country?: string
+ Province?: string
City?: string
+ Operator?: string
+ Ip?: string
Width?: number
Height?: number
Ua?: string
diff --git a/admin/src/api/monitor/slow.ts b/admin/src/api/monitor/slow.ts
new file mode 100644
index 0000000..3eb6fe7
--- /dev/null
+++ b/admin/src/api/monitor/slow.ts
@@ -0,0 +1,77 @@
+import request from '@/utils/request'
+import type { Pages } from '@/utils/request'
+
+import config from '@/config'
+import queryString from 'query-string'
+import { getToken } from '@/utils/auth'
+import { clearEmpty } from '@/utils/util'
+
+export type type_monitor_slow = {
+ Id?: number
+ ProjectKey?: string
+ ClientId?: string
+ UserId?: string
+ Path?: string
+ Time?: number
+ CreateTime?: string
+}
+// 查询
+export type type_monitor_slow_query = {
+ ProjectKey?: string
+ ClientId?: string
+ UserId?: string
+ Path?: string
+ Time?: number
+ CreateTimeStart?: string
+ CreateTimeEnd?: string
+}
+// 添加编辑
+export type type_monitor_slow_edit = {
+ Id?: number
+ ProjectKey?: string
+ ClientId?: string
+ UserId?: string
+ Path?: string
+ Time?: number
+}
+
+// 监控-错误列列表
+export function monitor_slow_list(params?: type_monitor_slow_query) {
+ return request.get>({ url: '/monitor_slow/list', params: clearEmpty(params) })
+}
+// 监控-错误列列表-所有
+export function monitor_slow_list_all(params?: type_monitor_slow_query) {
+ return request.get({ url: '/monitor_slow/listAll', params: clearEmpty(params) })
+}
+
+// 监控-错误列详情
+export function monitor_slow_detail(Id: number | string) {
+ return request.get({ url: '/monitor_slow/detail', params: { Id } })
+}
+
+// 监控-错误列新增
+export function monitor_slow_add(data: type_monitor_slow_edit) {
+ return request.post({ url: '/monitor_slow/add', data })
+}
+
+// 监控-错误列编辑
+export function monitor_slow_edit(data: type_monitor_slow_edit) {
+ return request.post({ url: '/monitor_slow/edit', data })
+}
+
+// 监控-错误列删除
+export function monitor_slow_delete(Id: number | string) {
+ return request.post({ url: '/monitor_slow/del', data: { Id } })
+}
+// 监控-错误列删除-批量
+export function monitor_slow_delete_batch(data: { Ids: string }) {
+ return request.post({ url: '/monitor_slow/delBatch', data })
+}
+
+// 监控-错误列导入
+export const monitor_slow_import_file = '/monitor_slow/ImportFile'
+
+// 监控-错误列导出
+export function monitor_slow_export_file(params: any) {
+ return (window.location.href =`${config.baseUrl}${config.urlPrefix}/monitor_slow/ExportFile?token=${getToken()}&` + queryString.stringify(clearEmpty(params)))
+}
diff --git a/admin/src/components/dict-value/index.vue b/admin/src/components/dict-value/index.vue
index f9cee28..a34915f 100644
--- a/admin/src/components/dict-value/index.vue
+++ b/admin/src/components/dict-value/index.vue
@@ -1,14 +1,12 @@
-
-
- {{ index != 0 ? '、' : '' }}{{ item[props.labelKey] }}
-
-
+
+ {{ index != 0 ? '、' : '' }}{{ item[props.labelKey] }}
+
diff --git a/admin/src/components/icon/picker.vue b/admin/src/components/icon/picker.vue
index d18fc92..b2dcd5e 100644
--- a/admin/src/components/icon/picker.vue
+++ b/admin/src/components/icon/picker.vue
@@ -77,7 +77,7 @@
+
+
+ {{ msg }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/src/views/flow/flow_history/todo.vue b/admin/src/views/flow/flow_history/todo.vue
index c85d4cb..e0eea55 100644
--- a/admin/src/views/flow/flow_history/todo.vue
+++ b/admin/src/views/flow/flow_history/todo.vue
@@ -69,7 +69,7 @@
diff --git a/admin/src/views/monitor/project/edit.vue b/admin/src/views/monitor/project/edit.vue
index 3519131..1c3be9e 100644
--- a/admin/src/views/monitor/project/edit.vue
+++ b/admin/src/views/monitor/project/edit.vue
@@ -4,14 +4,14 @@
ref="popupRef"
:title="popupTitle"
:async="true"
- width="550px"
+ width="700px"
:clickModalClose="true"
@confirm="handleSubmit"
@close="handleClose"
>
-
-
+
+ {{ formData.ProjectKey }}
@@ -48,6 +48,9 @@
/>
+
+
+
@@ -73,6 +76,7 @@ defineProps({
default: () => ({})
}
})
+
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef()
const popupRef = shallowRef>()
@@ -88,7 +92,19 @@ const formData = reactive({
ProjectType: null,
Status: null
})
-
+const code = computed(() => {
+ return `import { XErr, XErrWeb } from '../../x_err_sdk/web/index'
+new XErr(
+ {
+ Dns: '${location.origin}/api',
+ Pid: '${formData.ProjectKey}',
+ Uid: ''
+ },
+ new XErrWeb({
+ onloadTimeOut: 3000
+ })
+)`
+})
const formRules = {
Id: [
{
diff --git a/admin/src/views/monitor/project/index.vue b/admin/src/views/monitor/project/index.vue
index 7fbe46a..8fc0e8c 100644
--- a/admin/src/views/monitor/project/index.vue
+++ b/admin/src/views/monitor/project/index.vue
@@ -37,13 +37,13 @@
/>
-
+
-
+
+
+
+
diff --git a/admin/src/views/monitor/slow/index.vue b/admin/src/views/monitor/slow/index.vue
new file mode 100644
index 0000000..e670794
--- /dev/null
+++ b/admin/src/views/monitor/slow/index.vue
@@ -0,0 +1,202 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+ 批量删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/vite.config.ts b/admin/vite.config.ts
index 443d206..c1c1ca0 100644
--- a/admin/vite.config.ts
+++ b/admin/vite.config.ts
@@ -23,10 +23,12 @@ export default ({ mode }) => {
// 依赖预构建,避免开发刷新
include: ['@wangeditor/editor-for-vue', 'vuedraggable', 'vue-echarts', 'crypto-js']
},
+
base: '/',
build: {
sourcemap: true,
rollupOptions: {
+ external: ['XErr'],
output: {
manualChunks: {
vue: ['vue'],
diff --git a/docs/admin/nginx配置.md b/docs/admin/nginx配置.md
index 10f7902..477dea0 100644
--- a/docs/admin/nginx配置.md
+++ b/docs/admin/nginx配置.md
@@ -4,8 +4,13 @@
## 前端页面使用history模式需要重定向
```nginx
+
location / {
index /index.html;
try_files $uri $uri/ /index.html;
}
+# 找不到静态文件返回404
+location ~* \.(?:html|css|js|png|jpg|jpeg|gif|webp|pdf|mp4|mp3|aac|ico|svg|woff|woff2|ttf|eot)$ {
+ try_files $uri =404;
+}
```
\ No newline at end of file
diff --git a/server.code-workspace b/server.code-workspace
index b054356..c10644e 100644
--- a/server.code-workspace
+++ b/server.code-workspace
@@ -17,6 +17,9 @@
},
{
"path": ".workflow"
+ },
+ {
+ "path": "x_err_sdk"
}
],
"settings": {
diff --git a/server/admin/article_collect/article_collect_service.go b/server/admin/article_collect/article_collect_service.go
index 270a263..e75063c 100644
--- a/server/admin/article_collect/article_collect_service.go
+++ b/server/admin/article_collect/article_collect_service.go
@@ -5,7 +5,7 @@ import (
"x_admin/core/request"
"x_admin/core/response"
"x_admin/model"
- "x_admin/util"
+ "x_admin/util/convert_util"
"gorm.io/gorm"
)
@@ -58,7 +58,7 @@ func (service ArticleCollectService) List(page request.PageReq, listReq ArticleC
return
}
result := []ArticleCollectResp{}
- util.ConvertUtil.Copy(&result, modelList)
+ convert_util.Copy(&result, modelList)
return response.PageResp{
PageNo: page.PageNo,
PageSize: page.PageSize,
diff --git a/server/admin/common/album/service.go b/server/admin/common/album/service.go
index 4aebe8b..9b5f647 100644
--- a/server/admin/common/album/service.go
+++ b/server/admin/common/album/service.go
@@ -8,6 +8,7 @@ import (
"x_admin/core/response"
"x_admin/model/common_model"
"x_admin/util"
+ "x_admin/util/convert_util"
"gorm.io/gorm"
)
@@ -66,7 +67,7 @@ func (albSrv albumService) AlbumList(page request.PageReq, listReq CommonAlbumLi
return
}
albumResps := []CommonAlbumListResp{}
- util.ConvertUtil.Copy(&albumResps, albums)
+ convert_util.Copy(&albumResps, albums)
// TODO: engine默认local
engine := "local"
for i := 0; i < len(albumResps); i++ {
@@ -134,7 +135,7 @@ func (albSrv albumService) AlbumAdd(addReq CommonAlbumAddReq) (res uint, e error
// core.Logger.Errorf("AlbumAdd Decode err: err=[%+v]", err)
// return response.SystemError
//}
- util.ConvertUtil.Copy(&alb, addReq)
+ convert_util.Copy(&alb, addReq)
err := albSrv.db.Create(&alb).Error
if e = response.CheckErr(err, "Album添加失败"); e != nil {
return
@@ -173,14 +174,14 @@ func (albSrv albumService) CateList(listReq CommonCateListReq) (mapList []Common
return
}
cateResps := []CommonCateListResp{}
- util.ConvertUtil.Copy(&cateResps, cates)
+ convert_util.Copy(&cateResps, cates)
return cateResps, nil
}
// CateAdd 分类新增
func (albSrv albumService) CateAdd(addReq CommonCateAddReq) (e error) {
var cate common_model.AlbumCate
- util.ConvertUtil.Copy(&cate, addReq)
+ convert_util.Copy(&cate, addReq)
err := albSrv.db.Create(&cate).Error
e = response.CheckErr(err, "Cate添加失败")
return
diff --git a/server/admin/common/index/index.go b/server/admin/common/index/index.go
index 71992cf..238b918 100644
--- a/server/admin/common/index/index.go
+++ b/server/admin/common/index/index.go
@@ -8,14 +8,6 @@ import (
)
func IndexRoute(rg *gin.RouterGroup) {
- // db := core.GetDB()
- // permSrv := system.NewSystemAuthPermService(db)
- // roleSrv := system.NewSystemAuthRoleService(db, permSrv)
- // adminSrv := system.NewSystemAuthAdminService(db, permSrv, roleSrv)
- // service := system.NewSystemLoginService(db, adminSrv)
-
- // authSrv := system.NewSystemAuthMenuService(db, permSrv)
- // IndexService := NewIndexService()
handle := indexHandler{}
rg = rg.Group("/common", middleware.TokenAuth())
diff --git a/server/admin/common/index/service.go b/server/admin/common/index/service.go
index 6e49404..3b8a7bb 100644
--- a/server/admin/common/index/service.go
+++ b/server/admin/common/index/service.go
@@ -10,15 +10,10 @@ import (
"gorm.io/gorm"
)
-type IIndexService interface {
- Console() (res map[string]interface{}, e error)
- Config() (res map[string]interface{}, e error)
-}
-
var Service = NewIndexService()
// NewIndexService 初始化
-func NewIndexService() IIndexService {
+func NewIndexService() *indexService {
db := core.GetDB()
return &indexService{db: db}
}
@@ -47,7 +42,7 @@ func (iSrv indexService) Console() (res map[string]interface{}, e error) {
}
// 今日数据
today := map[string]interface{}{
- "time": "2022-08-11 15:08:29",
+ "time": util.NullTimeUtil.Now(),
"todayVisits": 10, // 访问量(人)
"totalVisits": 100, // 总访问量
"todaySales": 30, // 销售额(元)
@@ -65,7 +60,7 @@ func (iSrv indexService) Console() (res map[string]interface{}, e error) {
}
visitor := map[string]interface{}{
"date": date,
- "list": []int{12, 13, 11, 5, 8, 22, 14, 9, 456, 62, 78, 12, 18, 22, 46},
+ "list": []int{12, 13, 11, 5, 100, 22, 14, 9, 456, 62, 78, 12, 18, 22, 46},
}
return map[string]interface{}{
"version": version,
diff --git a/server/admin/common/upload/service.go b/server/admin/common/upload/service.go
index 1d8effc..eb0e847 100644
--- a/server/admin/common/upload/service.go
+++ b/server/admin/common/upload/service.go
@@ -4,7 +4,7 @@ import (
"mime/multipart"
"x_admin/admin/common/album"
"x_admin/plugin"
- "x_admin/util"
+ "x_admin/util/convert_util"
)
type IUploadService interface {
@@ -39,14 +39,14 @@ func (upSrv uploadService) uploadFile(file *multipart.FileHeader, folder string,
return
}
var addReq album.CommonAlbumAddReq
- util.ConvertUtil.Copy(&addReq, upRes)
+ convert_util.Copy(&addReq, upRes)
addReq.Aid = aid
addReq.Cid = cid
var albumId uint
if albumId, e = album.Service.AlbumAdd(addReq); e != nil {
return
}
- util.ConvertUtil.Copy(&res, addReq)
+ convert_util.Copy(&res, addReq)
res.ID = albumId
res.Path = upRes.Path
return res, nil
diff --git a/server/admin/flow/flow_apply/flow_apply_service.go b/server/admin/flow/flow_apply/flow_apply_service.go
index 1eff2b9..9de3a9e 100644
--- a/server/admin/flow/flow_apply/flow_apply_service.go
+++ b/server/admin/flow/flow_apply/flow_apply_service.go
@@ -8,6 +8,7 @@ import (
"x_admin/core/response"
"x_admin/model"
"x_admin/util"
+ "x_admin/util/convert_util"
"gorm.io/gorm"
)
@@ -81,7 +82,7 @@ func (service flowApplyService) List(page request.PageReq, listReq FlowApplyList
return
}
result := []FlowApplyResp{}
- util.ConvertUtil.Copy(&result, modelList)
+ convert_util.Copy(&result, modelList)
return response.PageResp{
PageNo: page.PageNo,
PageSize: page.PageSize,
@@ -100,7 +101,7 @@ func (service flowApplyService) Detail(id int) (res FlowApplyResp, e error) {
if e = response.CheckErr(err, "详情获取失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&res, obj)
+ convert_util.Copy(&res, obj)
return
}
@@ -111,7 +112,7 @@ func (service flowApplyService) Add(addReq FlowApplyAddReq) (e error) {
if e = response.CheckErrDBNotRecord(err, "模板不存在!"); e != nil {
return
}
- util.ConvertUtil.Copy(&obj, addReq)
+ convert_util.Copy(&obj, addReq)
// obj.FlowName = flow_template_resp.FlowName
obj.FlowGroup = flow_template_resp.FlowGroup
obj.FlowRemark = flow_template_resp.FlowRemark
@@ -136,7 +137,7 @@ func (service flowApplyService) Edit(editReq FlowApplyEditReq) (e error) {
return
}
// 更新
- util.ConvertUtil.Copy(&obj, editReq)
+ convert_util.Copy(&obj, editReq)
err = service.db.Model(&obj).Updates(obj).Error
e = response.CheckErr(err, "编辑失败")
return
diff --git a/server/admin/flow/flow_history/flow_history_service.go b/server/admin/flow/flow_history/flow_history_service.go
index bbeebd4..c9a8219 100644
--- a/server/admin/flow/flow_history/flow_history_service.go
+++ b/server/admin/flow/flow_history/flow_history_service.go
@@ -14,6 +14,7 @@ import (
"x_admin/model"
"x_admin/model/system_model"
"x_admin/util"
+ "x_admin/util/convert_util"
"gorm.io/gorm"
)
@@ -93,7 +94,7 @@ func (service flowHistoryService) List(page request.PageReq, listReq FlowHistory
return
}
list := []FlowHistoryResp{}
- util.ConvertUtil.Copy(&list, modelList)
+ convert_util.Copy(&list, modelList)
return response.PageResp{
PageNo: page.PageNo,
PageSize: page.PageSize,
@@ -122,7 +123,7 @@ func (service flowHistoryService) ListAll(listReq FlowHistoryListReq) (res []Flo
if e = response.CheckErr(err, "获取列表失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&res, modelList)
+ convert_util.Copy(&res, modelList)
return res, nil
}
@@ -136,14 +137,14 @@ func (service flowHistoryService) Detail(id int) (res FlowHistoryResp, e error)
if e = response.CheckErr(err, "详情获取失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&res, obj)
+ convert_util.Copy(&res, obj)
return
}
// Add 流程历史新增
func (service flowHistoryService) Add(addReq FlowHistoryAddReq) (e error) {
var obj model.FlowHistory
- util.ConvertUtil.Copy(&obj, addReq)
+ convert_util.Copy(&obj, addReq)
err := service.db.Create(&obj).Error
e = response.CheckErr(err, "添加失败")
return
@@ -161,7 +162,7 @@ func (service flowHistoryService) Edit(editReq FlowHistoryEditReq) (e error) {
return
}
// 更新
- util.ConvertUtil.Copy(&obj, editReq)
+ convert_util.Copy(&obj, editReq)
err = service.db.Model(&obj).Updates(obj).Error
e = response.CheckErr(err, "编辑失败")
return
@@ -422,7 +423,7 @@ func (service flowHistoryService) Back(back BackReq) (e error) {
}
var obj model.FlowApply
- util.ConvertUtil.Copy(&obj, applyDetail)
+ convert_util.Copy(&obj, applyDetail)
obj.Status = 4
err = tx.Save(&obj).Error
if err != nil {
diff --git a/server/admin/flow/flow_template/flow_template_service.go b/server/admin/flow/flow_template/flow_template_service.go
index e254f7f..fa42f8d 100644
--- a/server/admin/flow/flow_template/flow_template_service.go
+++ b/server/admin/flow/flow_template/flow_template_service.go
@@ -5,7 +5,7 @@ import (
"x_admin/core/request"
"x_admin/core/response"
"x_admin/model"
- "x_admin/util"
+ "x_admin/util/convert_util"
"gorm.io/gorm"
)
@@ -67,7 +67,7 @@ func (service flowTemplateService) List(page request.PageReq, listReq FlowTempla
return
}
result := []FlowTemplateResp{}
- util.ConvertUtil.Copy(&result, modelList)
+ convert_util.Copy(&result, modelList)
return response.PageResp{
PageNo: page.PageNo,
PageSize: page.PageSize,
@@ -83,7 +83,7 @@ func (service flowTemplateService) ListAll() (res []FlowTemplateResp, e error) {
if e = response.CheckErr(err, "获取列表失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&res, modelList)
+ convert_util.Copy(&res, modelList)
return res, nil
}
@@ -97,14 +97,14 @@ func (service flowTemplateService) Detail(id int) (res FlowTemplateResp, e error
if e = response.CheckErr(err, "详情获取失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&res, obj)
+ convert_util.Copy(&res, obj)
return
}
// Add 流程模板新增
func (service flowTemplateService) Add(addReq FlowTemplateAddReq) (e error) {
var obj model.FlowTemplate
- util.ConvertUtil.Copy(&obj, addReq)
+ convert_util.Copy(&obj, addReq)
err := service.db.Create(&obj).Error
e = response.CheckErr(err, "添加失败")
return
@@ -122,7 +122,7 @@ func (service flowTemplateService) Edit(editReq FlowTemplateEditReq) (e error) {
return
}
// 更新
- util.ConvertUtil.Copy(&obj, editReq)
+ convert_util.Copy(&obj, editReq)
err = service.db.Model(&obj).Updates(obj).Error
e = response.CheckErr(err, "编辑失败")
return
diff --git a/server/admin/generator/gen/service.go b/server/admin/generator/gen/service.go
index 65573ca..89b810a 100644
--- a/server/admin/generator/gen/service.go
+++ b/server/admin/generator/gen/service.go
@@ -9,6 +9,7 @@ import (
"x_admin/core/request"
"x_admin/core/response"
"x_admin/model/gen_model"
+ "x_admin/util/convert_util"
"strings"
@@ -123,11 +124,11 @@ func (genSrv generateService) Detail(id uint) (res GenTableDetailResp, e error)
return
}
var base GenTableBaseResp
- util.ConvertUtil.Copy(&base, genTb)
+ convert_util.Copy(&base, genTb)
var gen GenTableGenResp
- util.ConvertUtil.Copy(&gen, genTb)
+ convert_util.Copy(&gen, genTb)
var colResp []GenColumnResp
- util.ConvertUtil.Copy(&colResp, columns)
+ convert_util.Copy(&colResp, columns)
return GenTableDetailResp{
Base: base,
Gen: gen,
@@ -143,7 +144,7 @@ func (genSrv generateService) ImportTable(tableNames []string) (e error) {
return
}
var tables []gen_model.GenTable
- util.ConvertUtil.Copy(&tables, dbTbs)
+ convert_util.Copy(&tables, dbTbs)
if len(tables) == 0 {
e = response.AssertArgumentError.SetMessage("表不存在!")
return
@@ -281,7 +282,7 @@ func (genSrv generateService) EditTable(editReq EditTableReq) (e error) {
if e = response.CheckErr(err, "查找数据失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&genTable, editReq)
+ convert_util.Copy(&genTable, editReq)
err = genSrv.db.Transaction(func(tx *gorm.DB) error {
genTable.SubTableName = strings.Replace(editReq.SubTableName, config.Config.DbTablePrefix, "", 1)
txErr := tx.Save(&genTable).Error
@@ -290,7 +291,7 @@ func (genSrv generateService) EditTable(editReq EditTableReq) (e error) {
}
for i := 0; i < len(editReq.Columns); i++ {
var col gen_model.GenTableColumn
- util.ConvertUtil.Copy(&col, editReq.Columns[i])
+ convert_util.Copy(&col, editReq.Columns[i])
txErr = tx.Save(&col).Error
if te := response.CheckErr(txErr, "更新失败"); te != nil {
return te
diff --git a/server/admin/generator/tpl_utils/templates/gocode/route.go.tpl b/server/admin/generator/tpl_utils/templates/gocode/route.go.tpl
index 5e05d0d..a79f8b3 100644
--- a/server/admin/generator/tpl_utils/templates/gocode/route.go.tpl
+++ b/server/admin/generator/tpl_utils/templates/gocode/route.go.tpl
@@ -26,19 +26,17 @@ admin:{{{.ModuleName }}}:detail
admin:{{{.ModuleName }}}:ExportFile
admin:{{{.ModuleName }}}:ImportFile
-// 列表-先添加菜单获取菜单id
+// 列表
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, paths, component, is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'C', '{{{ .FunctionName }}}', '{{{nameToPath .ModuleName }}}/index', '{{{nameToPath .ModuleName }}}/index', 0, 1, 0, now(), now());
-按钮-替换pid参数为菜单id
-
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}添加','admin:{{{ .ModuleName }}}:add', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}编辑','admin:{{{ .ModuleName }}}:edit', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}删除','admin:{{{ .ModuleName }}}:del', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}删除-批量','admin:{{{ .ModuleName }}}:delBatch', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}列表','admin:{{{ .ModuleName }}}:list', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}全部列表','admin:{{{ .ModuleName }}}:listAll', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}详情','admin:{{{ .ModuleName }}}:detail', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}导出excel','admin:{{{ .ModuleName }}}:ExportFile', 0, 1, 0, now(), now());
-INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '{{{ .FunctionName }}}导入excel','admin:{{{ .ModuleName }}}:ImportFile', 0, 1, 0, now(), now());
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}添加','admin:{{{ .ModuleName }}}:add', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}编辑','admin:{{{ .ModuleName }}}:edit', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}删除','admin:{{{ .ModuleName }}}:del', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}删除-批量','admin:{{{ .ModuleName }}}:delBatch', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}列表','admin:{{{ .ModuleName }}}:list', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}全部列表','admin:{{{ .ModuleName }}}:listAll', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}详情','admin:{{{ .ModuleName }}}:detail', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}导出excel','admin:{{{ .ModuleName }}}:ExportFile', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
+INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}导入excel','admin:{{{ .ModuleName }}}:ImportFile', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
*/
diff --git a/server/admin/generator/tpl_utils/templates/gocode/service.go.tpl b/server/admin/generator/tpl_utils/templates/gocode/service.go.tpl
index d884bb8..3bb30d8 100644
--- a/server/admin/generator/tpl_utils/templates/gocode/service.go.tpl
+++ b/server/admin/generator/tpl_utils/templates/gocode/service.go.tpl
@@ -7,6 +7,7 @@ import (
"x_admin/model"
"gorm.io/gorm"
"x_admin/util"
+ "x_admin/util/convert_util"
"x_admin/util/excel2"
)
@@ -82,7 +83,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) List(page request.PageReq,
return
}
result := []{{{ toUpperCamelCase .EntityName }}}Resp{}
- util.ConvertUtil.Copy(&result, modelList)
+ convert_util.Copy(&result, modelList)
return response.PageResp{
PageNo: page.PageNo,
PageSize: page.PageSize,
@@ -100,7 +101,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) ListAll(listReq {{{ toUppe
if e = response.CheckErr(err, "查询全部失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&res, modelList)
+ convert_util.Copy(&res, modelList)
return res, nil
}
@@ -125,14 +126,14 @@ func (service {{{ toCamelCase .EntityName }}}Service) Detail({{{ toUpperCamelCas
cacheUtil.SetCache(obj.{{{ toUpperCamelCase .PrimaryKey }}}, obj)
}
- util.ConvertUtil.Copy(&res, obj)
+ convert_util.Copy(&res, obj)
return
}
// Add {{{ .FunctionName }}}新增
func (service {{{ toCamelCase .EntityName }}}Service) Add(addReq {{{ toUpperCamelCase .EntityName }}}AddReq) (createId int,e error) {
var obj model.{{{ toUpperCamelCase .EntityName }}}
- util.ConvertUtil.StructToStruct(addReq,&obj)
+ convert_util.StructToStruct(addReq,&obj)
err := service.db.Create(&obj).Error
e = response.CheckMysqlErr(err)
if e != nil {
@@ -154,7 +155,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) Edit(editReq {{{ toUpperCa
if e = response.CheckErr(err, "查询失败"); e != nil {
return
}
- util.ConvertUtil.Copy(&obj, editReq)
+ convert_util.Copy(&obj, editReq)
err = service.db.Model(&obj).Select("*").Updates(obj).Error
if e = response.CheckErr(err, "编辑失败"); e != nil {
@@ -200,9 +201,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) DelBatch(Ids []string) (e
return err
}
// 删除缓存
- for _, v := range Ids {
- cacheUtil.RemoveCache(v)
- }
+ cacheUtil.RemoveCache(Ids)
return nil
}
@@ -237,14 +236,14 @@ func (service {{{ toCamelCase .EntityName }}}Service) ExportFile(listReq {{{ toU
return
}
result := []{{{ toUpperCamelCase .EntityName }}}Resp{}
- util.ConvertUtil.Copy(&result, modelList)
+ convert_util.Copy(&result, modelList)
return result, nil
}
// 导入
func (service {{{ toCamelCase .EntityName }}}Service) ImportFile(importReq []{{{ toUpperCamelCase .EntityName }}}Resp) (e error) {
var importData []model.{{{ toUpperCamelCase .EntityName }}}
- util.ConvertUtil.Copy(&importData, importReq)
+ convert_util.Copy(&importData, importReq)
err := service.db.Create(&importData).Error
e = response.CheckErr(err, "添加失败")
return e
diff --git a/server/admin/generator/tpl_utils/templates/vue/index.vue.tpl b/server/admin/generator/tpl_utils/templates/vue/index.vue.tpl
index 311b039..9a4b2f8 100644
--- a/server/admin/generator/tpl_utils/templates/vue/index.vue.tpl
+++ b/server/admin/generator/tpl_utils/templates/vue/index.vue.tpl
@@ -173,7 +173,7 @@