mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-09-27 12:32:19 +08:00
更换为null_time,null_int
This commit is contained in:
@@ -7,38 +7,39 @@ import { getToken } from '@/utils/auth'
|
|||||||
import { clearEmpty } from '@/utils/util'
|
import { clearEmpty } from '@/utils/util'
|
||||||
|
|
||||||
export type type_system_log_sms = {
|
export type type_system_log_sms = {
|
||||||
id?: number
|
Id?: number
|
||||||
scene?: number
|
Scene?: number
|
||||||
mobile?: string
|
Mobile?: string
|
||||||
content?: string
|
Content?: string
|
||||||
status?: number
|
Status?: number
|
||||||
results?: string
|
Results?: string
|
||||||
send_time?: number
|
SendTime?: string
|
||||||
create_time?: string
|
CreateTime?: string
|
||||||
update_time?: string
|
UpdateTime?: string
|
||||||
}
|
}
|
||||||
// 查询
|
// 查询
|
||||||
export type type_system_log_sms_query = {
|
export type type_system_log_sms_query = {
|
||||||
scene?: number
|
Scene?: number
|
||||||
mobile?: string
|
Mobile?: string
|
||||||
content?: string
|
Content?: string
|
||||||
status?: number
|
Status?: number
|
||||||
results?: string
|
Results?: string
|
||||||
send_time?: number
|
SendTime_start?: string
|
||||||
create_timeStart?: string
|
SendTime_end?: string
|
||||||
create_timeEnd?: string
|
CreateTime_start?: string
|
||||||
update_timeStart?: string
|
CreateTime_end?: string
|
||||||
update_timeEnd?: string
|
UpdateTime_start?: string
|
||||||
|
UpdateTime_end?: string
|
||||||
}
|
}
|
||||||
// 添加编辑
|
// 添加编辑
|
||||||
export type type_system_log_sms_edit = {
|
export type type_system_log_sms_edit = {
|
||||||
id?: number
|
Id?: number
|
||||||
scene?: number
|
Scene?: number
|
||||||
mobile?: string
|
Mobile?: string
|
||||||
content?: string
|
Content?: string
|
||||||
status?: number
|
Status?: number
|
||||||
results?: string
|
Results?: string
|
||||||
send_time?: number
|
SendTime?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 系统短信日志列表
|
// 系统短信日志列表
|
||||||
@@ -68,7 +69,11 @@ export function system_log_sms_add(data: type_system_log_sms_edit) {
|
|||||||
|
|
||||||
// 系统短信日志编辑
|
// 系统短信日志编辑
|
||||||
export function system_log_sms_edit(data: type_system_log_sms_edit) {
|
export function system_log_sms_edit(data: type_system_log_sms_edit) {
|
||||||
return request.post<null>({ url: '/system_log_sms/edit', data })
|
return request.post<null>({
|
||||||
|
url: '/system_log_sms/edit',
|
||||||
|
data: data
|
||||||
|
// data: clearEmpty(data)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 系统短信日志删除
|
// 系统短信日志删除
|
||||||
|
@@ -2,12 +2,15 @@
|
|||||||
<div>
|
<div>
|
||||||
<template v-for="(item, index) in getOptions" :key="index">
|
<template v-for="(item, index) in getOptions" :key="index">
|
||||||
<span :style="{ color: item.color }"
|
<span :style="{ color: item.color }"
|
||||||
>{{ index != 0 ? '、' : '' }}{{ item[props.valueKey] }}</span
|
>{{ index != 0 ? '、' : '' }}{{ item[props.labelKey] }}</span
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
defineOptions({
|
||||||
|
name: 'dict-value'
|
||||||
|
})
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
options: any[]
|
options: any[]
|
||||||
|
@@ -190,7 +190,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.login {
|
.login {
|
||||||
background-image: url('./images/login_bg.png');
|
// background-image: url('./images/login_bg.png');
|
||||||
|
background-color: #f8f8f8;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
@@ -82,7 +82,7 @@
|
|||||||
<el-option label="float64" value="float64" />
|
<el-option label="float64" value="float64" />
|
||||||
<el-option label="rune" value="rune" />
|
<el-option label="rune" value="rune" />
|
||||||
<el-option label="bool" value="bool" />
|
<el-option label="bool" value="bool" />
|
||||||
<el-option label="TsTime" value="core.TsTime" />
|
<el-option label="NullTime" value="core.NullTime" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@@ -10,19 +10,22 @@
|
|||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||||
<el-form-item label="场景编号" prop="scene">
|
<el-form-item label="id" prop="Id">
|
||||||
<el-input v-model="formData.scene" placeholder="请输入场景编号" />
|
<el-input v-model="formData.Id" type="number" placeholder="请输入id" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="手机号码" prop="mobile">
|
<el-form-item label="场景编号" prop="Scene">
|
||||||
<el-input v-model="formData.mobile" placeholder="请输入手机号码" />
|
<el-input v-model="formData.Scene" placeholder="请输入场景编号" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发送内容" prop="content">
|
<el-form-item label="手机号码" prop="Mobile">
|
||||||
<editor v-model="formData.content" :height="500" />
|
<el-input v-model="formData.Mobile" placeholder="请输入手机号码" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]" prop="status">
|
<el-form-item label="发送内容" prop="Content">
|
||||||
|
<editor v-model="formData.Content" :height="500" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]" prop="Status">
|
||||||
<el-select
|
<el-select
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
v-model="formData.status"
|
v-model="formData.Status"
|
||||||
placeholder="请选择发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
placeholder="请选择发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@@ -35,19 +38,22 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="短信结果" prop="results">
|
<el-form-item label="短信结果" prop="Results">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="formData.results"
|
v-model="formData.Results"
|
||||||
placeholder="请输入短信结果"
|
placeholder="请输入短信结果"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发送时间" prop="send_time">
|
<el-form-item label="发送时间" prop="SendTime">
|
||||||
<el-input
|
<el-date-picker
|
||||||
v-model.number="formData.send_time"
|
class="flex-1 !flex"
|
||||||
type="number"
|
v-model="formData.SendTime"
|
||||||
placeholder="请输入发送时间"
|
type="datetime"
|
||||||
|
clearable
|
||||||
|
value-format="YYYY-MM-DD hh:mm:ss"
|
||||||
|
placeholder="请选择发送时间"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -83,62 +89,62 @@ const popupTitle = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
Id: null,
|
||||||
scene: '',
|
Scene: null,
|
||||||
mobile: '',
|
Mobile: null,
|
||||||
content: '',
|
Content: null,
|
||||||
status: '',
|
Status: null,
|
||||||
results: '',
|
Results: null,
|
||||||
send_time: ''
|
SendTime: null
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules = {
|
const formRules = {
|
||||||
id: [
|
// Id: [
|
||||||
{
|
// {
|
||||||
required: true,
|
// required: true,
|
||||||
message: '请输入id',
|
// message: '请输入id',
|
||||||
trigger: ['blur']
|
// trigger: ['blur']
|
||||||
}
|
// }
|
||||||
]
|
// ],
|
||||||
// scene: [
|
// Scene: [
|
||||||
// {
|
// {
|
||||||
// required: true,
|
// required: true,
|
||||||
// message: '请输入场景编号',
|
// message: '请输入场景编号',
|
||||||
// trigger: ['blur']
|
// trigger: ['blur']
|
||||||
// }
|
// }
|
||||||
// ],
|
// ],
|
||||||
// mobile: [
|
// Mobile: [
|
||||||
// {
|
// {
|
||||||
// required: true,
|
// required: true,
|
||||||
// message: '请输入手机号码',
|
// message: '请输入手机号码',
|
||||||
// trigger: ['blur']
|
// trigger: ['blur']
|
||||||
// }
|
// }
|
||||||
// ],
|
// ],
|
||||||
// content: [
|
// Content: [
|
||||||
// {
|
// {
|
||||||
// required: true,
|
// required: true,
|
||||||
// message: '请输入发送内容',
|
// message: '请输入发送内容',
|
||||||
// trigger: ['blur']
|
// trigger: ['blur']
|
||||||
// }
|
// }
|
||||||
// ],
|
// ],
|
||||||
// status: [
|
// Status: [
|
||||||
// {
|
// {
|
||||||
// required: true,
|
// required: true,
|
||||||
// message: '请选择发送状态:[0=发送中, 1=发送成功, 2=发送失败]',
|
// message: '请选择发送状态:[0=发送中, 1=发送成功, 2=发送失败]',
|
||||||
// trigger: ['blur']
|
// trigger: ['blur']
|
||||||
// }
|
// }
|
||||||
// ],
|
// ],
|
||||||
// results: [
|
// Results: [
|
||||||
// {
|
// {
|
||||||
// required: true,
|
// required: true,
|
||||||
// message: '请输入短信结果',
|
// message: '请输入短信结果',
|
||||||
// trigger: ['blur']
|
// trigger: ['blur']
|
||||||
// }
|
// }
|
||||||
// ],
|
// ],
|
||||||
// send_time: [
|
// SendTime: [
|
||||||
// {
|
// {
|
||||||
// required: true,
|
// required: true,
|
||||||
// message: '请输入发送时间',
|
// message: '请选择发送时间',
|
||||||
// trigger: ['blur']
|
// trigger: ['blur']
|
||||||
// }
|
// }
|
||||||
// ]
|
// ]
|
||||||
@@ -171,7 +177,7 @@ const setFormData = async (data: Record<string, any>) => {
|
|||||||
|
|
||||||
const getDetail = async (row: Record<string, any>) => {
|
const getDetail = async (row: Record<string, any>) => {
|
||||||
try {
|
try {
|
||||||
const data = await system_log_sms_detail(row.id)
|
const data = await system_log_sms_detail(row.Id)
|
||||||
setFormData(data)
|
setFormData(data)
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="index-lists">
|
<div class="index-lists">
|
||||||
<el-card class="!border-none" shadow="never">
|
<el-card class="!border-none" shadow="never">
|
||||||
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true" label-width="70px"
|
<el-form
|
||||||
label-position="left">
|
ref="formRef"
|
||||||
<el-form-item label="手机号码" prop="mobile" class="w-[280px]">
|
class="mb-[-16px]"
|
||||||
<el-input v-model="queryParams.mobile" />
|
:model="queryParams"
|
||||||
|
:inline="true"
|
||||||
|
label-width="70px"
|
||||||
|
label-position="left"
|
||||||
|
>
|
||||||
|
<el-form-item label="手机号码" prop="Mobile" class="w-[280px]">
|
||||||
|
<el-input v-model="queryParams.Mobile" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]" prop="status" class="w-[280px]">
|
<el-form-item
|
||||||
<el-select
|
label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
v-model="queryParams.status"
|
prop="Status"
|
||||||
clearable
|
class="w-[280px]"
|
||||||
>
|
>
|
||||||
|
<el-select v-model="queryParams.Status" clearable>
|
||||||
<el-option label="全部" value="" />
|
<el-option label="全部" value="" />
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in dictData.flow_apply_status"
|
v-for="(item, index) in dictData.flow_apply_status"
|
||||||
@@ -21,16 +27,22 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" prop="create_time" class="w-[280px]">
|
<el-form-item label="发送时间" prop="SendTime" class="w-[280px]">
|
||||||
<daterange-picker
|
<daterange-picker
|
||||||
v-model:startTime="queryParams.create_timeStart"
|
v-model:startTime="queryParams.SendTime_start"
|
||||||
v-model:endTime="queryParams.create_timeEnd"
|
v-model:endTime="queryParams.SendTime_end"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="更新时间" prop="update_time" class="w-[280px]">
|
<el-form-item label="创建时间" prop="CreateTime" class="w-[280px]">
|
||||||
<daterange-picker
|
<daterange-picker
|
||||||
v-model:startTime="queryParams.update_timeStart"
|
v-model:startTime="queryParams.CreateTime_start"
|
||||||
v-model:endTime="queryParams.update_timeEnd"
|
v-model:endTime="queryParams.CreateTime_end"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="更新时间" prop="UpdateTime" class="w-[280px]">
|
||||||
|
<daterange-picker
|
||||||
|
v-model:startTime="queryParams.UpdateTime_start"
|
||||||
|
v-model:endTime="queryParams.UpdateTime_end"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@@ -41,13 +53,17 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none mt-4" shadow="never">
|
<el-card class="!border-none mt-4" shadow="never">
|
||||||
<div>
|
<div>
|
||||||
<el-button v-perms="['admin:system_log_sms:add']" type="primary" @click="handleAdd()">
|
<el-button
|
||||||
|
v-perms="['admin:system_log_sms:add']"
|
||||||
|
type="primary"
|
||||||
|
@click="handleAdd()"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon name="el-icon-Plus" />
|
<icon name="el-icon-Plus" />
|
||||||
</template>
|
</template>
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<upload
|
<upload
|
||||||
class="ml-3 mr-3"
|
class="ml-3 mr-3"
|
||||||
:url="system_log_sms_import_file"
|
:url="system_log_sms_import_file"
|
||||||
:data="{ cid: 0 }"
|
:data="{ cid: 0 }"
|
||||||
@@ -69,24 +85,23 @@
|
|||||||
导出
|
导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table class="mt-4" size="large" v-loading="pager.loading" :data="pager.lists">
|
||||||
class="mt-4"
|
<el-table-column label="场景编号" prop="Scene" min-width="130" />
|
||||||
size="large"
|
<el-table-column label="手机号码" prop="Mobile" min-width="130" />
|
||||||
v-loading="pager.loading"
|
<el-table-column label="发送内容" prop="Content" min-width="130" />
|
||||||
:data="pager.lists"
|
<el-table-column
|
||||||
>
|
label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
<el-table-column label="场景编号" prop="scene" min-width="130" />
|
prop="Status"
|
||||||
<el-table-column label="手机号码" prop="mobile" min-width="130" />
|
min-width="100"
|
||||||
<el-table-column label="发送内容" prop="content" min-width="130" />
|
>
|
||||||
<el-table-column label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]" prop="status" min-width="100">
|
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-value :options="dictData.flow_apply_status" :value="row.status" />
|
<dict-value :options="dictData.flow_apply_status" :value="row.Status" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="短信结果" prop="results" min-width="130" />
|
<el-table-column label="短信结果" prop="Results" min-width="130" />
|
||||||
<el-table-column label="发送时间" prop="send_time" min-width="130" />
|
<el-table-column label="发送时间" prop="SendTime" min-width="130" />
|
||||||
<el-table-column label="创建时间" prop="create_time" min-width="130" />
|
<el-table-column label="创建时间" prop="CreateTime" min-width="130" />
|
||||||
<el-table-column label="更新时间" prop="update_time" min-width="130" />
|
<el-table-column label="更新时间" prop="UpdateTime" min-width="130" />
|
||||||
<el-table-column label="操作" width="120" fixed="right">
|
<el-table-column label="操作" width="120" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -101,7 +116,7 @@
|
|||||||
v-perms="['admin:system_log_sms:del']"
|
v-perms="['admin:system_log_sms:del']"
|
||||||
type="danger"
|
type="danger"
|
||||||
link
|
link
|
||||||
@click="handleDelete(row.id)"
|
@click="handleDelete(row.Id)"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -122,32 +137,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { system_log_sms_delete, system_log_sms_list,system_log_sms_import_file, system_log_sms_export_file } from '@/api/system_log_sms'
|
import {
|
||||||
import type { type_system_log_sms,type_system_log_sms_query } from "@/api/system_log_sms";
|
system_log_sms_delete,
|
||||||
|
system_log_sms_list,
|
||||||
|
system_log_sms_import_file,
|
||||||
|
system_log_sms_export_file
|
||||||
|
} from '@/api/system_log_sms'
|
||||||
|
import type { type_system_log_sms, type_system_log_sms_query } from '@/api/system_log_sms'
|
||||||
|
|
||||||
|
import { useDictData } from '@/hooks/useDictOptions'
|
||||||
import { useDictData,useListAllData } from '@/hooks/useDictOptions'
|
|
||||||
import type { type_dict } from '@/hooks/useDictOptions'
|
import type { type_dict } from '@/hooks/useDictOptions'
|
||||||
|
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name:"system_log_sms"
|
name: 'system_log_sms'
|
||||||
})
|
})
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
const queryParams = reactive<type_system_log_sms_query>({
|
const queryParams = reactive<type_system_log_sms_query>({
|
||||||
scene: null,
|
Scene: null,
|
||||||
mobile: null,
|
Mobile: null,
|
||||||
content: null,
|
Content: null,
|
||||||
status: null,
|
Status: null,
|
||||||
results: null,
|
Results: null,
|
||||||
send_time: null,
|
SendTime_start: null,
|
||||||
create_timeStart: null,
|
SendTime_end: null,
|
||||||
create_timeEnd: null,
|
CreateTime_start: null,
|
||||||
update_timeStart: null,
|
CreateTime_end: null,
|
||||||
update_timeEnd: null,
|
UpdateTime_start: null,
|
||||||
|
UpdateTime_end: null
|
||||||
})
|
})
|
||||||
|
|
||||||
const { pager, getLists, resetPage, resetParams } = usePaging<type_system_log_sms>({
|
const { pager, getLists, resetPage, resetParams } = usePaging<type_system_log_sms>({
|
||||||
@@ -158,7 +178,6 @@ const { dictData } = useDictData<{
|
|||||||
flow_apply_status: type_dict[]
|
flow_apply_status: type_dict[]
|
||||||
}>(['flow_apply_status'])
|
}>(['flow_apply_status'])
|
||||||
|
|
||||||
|
|
||||||
const handleAdd = async () => {
|
const handleAdd = async () => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
@@ -175,7 +194,7 @@ const handleEdit = async (data: any) => {
|
|||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
await feedback.confirm('确定要删除?')
|
await feedback.confirm('确定要删除?')
|
||||||
await system_log_sms_delete( id )
|
await system_log_sms_delete(id)
|
||||||
feedback.msgSuccess('删除成功')
|
feedback.msgSuccess('删除成功')
|
||||||
getLists()
|
getLists()
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
|
@@ -4,4 +4,4 @@
|
|||||||
2. Gorm零值不更新:避免数据库出现值0,这能避免很多工作
|
2. Gorm零值不更新:避免数据库出现值0,这能避免很多工作
|
||||||
3. 软删除,本系统需要IsDelete和DeleteTime字段,https://gorm.io/zh_CN/docs/delete.html#%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F
|
3. 软删除,本系统需要IsDelete和DeleteTime字段,https://gorm.io/zh_CN/docs/delete.html#%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F
|
||||||
|
|
||||||
4. 时间:统一用自定义的`core.TsTime`
|
4. 时间:统一用自定义的`core.NullTime`
|
@@ -33,9 +33,9 @@ type ArticleCollectDelReq struct {
|
|||||||
|
|
||||||
//ArticleCollectResp 文章收藏返回信息
|
//ArticleCollectResp 文章收藏返回信息
|
||||||
type ArticleCollectResp struct {
|
type ArticleCollectResp struct {
|
||||||
Id int `json:"id" structs:"id"` // 主键
|
Id int `json:"id" structs:"id"` // 主键
|
||||||
UserId int `json:"userId" structs:"userId"` // 用户ID
|
UserId int `json:"userId" structs:"userId"` // 用户ID
|
||||||
ArticleId int `json:"articleId" structs:"articleId"` // 文章ID
|
ArticleId int `json:"articleId" structs:"articleId"` // 文章ID
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model"
|
"x_admin/model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -57,7 +58,7 @@ func (service ArticleCollectService) List(page request.PageReq, listReq ArticleC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []ArticleCollectResp{}
|
result := []ArticleCollectResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
|
@@ -82,22 +82,22 @@ type CommonUploadFileResp struct {
|
|||||||
|
|
||||||
//CommonAlbumListResp 相册文件列表返回信息
|
//CommonAlbumListResp 相册文件列表返回信息
|
||||||
type CommonAlbumListResp struct {
|
type CommonAlbumListResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Cid uint `json:"cid" structs:"cid"` // 所属类目
|
Cid uint `json:"cid" structs:"cid"` // 所属类目
|
||||||
Name string `json:"name" structs:"name"` // 文件名称
|
Name string `json:"name" structs:"name"` // 文件名称
|
||||||
Path string `json:"path" structs:"path"` // 相对路径
|
Path string `json:"path" structs:"path"` // 相对路径
|
||||||
Uri string `json:"uri" structs:"uri"` // 文件路径
|
Uri string `json:"uri" structs:"uri"` // 文件路径
|
||||||
Ext string `json:"ext" structs:"ext"` // 文件扩展
|
Ext string `json:"ext" structs:"ext"` // 文件扩展
|
||||||
Size string `json:"size" structs:"size"` // 文件大小
|
Size string `json:"size" structs:"size"` // 文件大小
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//CommonCateListResp 相册分类列表返回信息
|
//CommonCateListResp 相册分类列表返回信息
|
||||||
type CommonCateListResp struct {
|
type CommonCateListResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Pid uint `json:"pid" structs:"pid"` // 父级ID
|
Pid uint `json:"pid" structs:"pid"` // 父级ID
|
||||||
Name string `json:"name" structs:"name"` // 分类名称
|
Name string `json:"name" structs:"name"` // 分类名称
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ func (albSrv albumService) AlbumList(page request.PageReq, listReq CommonAlbumLi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
albumResps := []CommonAlbumListResp{}
|
albumResps := []CommonAlbumListResp{}
|
||||||
response.Copy(&albumResps, albums)
|
util.ConvertUtil.Copy(&albumResps, albums)
|
||||||
// TODO: engine默认local
|
// TODO: engine默认local
|
||||||
engine := "local"
|
engine := "local"
|
||||||
for i := 0; i < len(albumResps); i++ {
|
for i := 0; i < len(albumResps); i++ {
|
||||||
@@ -134,7 +134,7 @@ func (albSrv albumService) AlbumAdd(addReq CommonAlbumAddReq) (res uint, e error
|
|||||||
// core.Logger.Errorf("AlbumAdd Decode err: err=[%+v]", err)
|
// core.Logger.Errorf("AlbumAdd Decode err: err=[%+v]", err)
|
||||||
// return response.SystemError
|
// return response.SystemError
|
||||||
//}
|
//}
|
||||||
response.Copy(&alb, addReq)
|
util.ConvertUtil.Copy(&alb, addReq)
|
||||||
err := albSrv.db.Create(&alb).Error
|
err := albSrv.db.Create(&alb).Error
|
||||||
if e = response.CheckErr(err, "Album添加失败"); e != nil {
|
if e = response.CheckErr(err, "Album添加失败"); e != nil {
|
||||||
return
|
return
|
||||||
@@ -153,7 +153,7 @@ func (albSrv albumService) AlbumDel(ids []uint) (e error) {
|
|||||||
return response.AssertArgumentError.SetMessage("文件丢失!")
|
return response.AssertArgumentError.SetMessage("文件丢失!")
|
||||||
}
|
}
|
||||||
err = albSrv.db.Model(&common_model.Album{}).Where("id in ?", ids).Updates(
|
err = albSrv.db.Model(&common_model.Album{}).Where("id in ?", ids).Updates(
|
||||||
common_model.Album{IsDelete: 1, DeleteTime: core.NowTime()}).Error
|
common_model.Album{IsDelete: 1, DeleteTime: util.NullTimeUtil.Now()}).Error
|
||||||
e = response.CheckErr(err, "AlbumDel UpdateColumn err")
|
e = response.CheckErr(err, "AlbumDel UpdateColumn err")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -173,14 +173,14 @@ func (albSrv albumService) CateList(listReq CommonCateListReq) (mapList []Common
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
cateResps := []CommonCateListResp{}
|
cateResps := []CommonCateListResp{}
|
||||||
response.Copy(&cateResps, cates)
|
util.ConvertUtil.Copy(&cateResps, cates)
|
||||||
return cateResps, nil
|
return cateResps, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CateAdd 分类新增
|
// CateAdd 分类新增
|
||||||
func (albSrv albumService) CateAdd(addReq CommonCateAddReq) (e error) {
|
func (albSrv albumService) CateAdd(addReq CommonCateAddReq) (e error) {
|
||||||
var cate common_model.AlbumCate
|
var cate common_model.AlbumCate
|
||||||
response.Copy(&cate, addReq)
|
util.ConvertUtil.Copy(&cate, addReq)
|
||||||
err := albSrv.db.Create(&cate).Error
|
err := albSrv.db.Create(&cate).Error
|
||||||
e = response.CheckErr(err, "Cate添加失败")
|
e = response.CheckErr(err, "Cate添加失败")
|
||||||
return
|
return
|
||||||
@@ -220,7 +220,7 @@ func (albSrv albumService) CateDel(id uint) (e error) {
|
|||||||
return response.AssertArgumentError.SetMessage("当前分类正被使用中,不能删除!")
|
return response.AssertArgumentError.SetMessage("当前分类正被使用中,不能删除!")
|
||||||
}
|
}
|
||||||
cate.IsDelete = 1
|
cate.IsDelete = 1
|
||||||
cate.DeleteTime = core.NowTime()
|
cate.DeleteTime = util.NullTimeUtil.Now()
|
||||||
err = albSrv.db.Save(&cate).Error
|
err = albSrv.db.Save(&cate).Error
|
||||||
e = response.CheckErr(err, "CateDel Save err")
|
e = response.CheckErr(err, "CateDel Save err")
|
||||||
return
|
return
|
||||||
|
@@ -3,8 +3,8 @@ package upload
|
|||||||
import (
|
import (
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"x_admin/admin/common/album"
|
"x_admin/admin/common/album"
|
||||||
"x_admin/core/response"
|
|
||||||
"x_admin/plugin"
|
"x_admin/plugin"
|
||||||
|
"x_admin/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IUploadService interface {
|
type IUploadService interface {
|
||||||
@@ -39,14 +39,14 @@ func (upSrv uploadService) uploadFile(file *multipart.FileHeader, folder string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var addReq album.CommonAlbumAddReq
|
var addReq album.CommonAlbumAddReq
|
||||||
response.Copy(&addReq, upRes)
|
util.ConvertUtil.Copy(&addReq, upRes)
|
||||||
addReq.Aid = aid
|
addReq.Aid = aid
|
||||||
addReq.Cid = cid
|
addReq.Cid = cid
|
||||||
var albumId uint
|
var albumId uint
|
||||||
if albumId, e = album.Service.AlbumAdd(addReq); e != nil {
|
if albumId, e = album.Service.AlbumAdd(addReq); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, addReq)
|
util.ConvertUtil.Copy(&res, addReq)
|
||||||
res.ID = albumId
|
res.ID = albumId
|
||||||
res.Path = upRes.Path
|
res.Path = upRes.Path
|
||||||
return res, nil
|
return res, nil
|
||||||
|
@@ -60,18 +60,18 @@ type FlowApplyDelReq struct {
|
|||||||
|
|
||||||
//FlowApplyResp 申请流程返回信息
|
//FlowApplyResp 申请流程返回信息
|
||||||
type FlowApplyResp struct {
|
type FlowApplyResp struct {
|
||||||
Id int `json:"id" structs:"id"` //
|
Id int `json:"id" structs:"id"` //
|
||||||
TemplateId int `json:"templateId" structs:"templateId"` // 模板
|
TemplateId int `json:"templateId" structs:"templateId"` // 模板
|
||||||
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
||||||
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
||||||
FlowName string `json:"flowName" structs:"flowName"` // 流程名称
|
FlowName string `json:"flowName" structs:"flowName"` // 流程名称
|
||||||
FlowGroup int `json:"flowGroup" structs:"flowGroup"` // 流程分类
|
FlowGroup int `json:"flowGroup" structs:"flowGroup"` // 流程分类
|
||||||
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
||||||
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
||||||
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
||||||
FlowProcessDataList string `json:"flowProcessDataList"` // 流程配置list数据
|
FlowProcessDataList string `json:"flowProcessDataList"` // 流程配置list数据
|
||||||
FormValue string `json:"formValue"` // 表单值
|
FormValue string `json:"formValue"` // 表单值
|
||||||
Status int `json:"status" structs:"status"` // 状态:1待提交,2审批中,3审批完成,4审批失败
|
Status int `json:"status" structs:"status"` // 状态:1待提交,2审批中,3审批完成,4审批失败
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model"
|
"x_admin/model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -80,7 +81,7 @@ func (service flowApplyService) List(page request.PageReq, listReq FlowApplyList
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []FlowApplyResp{}
|
result := []FlowApplyResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -99,7 +100,7 @@ func (service flowApplyService) Detail(id int) (res FlowApplyResp, e error) {
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, obj)
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ func (service flowApplyService) Add(addReq FlowApplyAddReq) (e error) {
|
|||||||
if e = response.CheckErrDBNotRecord(err, "模板不存在!"); e != nil {
|
if e = response.CheckErrDBNotRecord(err, "模板不存在!"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&obj, addReq)
|
util.ConvertUtil.Copy(&obj, addReq)
|
||||||
// obj.FlowName = flow_template_resp.FlowName
|
// obj.FlowName = flow_template_resp.FlowName
|
||||||
obj.FlowGroup = flow_template_resp.FlowGroup
|
obj.FlowGroup = flow_template_resp.FlowGroup
|
||||||
obj.FlowRemark = flow_template_resp.FlowRemark
|
obj.FlowRemark = flow_template_resp.FlowRemark
|
||||||
@@ -135,7 +136,7 @@ func (service flowApplyService) Edit(editReq FlowApplyEditReq) (e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&obj, editReq)
|
util.ConvertUtil.Copy(&obj, editReq)
|
||||||
err = service.db.Model(&obj).Updates(obj).Error
|
err = service.db.Model(&obj).Updates(obj).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
return
|
return
|
||||||
@@ -159,7 +160,7 @@ func (service flowApplyService) Del(id int) (e error) {
|
|||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
obj.IsDelete = 1
|
obj.IsDelete = 1
|
||||||
obj.DeleteTime = core.NowTime()
|
obj.DeleteTime = util.NullTimeUtil.Now()
|
||||||
err = service.db.Save(&obj).Error
|
err = service.db.Save(&obj).Error
|
||||||
e = response.CheckErr(err, "Del Save err")
|
e = response.CheckErr(err, "Del Save err")
|
||||||
return
|
return
|
||||||
|
@@ -63,21 +63,21 @@ type FlowHistoryDelReq struct {
|
|||||||
|
|
||||||
//FlowHistoryResp 流程历史返回信息
|
//FlowHistoryResp 流程历史返回信息
|
||||||
type FlowHistoryResp struct {
|
type FlowHistoryResp struct {
|
||||||
Id int `json:"id" structs:"id"` // 历史id
|
Id int `json:"id" structs:"id"` // 历史id
|
||||||
ApplyId int `json:"applyId" structs:"applyId"` // 申请id
|
ApplyId int `json:"applyId" structs:"applyId"` // 申请id
|
||||||
TemplateId int `json:"templateId" structs:"templateId"` // 模板id
|
TemplateId int `json:"templateId" structs:"templateId"` // 模板id
|
||||||
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
||||||
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
||||||
ApproverId int `json:"approverId" structs:"approverId"` // 审批人id
|
ApproverId int `json:"approverId" structs:"approverId"` // 审批人id
|
||||||
ApproverNickname string `json:"approverNickname" structs:"approverNickname"` // 审批用户昵称
|
ApproverNickname string `json:"approverNickname" structs:"approverNickname"` // 审批用户昵称
|
||||||
NodeId string `json:"nodeId" structs:"nodeId"` // 节点
|
NodeId string `json:"nodeId" structs:"nodeId"` // 节点
|
||||||
NodeType string `json:"nodeType" structs:"nodeType"` // 节点类型
|
NodeType string `json:"nodeType" structs:"nodeType"` // 节点类型
|
||||||
NodeLabel string `json:"nodeLabel" structs:"nodeLabel"` // 节点名称
|
NodeLabel string `json:"nodeLabel" structs:"nodeLabel"` // 节点名称
|
||||||
FormValue string `json:"formValue" structs:"formValue"` // 表单值
|
FormValue string `json:"formValue" structs:"formValue"` // 表单值
|
||||||
PassStatus int `json:"passStatus" structs:"passStatus"` // 通过状态:1待处理,2通过,3拒绝
|
PassStatus int `json:"passStatus" structs:"passStatus"` // 通过状态:1待处理,2通过,3拒绝
|
||||||
PassRemark string `json:"passRemark" structs:"passRemark"` // 通过备注
|
PassRemark string `json:"passRemark" structs:"passRemark"` // 通过备注
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
}
|
}
|
||||||
|
|
||||||
type gateway struct {
|
type gateway struct {
|
||||||
|
@@ -93,7 +93,7 @@ func (service flowHistoryService) List(page request.PageReq, listReq FlowHistory
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
list := []FlowHistoryResp{}
|
list := []FlowHistoryResp{}
|
||||||
response.Copy(&list, modelList)
|
util.ConvertUtil.Copy(&list, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -122,7 +122,7 @@ func (service flowHistoryService) ListAll(listReq FlowHistoryListReq) (res []Flo
|
|||||||
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, modelList)
|
util.ConvertUtil.Copy(&res, modelList)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,14 +136,14 @@ func (service flowHistoryService) Detail(id int) (res FlowHistoryResp, e error)
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, obj)
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add 流程历史新增
|
// Add 流程历史新增
|
||||||
func (service flowHistoryService) Add(addReq FlowHistoryAddReq) (e error) {
|
func (service flowHistoryService) Add(addReq FlowHistoryAddReq) (e error) {
|
||||||
var obj model.FlowHistory
|
var obj model.FlowHistory
|
||||||
response.Copy(&obj, addReq)
|
util.ConvertUtil.Copy(&obj, addReq)
|
||||||
err := service.db.Create(&obj).Error
|
err := service.db.Create(&obj).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return
|
return
|
||||||
@@ -161,7 +161,7 @@ func (service flowHistoryService) Edit(editReq FlowHistoryEditReq) (e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&obj, editReq)
|
util.ConvertUtil.Copy(&obj, editReq)
|
||||||
err = service.db.Model(&obj).Updates(obj).Error
|
err = service.db.Model(&obj).Updates(obj).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
return
|
return
|
||||||
@@ -422,7 +422,7 @@ func (service flowHistoryService) Back(back BackReq) (e error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var obj model.FlowApply
|
var obj model.FlowApply
|
||||||
response.Copy(&obj, applyDetail)
|
util.ConvertUtil.Copy(&obj, applyDetail)
|
||||||
obj.Status = 4
|
obj.Status = 4
|
||||||
err = tx.Save(&obj).Error
|
err = tx.Save(&obj).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model"
|
"x_admin/model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -66,7 +67,7 @@ func (service flowTemplateService) List(page request.PageReq, listReq FlowTempla
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []FlowTemplateResp{}
|
result := []FlowTemplateResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -82,7 +83,7 @@ func (service flowTemplateService) ListAll() (res []FlowTemplateResp, e error) {
|
|||||||
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, modelList)
|
util.ConvertUtil.Copy(&res, modelList)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,14 +97,14 @@ func (service flowTemplateService) Detail(id int) (res FlowTemplateResp, e error
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, obj)
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add 流程模板新增
|
// Add 流程模板新增
|
||||||
func (service flowTemplateService) Add(addReq FlowTemplateAddReq) (e error) {
|
func (service flowTemplateService) Add(addReq FlowTemplateAddReq) (e error) {
|
||||||
var obj model.FlowTemplate
|
var obj model.FlowTemplate
|
||||||
response.Copy(&obj, addReq)
|
util.ConvertUtil.Copy(&obj, addReq)
|
||||||
err := service.db.Create(&obj).Error
|
err := service.db.Create(&obj).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return
|
return
|
||||||
@@ -121,7 +122,7 @@ func (service flowTemplateService) Edit(editReq FlowTemplateEditReq) (e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&obj, editReq)
|
util.ConvertUtil.Copy(&obj, editReq)
|
||||||
err = service.db.Model(&obj).Updates(obj).Error
|
err = service.db.Model(&obj).Updates(obj).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
return
|
return
|
||||||
|
@@ -60,8 +60,8 @@ type EditColumn struct {
|
|||||||
DictType string `form:"dictType" binding:"required,max=200"` // 字典类型
|
DictType string `form:"dictType" binding:"required,max=200"` // 字典类型
|
||||||
ListAllApi string `form:"listAllApi" binding:"max=200"` // 下拉框数据来源listAll
|
ListAllApi string `form:"listAllApi" binding:"max=200"` // 下拉框数据来源listAll
|
||||||
|
|
||||||
CreateTime core.TsTime `form:"createTime"` // 创建时间
|
CreateTime core.NullTime `form:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `form:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `form:"updateTime"` // 更新时间
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,32 +107,32 @@ type DownloadReq struct {
|
|||||||
|
|
||||||
// DbTableResp 数据表返回信息
|
// DbTableResp 数据表返回信息
|
||||||
type DbTableResp struct {
|
type DbTableResp struct {
|
||||||
TableName string `json:"tableName" structs:"tableName"` // 表的名称
|
TableName string `json:"tableName" structs:"tableName"` // 表的名称
|
||||||
TableComment string `json:"tableComment" structs:"tableComment"` // 表的描述
|
TableComment string `json:"tableComment" structs:"tableComment"` // 表的描述
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTableResp 生成表返回信息
|
// GenTableResp 生成表返回信息
|
||||||
type GenTableResp struct {
|
type GenTableResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
|
|
||||||
TableName string `json:"tableName" structs:"tableName"` // 表名称
|
TableName string `json:"tableName" structs:"tableName"` // 表名称
|
||||||
TableComment string `json:"tableComment" structs:"tableComment"` // 表描述
|
TableComment string `json:"tableComment" structs:"tableComment"` // 表描述
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTableBaseResp 生成表基本返回信息
|
// GenTableBaseResp 生成表基本返回信息
|
||||||
type GenTableBaseResp struct {
|
type GenTableBaseResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
TableName string `json:"tableName" structs:"tableName"` // 表的名称
|
TableName string `json:"tableName" structs:"tableName"` // 表的名称
|
||||||
TableComment string `json:"tableComment" structs:"tableComment"` // 表的描述
|
TableComment string `json:"tableComment" structs:"tableComment"` // 表的描述
|
||||||
EntityName string `json:"entityName" structs:"entityName"` // 实体名称
|
EntityName string `json:"entityName" structs:"entityName"` // 实体名称
|
||||||
AuthorName string `json:"authorName" structs:"authorName"` // 作者名称
|
AuthorName string `json:"authorName" structs:"authorName"` // 作者名称
|
||||||
Remarks string `json:"remarks" structs:"remarks"` // 备注信息
|
Remarks string `json:"remarks" structs:"remarks"` // 备注信息
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTableGenResp 生成表生成返回信息
|
// GenTableGenResp 生成表生成返回信息
|
||||||
@@ -160,19 +160,19 @@ type GenColumnResp struct {
|
|||||||
GoType string `json:"goType" structs:"goType"` // Go类型
|
GoType string `json:"goType" structs:"goType"` // Go类型
|
||||||
GoField string `json:"goField" structs:"goField"` // Go字段
|
GoField string `json:"goField" structs:"goField"` // Go字段
|
||||||
|
|
||||||
IsPk uint8 `json:"isPk" structs:"isPk"`
|
IsPk uint8 `json:"isPk" structs:"isPk"`
|
||||||
IsIncrement uint8 `json:"isIncrement" structs:"isIncrement"`
|
IsIncrement uint8 `json:"isIncrement" structs:"isIncrement"`
|
||||||
IsRequired uint8 `json:"isRequired" structs:"isRequired"` // 是否必填
|
IsRequired uint8 `json:"isRequired" structs:"isRequired"` // 是否必填
|
||||||
IsInsert uint8 `json:"isInsert" structs:"isInsert"` // 是否为插入字段
|
IsInsert uint8 `json:"isInsert" structs:"isInsert"` // 是否为插入字段
|
||||||
IsEdit uint8 `json:"isEdit" structs:"isEdit"` // 是否编辑字段
|
IsEdit uint8 `json:"isEdit" structs:"isEdit"` // 是否编辑字段
|
||||||
IsList uint8 `json:"isList" structs:"isList"` // 是否列表字段
|
IsList uint8 `json:"isList" structs:"isList"` // 是否列表字段
|
||||||
IsQuery uint8 `json:"isQuery" structs:"isQuery"` // 是否查询字段
|
IsQuery uint8 `json:"isQuery" structs:"isQuery"` // 是否查询字段
|
||||||
QueryType string `json:"queryType" structs:"queryType"` // 查询方式: [等于、不等于、大于、小于、范围]
|
QueryType string `json:"queryType" structs:"queryType"` // 查询方式: [等于、不等于、大于、小于、范围]
|
||||||
HtmlType string `json:"htmlType" structs:"htmlType"` // 显示类型: [文本框、文本域、下拉框、复选框、单选框、日期控件]
|
HtmlType string `json:"htmlType" structs:"htmlType"` // 显示类型: [文本框、文本域、下拉框、复选框、单选框、日期控件]
|
||||||
DictType string `json:"dictType" structs:"dictType"` // 字典类型
|
DictType string `json:"dictType" structs:"dictType"` // 字典类型
|
||||||
ListAllApi string `json:"listAllApi" structs:"listAllApi"` // 下拉框数据来源listAll
|
ListAllApi string `json:"listAllApi" structs:"listAllApi"` // 下拉框数据来源listAll
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTableDetailResp 生成表详情返回信息
|
// GenTableDetailResp 生成表详情返回信息
|
||||||
|
@@ -123,11 +123,11 @@ func (genSrv generateService) Detail(id uint) (res GenTableDetailResp, e error)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var base GenTableBaseResp
|
var base GenTableBaseResp
|
||||||
response.Copy(&base, genTb)
|
util.ConvertUtil.Copy(&base, genTb)
|
||||||
var gen GenTableGenResp
|
var gen GenTableGenResp
|
||||||
response.Copy(&gen, genTb)
|
util.ConvertUtil.Copy(&gen, genTb)
|
||||||
var colResp []GenColumnResp
|
var colResp []GenColumnResp
|
||||||
response.Copy(&colResp, columns)
|
util.ConvertUtil.Copy(&colResp, columns)
|
||||||
return GenTableDetailResp{
|
return GenTableDetailResp{
|
||||||
Base: base,
|
Base: base,
|
||||||
Gen: gen,
|
Gen: gen,
|
||||||
@@ -143,7 +143,7 @@ func (genSrv generateService) ImportTable(tableNames []string) (e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var tables []gen_model.GenTable
|
var tables []gen_model.GenTable
|
||||||
response.Copy(&tables, dbTbs)
|
util.ConvertUtil.Copy(&tables, dbTbs)
|
||||||
if len(tables) == 0 {
|
if len(tables) == 0 {
|
||||||
e = response.AssertArgumentError.SetMessage("表不存在!")
|
e = response.AssertArgumentError.SetMessage("表不存在!")
|
||||||
return
|
return
|
||||||
@@ -281,7 +281,7 @@ func (genSrv generateService) EditTable(editReq EditTableReq) (e error) {
|
|||||||
if e = response.CheckErr(err, "查找数据失败"); e != nil {
|
if e = response.CheckErr(err, "查找数据失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&genTable, editReq)
|
util.ConvertUtil.Copy(&genTable, editReq)
|
||||||
err = genSrv.db.Transaction(func(tx *gorm.DB) error {
|
err = genSrv.db.Transaction(func(tx *gorm.DB) error {
|
||||||
genTable.SubTableName = strings.Replace(editReq.SubTableName, config.Config.DbTablePrefix, "", 1)
|
genTable.SubTableName = strings.Replace(editReq.SubTableName, config.Config.DbTablePrefix, "", 1)
|
||||||
txErr := tx.Save(&genTable).Error
|
txErr := tx.Save(&genTable).Error
|
||||||
@@ -290,7 +290,7 @@ func (genSrv generateService) EditTable(editReq EditTableReq) (e error) {
|
|||||||
}
|
}
|
||||||
for i := 0; i < len(editReq.Columns); i++ {
|
for i := 0; i < len(editReq.Columns); i++ {
|
||||||
var col gen_model.GenTableColumn
|
var col gen_model.GenTableColumn
|
||||||
response.Copy(&col, editReq.Columns[i])
|
util.ConvertUtil.Copy(&col, editReq.Columns[i])
|
||||||
txErr = tx.Save(&col).Error
|
txErr = tx.Save(&col).Error
|
||||||
if te := response.CheckErr(txErr, "更新失败"); te != nil {
|
if te := response.CheckErr(txErr, "更新失败"); te != nil {
|
||||||
return te
|
return te
|
||||||
|
@@ -12,10 +12,10 @@ var GenConstants = genConstants{
|
|||||||
|
|
||||||
//GoConstants Go相关常量
|
//GoConstants Go相关常量
|
||||||
var GoConstants = goConstants{
|
var GoConstants = goConstants{
|
||||||
TypeString: "string", //字符串类型
|
TypeString: "string", //字符串类型
|
||||||
TypeFloat: "float64", //浮点型
|
TypeFloat: "float64", //浮点型
|
||||||
TypeInt: "int", //整型
|
TypeInt: "int", //整型
|
||||||
TypeDate: "core.TsTime", //时间类型
|
TypeDate: "core.NullTime", //时间类型
|
||||||
}
|
}
|
||||||
|
|
||||||
//SqlConstants 数据库相关常量
|
//SqlConstants 数据库相关常量
|
||||||
|
@@ -8,7 +8,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/util"
|
"x_admin/util"
|
||||||
"x_admin/util/excel"
|
"x_admin/util/excel2"
|
||||||
"golang.org/x/sync/singleflight"
|
"golang.org/x/sync/singleflight"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,10 +26,10 @@ type {{{ toUpperCamelCase .ModuleName }}}Handler struct {
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
// @Param {{{ .GoField }}}_start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
// @Param {{{ .GoField }}}_end query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
// @Param {{{ .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -54,10 +54,10 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) List(c *gin.Context) {
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
// @Param {{{ .GoField }}}_start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
// @Param {{{ .GoField }}}_end query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
// @Param {{{ .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -78,7 +78,7 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) ListAll(c *gin.Context)
|
|||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsPk }}}
|
{{{- if .IsPk }}}
|
||||||
// @Param {{{ .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
// @Success 200 {object} response.Response{ data={{{ toUpperCamelCase .EntityName }}}Resp} "成功"
|
// @Success 200 {object} response.Response{ data={{{ toUpperCamelCase .EntityName }}}Resp} "成功"
|
||||||
@@ -103,7 +103,7 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) Detail(c *gin.Context) {
|
|||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsInsert }}}
|
{{{- if .IsInsert }}}
|
||||||
// @Param {{{ .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
@@ -122,7 +122,7 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) Add(c *gin.Context) {
|
|||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsEdit }}}
|
{{{- if .IsEdit }}}
|
||||||
// @Param {{{ .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
@@ -140,7 +140,7 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) Edit(c *gin.Context) {
|
|||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsPk }}}
|
{{{- if .IsPk }}}
|
||||||
// @Param {{{ .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
@@ -155,6 +155,8 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) Del(c *gin.Context) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Summary {{{ .FunctionName }}}导出
|
// @Summary {{{ .FunctionName }}}导出
|
||||||
// @Tags {{{ .ModuleName }}}-{{{ .FunctionName }}}
|
// @Tags {{{ .ModuleName }}}-{{{ .FunctionName }}}
|
||||||
// @Produce json
|
// @Produce json
|
||||||
@@ -162,10 +164,10 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) Del(c *gin.Context) {
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
// @Param {{{ .GoField }}}_start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
// @Param {{{ .GoField }}}_end query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
// @Param {{{ .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
// @Param {{{toUpperCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -180,12 +182,12 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) ExportFile(c *gin.Contex
|
|||||||
response.FailWithMsg(c, response.SystemError, "查询信息失败")
|
response.FailWithMsg(c, response.SystemError, "查询信息失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f, err := excel.NormalDynamicExport(res, "Sheet1", "{{{ .FunctionName }}}", nil)
|
f, err := excel2.Export(res,{{{ toUpperCamelCase .EntityName }}}Service.GetExcelCol(), "Sheet1", "{{{ .FunctionName }}}")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
response.FailWithMsg(c, response.SystemError, "导出失败")
|
response.FailWithMsg(c, response.SystemError, "导出失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
excel.DownLoadExcel("{{{ .FunctionName }}}" + time.Now().Format("20060102-150405"), c.Writer, f)
|
excel2.DownLoadExcel("{{{ .FunctionName }}}" + time.Now().Format("20060102-150405"), c.Writer, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary {{{ .FunctionName }}}导入
|
// @Summary {{{ .FunctionName }}}导入
|
||||||
@@ -200,7 +202,7 @@ func (hd *{{{ toUpperCamelCase .ModuleName }}}Handler) ImportFile(c *gin.Contex
|
|||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
importList := []{{{ toUpperCamelCase .EntityName }}}Resp{}
|
importList := []{{{ toUpperCamelCase .EntityName }}}Resp{}
|
||||||
err = excel.GetExcelData(file, &importList)
|
err = excel2.GetExcelData(file, &importList,{{{ toUpperCamelCase .EntityName }}}Service.GetExcelCol())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(http.StatusInternalServerError, err.Error())
|
c.String(http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
|
@@ -11,8 +11,8 @@ type {{{ toUpperCamelCase .EntityName }}} struct {
|
|||||||
{{{- if eq .GoField "is_delete" }}}
|
{{{- if eq .GoField "is_delete" }}}
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{- if eq .GoType "core.TsTime" }}}
|
{{{- if eq .GoType "core.NullTime" }}}
|
||||||
{{{ toUpperCamelCase .GoField }}} core.TsTime `gorm:"{{{ if eq .GoField "create_time" }}}autoCreateTime;{{{ else }}}{{{if eq .GoField "update_time"}}}autoUpdateTime;{{{ end }}}{{{ end }}}comment:'{{{ .ColumnComment }}}'"` // {{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}} core.NullTime `gorm:"{{{ if eq .GoField "create_time" }}}autoCreateTime;{{{ else }}}{{{if eq .GoField "update_time"}}}autoUpdateTime;{{{ end }}}{{{ end }}}comment:'{{{ .ColumnComment }}}'"` // {{{ .ColumnComment }}}
|
||||||
{{{- else if .IsPk }}}
|
{{{- else if .IsPk }}}
|
||||||
{{{ toUpperCamelCase .GoField }}} {{{ .GoType }}} `gorm:"primarykey;comment:'{{{ .ColumnComment }}}'"` // {{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}} {{{ .GoType }}} `gorm:"primarykey;comment:'{{{ .ColumnComment }}}'"` // {{{ .ColumnComment }}}
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
|
@@ -9,10 +9,10 @@ type {{{ toUpperCamelCase .EntityName }}}ListReq struct {
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
{{{ toUpperCamelCase .GoField }}}Start *string `mapstructure:"{{{ .GoField }}}_start" json:"{{{ .GoField }}}_start" form:"{{{ .GoField }}}_start"` // 开始{{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}}Start *string `form:"{{{ .GoField }}}Start"` // 开始{{{ .ColumnComment }}}
|
||||||
{{{ toUpperCamelCase .GoField }}}End *string `mapstructure:"{{{ .GoField }}}_end" json:"{{{ .GoField }}}_end" form:"{{{ .GoField }}}_end"` // 结束{{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}}End *string `GoField }}}End" form:"{{{ .GoField }}}End"` // 结束{{{ .ColumnComment }}}
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ toUpperCamelCase .GoField }}} *{{{.GoType }}} `mapstructure:"{{{ .GoField }}}" json:"{{{ .GoField }}}" form:"{{{ .GoField }}}"` // {{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}} *{{{.GoType }}} ` form:"{{{ .GoField }}}"` // {{{ .ColumnComment }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -24,7 +24,7 @@ type {{{ toUpperCamelCase .EntityName }}}ListReq struct {
|
|||||||
type {{{ toUpperCamelCase .EntityName }}}AddReq struct {
|
type {{{ toUpperCamelCase .EntityName }}}AddReq struct {
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsInsert }}}
|
{{{- if .IsInsert }}}
|
||||||
{{{ toUpperCamelCase .GoField }}} interface{} `mapstructure:"{{{ .GoField }}}" json:"{{{ .GoField }}} form:"{{{ .GoField }}}"` // {{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}} interface{} `mapstructure:"{{{ .GoField }}}" json:"{{{ .GoField }}}" form:"{{{ .GoField }}}"` // {{{ .ColumnComment }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ type {{{ toUpperCamelCase .EntityName }}}Resp struct {
|
|||||||
{{{- if .IsPk }}}
|
{{{- if .IsPk }}}
|
||||||
{{{ toUpperCamelCase .GoField }}} {{{ .GoType }}} `mapstructure:"{{{ .GoField }}}" json:"{{{ .GoField }}}"` // {{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}} {{{ .GoType }}} `mapstructure:"{{{ .GoField }}}" json:"{{{ .GoField }}}"` // {{{ .ColumnComment }}}
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ toUpperCamelCase .GoField }}} {{{ .GoType }}} `mapstructure:"{{{ .GoField }}}" json:"{{{ .GoField }}}" excel:"name:{{{ .ColumnComment }}};"` // {{{ .ColumnComment }}}
|
{{{ toUpperCamelCase .GoField }}} {{{ .GoType }}} `mapstructure:"{{{ .GoField }}}" json:"{{{ .GoField }}}"` // {{{ .ColumnComment }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
|
@@ -7,6 +7,7 @@ import (
|
|||||||
"x_admin/model"
|
"x_admin/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"x_admin/util"
|
"x_admin/util"
|
||||||
|
"x_admin/util/excel2"
|
||||||
"github.com/duke-git/lancet/v2/convertor"
|
"github.com/duke-git/lancet/v2/convertor"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) List(page request.PageReq,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []{{{ toUpperCamelCase .EntityName }}}Resp{}
|
result := []{{{ toUpperCamelCase .EntityName }}}Resp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -100,7 +101,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) ListAll(listReq {{{ toUppe
|
|||||||
if e = response.CheckErr(err, "查询全部失败"); e != nil {
|
if e = response.CheckErr(err, "查询全部失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, modelList)
|
util.ConvertUtil.Copy(&res, modelList)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,14 +126,14 @@ func (service {{{ toCamelCase .EntityName }}}Service) Detail({{{ toUpperCamelCas
|
|||||||
cacheUtil.SetCache(obj.{{{ toUpperCamelCase .PrimaryKey }}}, obj)
|
cacheUtil.SetCache(obj.{{{ toUpperCamelCase .PrimaryKey }}}, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Copy(&res, obj)
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add {{{ .FunctionName }}}新增
|
// Add {{{ .FunctionName }}}新增
|
||||||
func (service {{{ toCamelCase .EntityName }}}Service) Add(addReq {{{ toUpperCamelCase .EntityName }}}AddReq) (createId int,e error) {
|
func (service {{{ toCamelCase .EntityName }}}Service) Add(addReq {{{ toUpperCamelCase .EntityName }}}AddReq) (createId int,e error) {
|
||||||
var obj model.{{{ toUpperCamelCase .EntityName }}}
|
var obj model.{{{ toUpperCamelCase .EntityName }}}
|
||||||
response.Copy(&obj, addReq)
|
util.ConvertUtil.Copy(&obj, addReq)
|
||||||
err := service.db.Create(&obj).Error
|
err := service.db.Create(&obj).Error
|
||||||
e = response.CheckMysqlErr(err)
|
e = response.CheckMysqlErr(err)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@@ -156,7 +157,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) Edit(editReq {{{ toUpperCa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
// response.Copy(&obj, editReq)
|
// util.ConvertUtil.Copy(&obj, editReq)
|
||||||
//
|
//
|
||||||
editInfo, err := convertor.StructToMap(editReq)
|
editInfo, err := convertor.StructToMap(editReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -199,6 +200,21 @@ func (service {{{ toCamelCase .EntityName }}}Service) Del({{{ toUpperCamelCase .
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取Excel的列
|
||||||
|
func (service {{{ toCamelCase .EntityName }}}Service) GetExcelCol() []excel2.Col {
|
||||||
|
var cols = []excel2.Col{
|
||||||
|
{{{- range .Columns }}}
|
||||||
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
|
{Name: "{{{.ColumnComment}}}", Key: "{{{ toUpperCamelCase .GoField }}}", Width: 15, Decode: excel2.DecodeTime },
|
||||||
|
{{{- else }}}
|
||||||
|
{Name: "{{{.ColumnComment}}}", Key: "{{{ toUpperCamelCase .GoField }}}", Width: 15},
|
||||||
|
{{{- end }}}
|
||||||
|
{{{- end }}}
|
||||||
|
}
|
||||||
|
// 还可以考虑字典,请求下来加上 Replace 实现替换导出
|
||||||
|
return cols
|
||||||
|
}
|
||||||
|
|
||||||
// ExportFile {{{ .FunctionName }}}导出
|
// ExportFile {{{ .FunctionName }}}导出
|
||||||
func (service {{{ toCamelCase .EntityName }}}Service) ExportFile(listReq {{{ toUpperCamelCase .EntityName }}}ListReq) (res []{{{ toUpperCamelCase .EntityName }}}Resp, e error) {
|
func (service {{{ toCamelCase .EntityName }}}Service) ExportFile(listReq {{{ toUpperCamelCase .EntityName }}}ListReq) (res []{{{ toUpperCamelCase .EntityName }}}Resp, e error) {
|
||||||
// 查询
|
// 查询
|
||||||
@@ -211,14 +227,14 @@ func (service {{{ toCamelCase .EntityName }}}Service) ExportFile(listReq {{{ toU
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []{{{ toUpperCamelCase .EntityName }}}Resp{}
|
result := []{{{ toUpperCamelCase .EntityName }}}Resp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入
|
// 导入
|
||||||
func (service {{{ toCamelCase .EntityName }}}Service) ImportFile(importReq []{{{ toUpperCamelCase .EntityName }}}Resp) (e error) {
|
func (service {{{ toCamelCase .EntityName }}}Service) ImportFile(importReq []{{{ toUpperCamelCase .EntityName }}}Resp) (e error) {
|
||||||
var importData []model.{{{ toUpperCamelCase .EntityName }}}
|
var importData []model.{{{ toUpperCamelCase .EntityName }}}
|
||||||
response.Copy(&importData, importReq)
|
util.ConvertUtil.Copy(&importData, importReq)
|
||||||
err := service.db.Create(&importData).Error
|
err := service.db.Create(&importData).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return e
|
return e
|
||||||
|
@@ -12,8 +12,8 @@ export type type_{{{.ModuleName}}}_query = {
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
{{{ .GoField }}}_start?: string;
|
{{{ .GoField }}}Start?: string;
|
||||||
{{{ .GoField }}}_end?: string;
|
{{{ .GoField }}}End?: string;
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ .GoField }}}?: {{{goToTsType .GoType}}};
|
{{{ .GoField }}}?: {{{goToTsType .GoType}}};
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
|
@@ -72,8 +72,8 @@ const queryParams = reactive<type_{{{.ModuleName}}}_query>({
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
{{{ (.GoField) }}}_start: '',
|
{{{ (.GoField) }}}Start: '',
|
||||||
{{{ (.GoField) }}}_end: '',
|
{{{ (.GoField) }}}End: '',
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ (.GoField) }}}: '',
|
{{{ (.GoField) }}}: '',
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
|
@@ -5,8 +5,8 @@
|
|||||||
{{{- if eq .IsQuery 1 }}}
|
{{{- if eq .IsQuery 1 }}}
|
||||||
<uv-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" borderBottom>
|
<uv-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" borderBottom>
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
<x-date-range v-model:startTime="form.{{{ (.GoField) }}}_start"
|
<x-date-range v-model:startTime="form.{{{ (.GoField) }}}Start"
|
||||||
v-model:endTime="form.{{{ (.GoField) }}}_end"></x-date-range>
|
v-model:endTime="form.{{{ (.GoField) }}}End"></x-date-range>
|
||||||
{{{- else if or (eq .HtmlType "checkbox") (eq .HtmlType "radio") (eq .HtmlType "select") }}}
|
{{{- else if or (eq .HtmlType "checkbox") (eq .HtmlType "radio") (eq .HtmlType "select") }}}
|
||||||
{{{- if ne .DictType "" }}}
|
{{{- if ne .DictType "" }}}
|
||||||
<x-picker v-model="form.{{{ (.GoField) }}}" valueKey="value" labelKey="name" :columns="dictData.{{{ .DictType }}}"></x-picker>
|
<x-picker v-model="form.{{{ (.GoField) }}}" valueKey="value" labelKey="name" :columns="dictData.{{{ .DictType }}}"></x-picker>
|
||||||
@@ -71,8 +71,8 @@ const { listAllData } = useListAllData<{
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
{{{ (.GoField) }}}_start: null,
|
{{{ (.GoField) }}}Start: null,
|
||||||
{{{ (.GoField) }}}_end: null,
|
{{{ (.GoField) }}}End: null,
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ (.GoField) }}}: null,
|
{{{ (.GoField) }}}: null,
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
|
@@ -8,7 +8,7 @@ import { clearEmpty } from '@/utils/util'
|
|||||||
|
|
||||||
export type type_{{{.ModuleName}}} = {
|
export type type_{{{.ModuleName}}} = {
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{ .GoField }}}?: {{{goToTsType .GoType}}};
|
{{{toUpperCamelCase .GoField }}}?: {{{goToTsType .GoType}}};
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
}
|
}
|
||||||
// 查询
|
// 查询
|
||||||
@@ -16,10 +16,10 @@ export type type_{{{.ModuleName}}}_query = {
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
{{{ .GoField }}}_start?: string;
|
{{{toUpperCamelCase .GoField }}}Start?: string;
|
||||||
{{{ .GoField }}}_end?: string;
|
{{{toUpperCamelCase .GoField }}}End?: string;
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ .GoField }}}?: {{{goToTsType .GoType}}};
|
{{{toUpperCamelCase .GoField }}}?: {{{goToTsType .GoType}}};
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -28,7 +28,7 @@ export type type_{{{.ModuleName}}}_query = {
|
|||||||
export type type_{{{.ModuleName}}}_edit = {
|
export type type_{{{.ModuleName}}}_edit = {
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if or .IsEdit .IsInsert }}}
|
{{{- if or .IsEdit .IsInsert }}}
|
||||||
{{{ .GoField }}}?: {{{goToTsType .GoType}}};
|
{{{toUpperCamelCase .GoField }}}?: {{{goToTsType .GoType}}};
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
}
|
}
|
||||||
|
@@ -12,12 +12,12 @@
|
|||||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsEdit }}}
|
{{{- if .IsEdit }}}
|
||||||
{{{- if ne (.GoField) "id" }}}
|
{{{- if ne (toUpperCamelCase .GoField) "id" }}}
|
||||||
{{{- if and (ne $.Table.TreeParent "") (eq (.GoField) $.Table.TreeParent) }}}
|
{{{- if and (ne $.Table.TreeParent "") (eq (toUpperCamelCase .GoField) $.Table.TreeParent) }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
v-model="formData.{{{ (.GoField) }}}"
|
v-model="formData.{{{ (toUpperCamelCase .GoField) }}}"
|
||||||
:data="treeList"
|
:data="treeList"
|
||||||
clearable
|
clearable
|
||||||
node-key="{{{ .Table.TreePrimary }}}"
|
node-key="{{{ .Table.TreePrimary }}}"
|
||||||
@@ -28,25 +28,25 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "input" }}}
|
{{{- else if eq .HtmlType "input" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-input v-model.number="formData.{{{ (.GoField) }}}" placeholder="请输入{{{ .ColumnComment }}}" />
|
<el-input v-model.number="formData.{{{ (toUpperCamelCase .GoField) }}}" placeholder="请输入{{{ .ColumnComment }}}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "number" }}}
|
{{{- else if eq .HtmlType "number" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-input v-model="formData.{{{ (.GoField) }}}" type="number" placeholder="请输入{{{ .ColumnComment }}}" />
|
<el-input v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" type="number" placeholder="请输入{{{ .ColumnComment }}}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "textarea" }}}
|
{{{- else if eq .HtmlType "textarea" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="formData.{{{ (.GoField) }}}"
|
v-model="formData.{{{ (toUpperCamelCase .GoField) }}}"
|
||||||
placeholder="请输入{{{ .ColumnComment }}}"
|
placeholder="请输入{{{ .ColumnComment }}}"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "checkbox" }}}
|
{{{- else if eq .HtmlType "checkbox" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-checkbox-group v-model="formData.{{{ (.GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}">
|
<el-checkbox-group v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}">
|
||||||
{{{- if ne .DictType "" }}}
|
{{{- if ne .DictType "" }}}
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
||||||
@@ -68,8 +68,8 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "select" }}}
|
{{{- else if eq .HtmlType "select" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-select class="flex-1" v-model="formData.{{{ (.GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}">
|
<el-select class="flex-1" v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}">
|
||||||
{{{- if ne .DictType "" }}}
|
{{{- if ne .DictType "" }}}
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
||||||
@@ -101,8 +101,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "radio" }}}
|
{{{- else if eq .HtmlType "radio" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-radio-group v-model="formData.{{{ (.GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}">
|
<el-radio-group v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}">
|
||||||
{{{- if ne .DictType "" }}}
|
{{{- if ne .DictType "" }}}
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
||||||
@@ -134,10 +134,10 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "datetime" }}}
|
{{{- else if eq .HtmlType "datetime" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
class="flex-1 !flex"
|
class="flex-1 !flex"
|
||||||
v-model="formData.{{{ (.GoField) }}}"
|
v-model="formData.{{{ (toUpperCamelCase .GoField) }}}"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
clearable
|
clearable
|
||||||
value-format="YYYY-MM-DD hh:mm:ss"
|
value-format="YYYY-MM-DD hh:mm:ss"
|
||||||
@@ -145,12 +145,12 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "editor" }}}
|
{{{- else if eq .HtmlType "editor" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<editor v-model="formData.{{{ (.GoField) }}}" :height="500" />
|
<editor v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" :height="500" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "imageUpload" }}}
|
{{{- else if eq .HtmlType "imageUpload" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||||
<material-picker v-model="formData.{{{ (.GoField) }}}" />
|
<material-picker v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -190,15 +190,15 @@ const popupTitle = computed(() => {
|
|||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if eq (.GoField) $.PrimaryKey }}}
|
{{{- if eq (toUpperCamelCase .GoField) $.PrimaryKey }}}
|
||||||
{{{ $.PrimaryKey }}}: '',
|
{{{ $.PrimaryKey }}}: '',
|
||||||
{{{- else if .IsEdit }}}
|
{{{- else if .IsEdit }}}
|
||||||
{{{- if eq .HtmlType "checkbox" }}}
|
{{{- if eq .HtmlType "checkbox" }}}
|
||||||
{{{ (.GoField) }}}: [],
|
{{{ (toUpperCamelCase .GoField) }}}: [],
|
||||||
{{{- else if eq .HtmlType "number" }}}
|
{{{- else if eq .HtmlType "number" }}}
|
||||||
{{{ (.GoField) }}}: 0,
|
{{{ (toUpperCamelCase .GoField) }}}: null,
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ (.GoField) }}}: '',
|
{{{ (toUpperCamelCase .GoField) }}}: null,
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -206,10 +206,10 @@ const formData = reactive({
|
|||||||
|
|
||||||
const formRules = {
|
const formRules = {
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if and .IsEdit .IsRequired }}}
|
{{{- if and .IsEdit }}}
|
||||||
{{{ (.GoField) }}}: [
|
{{{ (toUpperCamelCase .GoField) }}}: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: {{{- if eq .IsRequired 1}}} true {{{- else}}} false {{{- end }}},
|
||||||
{{{- if or (eq .HtmlType "checkbox") (eq .HtmlType "datetime") (eq .HtmlType "radio") (eq .HtmlType "select") (eq .HtmlType "imageUpload") }}}
|
{{{- if or (eq .HtmlType "checkbox") (eq .HtmlType "datetime") (eq .HtmlType "radio") (eq .HtmlType "select") (eq .HtmlType "imageUpload") }}}
|
||||||
message: '请选择{{{ .ColumnComment }}}',
|
message: '请选择{{{ .ColumnComment }}}',
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
@@ -228,7 +228,7 @@ const handleSubmit = async () => {
|
|||||||
const data: any = { ...formData }
|
const data: any = { ...formData }
|
||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if eq .HtmlType "checkbox" }}}
|
{{{- if eq .HtmlType "checkbox" }}}
|
||||||
data.{{{ (.GoField) }}} = data.{{{ (.GoField) }}}.join(',')
|
data.{{{ (toUpperCamelCase .GoField) }}} = data.{{{ (toUpperCamelCase .GoField) }}}.join(',')
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
mode.value == 'edit' ? await {{{ .ModuleName }}}_edit(data) : await {{{ .ModuleName }}}_add(data)
|
mode.value == 'edit' ? await {{{ .ModuleName }}}_edit(data) : await {{{ .ModuleName }}}_add(data)
|
||||||
@@ -251,7 +251,7 @@ const setFormData = async (data: Record<string, any>) => {
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if eq .HtmlType "checkbox" }}}
|
{{{- if eq .HtmlType "checkbox" }}}
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
formData.{{{ (.GoField) }}} = String(data.{{{ (.GoField) }}}).split(',')
|
formData.{{{ (toUpperCamelCase .GoField) }}} = String(data.{{{ (toUpperCamelCase .GoField) }}}).split(',')
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
}
|
}
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}">
|
||||||
<daterange-picker
|
<daterange-picker
|
||||||
v-model:startTime="queryParams.{{{ (.GoField) }}}_start"
|
v-model:startTime="queryParams.{{{ (.GoField) }}}Start"
|
||||||
v-model:endTime="queryParams.{{{ (.GoField) }}}_end"
|
v-model:endTime="queryParams.{{{ (.GoField) }}}End"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if or (eq .HtmlType "select") (eq .HtmlType "radio") }}}
|
{{{- else if or (eq .HtmlType "select") (eq .HtmlType "radio") }}}
|
||||||
@@ -172,8 +172,8 @@ const queryParams = reactive<type_{{{.ModuleName}}}_query>({
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
{{{ (.GoField) }}}_start: '',
|
{{{ (.GoField) }}}Start: '',
|
||||||
{{{ (.GoField) }}}_end: '',
|
{{{ (.GoField) }}}End: '',
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ (.GoField) }}}: '',
|
{{{ (.GoField) }}}: '',
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
|
@@ -6,16 +6,16 @@
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if eq .IsQuery 1 }}}
|
{{{- if eq .IsQuery 1 }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" class="w-[280px]">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}" class="w-[280px]">
|
||||||
<daterange-picker
|
<daterange-picker
|
||||||
v-model:startTime="queryParams.{{{ (.GoField) }}}_start"
|
v-model:startTime="queryParams.{{{ (toUpperCamelCase .GoField) }}}Start"
|
||||||
v-model:endTime="queryParams.{{{ (.GoField) }}}_end"
|
v-model:endTime="queryParams.{{{ (toUpperCamelCase .GoField) }}}End"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if or (eq .HtmlType "select") (eq .HtmlType "radio") }}}
|
{{{- else if or (eq .HtmlType "select") (eq .HtmlType "radio") }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" class="w-[280px]">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}" class="w-[280px]">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.{{{ (.GoField) }}}"
|
v-model="queryParams.{{{ (toUpperCamelCase .GoField) }}}"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
{{{- if ne .DictType "" }}}
|
{{{- if ne .DictType "" }}}
|
||||||
@@ -41,8 +41,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- else if eq .HtmlType "input" }}}
|
{{{- else if eq .HtmlType "input" }}}
|
||||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" class="w-[280px]">
|
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}" class="w-[280px]">
|
||||||
<el-input v-model="queryParams.{{{ (.GoField) }}}" />
|
<el-input v-model="queryParams.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -92,33 +92,33 @@
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsList }}}
|
{{{- if .IsList }}}
|
||||||
{{{- if and (ne .DictType "") (or (eq .HtmlType "select") (eq .HtmlType "radio") (eq .HtmlType "checkbox")) }}}
|
{{{- if and (ne .DictType "") (or (eq .HtmlType "select") (eq .HtmlType "radio") (eq .HtmlType "checkbox")) }}}
|
||||||
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" min-width="100">
|
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}" min-width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-value :options="dictData.{{{ .DictType }}}" :value="row.{{{ (.GoField) }}}" />
|
<dict-value :options="dictData.{{{ .DictType }}}" :value="row.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{{- else if and (ne .ListAllApi "") (or (eq .HtmlType "select") (eq .HtmlType "radio") (eq .HtmlType "checkbox")) }}}
|
{{{- else if and (ne .ListAllApi "") (or (eq .HtmlType "select") (eq .HtmlType "radio") (eq .HtmlType "checkbox")) }}}
|
||||||
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" min-width="100">
|
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}" min-width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="row.{{{ (.GoField) }}}" labelKey='id' valueKey='id' />
|
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="row.{{{ (toUpperCamelCase .GoField) }}}" labelKey='id' valueKey='id' />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
{{{- else if eq .HtmlType "imageUpload" }}}
|
{{{- else if eq .HtmlType "imageUpload" }}}
|
||||||
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" min-width="100">
|
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}" min-width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<image-contain
|
<image-contain
|
||||||
:width="40"
|
:width="40"
|
||||||
:height="40"
|
:height="40"
|
||||||
:src="row.{{{ (.GoField) }}}"
|
:src="row.{{{ (toUpperCamelCase .GoField) }}}"
|
||||||
:preview-src-list="[row.{{{ (.GoField) }}}]"
|
:preview-src-list="[row.{{{ (toUpperCamelCase .GoField) }}}]"
|
||||||
preview-teleported
|
preview-teleported
|
||||||
hide-on-click-modal
|
hide-on-click-modal
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (.GoField) }}}" min-width="130" />
|
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}" min-width="130" />
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
@@ -181,10 +181,10 @@ const queryParams = reactive<type_{{{.ModuleName}}}_query>({
|
|||||||
{{{- range .Columns }}}
|
{{{- range .Columns }}}
|
||||||
{{{- if .IsQuery }}}
|
{{{- if .IsQuery }}}
|
||||||
{{{- if eq .HtmlType "datetime" }}}
|
{{{- if eq .HtmlType "datetime" }}}
|
||||||
{{{ (.GoField) }}}_start: null,
|
{{{ (toUpperCamelCase .GoField) }}}Start: null,
|
||||||
{{{ (.GoField) }}}_end: null,
|
{{{ (toUpperCamelCase .GoField) }}}End: null,
|
||||||
{{{- else }}}
|
{{{- else }}}
|
||||||
{{{ (.GoField) }}}: null,
|
{{{ (toUpperCamelCase .GoField) }}}: null,
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
{{{- end }}}
|
{{{- end }}}
|
||||||
|
@@ -4,7 +4,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"x_admin/config"
|
"x_admin/config"
|
||||||
"x_admin/core"
|
|
||||||
"x_admin/model/gen_model"
|
"x_admin/model/gen_model"
|
||||||
"x_admin/util"
|
"x_admin/util"
|
||||||
|
|
||||||
@@ -70,8 +69,8 @@ func (gu genUtil) InitTable(table gen_model.GenTable) gen_model.GenTable {
|
|||||||
EntityName: gu.ToClassName(table.TableName),
|
EntityName: gu.ToClassName(table.TableName),
|
||||||
ModuleName: gu.ToModuleName(table.TableName),
|
ModuleName: gu.ToModuleName(table.TableName),
|
||||||
FunctionName: strings.Replace(table.TableComment, "表", "", -1),
|
FunctionName: strings.Replace(table.TableComment, "表", "", -1),
|
||||||
CreateTime: core.NowTime(),
|
CreateTime: util.NullTimeUtil.Now(),
|
||||||
UpdateTime: core.NowTime(),
|
UpdateTime: util.NullTimeUtil.Now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,8 +91,8 @@ func (gu genUtil) InitColumn(tableId uint, column gen_model.GenTableColumn) gen_
|
|||||||
IsPk: column.IsPk,
|
IsPk: column.IsPk,
|
||||||
IsIncrement: column.IsIncrement,
|
IsIncrement: column.IsIncrement,
|
||||||
IsRequired: column.IsRequired,
|
IsRequired: column.IsRequired,
|
||||||
CreateTime: core.NowTime(),
|
CreateTime: util.NullTimeUtil.Now(),
|
||||||
UpdateTime: core.NowTime(),
|
UpdateTime: util.NullTimeUtil.Now(),
|
||||||
}
|
}
|
||||||
if util.ToolsUtil.Contains(append(SqlConstants.ColumnTypeStr, SqlConstants.ColumnTypeText...), columnType) {
|
if util.ToolsUtil.Contains(append(SqlConstants.ColumnTypeStr, SqlConstants.ColumnTypeText...), columnType) {
|
||||||
//文本域组
|
//文本域组
|
||||||
@@ -234,7 +233,7 @@ func (gu genUtil) GoToTsType(s string) string {
|
|||||||
return "number[]"
|
return "number[]"
|
||||||
} else if s == "[]float" {
|
} else if s == "[]float" {
|
||||||
return "number[]"
|
return "number[]"
|
||||||
} else if s == "core.TsTime" {
|
} else if s == "core.NullTime" {
|
||||||
return "string"
|
return "string"
|
||||||
}
|
}
|
||||||
return "string"
|
return "string"
|
||||||
@@ -264,7 +263,7 @@ func (gu genUtil) GoToNullType(s string) string {
|
|||||||
|
|
||||||
// 拼接字符串
|
// 拼接字符串
|
||||||
func (gu genUtil) GetPageResp(s string) string {
|
func (gu genUtil) GetPageResp(s string) string {
|
||||||
return `response.Response{ data=response.PageResp{ lists= []` + s + `Resp}}`
|
return `response.Response{ data=response.PageResp{ lists=[]` + s + `Resp}}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NameToPath 下划线文件路径
|
// NameToPath 下划线文件路径
|
||||||
|
@@ -13,30 +13,30 @@ import (
|
|||||||
|
|
||||||
type MonitorClientHandler struct{}
|
type MonitorClientHandler struct{}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息列表
|
// @Summary 监控-客户端信息列表
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param PageNo query int true "页码"
|
// @Param PageNo query int true "页码"
|
||||||
// @Param PageSize query int true "每页数量"
|
// @Param PageSize query int true "每页数量"
|
||||||
// @Param projectKey query string false "项目key."
|
// @Param projectKey query string false "项目key."
|
||||||
// @Param clientId query string false "sdk生成的客户端id."
|
// @Param clientId query string false "sdk生成的客户端id."
|
||||||
// @Param userId query string false "用户id."
|
// @Param userId query string false "用户id."
|
||||||
// @Param os query string false "系统."
|
// @Param os query string false "系统."
|
||||||
// @Param browser query string false "浏览器."
|
// @Param browser query string false "浏览器."
|
||||||
// @Param city query string false "城市."
|
// @Param city query string false "城市."
|
||||||
// @Param width query int false "屏幕."
|
// @Param width query int false "屏幕."
|
||||||
// @Param height query int false "屏幕高度."
|
// @Param height query int false "屏幕高度."
|
||||||
// @Param ua query string false "ua记录."
|
// @Param ua query string false "ua记录."
|
||||||
// @Param createTimeStart query core.TsTime false "创建时间."
|
// @Param createTimeStart query core.NullTime false "创建时间."
|
||||||
// @Param createTimeEnd query core.TsTime false "创建时间."
|
// @Param createTimeEnd query core.NullTime false "创建时间."
|
||||||
// @Param clientTimeStart query core.TsTime false "更新时间."
|
// @Param clientTimeStart query core.NullTime false "更新时间."
|
||||||
// @Param clientTimeEnd query core.TsTime false "更新时间."
|
// @Param clientTimeEnd query core.NullTime false "更新时间."
|
||||||
//
|
//
|
||||||
// @Success 200 {object} response.Response{data=response.PageResp{lists=[]MonitorClientResp}} "成功"
|
// @Success 200 {object} response.Response{data=response.PageResp{lists=[]MonitorClientResp}} "成功"
|
||||||
//
|
//
|
||||||
// @Failure 400 {object} string "请求错误"
|
// @Failure 400 {object} string "请求错误"
|
||||||
// @Router /api/admin/monitor_client/list [get]
|
// @Router /api/admin/monitor_client/list [get]
|
||||||
func (hd MonitorClientHandler) List(c *gin.Context) {
|
func (hd MonitorClientHandler) List(c *gin.Context) {
|
||||||
var page request.PageReq
|
var page request.PageReq
|
||||||
var listReq MonitorClientListReq
|
var listReq MonitorClientListReq
|
||||||
@@ -50,24 +50,24 @@ func (hd MonitorClientHandler) List(c *gin.Context) {
|
|||||||
response.CheckAndRespWithData(c, res, err)
|
response.CheckAndRespWithData(c, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息列表-所有
|
// @Summary 监控-客户端信息列表-所有
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param projectKey query string false "项目key."
|
// @Param projectKey query string false "项目key."
|
||||||
// @Param clientId query string false "sdk生成的客户端id."
|
// @Param clientId query string false "sdk生成的客户端id."
|
||||||
// @Param userId query string false "用户id."
|
// @Param userId query string false "用户id."
|
||||||
// @Param os query string false "系统."
|
// @Param os query string false "系统."
|
||||||
// @Param browser query string false "浏览器."
|
// @Param browser query string false "浏览器."
|
||||||
// @Param city query string false "城市."
|
// @Param city query string false "城市."
|
||||||
// @Param width query int false "屏幕."
|
// @Param width query int false "屏幕."
|
||||||
// @Param height query int false "屏幕高度."
|
// @Param height query int false "屏幕高度."
|
||||||
// @Param ua query string false "ua记录."
|
// @Param ua query string false "ua记录."
|
||||||
// @Param createTimeStart query core.TsTime false "创建时间."
|
// @Param createTimeStart query core.NullTime false "创建时间."
|
||||||
// @Param createTimeEnd query core.TsTime false "创建时间."
|
// @Param createTimeEnd query core.NullTime false "创建时间."
|
||||||
// @Param clientTimeStart query core.TsTime false "更新时间."
|
// @Param clientTimeStart query core.NullTime false "更新时间."
|
||||||
// @Param clientTimeEnd query core.TsTime false "更新时间."
|
// @Param clientTimeEnd query core.NullTime false "更新时间."
|
||||||
// @Success 200 {object} response.Response{data=[]MonitorClientResp} "成功"
|
// @Success 200 {object} response.Response{data=[]MonitorClientResp} "成功"
|
||||||
// @Router /api/admin/monitor_client/listAll [get]
|
// @Router /api/admin/monitor_client/listAll [get]
|
||||||
func (hd MonitorClientHandler) ListAll(c *gin.Context) {
|
func (hd MonitorClientHandler) ListAll(c *gin.Context) {
|
||||||
var listReq MonitorClientListReq
|
var listReq MonitorClientListReq
|
||||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||||
@@ -77,13 +77,13 @@ func (hd MonitorClientHandler) ListAll(c *gin.Context) {
|
|||||||
response.CheckAndRespWithData(c, res, err)
|
response.CheckAndRespWithData(c, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息详情
|
// @Summary 监控-客户端信息详情
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param id query int false "uuid."
|
// @Param id query int false "uuid."
|
||||||
// @Success 200 {object} response.Response{data=MonitorClientResp} "成功"
|
// @Success 200 {object} response.Response{data=MonitorClientResp} "成功"
|
||||||
// @Router /api/admin/monitor_client/detail [get]
|
// @Router /api/admin/monitor_client/detail [get]
|
||||||
func (hd MonitorClientHandler) Detail(c *gin.Context) {
|
func (hd MonitorClientHandler) Detail(c *gin.Context) {
|
||||||
var detailReq MonitorClientDetailReq
|
var detailReq MonitorClientDetailReq
|
||||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
||||||
@@ -93,21 +93,21 @@ func (hd MonitorClientHandler) Detail(c *gin.Context) {
|
|||||||
response.CheckAndRespWithData(c, res, err)
|
response.CheckAndRespWithData(c, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息新增
|
// @Summary 监控-客户端信息新增
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param clientId body string false "sdk生成的客户端id."
|
// @Param clientId body string false "sdk生成的客户端id."
|
||||||
// @Param userId body string false "用户id."
|
// @Param userId body string false "用户id."
|
||||||
// @Param os body string false "系统."
|
// @Param os body string false "系统."
|
||||||
// @Param browser body string false "浏览器."
|
// @Param browser body string false "浏览器."
|
||||||
// @Param city body string false "城市."
|
// @Param city body string false "城市."
|
||||||
// @Param width body int false "屏幕."
|
// @Param width body int false "屏幕."
|
||||||
// @Param height body int false "屏幕高度."
|
// @Param height body int false "屏幕高度."
|
||||||
// @Param ua body string false "ua记录."
|
// @Param ua body string false "ua记录."
|
||||||
// @Param clientTime body core.TsTime false "更新时间."
|
// @Param clientTime body core.NullTime false "更新时间."
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
// @Router /api/admin/monitor_client/add [post]
|
// @Router /api/admin/monitor_client/add [post]
|
||||||
func (hd MonitorClientHandler) Add(c *gin.Context) {
|
func (hd MonitorClientHandler) Add(c *gin.Context) {
|
||||||
var addReq MonitorClientAddReq
|
var addReq MonitorClientAddReq
|
||||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &addReq)) {
|
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &addReq)) {
|
||||||
@@ -116,21 +116,21 @@ func (hd MonitorClientHandler) Add(c *gin.Context) {
|
|||||||
response.CheckAndResp(c, Service.Add(addReq))
|
response.CheckAndResp(c, Service.Add(addReq))
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息编辑
|
// @Summary 监控-客户端信息编辑
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param clientId body string false "sdk生成的客户端id."
|
// @Param clientId body string false "sdk生成的客户端id."
|
||||||
// @Param userId body string false "用户id."
|
// @Param userId body string false "用户id."
|
||||||
// @Param os body string false "系统."
|
// @Param os body string false "系统."
|
||||||
// @Param browser body string false "浏览器."
|
// @Param browser body string false "浏览器."
|
||||||
// @Param city body string false "城市."
|
// @Param city body string false "城市."
|
||||||
// @Param width body int false "屏幕."
|
// @Param width body int false "屏幕."
|
||||||
// @Param height body int false "屏幕高度."
|
// @Param height body int false "屏幕高度."
|
||||||
// @Param ua body string false "ua记录."
|
// @Param ua body string false "ua记录."
|
||||||
// @Param clientTime body core.TsTime false "更新时间."
|
// @Param clientTime body core.NullTime false "更新时间."
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
// @Router /api/admin/monitor_client/edit [post]
|
// @Router /api/admin/monitor_client/edit [post]
|
||||||
func (hd MonitorClientHandler) Edit(c *gin.Context) {
|
func (hd MonitorClientHandler) Edit(c *gin.Context) {
|
||||||
var editReq MonitorClientEditReq
|
var editReq MonitorClientEditReq
|
||||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &editReq)) {
|
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &editReq)) {
|
||||||
@@ -139,13 +139,13 @@ func (hd MonitorClientHandler) Edit(c *gin.Context) {
|
|||||||
response.CheckAndResp(c, Service.Edit(editReq))
|
response.CheckAndResp(c, Service.Edit(editReq))
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息删除
|
// @Summary 监控-客户端信息删除
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param id body int false "uuid."
|
// @Param id body int false "uuid."
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
// @Router /api/admin/monitor_client/del [post]
|
// @Router /api/admin/monitor_client/del [post]
|
||||||
func (hd MonitorClientHandler) Del(c *gin.Context) {
|
func (hd MonitorClientHandler) Del(c *gin.Context) {
|
||||||
var delReq MonitorClientDelReq
|
var delReq MonitorClientDelReq
|
||||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &delReq)) {
|
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &delReq)) {
|
||||||
@@ -154,22 +154,22 @@ func (hd MonitorClientHandler) Del(c *gin.Context) {
|
|||||||
response.CheckAndResp(c, Service.Del(delReq.Id))
|
response.CheckAndResp(c, Service.Del(delReq.Id))
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息导出
|
// @Summary 监控-客户端信息导出
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param projectKey query string false "项目key."
|
// @Param projectKey query string false "项目key."
|
||||||
// @Param clientId query string false "sdk生成的客户端id."
|
// @Param clientId query string false "sdk生成的客户端id."
|
||||||
// @Param userId query string false "用户id."
|
// @Param userId query string false "用户id."
|
||||||
// @Param os query string false "系统."
|
// @Param os query string false "系统."
|
||||||
// @Param browser query string false "浏览器."
|
// @Param browser query string false "浏览器."
|
||||||
// @Param city query string false "城市."
|
// @Param city query string false "城市."
|
||||||
// @Param width query int false "屏幕."
|
// @Param width query int false "屏幕."
|
||||||
// @Param height query int false "屏幕高度."
|
// @Param height query int false "屏幕高度."
|
||||||
// @Param ua query string false "ua记录."
|
// @Param ua query string false "ua记录."
|
||||||
// @Param createTime query core.TsTime false "创建时间."
|
// @Param createTime query core.NullTime false "创建时间."
|
||||||
// @Param clientTime query core.TsTime false "更新时间."
|
// @Param clientTime query core.NullTime false "更新时间."
|
||||||
// @Router /api/admin/monitor_client/ExportFile [get]
|
// @Router /api/admin/monitor_client/ExportFile [get]
|
||||||
func (hd MonitorClientHandler) ExportFile(c *gin.Context) {
|
func (hd MonitorClientHandler) ExportFile(c *gin.Context) {
|
||||||
var listReq MonitorClientListReq
|
var listReq MonitorClientListReq
|
||||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||||
@@ -188,9 +188,9 @@ func (hd MonitorClientHandler) ExportFile(c *gin.Context) {
|
|||||||
excel.DownLoadExcel("监控-客户端信息"+time.Now().Format("20060102-150405"), c.Writer, f)
|
excel.DownLoadExcel("监控-客户端信息"+time.Now().Format("20060102-150405"), c.Writer, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 监控-客户端信息导入
|
// @Summary 监控-客户端信息导入
|
||||||
// @Tags monitor_client-监控-客户端信息
|
// @Tags monitor_client-监控-客户端信息
|
||||||
// @Produce json
|
// @Produce json
|
||||||
func (hd MonitorClientHandler) ImportFile(c *gin.Context) {
|
func (hd MonitorClientHandler) ImportFile(c *gin.Context) {
|
||||||
file, _, err := c.Request.FormFile("file")
|
file, _, err := c.Request.FormFile("file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -26,29 +26,29 @@ type MonitorClientDetailReq struct {
|
|||||||
|
|
||||||
//MonitorClientAddReq 监控-客户端信息新增参数
|
//MonitorClientAddReq 监控-客户端信息新增参数
|
||||||
type MonitorClientAddReq struct {
|
type MonitorClientAddReq struct {
|
||||||
ClientId string `form:"clientId"` // sdk生成的客户端id
|
ClientId string `form:"clientId"` // sdk生成的客户端id
|
||||||
UserId string `form:"userId"` // 用户id
|
UserId string `form:"userId"` // 用户id
|
||||||
Os string `form:"os"` // 系统
|
Os string `form:"os"` // 系统
|
||||||
Browser string `form:"browser"` // 浏览器
|
Browser string `form:"browser"` // 浏览器
|
||||||
City string `form:"city"` // 城市
|
City string `form:"city"` // 城市
|
||||||
Width int `form:"width"` // 屏幕
|
Width int `form:"width"` // 屏幕
|
||||||
Height int `form:"height"` // 屏幕高度
|
Height int `form:"height"` // 屏幕高度
|
||||||
Ua string `form:"ua"` // ua记录
|
Ua string `form:"ua"` // ua记录
|
||||||
ClientTime core.TsTime `form:"clientTime"` // 更新时间
|
ClientTime core.NullTime `form:"clientTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//MonitorClientEditReq 监控-客户端信息编辑参数
|
//MonitorClientEditReq 监控-客户端信息编辑参数
|
||||||
type MonitorClientEditReq struct {
|
type MonitorClientEditReq struct {
|
||||||
Id int `form:"id"` // id
|
Id int `form:"id"` // id
|
||||||
ClientId string `form:"clientId"` // sdk生成的客户端id
|
ClientId string `form:"clientId"` // sdk生成的客户端id
|
||||||
UserId string `form:"userId"` // 用户id
|
UserId string `form:"userId"` // 用户id
|
||||||
Os string `form:"os"` // 系统
|
Os string `form:"os"` // 系统
|
||||||
Browser string `form:"browser"` // 浏览器
|
Browser string `form:"browser"` // 浏览器
|
||||||
City string `form:"city"` // 城市
|
City string `form:"city"` // 城市
|
||||||
Width int `form:"width"` // 屏幕
|
Width int `form:"width"` // 屏幕
|
||||||
Height int `form:"height"` // 屏幕高度
|
Height int `form:"height"` // 屏幕高度
|
||||||
Ua string `form:"ua"` // ua记录
|
Ua string `form:"ua"` // ua记录
|
||||||
ClientTime core.TsTime `form:"clientTime"` // 更新时间
|
ClientTime core.NullTime `form:"clientTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//MonitorClientDelReq 监控-客户端信息新增参数
|
//MonitorClientDelReq 监控-客户端信息新增参数
|
||||||
@@ -58,16 +58,16 @@ type MonitorClientDelReq struct {
|
|||||||
|
|
||||||
//MonitorClientResp 监控-客户端信息返回信息
|
//MonitorClientResp 监控-客户端信息返回信息
|
||||||
type MonitorClientResp struct {
|
type MonitorClientResp struct {
|
||||||
Id int `json:"id" structs:"id"` // uuid
|
Id int `json:"id" structs:"id"` // uuid
|
||||||
ProjectKey string `json:"projectKey" structs:"projectKey" excel:"name:项目key;"` // 项目key
|
ProjectKey string `json:"projectKey" structs:"projectKey" excel:"name:项目key;"` // 项目key
|
||||||
ClientId string `json:"clientId" structs:"clientId" excel:"name:sdk生成的客户端id;"` // sdk生成的客户端id
|
ClientId string `json:"clientId" structs:"clientId" excel:"name:sdk生成的客户端id;"` // sdk生成的客户端id
|
||||||
UserId string `json:"userId" structs:"userId" excel:"name:用户id;"` // 用户id
|
UserId string `json:"userId" structs:"userId" excel:"name:用户id;"` // 用户id
|
||||||
Os string `json:"os" structs:"os" excel:"name:系统;"` // 系统
|
Os string `json:"os" structs:"os" excel:"name:系统;"` // 系统
|
||||||
Browser string `json:"browser" structs:"browser" excel:"name:浏览器;"` // 浏览器
|
Browser string `json:"browser" structs:"browser" excel:"name:浏览器;"` // 浏览器
|
||||||
City string `json:"city" structs:"city" excel:"name:城市;"` // 城市
|
City string `json:"city" structs:"city" excel:"name:城市;"` // 城市
|
||||||
Width int `json:"width" structs:"width" excel:"name:屏幕;"` // 屏幕
|
Width int `json:"width" structs:"width" excel:"name:屏幕;"` // 屏幕
|
||||||
Height int `json:"height" structs:"height" excel:"name:屏幕高度;"` // 屏幕高度
|
Height int `json:"height" structs:"height" excel:"name:屏幕高度;"` // 屏幕高度
|
||||||
Ua string `json:"ua" structs:"ua" excel:"name:ua记录;"` // ua记录
|
Ua string `json:"ua" structs:"ua" excel:"name:ua记录;"` // ua记录
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime" excel:"name:创建时间;"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime" excel:"name:创建时间;"` // 创建时间
|
||||||
ClientTime core.TsTime `json:"clientTime" structs:"clientTime" excel:"name:更新时间;"` // 更新时间
|
ClientTime core.NullTime `json:"clientTime" structs:"clientTime" excel:"name:更新时间;"` // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model"
|
"x_admin/model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -87,7 +88,7 @@ func (service monitorClientService) List(page request.PageReq, listReq MonitorCl
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []MonitorClientResp{}
|
result := []MonitorClientResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -106,7 +107,7 @@ func (service monitorClientService) ListAll(listReq MonitorClientListReq) (res [
|
|||||||
if e = response.CheckErr(err, "查询全部失败"); e != nil {
|
if e = response.CheckErr(err, "查询全部失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, modelList)
|
util.ConvertUtil.Copy(&res, modelList)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,14 +121,14 @@ func (service monitorClientService) Detail(id int) (res MonitorClientResp, e err
|
|||||||
if e = response.CheckErr(err, "获取详情失败"); e != nil {
|
if e = response.CheckErr(err, "获取详情失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, obj)
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add 监控-客户端信息新增
|
// Add 监控-客户端信息新增
|
||||||
func (service monitorClientService) Add(addReq MonitorClientAddReq) (e error) {
|
func (service monitorClientService) Add(addReq MonitorClientAddReq) (e error) {
|
||||||
var obj model.MonitorClient
|
var obj model.MonitorClient
|
||||||
response.Copy(&obj, addReq)
|
util.ConvertUtil.Copy(&obj, addReq)
|
||||||
err := service.db.Create(&obj).Error
|
err := service.db.Create(&obj).Error
|
||||||
e = response.CheckMysqlErr(err)
|
e = response.CheckMysqlErr(err)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@@ -149,7 +150,7 @@ func (service monitorClientService) Edit(editReq MonitorClientEditReq) (e error)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&obj, editReq)
|
util.ConvertUtil.Copy(&obj, editReq)
|
||||||
err = service.db.Model(&obj).Select("*").Updates(obj).Error
|
err = service.db.Model(&obj).Select("*").Updates(obj).Error
|
||||||
e = response.CheckErr(err, "更新失败")
|
e = response.CheckErr(err, "更新失败")
|
||||||
return
|
return
|
||||||
@@ -184,14 +185,14 @@ func (service monitorClientService) ExportFile(listReq MonitorClientListReq) (re
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []MonitorClientResp{}
|
result := []MonitorClientResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入
|
// 导入
|
||||||
func (service monitorClientService) ImportFile(importReq []MonitorClientResp) (e error) {
|
func (service monitorClientService) ImportFile(importReq []MonitorClientResp) (e error) {
|
||||||
var importData []model.MonitorClient
|
var importData []model.MonitorClient
|
||||||
response.Copy(&importData, importReq)
|
util.ConvertUtil.Copy(&importData, importReq)
|
||||||
err := service.db.Create(&importData).Error
|
err := service.db.Create(&importData).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return e
|
return e
|
||||||
|
@@ -40,10 +40,10 @@ type MonitorProjectDelReq struct {
|
|||||||
|
|
||||||
//MonitorProjectResp 错误项目返回信息
|
//MonitorProjectResp 错误项目返回信息
|
||||||
type MonitorProjectResp struct {
|
type MonitorProjectResp struct {
|
||||||
Id int `json:"id" structs:"id" excel:"name:项目id;"` // 项目id
|
Id int `json:"id" structs:"id" excel:"name:项目id;"` // 项目id
|
||||||
ProjectKey string `json:"projectKey" structs:"projectKey" excel:"name:项目uuid;"` // 项目uuid
|
ProjectKey string `json:"projectKey" structs:"projectKey" excel:"name:项目uuid;"` // 项目uuid
|
||||||
ProjectName string `json:"projectName" structs:"projectName" excel:"name:项目名称;"` // 项目名称
|
ProjectName string `json:"projectName" structs:"projectName" excel:"name:项目名称;"` // 项目名称
|
||||||
ProjectType string `json:"projectType" structs:"projectType" excel:"name:项目类型go java web node php 等;"` // 项目类型go java web node php 等
|
ProjectType string `json:"projectType" structs:"projectType" excel:"name:项目类型go java web node php 等;"` // 项目类型go java web node php 等
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime" excel:"name:更新时间;"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime" excel:"name:更新时间;"` // 更新时间
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime" excel:"name:创建时间;"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime" excel:"name:创建时间;"` // 创建时间
|
||||||
}
|
}
|
||||||
|
@@ -106,7 +106,7 @@ func (service monitorProjectService) List(page request.PageReq, listReq MonitorP
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []MonitorProjectResp{}
|
result := []MonitorProjectResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -123,7 +123,7 @@ func (service monitorProjectService) ListAll() (res []MonitorProjectResp, e erro
|
|||||||
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, modelList)
|
util.ConvertUtil.Copy(&res, modelList)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,14 +142,14 @@ func (service monitorProjectService) Detail(id int) (res MonitorProjectResp, e e
|
|||||||
service.SetCache(obj)
|
service.SetCache(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Copy(&res, obj)
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add 错误项目新增
|
// Add 错误项目新增
|
||||||
func (service monitorProjectService) Add(addReq MonitorProjectAddReq) (createId int, e error) {
|
func (service monitorProjectService) Add(addReq MonitorProjectAddReq) (createId int, e error) {
|
||||||
var obj model.MonitorProject
|
var obj model.MonitorProject
|
||||||
response.Copy(&obj, addReq)
|
util.ConvertUtil.Copy(&obj, addReq)
|
||||||
obj.ProjectKey = util.ToolsUtil.MakeUuid()
|
obj.ProjectKey = util.ToolsUtil.MakeUuid()
|
||||||
err := service.db.Create(&obj).Error
|
err := service.db.Create(&obj).Error
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ func (service monitorProjectService) Edit(editReq MonitorProjectEditReq) (e erro
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&obj, editReq)
|
util.ConvertUtil.Copy(&obj, editReq)
|
||||||
|
|
||||||
err = service.db.Model(&obj).Select("*").Updates(obj).Error
|
err = service.db.Model(&obj).Select("*").Updates(obj).Error
|
||||||
if e = response.CheckErr(err, "编辑失败"); e != nil {
|
if e = response.CheckErr(err, "编辑失败"); e != nil {
|
||||||
@@ -225,14 +225,14 @@ func (service monitorProjectService) ExportFile(listReq MonitorProjectListReq) (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []MonitorProjectResp{}
|
result := []MonitorProjectResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入
|
// 导入
|
||||||
func (service monitorProjectService) ImportFile(importReq []MonitorProjectResp) (e error) {
|
func (service monitorProjectService) ImportFile(importReq []MonitorProjectResp) (e error) {
|
||||||
var importData []model.MonitorProject
|
var importData []model.MonitorProject
|
||||||
response.Copy(&importData, importReq)
|
util.ConvertUtil.Copy(&importData, importReq)
|
||||||
err := service.db.Create(&importData).Error
|
err := service.db.Create(&importData).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return e
|
return e
|
||||||
|
@@ -23,25 +23,25 @@ type MonitorWebDetailReq struct {
|
|||||||
|
|
||||||
//MonitorWebAddReq 错误收集error新增参数
|
//MonitorWebAddReq 错误收集error新增参数
|
||||||
type MonitorWebAddReq struct {
|
type MonitorWebAddReq struct {
|
||||||
ProjectKey string `form:"projectKey"` // 项目key
|
ProjectKey string `form:"projectKey"` // 项目key
|
||||||
ClientId string `form:"clientId"` // sdk生成的客户端id
|
ClientId string `form:"clientId"` // sdk生成的客户端id
|
||||||
EventType string `form:"eventType"` // 事件类型
|
EventType string `form:"eventType"` // 事件类型
|
||||||
Page string `form:"page"` // URL地址
|
Page string `form:"page"` // URL地址
|
||||||
Message string `form:"message"` // 错误消息
|
Message string `form:"message"` // 错误消息
|
||||||
Stack string `form:"stack"` // 错误堆栈
|
Stack string `form:"stack"` // 错误堆栈
|
||||||
ClientTime core.TsTime `form:"clientTime"` // 客户端时间
|
ClientTime core.NullTime `form:"clientTime"` // 客户端时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//MonitorWebEditReq 错误收集error编辑参数
|
//MonitorWebEditReq 错误收集error编辑参数
|
||||||
type MonitorWebEditReq struct {
|
type MonitorWebEditReq struct {
|
||||||
Id int `form:"id"` // uuid
|
Id int `form:"id"` // uuid
|
||||||
ProjectKey string `form:"projectKey"` // 项目key
|
ProjectKey string `form:"projectKey"` // 项目key
|
||||||
ClientId string `form:"clientId"` // sdk生成的客户端id
|
ClientId string `form:"clientId"` // sdk生成的客户端id
|
||||||
EventType string `form:"eventType"` // 事件类型
|
EventType string `form:"eventType"` // 事件类型
|
||||||
Page string `form:"page"` // URL地址
|
Page string `form:"page"` // URL地址
|
||||||
Message string `form:"message"` // 错误消息
|
Message string `form:"message"` // 错误消息
|
||||||
Stack string `form:"stack"` // 错误堆栈
|
Stack string `form:"stack"` // 错误堆栈
|
||||||
ClientTime core.TsTime `form:"clientTime"` // 客户端时间
|
ClientTime core.NullTime `form:"clientTime"` // 客户端时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//MonitorWebDelReq 错误收集error新增参数
|
//MonitorWebDelReq 错误收集error新增参数
|
||||||
@@ -51,13 +51,13 @@ type MonitorWebDelReq struct {
|
|||||||
|
|
||||||
//MonitorWebResp 错误收集error返回信息
|
//MonitorWebResp 错误收集error返回信息
|
||||||
type MonitorWebResp struct {
|
type MonitorWebResp struct {
|
||||||
Id int `json:"id"` // uuid
|
Id int `json:"id"` // uuid
|
||||||
ProjectKey string `json:"projectKey" excel:"name:项目key;"` // 项目key
|
ProjectKey string `json:"projectKey" excel:"name:项目key;"` // 项目key
|
||||||
ClientId string `json:"clientId" excel:"name:sdk生成的客户端id;"` // sdk生成的客户端id
|
ClientId string `json:"clientId" excel:"name:sdk生成的客户端id;"` // sdk生成的客户端id
|
||||||
EventType string `json:"eventType" excel:"name:事件类型;"` // 事件类型
|
EventType string `json:"eventType" excel:"name:事件类型;"` // 事件类型
|
||||||
Page string `json:"page" excel:"name:URL地址;"` // URL地址
|
Page string `json:"page" excel:"name:URL地址;"` // URL地址
|
||||||
Message string `json:"message" excel:"name:错误消息;"` // 错误消息
|
Message string `json:"message" excel:"name:错误消息;"` // 错误消息
|
||||||
Stack string `json:"stack" excel:"name:错误堆栈;"` // 错误堆栈
|
Stack string `json:"stack" excel:"name:错误堆栈;"` // 错误堆栈
|
||||||
ClientTime core.TsTime `json:"clientTime" excel:"name:客户端时间;"` // 客户端时间
|
ClientTime core.NullTime `json:"clientTime" excel:"name:客户端时间;"` // 客户端时间
|
||||||
CreateTime core.TsTime `json:"createTime" excel:"name:创建时间;"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" excel:"name:创建时间;"` // 创建时间
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model"
|
"x_admin/model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -82,7 +83,7 @@ func (service monitorWebService) List(page request.PageReq, listReq MonitorWebLi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []MonitorWebResp{}
|
result := []MonitorWebResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -99,7 +100,7 @@ func (service monitorWebService) ListAll() (res []MonitorWebResp, e error) {
|
|||||||
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
if e = response.CheckErr(err, "获取列表失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, modelList)
|
util.ConvertUtil.Copy(&res, modelList)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,14 +114,14 @@ func (service monitorWebService) Detail(id int) (res MonitorWebResp, e error) {
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, obj)
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add 错误收集error新增
|
// Add 错误收集error新增
|
||||||
func (service monitorWebService) Add(addReq MonitorWebAddReq) (e error) {
|
func (service monitorWebService) Add(addReq MonitorWebAddReq) (e error) {
|
||||||
var obj model.MonitorWeb
|
var obj model.MonitorWeb
|
||||||
response.Copy(&obj, addReq)
|
util.ConvertUtil.Copy(&obj, addReq)
|
||||||
err := service.db.Create(&obj).Error
|
err := service.db.Create(&obj).Error
|
||||||
e = response.CheckMysqlErr(err)
|
e = response.CheckMysqlErr(err)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@@ -142,7 +143,7 @@ func (service monitorWebService) Edit(editReq MonitorWebEditReq) (e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&obj, editReq)
|
util.ConvertUtil.Copy(&obj, editReq)
|
||||||
err = service.db.Model(&obj).Updates(obj).Error
|
err = service.db.Model(&obj).Updates(obj).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
return
|
return
|
||||||
@@ -201,14 +202,14 @@ func (service monitorWebService) ExportFile(listReq MonitorWebListReq) (res []Mo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []MonitorWebResp{}
|
result := []MonitorWebResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入
|
// 导入
|
||||||
func (service monitorWebService) ImportFile(importReq []MonitorWebResp) (e error) {
|
func (service monitorWebService) ImportFile(importReq []MonitorWebResp) (e error) {
|
||||||
var importData []model.MonitorWeb
|
var importData []model.MonitorWeb
|
||||||
response.Copy(&importData, importReq)
|
util.ConvertUtil.Copy(&importData, importReq)
|
||||||
err := service.db.Create(&importData).Error
|
err := service.db.Create(&importData).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return e
|
return e
|
||||||
|
@@ -4,16 +4,16 @@ import "x_admin/core"
|
|||||||
|
|
||||||
//SettingDictDataResp 字典数据返回信息
|
//SettingDictDataResp 字典数据返回信息
|
||||||
type SettingDictDataResp struct {
|
type SettingDictDataResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
TypeId uint `json:"typeId" structs:"typeId"` // 类型
|
TypeId uint `json:"typeId" structs:"typeId"` // 类型
|
||||||
Name string `json:"name" structs:"name"` // 键
|
Name string `json:"name" structs:"name"` // 键
|
||||||
Value string `json:"value" structs:"value"` // 值
|
Value string `json:"value" structs:"value"` // 值
|
||||||
Color string `json:"color" structs:"color"` // 颜色
|
Color string `json:"color" structs:"color"` // 颜色
|
||||||
Remark string `json:"remark" structs:"remark"` // 备注
|
Remark string `json:"remark" structs:"remark"` // 备注
|
||||||
Sort uint16 `json:"sort" structs:"sort"` // 排序
|
Sort uint16 `json:"sort" structs:"sort"` // 排序
|
||||||
Status uint8 `json:"status" structs:"status"` // 状态: [0=停用, 1=禁用]
|
Status uint8 `json:"status" structs:"status"` // 状态: [0=停用, 1=禁用]
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//SettingDictDataListReq 字典数据列表参数
|
//SettingDictDataListReq 字典数据列表参数
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model/setting_model"
|
"x_admin/model/setting_model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -57,7 +58,7 @@ func (ddSrv settingDictDataService) All(allReq SettingDictDataListReq) (res []Se
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
res = []SettingDictDataResp{}
|
res = []SettingDictDataResp{}
|
||||||
response.Copy(&res, dictDatas)
|
util.ConvertUtil.Copy(&res, dictDatas)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ func (ddSrv settingDictDataService) List(page request.PageReq, listReq SettingDi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dtResp := []SettingDictDataResp{}
|
dtResp := []SettingDictDataResp{}
|
||||||
response.Copy(&dtResp, dds)
|
util.ConvertUtil.Copy(&dtResp, dds)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -113,7 +114,7 @@ func (ddSrv settingDictDataService) Detail(id uint) (res SettingDictDataResp, e
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, dd)
|
util.ConvertUtil.Copy(&res, dd)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ func (ddSrv settingDictDataService) Add(addReq SettingDictDataAddReq) (e error)
|
|||||||
return response.AssertArgumentError.SetMessage("字典数据已存在!")
|
return response.AssertArgumentError.SetMessage("字典数据已存在!")
|
||||||
}
|
}
|
||||||
var dd setting_model.DictData
|
var dd setting_model.DictData
|
||||||
response.Copy(&dd, addReq)
|
util.ConvertUtil.Copy(&dd, addReq)
|
||||||
err := ddSrv.db.Create(&dd).Error
|
err := ddSrv.db.Create(&dd).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return
|
return
|
||||||
@@ -143,7 +144,7 @@ func (ddSrv settingDictDataService) Edit(editReq SettingDictDataEditReq) (e erro
|
|||||||
return response.AssertArgumentError.SetMessage("字典数据已存在!")
|
return response.AssertArgumentError.SetMessage("字典数据已存在!")
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Copy(&dd, editReq)
|
util.ConvertUtil.Copy(&dd, editReq)
|
||||||
err = ddSrv.db.Save(&dd).Error
|
err = ddSrv.db.Save(&dd).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
return
|
return
|
||||||
@@ -152,6 +153,6 @@ func (ddSrv settingDictDataService) Edit(editReq SettingDictDataEditReq) (e erro
|
|||||||
// Del 字典数据删除
|
// Del 字典数据删除
|
||||||
func (ddSrv settingDictDataService) Del(delReq SettingDictDataDelReq) (e error) {
|
func (ddSrv settingDictDataService) Del(delReq SettingDictDataDelReq) (e error) {
|
||||||
err := ddSrv.db.Model(&setting_model.DictData{}).Where("id IN ?", delReq.Ids).Updates(
|
err := ddSrv.db.Model(&setting_model.DictData{}).Where("id IN ?", delReq.Ids).Updates(
|
||||||
setting_model.DictData{IsDelete: 1, DeleteTime: core.NowTime()}).Error
|
setting_model.DictData{IsDelete: 1, DeleteTime: util.NullTimeUtil.Now()}).Error
|
||||||
return response.CheckErr(err, "Del Update err")
|
return response.CheckErr(err, "Del Update err")
|
||||||
}
|
}
|
||||||
|
@@ -38,11 +38,11 @@ type SettingDictTypeDelReq struct {
|
|||||||
|
|
||||||
//SettingDictTypeResp 字典类型返回信息
|
//SettingDictTypeResp 字典类型返回信息
|
||||||
type SettingDictTypeResp struct {
|
type SettingDictTypeResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
DictName string `json:"dictName" structs:"dictName"` // 字典名称
|
DictName string `json:"dictName" structs:"dictName"` // 字典名称
|
||||||
DictType string `json:"dictType" structs:"dictType"` // 字典类型
|
DictType string `json:"dictType" structs:"dictType"` // 字典类型
|
||||||
DictRemark string `json:"dictRemark" structs:"dictRemark"` // 字典备注
|
DictRemark string `json:"dictRemark" structs:"dictRemark"` // 字典备注
|
||||||
DictStatus uint8 `json:"dictStatus" structs:"dictStatus"` // 字典状态
|
DictStatus uint8 `json:"dictStatus" structs:"dictStatus"` // 字典状态
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model/setting_model"
|
"x_admin/model/setting_model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -39,7 +40,7 @@ func (dtSrv settingDictTypeService) All() (res []SettingDictTypeResp, e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
res = []SettingDictTypeResp{}
|
res = []SettingDictTypeResp{}
|
||||||
response.Copy(&res, dictTypes)
|
util.ConvertUtil.Copy(&res, dictTypes)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ func (dtSrv settingDictTypeService) List(page request.PageReq, listReq SettingDi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dtResp := []SettingDictTypeResp{}
|
dtResp := []SettingDictTypeResp{}
|
||||||
response.Copy(&dtResp, dts)
|
util.ConvertUtil.Copy(&dtResp, dts)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -87,7 +88,7 @@ func (dtSrv settingDictTypeService) Detail(id uint) (res SettingDictTypeResp, e
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, dt)
|
util.ConvertUtil.Copy(&res, dt)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ func (dtSrv settingDictTypeService) Add(addReq SettingDictTypeAddReq) (e error)
|
|||||||
return response.AssertArgumentError.SetMessage("字典类型已存在!")
|
return response.AssertArgumentError.SetMessage("字典类型已存在!")
|
||||||
}
|
}
|
||||||
var dt setting_model.DictType
|
var dt setting_model.DictType
|
||||||
response.Copy(&dt, addReq)
|
util.ConvertUtil.Copy(&dt, addReq)
|
||||||
err := dtSrv.db.Create(&dt).Error
|
err := dtSrv.db.Create(&dt).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return
|
return
|
||||||
@@ -123,7 +124,7 @@ func (dtSrv settingDictTypeService) Edit(editReq SettingDictTypeEditReq) (e erro
|
|||||||
return response.AssertArgumentError.SetMessage("字典类型已存在!")
|
return response.AssertArgumentError.SetMessage("字典类型已存在!")
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Copy(&dt, editReq)
|
util.ConvertUtil.Copy(&dt, editReq)
|
||||||
// err = dtSrv.db.Model(&dt).Updates(&up).Error
|
// err = dtSrv.db.Model(&dt).Updates(&up).Error
|
||||||
err = dtSrv.db.Save(&dt).Error
|
err = dtSrv.db.Save(&dt).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
@@ -133,6 +134,6 @@ func (dtSrv settingDictTypeService) Edit(editReq SettingDictTypeEditReq) (e erro
|
|||||||
// Del 字典类型删除
|
// Del 字典类型删除
|
||||||
func (dtSrv settingDictTypeService) Del(delReq SettingDictTypeDelReq) (e error) {
|
func (dtSrv settingDictTypeService) Del(delReq SettingDictTypeDelReq) (e error) {
|
||||||
err := dtSrv.db.Model(&setting_model.DictType{}).Where("id IN ?", delReq.Ids).Updates(
|
err := dtSrv.db.Model(&setting_model.DictType{}).Where("id IN ?", delReq.Ids).Updates(
|
||||||
setting_model.DictType{IsDelete: 1, DeleteTime: core.NowTime()}).Error
|
setting_model.DictType{IsDelete: 1, DeleteTime: util.NullTimeUtil.Now()}).Error
|
||||||
return response.CheckErr(err, "Del Update err")
|
return response.CheckErr(err, "Del Update err")
|
||||||
}
|
}
|
||||||
|
@@ -62,34 +62,34 @@ type SystemAuthAdminDisableReq struct {
|
|||||||
|
|
||||||
//SystemAuthAdminResp 管理员返回信息
|
//SystemAuthAdminResp 管理员返回信息
|
||||||
type SystemAuthAdminResp struct {
|
type SystemAuthAdminResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Username string `json:"username" structs:"username" excel:"name:账号;"` // 账号
|
Username string `json:"username" structs:"username" excel:"name:账号;"` // 账号
|
||||||
Nickname string `json:"nickname" structs:"nickname" excel:"name:昵称;"` // 昵称
|
Nickname string `json:"nickname" structs:"nickname" excel:"name:昵称;"` // 昵称
|
||||||
Avatar string `json:"avatar" structs:"avatar" excel:"name:头像;"` // 头像
|
Avatar string `json:"avatar" structs:"avatar" excel:"name:头像;"` // 头像
|
||||||
Role string `json:"role" structs:"role" excel:"name:角色;"` // 角色
|
Role string `json:"role" structs:"role" excel:"name:角色;"` // 角色
|
||||||
DeptId uint `json:"deptId" structs:"deptId" excel:"name:部门ID;"` // 部门ID
|
DeptId uint `json:"deptId" structs:"deptId" excel:"name:部门ID;"` // 部门ID
|
||||||
PostId uint `json:"postId" structs:"postId" excel:"name:岗位ID;"` // 岗位ID
|
PostId uint `json:"postId" structs:"postId" excel:"name:岗位ID;"` // 岗位ID
|
||||||
Dept string `json:"dept" structs:"dept" excel:"name:部门;"` // 部门
|
Dept string `json:"dept" structs:"dept" excel:"name:部门;"` // 部门
|
||||||
IsDisable uint8 `json:"isDisable" structs:"isDisable" excel:"name:是否禁用;"` // 是否禁用: [0=否, 1=是]
|
IsDisable uint8 `json:"isDisable" structs:"isDisable" excel:"name:是否禁用;"` // 是否禁用: [0=否, 1=是]
|
||||||
LastLoginIp string `json:"lastLoginIp" structs:"lastLoginIp" excel:"name:最后登录IP;"` // 最后登录IP
|
LastLoginIp string `json:"lastLoginIp" structs:"lastLoginIp" excel:"name:最后登录IP;"` // 最后登录IP
|
||||||
LastLoginTime core.TsTime `json:"lastLoginTime" structs:"lastLoginTime" excel:"name:最后登录时间;"` // 最后登录时间
|
LastLoginTime core.NullTime `json:"lastLoginTime" structs:"lastLoginTime" excel:"name:最后登录时间;"` // 最后登录时间
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime" excel:"name:创建时间;"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime" excel:"name:创建时间;"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime" excel:"name:更新时间;"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime" excel:"name:更新时间;"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//SystemAuthAdminSelfOneResp 当前管理员返回部分信息
|
//SystemAuthAdminSelfOneResp 当前管理员返回部分信息
|
||||||
type SystemAuthAdminSelfOneResp struct {
|
type SystemAuthAdminSelfOneResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Username string `json:"username" structs:"username"` // 账号
|
Username string `json:"username" structs:"username"` // 账号
|
||||||
Nickname string `json:"nickname" structs:"nickname"` // 昵称
|
Nickname string `json:"nickname" structs:"nickname"` // 昵称
|
||||||
Avatar string `json:"avatar" structs:"avatar"` // 头像
|
Avatar string `json:"avatar" structs:"avatar"` // 头像
|
||||||
Role string `json:"role" structs:"role"` // 角色
|
Role string `json:"role" structs:"role"` // 角色
|
||||||
Dept string `json:"dept" structs:"dept"` // 部门
|
Dept string `json:"dept" structs:"dept"` // 部门
|
||||||
IsDisable uint8 `json:"isDisable" structs:"isDisable"` // 是否禁用: [0=否, 1=是]
|
IsDisable uint8 `json:"isDisable" structs:"isDisable"` // 是否禁用: [0=否, 1=是]
|
||||||
LastLoginIp string `json:"lastLoginIp" structs:"lastLoginIp"` // 最后登录IP
|
LastLoginIp string `json:"lastLoginIp" structs:"lastLoginIp"` // 最后登录IP
|
||||||
LastLoginTime core.TsTime `json:"lastLoginTime" structs:"lastLoginTime"` // 最后登录时间
|
LastLoginTime core.NullTime `json:"lastLoginTime" structs:"lastLoginTime"` // 最后登录时间
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//SystemAuthAdminSelfResp 当前系统管理员返回信息
|
//SystemAuthAdminSelfResp 当前系统管理员返回信息
|
||||||
|
@@ -78,7 +78,7 @@ func (adminSrv systemAuthAdminService) Self(adminId uint) (res SystemAuthAdminSe
|
|||||||
auths = append(auths, "*")
|
auths = append(auths, "*")
|
||||||
}
|
}
|
||||||
var admin SystemAuthAdminSelfOneResp
|
var admin SystemAuthAdminSelfOneResp
|
||||||
response.Copy(&admin, sysAdmin)
|
util.ConvertUtil.Copy(&admin, sysAdmin)
|
||||||
admin.Dept = strconv.FormatUint(uint64(sysAdmin.DeptId), 10)
|
admin.Dept = strconv.FormatUint(uint64(sysAdmin.DeptId), 10)
|
||||||
admin.Avatar = util.UrlUtil.ToAbsoluteUrl(sysAdmin.Avatar)
|
admin.Avatar = util.UrlUtil.ToAbsoluteUrl(sysAdmin.Avatar)
|
||||||
return SystemAuthAdminSelfResp{User: admin, Permissions: auths}, nil
|
return SystemAuthAdminSelfResp{User: admin, Permissions: auths}, nil
|
||||||
@@ -151,7 +151,7 @@ func (adminSrv systemAuthAdminService) ExportFile(listReq SystemAuthAdminListReq
|
|||||||
// 导入
|
// 导入
|
||||||
func (adminSrv systemAuthAdminService) ImportFile(importReq []SystemAuthAdminResp) (e error) {
|
func (adminSrv systemAuthAdminService) ImportFile(importReq []SystemAuthAdminResp) (e error) {
|
||||||
var sysAdmin []system_model.SystemAuthAdmin
|
var sysAdmin []system_model.SystemAuthAdmin
|
||||||
response.Copy(&sysAdmin, importReq)
|
util.ConvertUtil.Copy(&sysAdmin, importReq)
|
||||||
err := adminSrv.db.Create(&sysAdmin).Error
|
err := adminSrv.db.Create(&sysAdmin).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return e
|
return e
|
||||||
@@ -254,7 +254,7 @@ func (adminSrv systemAuthAdminService) Detail(id uint) (res SystemAuthAdminResp,
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, sysAdmin)
|
util.ConvertUtil.Copy(&res, sysAdmin)
|
||||||
res.Avatar = util.UrlUtil.ToAbsoluteUrl(res.Avatar)
|
res.Avatar = util.UrlUtil.ToAbsoluteUrl(res.Avatar)
|
||||||
if res.Dept == "" {
|
if res.Dept == "" {
|
||||||
res.Dept = strconv.FormatUint(uint64(res.DeptId), 10)
|
res.Dept = strconv.FormatUint(uint64(res.DeptId), 10)
|
||||||
@@ -295,7 +295,7 @@ func (adminSrv systemAuthAdminService) Add(addReq SystemAuthAdminAddReq) (e erro
|
|||||||
return response.Failed.SetMessage("密码格式不正确")
|
return response.Failed.SetMessage("密码格式不正确")
|
||||||
}
|
}
|
||||||
salt := util.ToolsUtil.RandomString(5)
|
salt := util.ToolsUtil.RandomString(5)
|
||||||
response.Copy(&sysAdmin, addReq)
|
util.ConvertUtil.Copy(&sysAdmin, addReq)
|
||||||
sysAdmin.Role = strconv.FormatUint(uint64(addReq.Role), 10)
|
sysAdmin.Role = strconv.FormatUint(uint64(addReq.Role), 10)
|
||||||
sysAdmin.Salt = salt
|
sysAdmin.Salt = salt
|
||||||
sysAdmin.Password = util.ToolsUtil.MakeMd5(strings.Trim(addReq.Password, " ") + salt)
|
sysAdmin.Password = util.ToolsUtil.MakeMd5(strings.Trim(addReq.Password, " ") + salt)
|
||||||
@@ -466,7 +466,7 @@ func (adminSrv systemAuthAdminService) Del(c *gin.Context, id uint) (e error) {
|
|||||||
if id == config.AdminConfig.GetAdminId(c) {
|
if id == config.AdminConfig.GetAdminId(c) {
|
||||||
return response.AssertArgumentError.SetMessage("不能删除自己!")
|
return response.AssertArgumentError.SetMessage("不能删除自己!")
|
||||||
}
|
}
|
||||||
err = adminSrv.db.Model(&admin).Updates(system_model.SystemAuthAdmin{IsDelete: 1, DeleteTime: core.NowTime()}).Error
|
err = adminSrv.db.Model(&admin).Updates(system_model.SystemAuthAdmin{IsDelete: 1, DeleteTime: util.NullTimeUtil.Now()}).Error
|
||||||
e = response.CheckErr(err, "Del Updates err")
|
e = response.CheckErr(err, "Del Updates err")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -43,14 +43,14 @@ type SystemAuthDeptDelReq struct {
|
|||||||
|
|
||||||
//SystemAuthDeptResp 系统部门返回信息
|
//SystemAuthDeptResp 系统部门返回信息
|
||||||
type SystemAuthDeptResp struct {
|
type SystemAuthDeptResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Pid uint `json:"pid" structs:"pid"` // 部门父级
|
Pid uint `json:"pid" structs:"pid"` // 部门父级
|
||||||
Name string `json:"name" structs:"name"` // 部门名称
|
Name string `json:"name" structs:"name"` // 部门名称
|
||||||
DutyId int `json:"dutyId" structs:"dutyId"` // 负责人id
|
DutyId int `json:"dutyId" structs:"dutyId"` // 负责人id
|
||||||
Duty string `json:"duty" structs:"duty"` // 负责人
|
Duty string `json:"duty" structs:"duty"` // 负责人
|
||||||
Mobile string `json:"mobile" structs:"mobile"` // 联系电话
|
Mobile string `json:"mobile" structs:"mobile"` // 联系电话
|
||||||
Sort uint16 `json:"sort" structs:"sort"` // 排序编号
|
Sort uint16 `json:"sort" structs:"sort"` // 排序编号
|
||||||
IsStop uint8 `json:"isStop" structs:"isStop"` // 是否停用: [0=否, 1=是]
|
IsStop uint8 `json:"isStop" structs:"isStop"` // 是否停用: [0=否, 1=是]
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import (
|
|||||||
"x_admin/core"
|
"x_admin/core"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model/system_model"
|
"x_admin/model/system_model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -38,7 +39,7 @@ func (service systemAuthDeptService) All() (res []SystemAuthDeptResp, e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
res = []SystemAuthDeptResp{}
|
res = []SystemAuthDeptResp{}
|
||||||
response.Copy(&res, depts)
|
util.ConvertUtil.Copy(&res, depts)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ func (service systemAuthDeptService) List(listReq SystemAuthDeptListReq) (deptRe
|
|||||||
if e = response.CheckErr(err, "列表获取失败"); e != nil {
|
if e = response.CheckErr(err, "列表获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&deptResps, depts)
|
util.ConvertUtil.Copy(&deptResps, depts)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ func (service systemAuthDeptService) Detail(id uint) (res SystemAuthDeptResp, e
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, dept)
|
util.ConvertUtil.Copy(&res, dept)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ func (service systemAuthDeptService) Add(addReq SystemAuthDeptAddReq) (e error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dept system_model.SystemAuthDept
|
var dept system_model.SystemAuthDept
|
||||||
response.Copy(&dept, addReq)
|
util.ConvertUtil.Copy(&dept, addReq)
|
||||||
err := service.db.Create(&dept).Error
|
err := service.db.Create(&dept).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return
|
return
|
||||||
@@ -110,7 +111,7 @@ func (service systemAuthDeptService) Edit(editReq SystemAuthDeptEditReq) (e erro
|
|||||||
return response.AssertArgumentError.SetMessage("上级部门不能是自己!")
|
return response.AssertArgumentError.SetMessage("上级部门不能是自己!")
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&dept, editReq)
|
util.ConvertUtil.Copy(&dept, editReq)
|
||||||
err = service.db.Model(&dept).Select("*").Updates(dept).Error
|
err = service.db.Model(&dept).Select("*").Updates(dept).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
return
|
return
|
||||||
|
@@ -24,30 +24,30 @@ type SystemLogLoginReq struct {
|
|||||||
|
|
||||||
// SystemLogOperateResp 操作日志返回信息
|
// SystemLogOperateResp 操作日志返回信息
|
||||||
type SystemLogOperateResp struct {
|
type SystemLogOperateResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Username string `json:"username" structs:"username"` // 用户账号
|
Username string `json:"username" structs:"username"` // 用户账号
|
||||||
Nickname string `json:"nickname" structs:"nickname"` // 用户昵称
|
Nickname string `json:"nickname" structs:"nickname"` // 用户昵称
|
||||||
Type string `json:"type" structs:"type"` // 请求类型: GET/POST/PUT
|
Type string `json:"type" structs:"type"` // 请求类型: GET/POST/PUT
|
||||||
Title string `json:"title" structs:"title"` // 操作标题
|
Title string `json:"title" structs:"title"` // 操作标题
|
||||||
Method string `json:"method" structs:"method"` // 请求方式
|
Method string `json:"method" structs:"method"` // 请求方式
|
||||||
Ip string `json:"ip" structs:"ip"` // 请求IP
|
Ip string `json:"ip" structs:"ip"` // 请求IP
|
||||||
Url string `json:"url" structs:"url"` // 请求地址
|
Url string `json:"url" structs:"url"` // 请求地址
|
||||||
Args string `json:"args" structs:"args"` // 请求参数
|
Args string `json:"args" structs:"args"` // 请求参数
|
||||||
Error string `json:"error" structs:"error"` // 错误信息
|
Error string `json:"error" structs:"error"` // 错误信息
|
||||||
Status int `json:"status" structs:"status"` // 执行状态: [1=成功, 2=失败]
|
Status int `json:"status" structs:"status"` // 执行状态: [1=成功, 2=失败]
|
||||||
TaskTime string `json:"taskTime" structs:"taskTime"` // 执行耗时
|
TaskTime string `json:"taskTime" structs:"taskTime"` // 执行耗时
|
||||||
StartTime core.TsTime `json:"startTime" structs:"startTime"` // 开始时间
|
StartTime core.NullTime `json:"startTime" structs:"startTime"` // 开始时间
|
||||||
EndTime core.TsTime `json:"endTime" structs:"endTime"` // 结束时间
|
EndTime core.NullTime `json:"endTime" structs:"endTime"` // 结束时间
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemLogLoginResp 登录日志返回信息
|
// SystemLogLoginResp 登录日志返回信息
|
||||||
type SystemLogLoginResp struct {
|
type SystemLogLoginResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Username string `json:"username" structs:"username"` // 登录账号
|
Username string `json:"username" structs:"username"` // 登录账号
|
||||||
Ip string `json:"ip" structs:"ip"` // 来源IP
|
Ip string `json:"ip" structs:"ip"` // 来源IP
|
||||||
Os string `json:"os" structs:"os"` // 操作系统
|
Os string `json:"os" structs:"os"` // 操作系统
|
||||||
Browser string `json:"browser" structs:"browser"` // 浏览器
|
Browser string `json:"browser" structs:"browser"` // 浏览器
|
||||||
Status int `json:"status" structs:"status"` // 操作状态: [1=成功, 2=失败]
|
Status int `json:"status" structs:"status"` // 操作状态: [1=成功, 2=失败]
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
}
|
}
|
||||||
|
@@ -29,11 +29,11 @@ type SystemLogoutReq struct {
|
|||||||
|
|
||||||
// SystemLogLoginResp 登录日志返回信息
|
// SystemLogLoginResp 登录日志返回信息
|
||||||
type SystemLogLoginResp struct {
|
type SystemLogLoginResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Username string `json:"username" structs:"username"` // 登录账号
|
Username string `json:"username" structs:"username"` // 登录账号
|
||||||
Ip string `json:"ip" structs:"ip"` // 来源IP
|
Ip string `json:"ip" structs:"ip"` // 来源IP
|
||||||
Os string `json:"os" structs:"os"` // 操作系统
|
Os string `json:"os" structs:"os"` // 操作系统
|
||||||
Browser string `json:"browser" structs:"browser"` // 浏览器
|
Browser string `json:"browser" structs:"browser"` // 浏览器
|
||||||
Status int `json:"status" structs:"status"` // 操作状态: [1=成功, 2=失败]
|
Status int `json:"status" structs:"status"` // 操作状态: [1=成功, 2=失败]
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,7 @@ func (loginSrv systemLoginService) Login(c *gin.Context, req *SystemLoginReq) (r
|
|||||||
util.RedisUtil.Set(config.AdminConfig.BackstageTokenKey+token, adminIdStr, 7200)
|
util.RedisUtil.Set(config.AdminConfig.BackstageTokenKey+token, adminIdStr, 7200)
|
||||||
admin.Service.CacheAdminUserByUid(sysAdmin.ID)
|
admin.Service.CacheAdminUserByUid(sysAdmin.ID)
|
||||||
|
|
||||||
u := system_model.SystemAuthAdmin{LastLoginIp: c.ClientIP(), LastLoginTime: core.NowTime()}
|
u := system_model.SystemAuthAdmin{LastLoginIp: c.ClientIP(), LastLoginTime: util.NullTimeUtil.Now()}
|
||||||
// 更新登录信息
|
// 更新登录信息
|
||||||
err = loginSrv.db.Model(&sysAdmin).Updates(u).Error
|
err = loginSrv.db.Model(&sysAdmin).Updates(u).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -133,7 +133,7 @@ func (loginSrv systemLoginService) RecordLoginLog(c *gin.Context, adminId uint,
|
|||||||
Os: ua.Os.Family,
|
Os: ua.Os.Family,
|
||||||
Browser: ua.UserAgent.Family,
|
Browser: ua.UserAgent.Family,
|
||||||
Status: status,
|
Status: status,
|
||||||
CreateTime: core.NowTime(),
|
CreateTime: util.NullTimeUtil.Now(),
|
||||||
}).Error
|
}).Error
|
||||||
e = response.CheckErr(err, "创建记录失败")
|
e = response.CheckErr(err, "创建记录失败")
|
||||||
return
|
return
|
||||||
|
@@ -63,7 +63,7 @@ type SystemAuthMenuResp struct {
|
|||||||
IsCache uint8 `json:"isCache" structs:"isCache"` // 是否缓存: [0=否, 1=是]
|
IsCache uint8 `json:"isCache" structs:"isCache"` // 是否缓存: [0=否, 1=是]
|
||||||
IsShow uint8 `json:"isShow" structs:"isShow"` // 是否显示: [0=否, 1=是]
|
IsShow uint8 `json:"isShow" structs:"isShow"` // 是否显示: [0=否, 1=是]
|
||||||
IsDisable uint8 `json:"isDisable" structs:"isDisable"` // 是否禁用: [0=否, 1=是]
|
IsDisable uint8 `json:"isDisable" structs:"isDisable"` // 是否禁用: [0=否, 1=是]
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
Children []SystemAuthMenuResp `json:"children,omitempty" structs:"children"` // 子集
|
Children []SystemAuthMenuResp `json:"children,omitempty" structs:"children"` // 子集
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ func (menuSrv systemAuthMenuService) SelectMenuByRoleId(c *gin.Context, roleId u
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var menuResps []SystemAuthMenuResp
|
var menuResps []SystemAuthMenuResp
|
||||||
response.Copy(&menuResps, menus)
|
util.ConvertUtil.Copy(&menuResps, menus)
|
||||||
mapList = util.ArrayUtil.ListToTree(
|
mapList = util.ArrayUtil.ListToTree(
|
||||||
util.ConvertUtil.StructsToMaps(menuResps), "id", "pid", "children")
|
util.ConvertUtil.StructsToMaps(menuResps), "id", "pid", "children")
|
||||||
return
|
return
|
||||||
@@ -72,7 +72,7 @@ func (menuSrv systemAuthMenuService) List() (res []interface{}, e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var menuResps []SystemAuthMenuResp
|
var menuResps []SystemAuthMenuResp
|
||||||
response.Copy(&menuResps, menus)
|
util.ConvertUtil.Copy(&menuResps, menus)
|
||||||
return util.ArrayUtil.ListToTree(
|
return util.ArrayUtil.ListToTree(
|
||||||
util.ConvertUtil.StructsToMaps(menuResps), "id", "pid", "children"), nil
|
util.ConvertUtil.StructsToMaps(menuResps), "id", "pid", "children"), nil
|
||||||
}
|
}
|
||||||
@@ -87,13 +87,13 @@ func (menuSrv systemAuthMenuService) Detail(id uint) (res SystemAuthMenuResp, e
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, menu)
|
util.ConvertUtil.Copy(&res, menu)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (menuSrv systemAuthMenuService) Add(addReq SystemAuthMenuAddReq) (e error) {
|
func (menuSrv systemAuthMenuService) Add(addReq SystemAuthMenuAddReq) (e error) {
|
||||||
var menu system_model.SystemAuthMenu
|
var menu system_model.SystemAuthMenu
|
||||||
response.Copy(&menu, addReq)
|
util.ConvertUtil.Copy(&menu, addReq)
|
||||||
err := menuSrv.db.Create(&menu).Error
|
err := menuSrv.db.Create(&menu).Error
|
||||||
if e = response.CheckErr(err, "添加失败"); e != nil {
|
if e = response.CheckErr(err, "添加失败"); e != nil {
|
||||||
return
|
return
|
||||||
@@ -111,7 +111,7 @@ func (menuSrv systemAuthMenuService) Edit(editReq SystemAuthMenuEditReq) (e erro
|
|||||||
if e = response.CheckErr(err, "Edit Find err"); e != nil {
|
if e = response.CheckErr(err, "Edit Find err"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&menu, editReq)
|
util.ConvertUtil.Copy(&menu, editReq)
|
||||||
err = menuSrv.db.Model(&menu).Updates(structs.Map(menu)).Error
|
err = menuSrv.db.Model(&menu).Updates(structs.Map(menu)).Error
|
||||||
if e = response.CheckErr(err, "编辑失败"); e != nil {
|
if e = response.CheckErr(err, "编辑失败"); e != nil {
|
||||||
return
|
return
|
||||||
|
@@ -40,12 +40,12 @@ type SystemAuthPostDelReq struct {
|
|||||||
|
|
||||||
//SystemAuthPostResp 系统岗位返回信息
|
//SystemAuthPostResp 系统岗位返回信息
|
||||||
type SystemAuthPostResp struct {
|
type SystemAuthPostResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Code string `json:"code" structs:"code"` // 岗位编号
|
Code string `json:"code" structs:"code"` // 岗位编号
|
||||||
Name string `json:"name" structs:"name"` // 岗位名称
|
Name string `json:"name" structs:"name"` // 岗位名称
|
||||||
Remarks string `json:"remarks" structs:"remarks"` // 岗位备注
|
Remarks string `json:"remarks" structs:"remarks"` // 岗位备注
|
||||||
Sort uint16 `json:"sort" structs:"sort"` // 岗位排序
|
Sort uint16 `json:"sort" structs:"sort"` // 岗位排序
|
||||||
IsStop uint8 `json:"isStop" structs:"isStop"` // 是否停用: [0=否, 1=是]
|
IsStop uint8 `json:"isStop" structs:"isStop"` // 是否停用: [0=否, 1=是]
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model/system_model"
|
"x_admin/model/system_model"
|
||||||
|
"x_admin/util"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -39,7 +40,7 @@ func (service systemAuthPostService) All() (res []SystemAuthPostResp, e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
res = []SystemAuthPostResp{}
|
res = []SystemAuthPostResp{}
|
||||||
response.Copy(&res, posts)
|
util.ConvertUtil.Copy(&res, posts)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ func (service systemAuthPostService) List(page request.PageReq, listReq SystemAu
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
postResps := []SystemAuthPostResp{}
|
postResps := []SystemAuthPostResp{}
|
||||||
response.Copy(&postResps, posts)
|
util.ConvertUtil.Copy(&postResps, posts)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -91,7 +92,7 @@ func (service systemAuthPostService) Detail(id uint) (res SystemAuthPostResp, e
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, post)
|
util.ConvertUtil.Copy(&res, post)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ func (service systemAuthPostService) Add(addReq SystemAuthPostAddReq) (e error)
|
|||||||
return response.AssertArgumentError.SetMessage("该岗位已存在!")
|
return response.AssertArgumentError.SetMessage("该岗位已存在!")
|
||||||
}
|
}
|
||||||
var post system_model.SystemAuthPost
|
var post system_model.SystemAuthPost
|
||||||
response.Copy(&post, addReq)
|
util.ConvertUtil.Copy(&post, addReq)
|
||||||
err := service.db.Create(&post).Error
|
err := service.db.Create(&post).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return
|
return
|
||||||
@@ -130,7 +131,7 @@ func (service systemAuthPostService) Edit(editReq SystemAuthPostEditReq) (e erro
|
|||||||
return response.AssertArgumentError.SetMessage("该岗位已存在!")
|
return response.AssertArgumentError.SetMessage("该岗位已存在!")
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
response.Copy(&post, editReq)
|
util.ConvertUtil.Copy(&post, editReq)
|
||||||
err = service.db.Model(&post).Select("*").Updates(post).Error
|
err = service.db.Model(&post).Select("*").Updates(post).Error
|
||||||
e = response.CheckErr(err, "编辑失败")
|
e = response.CheckErr(err, "编辑失败")
|
||||||
return
|
return
|
||||||
|
@@ -4,23 +4,23 @@ import "x_admin/core"
|
|||||||
|
|
||||||
//SystemAuthRoleSimpleResp 系统角色返回简单信息
|
//SystemAuthRoleSimpleResp 系统角色返回简单信息
|
||||||
type SystemAuthRoleSimpleResp struct {
|
type SystemAuthRoleSimpleResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Name string `json:"name" structs:"name"` // 角色名称
|
Name string `json:"name" structs:"name"` // 角色名称
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//SystemAuthRoleResp 系统角色返回信息
|
//SystemAuthRoleResp 系统角色返回信息
|
||||||
type SystemAuthRoleResp struct {
|
type SystemAuthRoleResp struct {
|
||||||
ID uint `json:"id" structs:"id"` // 主键
|
ID uint `json:"id" structs:"id"` // 主键
|
||||||
Name string `json:"name" structs:"name"` // 角色名称
|
Name string `json:"name" structs:"name"` // 角色名称
|
||||||
Remark string `json:"remark" structs:"remark"` // 角色备注
|
Remark string `json:"remark" structs:"remark"` // 角色备注
|
||||||
Menus []uint `json:"menus" structs:"menus"` // 关联菜单
|
Menus []uint `json:"menus" structs:"menus"` // 关联菜单
|
||||||
Member int64 `json:"member" structs:"member"` // 成员数量
|
Member int64 `json:"member" structs:"member"` // 成员数量
|
||||||
Sort uint16 `json:"sort" structs:"sort"` // 角色排序
|
Sort uint16 `json:"sort" structs:"sort"` // 角色排序
|
||||||
IsDisable uint8 `json:"isDisable" structs:"isDisable"` // 是否禁用: [0=否, 1=是]
|
IsDisable uint8 `json:"isDisable" structs:"isDisable"` // 是否禁用: [0=否, 1=是]
|
||||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
CreateTime core.NullTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
UpdateTime core.NullTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -43,7 +43,7 @@ func (roleSrv systemAuthRoleService) All() (res []SystemAuthRoleSimpleResp, e er
|
|||||||
if e = response.CheckErr(err, "All Find err"); e != nil {
|
if e = response.CheckErr(err, "All Find err"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, roles)
|
util.ConvertUtil.Copy(&res, roles)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ func (roleSrv systemAuthRoleService) List(page request.PageReq) (res response.Pa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var roleResp []SystemAuthRoleResp
|
var roleResp []SystemAuthRoleResp
|
||||||
response.Copy(&roleResp, roles)
|
util.ConvertUtil.Copy(&roleResp, roles)
|
||||||
for i := 0; i < len(roleResp); i++ {
|
for i := 0; i < len(roleResp); i++ {
|
||||||
roleResp[i].Menus = []uint{}
|
roleResp[i].Menus = []uint{}
|
||||||
roleResp[i].Member = roleSrv.getMemberCnt(roleResp[i].ID)
|
roleResp[i].Member = roleSrv.getMemberCnt(roleResp[i].ID)
|
||||||
@@ -86,7 +86,7 @@ func (roleSrv systemAuthRoleService) Detail(id uint) (res SystemAuthRoleResp, e
|
|||||||
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
if e = response.CheckErr(err, "详情获取失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, role)
|
util.ConvertUtil.Copy(&res, role)
|
||||||
res.Member = roleSrv.getMemberCnt(role.ID)
|
res.Member = roleSrv.getMemberCnt(role.ID)
|
||||||
res.Menus, _ = PermService.SelectMenuIdsByRoleId(role.ID)
|
res.Menus, _ = PermService.SelectMenuIdsByRoleId(role.ID)
|
||||||
return
|
return
|
||||||
@@ -105,7 +105,7 @@ func (roleSrv systemAuthRoleService) Add(addReq SystemAuthRoleAddReq) (e error)
|
|||||||
if r := roleSrv.db.Where("name = ?", strings.Trim(addReq.Name, " ")).Limit(1).First(&role); r.RowsAffected > 0 {
|
if r := roleSrv.db.Where("name = ?", strings.Trim(addReq.Name, " ")).Limit(1).First(&role); r.RowsAffected > 0 {
|
||||||
return response.AssertArgumentError.SetMessage("角色名称已存在!")
|
return response.AssertArgumentError.SetMessage("角色名称已存在!")
|
||||||
}
|
}
|
||||||
response.Copy(&role, addReq)
|
util.ConvertUtil.Copy(&role, addReq)
|
||||||
role.Name = strings.Trim(addReq.Name, " ")
|
role.Name = strings.Trim(addReq.Name, " ")
|
||||||
// 事务
|
// 事务
|
||||||
err := roleSrv.db.Transaction(func(tx *gorm.DB) error {
|
err := roleSrv.db.Transaction(func(tx *gorm.DB) error {
|
||||||
|
@@ -4,7 +4,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
"x_admin/core"
|
|
||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/util"
|
"x_admin/util"
|
||||||
@@ -24,18 +23,19 @@ type SystemLogSmsHandler struct {
|
|||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param PageNo query int true "页码"
|
// @Param PageNo query int true "页码"
|
||||||
// @Param PageSize query int true "每页数量"
|
// @Param PageSize query int true "每页数量"
|
||||||
// @Param scene query int false "场景编号"
|
// @Param Scene query int false "场景编号"
|
||||||
// @Param mobile query string false "手机号码"
|
// @Param Mobile query string false "手机号码"
|
||||||
// @Param content query string false "发送内容"
|
// @Param Content query string false "发送内容"
|
||||||
// @Param status query int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
// @Param Status query int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
// @Param results query string false "短信结果"
|
// @Param Results query string false "短信结果"
|
||||||
// @Param send_time query int false "发送时间"
|
// @Param SendTimeStart query core.NullTime false "发送时间"
|
||||||
// @Param create_timeStart query core.TsTime false "创建时间"
|
// @Param SendTimeEnd query core.NullTime false "发送时间"
|
||||||
// @Param create_timeEnd query core.TsTime false "创建时间"
|
// @Param CreateTimeStart query core.NullTime false "创建时间"
|
||||||
// @Param update_timeStart query core.TsTime false "更新时间"
|
// @Param CreateTimeEnd query core.NullTime false "创建时间"
|
||||||
// @Param update_timeEnd query core.TsTime false "更新时间"
|
// @Param UpdateTimeStart query core.NullTime false "更新时间"
|
||||||
|
// @Param UpdateTimeEnd query core.NullTime false "更新时间"
|
||||||
//
|
//
|
||||||
// @Success 200 {object} response.Response{ data=response.PageResp{ lists= []SystemLogSmsResp}} "成功"
|
// @Success 200 {object} response.Response{ data=response.PageResp{ lists=[]SystemLogSmsResp}} "成功"
|
||||||
// @Router /api/admin/system_log_sms/list [get]
|
// @Router /api/admin/system_log_sms/list [get]
|
||||||
func (hd *SystemLogSmsHandler) List(c *gin.Context) {
|
func (hd *SystemLogSmsHandler) List(c *gin.Context) {
|
||||||
var page request.PageReq
|
var page request.PageReq
|
||||||
@@ -53,16 +53,17 @@ func (hd *SystemLogSmsHandler) List(c *gin.Context) {
|
|||||||
// @Summary 系统短信日志列表-所有
|
// @Summary 系统短信日志列表-所有
|
||||||
// @Tags system_log_sms-系统短信日志
|
// @Tags system_log_sms-系统短信日志
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param scene query int false "场景编号"
|
// @Param Scene query int false "场景编号"
|
||||||
// @Param mobile query string false "手机号码"
|
// @Param Mobile query string false "手机号码"
|
||||||
// @Param content query string false "发送内容"
|
// @Param Content query string false "发送内容"
|
||||||
// @Param status query int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
// @Param Status query int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
// @Param results query string false "短信结果"
|
// @Param Results query string false "短信结果"
|
||||||
// @Param send_time query int false "发送时间"
|
// @Param SendTimeStart query core.NullTime false "发送时间"
|
||||||
// @Param create_timeStart query core.TsTime false "创建时间"
|
// @Param SendTimeEnd query core.NullTime false "发送时间"
|
||||||
// @Param create_timeEnd query core.TsTime false "创建时间"
|
// @Param CreateTimeStart query core.NullTime false "创建时间"
|
||||||
// @Param update_timeStart query core.TsTime false "更新时间"
|
// @Param CreateTimeEnd query core.NullTime false "创建时间"
|
||||||
// @Param update_timeEnd query core.TsTime false "更新时间"
|
// @Param UpdateTimeStart query core.NullTime false "更新时间"
|
||||||
|
// @Param UpdateTimeEnd query core.NullTime false "更新时间"
|
||||||
// @Success 200 {object} response.Response{ data=[]SystemLogSmsResp} "成功"
|
// @Success 200 {object} response.Response{ data=[]SystemLogSmsResp} "成功"
|
||||||
// @Router /api/admin/system_log_sms/listAll [get]
|
// @Router /api/admin/system_log_sms/listAll [get]
|
||||||
func (hd *SystemLogSmsHandler) ListAll(c *gin.Context) {
|
func (hd *SystemLogSmsHandler) ListAll(c *gin.Context) {
|
||||||
@@ -78,7 +79,7 @@ func (hd *SystemLogSmsHandler) ListAll(c *gin.Context) {
|
|||||||
// @Tags system_log_sms-系统短信日志
|
// @Tags system_log_sms-系统短信日志
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param id query int false "id"
|
// @Param Id query int false "id"
|
||||||
// @Success 200 {object} response.Response{ data=SystemLogSmsResp} "成功"
|
// @Success 200 {object} response.Response{ data=SystemLogSmsResp} "成功"
|
||||||
// @Router /api/admin/system_log_sms/detail [get]
|
// @Router /api/admin/system_log_sms/detail [get]
|
||||||
func (hd *SystemLogSmsHandler) Detail(c *gin.Context) {
|
func (hd *SystemLogSmsHandler) Detail(c *gin.Context) {
|
||||||
@@ -98,12 +99,12 @@ func (hd *SystemLogSmsHandler) Detail(c *gin.Context) {
|
|||||||
// @Tags system_log_sms-系统短信日志
|
// @Tags system_log_sms-系统短信日志
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param scene body int false "场景编号"
|
// @Param Scene formData int false "场景编号"
|
||||||
// @Param mobile body string false "手机号码"
|
// @Param Mobile formData string false "手机号码"
|
||||||
// @Param content body string false "发送内容"
|
// @Param Content formData string false "发送内容"
|
||||||
// @Param status body int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
// @Param Status formData int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
// @Param results body string false "短信结果"
|
// @Param Results formData string false "短信结果"
|
||||||
// @Param send_time body int false "发送时间"
|
// @Param SendTime formData core.NullTime false "发送时间"
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
// @Router /api/admin/system_log_sms/add [post]
|
// @Router /api/admin/system_log_sms/add [post]
|
||||||
func (hd *SystemLogSmsHandler) Add(c *gin.Context) {
|
func (hd *SystemLogSmsHandler) Add(c *gin.Context) {
|
||||||
@@ -119,20 +120,26 @@ func (hd *SystemLogSmsHandler) Add(c *gin.Context) {
|
|||||||
// @Tags system_log_sms-系统短信日志
|
// @Tags system_log_sms-系统短信日志
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param id body int false "id"
|
// @Param Id body int false "id"
|
||||||
// @Param scene body int false "场景编号"
|
// @Param Scene body int false "场景编号"
|
||||||
// @Param mobile body string false "手机号码"
|
// @Param Mobile body string false "手机号码"
|
||||||
// @Param content body string false "发送内容"
|
// @Param Content body string false "发送内容"
|
||||||
// @Param status body int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
// @Param Status body int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
// @Param results body string false "短信结果"
|
// @Param Results body string false "短信结果"
|
||||||
// @Param send_time body int false "发送时间"
|
// @Param SendTime body core.NullTime false "发送时间"
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
// @Router /api/admin/system_log_sms/edit [post]
|
// @Router /api/admin/system_log_sms/edit [post]
|
||||||
func (hd *SystemLogSmsHandler) Edit(c *gin.Context) {
|
func (hd *SystemLogSmsHandler) Edit(c *gin.Context) {
|
||||||
var editReq SystemLogSmsEditReq
|
var editReq SystemLogSmsEditReq
|
||||||
|
// jsonObj := make(map[string]interface{}) //注意该结构接受的内容
|
||||||
|
// c.BindJSON(&jsonObj)
|
||||||
|
// c.ShouldBindBodyWith(&jsonObj, binding.JSON)
|
||||||
|
// fmt.Println(jsonObj)
|
||||||
|
// util.ConvertUtil.MapToStruct(jsonObj, &editReq)
|
||||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &editReq)) {
|
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &editReq)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// response.CheckAndRespWithData(c, editReq.Id, SystemLogSmsService.Edit2(jsonObj))
|
||||||
response.CheckAndRespWithData(c, editReq.Id, SystemLogSmsService.Edit(editReq))
|
response.CheckAndRespWithData(c, editReq.Id, SystemLogSmsService.Edit(editReq))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +147,7 @@ func (hd *SystemLogSmsHandler) Edit(c *gin.Context) {
|
|||||||
// @Tags system_log_sms-系统短信日志
|
// @Tags system_log_sms-系统短信日志
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param id body int false "id"
|
// @Param Id body int false "id"
|
||||||
// @Success 200 {object} response.Response "成功"
|
// @Success 200 {object} response.Response "成功"
|
||||||
// @Router /api/admin/system_log_sms/del [post]
|
// @Router /api/admin/system_log_sms/del [post]
|
||||||
func (hd *SystemLogSmsHandler) Del(c *gin.Context) {
|
func (hd *SystemLogSmsHandler) Del(c *gin.Context) {
|
||||||
@@ -151,43 +158,21 @@ func (hd *SystemLogSmsHandler) Del(c *gin.Context) {
|
|||||||
response.CheckAndResp(c, SystemLogSmsService.Del(delReq.Id))
|
response.CheckAndResp(c, SystemLogSmsService.Del(delReq.Id))
|
||||||
}
|
}
|
||||||
|
|
||||||
func DecodeTime(value any) any {
|
|
||||||
t, e := core.ParseStringToTsTime(value.(string))
|
|
||||||
if e != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
|
|
||||||
var cols = []excel2.Col{
|
|
||||||
{Name: "场景编号", Key: "Scene", Width: 15, Replace: map[string]interface{}{
|
|
||||||
"1": "a",
|
|
||||||
"2": "b",
|
|
||||||
}},
|
|
||||||
{Name: "手机号码", Key: "Mobile", Width: 15},
|
|
||||||
{Name: "发送内容", Key: "Content", Width: 15},
|
|
||||||
{Name: "发送状态", Key: "Status", Width: 20},
|
|
||||||
{Name: "短信结果", Key: "Results", Width: 21},
|
|
||||||
{Name: "发送时间", Key: "SendTime", Width: 20},
|
|
||||||
{Name: "创建时间", Key: "CreateTime", Width: 25},
|
|
||||||
{Name: "更新时间", Key: "UpdateTime", Width: 30, Decode: DecodeTime},
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Summary 系统短信日志导出
|
// @Summary 系统短信日志导出
|
||||||
// @Tags system_log_sms-系统短信日志
|
// @Tags system_log_sms-系统短信日志
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param scene query int false "场景编号"
|
// @Param Scene query int false "场景编号"
|
||||||
// @Param mobile query string false "手机号码"
|
// @Param Mobile query string false "手机号码"
|
||||||
// @Param content query string false "发送内容"
|
// @Param Content query string false "发送内容"
|
||||||
// @Param status query int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
// @Param Status query int false "发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||||
// @Param results query string false "短信结果"
|
// @Param Results query string false "短信结果"
|
||||||
// @Param send_time query int false "发送时间"
|
// @Param SendTimeStart query core.NullTime false "发送时间"
|
||||||
// @Param create_timeStart query core.TsTime false "创建时间"
|
// @Param SendTimeEnd query core.NullTime false "发送时间"
|
||||||
// @Param create_timeEnd query core.TsTime false "创建时间"
|
// @Param CreateTimeStart query core.NullTime false "创建时间"
|
||||||
// @Param update_timeStart query core.TsTime false "更新时间"
|
// @Param CreateTimeEnd query core.NullTime false "创建时间"
|
||||||
// @Param update_timeEnd query core.TsTime false "更新时间"
|
// @Param UpdateTimeStart query core.NullTime false "更新时间"
|
||||||
|
// @Param UpdateTimeEnd query core.NullTime false "更新时间"
|
||||||
// @Router /api/admin/system_log_sms/ExportFile [get]
|
// @Router /api/admin/system_log_sms/ExportFile [get]
|
||||||
func (hd *SystemLogSmsHandler) ExportFile(c *gin.Context) {
|
func (hd *SystemLogSmsHandler) ExportFile(c *gin.Context) {
|
||||||
var listReq SystemLogSmsListReq
|
var listReq SystemLogSmsListReq
|
||||||
@@ -199,13 +184,11 @@ func (hd *SystemLogSmsHandler) ExportFile(c *gin.Context) {
|
|||||||
response.FailWithMsg(c, response.SystemError, "查询信息失败")
|
response.FailWithMsg(c, response.SystemError, "查询信息失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
f, err := excel2.Export(res, SystemLogSmsService.GetExcelCol(), "Sheet1", "系统短信日志")
|
||||||
f, err := excel2.NormalDynamicExport(res, cols, "Sheet1", "系统短信日志")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
response.FailWithMsg(c, response.SystemError, "导出失败")
|
response.FailWithMsg(c, response.SystemError, "导出失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
excel2.DownLoadExcel("系统短信日志"+time.Now().Format("20060102-150405"), c.Writer, f)
|
excel2.DownLoadExcel("系统短信日志"+time.Now().Format("20060102-150405"), c.Writer, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +204,7 @@ func (hd *SystemLogSmsHandler) ImportFile(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
importList := []SystemLogSmsResp{}
|
importList := []SystemLogSmsResp{}
|
||||||
err = excel2.GetExcelData(file, &importList, cols)
|
err = excel2.GetExcelData(file, &importList, SystemLogSmsService.GetExcelCol())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(http.StatusInternalServerError, err.Error())
|
c.String(http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
|
@@ -6,37 +6,38 @@ import (
|
|||||||
|
|
||||||
// SystemLogSmsListReq 系统短信日志列表参数
|
// SystemLogSmsListReq 系统短信日志列表参数
|
||||||
type SystemLogSmsListReq struct {
|
type SystemLogSmsListReq struct {
|
||||||
Scene *int `form:"scene"` // 场景编号
|
Scene *int `` // 场景编号
|
||||||
Mobile *string `form:"mobile"` // 手机号码
|
Mobile *string `` // 手机号码
|
||||||
Content *string `form:"content"` // 发送内容
|
Content *string `` // 发送内容
|
||||||
Status *int `form:"status"` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
Status *int `` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
Results *string `form:"results"` // 短信结果
|
Results *string `` // 短信结果
|
||||||
SendTime *int `form:"send_time"` // 发送时间
|
SendTimeStart *string `` // 开始发送时间
|
||||||
CreateTimeStart *string `form:"create_timeStart"` // 开始创建时间
|
SendTimeEnd *string `` // 结束发送时间
|
||||||
CreateTimeEnd *string `form:"create_timeEnd"` // 结束创建时间
|
CreateTimeStart *string `` // 开始创建时间
|
||||||
UpdateTimeStart *string `form:"update_timeStart"` // 开始更新时间
|
CreateTimeEnd *string `` // 结束创建时间
|
||||||
UpdateTimeEnd *string `form:"update_timeEnd"` // 结束更新时间
|
UpdateTimeStart *string `` // 开始更新时间
|
||||||
|
UpdateTimeEnd *string `` // 结束更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemLogSmsAddReq 系统短信日志新增参数
|
// SystemLogSmsAddReq 系统短信日志新增参数
|
||||||
type SystemLogSmsAddReq struct {
|
type SystemLogSmsAddReq struct {
|
||||||
Scene interface{} `mapstructure:"scene" json:"scene" form:"scene"` // 场景编号
|
Scene core.NullInt `` // 场景编号
|
||||||
Mobile interface{} `mapstructure:"mobile" json:"mobile" form:"mobile"` // 手机号码
|
Mobile *string `` // 手机号码
|
||||||
Content interface{} `mapstructure:"content" json:"content" form:"content"` // 发送内容
|
Content *string `` // 发送内容
|
||||||
Status interface{} `mapstructure:"status" json:"status" form:"status"` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
Status core.NullInt `` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
Results interface{} `mapstructure:"results" json:"results" form:"results"` // 短信结果
|
Results *string `` // 短信结果
|
||||||
SendTime interface{} `mapstructure:"send_time" json:"send_time" form:"send_time"` // 发送时间
|
SendTime core.NullTime `` // 发送时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemLogSmsEditReq 系统短信日志编辑参数
|
// SystemLogSmsEditReq 系统短信日志编辑参数
|
||||||
type SystemLogSmsEditReq struct {
|
type SystemLogSmsEditReq struct {
|
||||||
Id int `mapstructure:"id" json:"id" form:"id"` // id
|
Id int `` // id
|
||||||
Scene interface{} `mapstructure:"scene" json:"scene" form:"scene"` // 场景编号
|
Scene core.NullInt `` // 场景编号
|
||||||
Mobile interface{} `mapstructure:"mobile" json:"mobile" form:"mobile"` // 手机号码
|
Mobile *string `` // 手机号码
|
||||||
Content interface{} `mapstructure:"content" json:"content" form:"content"` // 发送内容
|
Content *string `` // 发送内容
|
||||||
Status interface{} `mapstructure:"status" json:"status" form:"status"` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
Status core.NullInt `` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
Results interface{} `mapstructure:"results" json:"results" form:"results"` // 短信结果
|
Results *string `` // 短信结果
|
||||||
SendTime interface{} `mapstructure:"send_time" json:"send_time" form:"send_time"` // 发送时间
|
SendTime core.NullTime `` // 发送时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemLogSmsDetailReq 系统短信日志详情参数
|
// SystemLogSmsDetailReq 系统短信日志详情参数
|
||||||
@@ -51,13 +52,13 @@ type SystemLogSmsDelReq struct {
|
|||||||
|
|
||||||
// SystemLogSmsResp 系统短信日志返回信息
|
// SystemLogSmsResp 系统短信日志返回信息
|
||||||
type SystemLogSmsResp struct {
|
type SystemLogSmsResp struct {
|
||||||
Id int `json:"id"` // id
|
Id int // id
|
||||||
Scene int `json:"scene" excel:"name:场景编号;"` // 场景编号
|
Scene core.NullInt // 场景编号
|
||||||
Mobile string `json:"mobile" excel:"name:手机号码;"` // 手机号码
|
Mobile string // 手机号码
|
||||||
Content string `json:"content" excel:"name:发送内容;"` // 发送内容
|
Content string // 发送内容
|
||||||
Status int `json:"status" excel:"name:发送状态;"` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
Status core.NullInt // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
Results string `json:"results" excel:"name:短信结果;"` // 短信结果
|
Results string // 短信结果
|
||||||
SendTime int `json:"send_time" excel:"name:发送时间;"` // 发送时间
|
SendTime core.NullTime // 发送时间
|
||||||
CreateTime core.TsTime `json:"create_time" excel:"name:创建时间;"` // 创建时间
|
CreateTime core.NullTime // 创建时间
|
||||||
UpdateTime core.TsTime `json:"update_time" excel:"name:更新时间;"` // 更新时间
|
UpdateTime core.NullTime // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -6,8 +6,8 @@ import (
|
|||||||
"x_admin/core/response"
|
"x_admin/core/response"
|
||||||
"x_admin/model"
|
"x_admin/model"
|
||||||
"x_admin/util"
|
"x_admin/util"
|
||||||
|
"x_admin/util/excel2"
|
||||||
|
|
||||||
"github.com/duke-git/lancet/v2/convertor"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -49,8 +49,11 @@ func (service systemLogSmsService) GetModel(listReq SystemLogSmsListReq) *gorm.D
|
|||||||
if listReq.Results != nil {
|
if listReq.Results != nil {
|
||||||
dbModel = dbModel.Where("results = ?", *listReq.Results)
|
dbModel = dbModel.Where("results = ?", *listReq.Results)
|
||||||
}
|
}
|
||||||
if listReq.SendTime != nil {
|
if listReq.SendTimeStart != nil {
|
||||||
dbModel = dbModel.Where("send_time = ?", *listReq.SendTime)
|
dbModel = dbModel.Where("send_time >= ?", *listReq.SendTimeStart)
|
||||||
|
}
|
||||||
|
if listReq.SendTimeEnd != nil {
|
||||||
|
dbModel = dbModel.Where("send_time <= ?", *listReq.SendTimeEnd)
|
||||||
}
|
}
|
||||||
if listReq.CreateTimeStart != nil {
|
if listReq.CreateTimeStart != nil {
|
||||||
dbModel = dbModel.Where("create_time >= ?", *listReq.CreateTimeStart)
|
dbModel = dbModel.Where("create_time >= ?", *listReq.CreateTimeStart)
|
||||||
@@ -86,7 +89,7 @@ func (service systemLogSmsService) List(page request.PageReq, listReq SystemLogS
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []SystemLogSmsResp{}
|
result := []SystemLogSmsResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return response.PageResp{
|
return response.PageResp{
|
||||||
PageNo: page.PageNo,
|
PageNo: page.PageNo,
|
||||||
PageSize: page.PageSize,
|
PageSize: page.PageSize,
|
||||||
@@ -105,7 +108,7 @@ func (service systemLogSmsService) ListAll(listReq SystemLogSmsListReq) (res []S
|
|||||||
if e = response.CheckErr(err, "查询全部失败"); e != nil {
|
if e = response.CheckErr(err, "查询全部失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
response.Copy(&res, modelList)
|
util.ConvertUtil.Copy(&res, modelList)
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,29 +126,18 @@ func (service systemLogSmsService) Detail(Id int) (res SystemLogSmsResp, e error
|
|||||||
}
|
}
|
||||||
cacheUtil.SetCache(obj.Id, obj)
|
cacheUtil.SetCache(obj.Id, obj)
|
||||||
}
|
}
|
||||||
response.Copy(&res, obj)
|
|
||||||
|
util.ConvertUtil.Copy(&res, obj)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add 系统短信日志新增
|
// Add 系统短信日志新增
|
||||||
func (service systemLogSmsService) Add(addReq SystemLogSmsAddReq) (createId int, e error) {
|
func (service systemLogSmsService) Add(addReq SystemLogSmsAddReq) (createId int, e error) {
|
||||||
var obj model.SystemLogSms
|
var obj model.SystemLogSms
|
||||||
|
// util.ConvertUtil.Copy(&obj, addReq)
|
||||||
|
|
||||||
// 无法自动转换不同类型
|
util.ConvertUtil.StructToStruct(addReq, &obj)
|
||||||
// response.Copy(&obj, addReq)
|
err := service.db.Create(&obj).Error
|
||||||
|
|
||||||
// addInfo, err := convertor.StructToMap(addReq)
|
|
||||||
// if err != nil {
|
|
||||||
// return 0, err
|
|
||||||
// }
|
|
||||||
// // map弱类型转换到结构体
|
|
||||||
// err = mapstructure.WeakDecode(addInfo, &obj)
|
|
||||||
err := util.ConvertUtil.StructToStruct(&addReq, &obj)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
err = service.db.Create(&obj).Error
|
|
||||||
e = response.CheckMysqlErr(err)
|
e = response.CheckMysqlErr(err)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return 0, e
|
return 0, e
|
||||||
@@ -167,15 +159,10 @@ func (service systemLogSmsService) Edit(editReq SystemLogSmsEditReq) (e error) {
|
|||||||
if e = response.CheckErr(err, "查询失败"); e != nil {
|
if e = response.CheckErr(err, "查询失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 更新
|
|
||||||
// response.Copy(&obj, editReq)
|
|
||||||
//
|
|
||||||
editInfo, err := convertor.StructToMap(editReq)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = service.db.Model(&obj).Updates(editInfo).Error
|
util.ConvertUtil.Copy(&obj, editReq)
|
||||||
|
|
||||||
|
err = service.db.Model(&obj).Select("*").Updates(obj).Error
|
||||||
if e = response.CheckErr(err, "编辑失败"); e != nil {
|
if e = response.CheckErr(err, "编辑失败"); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -202,6 +189,23 @@ func (service systemLogSmsService) Del(Id int) (e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取Excel的列
|
||||||
|
func (service systemLogSmsService) GetExcelCol() []excel2.Col {
|
||||||
|
var cols = []excel2.Col{
|
||||||
|
|
||||||
|
{Name: "场景编号", Key: "Scene", Width: 15, Encode: core.EncodeInt, Decode: core.DecodeInt},
|
||||||
|
{Name: "手机号码", Key: "Mobile", Width: 15},
|
||||||
|
{Name: "发送内容", Key: "Content", Width: 15},
|
||||||
|
{Name: "发送状态:[0=发送中, 1=发送成功, 2=发送失败]", Key: "Status", Width: 15, Encode: core.EncodeInt, Decode: core.DecodeInt},
|
||||||
|
{Name: "短信结果", Key: "Results", Width: 15},
|
||||||
|
{Name: "发送时间", Key: "SendTime", Width: 15, Encode: util.NullTimeUtil.EncodeTime, Decode: util.NullTimeUtil.DecodeTime},
|
||||||
|
{Name: "创建时间", Key: "CreateTime", Width: 15, Encode: util.NullTimeUtil.EncodeTime, Decode: util.NullTimeUtil.DecodeTime},
|
||||||
|
{Name: "更新时间", Key: "UpdateTime", Width: 15, Encode: util.NullTimeUtil.EncodeTime, Decode: util.NullTimeUtil.DecodeTime},
|
||||||
|
}
|
||||||
|
// 还可以考虑字典,请求下来加上 Replace 实现替换导出
|
||||||
|
return cols
|
||||||
|
}
|
||||||
|
|
||||||
// ExportFile 系统短信日志导出
|
// ExportFile 系统短信日志导出
|
||||||
func (service systemLogSmsService) ExportFile(listReq SystemLogSmsListReq) (res []SystemLogSmsResp, e error) {
|
func (service systemLogSmsService) ExportFile(listReq SystemLogSmsListReq) (res []SystemLogSmsResp, e error) {
|
||||||
// 查询
|
// 查询
|
||||||
@@ -214,14 +218,14 @@ func (service systemLogSmsService) ExportFile(listReq SystemLogSmsListReq) (res
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := []SystemLogSmsResp{}
|
result := []SystemLogSmsResp{}
|
||||||
response.Copy(&result, modelList)
|
util.ConvertUtil.Copy(&result, modelList)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入
|
// 导入
|
||||||
func (service systemLogSmsService) ImportFile(importReq []SystemLogSmsResp) (e error) {
|
func (service systemLogSmsService) ImportFile(importReq []SystemLogSmsResp) (e error) {
|
||||||
var importData []model.SystemLogSms
|
var importData []model.SystemLogSms
|
||||||
response.Copy(&importData, importReq)
|
util.ConvertUtil.Copy(&importData, importReq)
|
||||||
err := service.db.Create(&importData).Error
|
err := service.db.Create(&importData).Error
|
||||||
e = response.CheckErr(err, "添加失败")
|
e = response.CheckErr(err, "添加失败")
|
||||||
return e
|
return e
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"x_admin/admin/system_log_sms"
|
|
||||||
"x_admin/middleware"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"x_admin/middleware"
|
||||||
|
"x_admin/admin/system_log_sms"
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +39,7 @@ INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_sh
|
|||||||
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', '系统短信日志导入excel','admin:system_log_sms: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) VALUES (0, 'A', '系统短信日志导入excel','admin:system_log_sms:ImportFile', 0, 1, 0, now(), now());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// SystemLogSmsRoute(rg)
|
// SystemLogSmsRoute(rg)
|
||||||
func SystemLogSmsRoute(rg *gin.RouterGroup) {
|
func SystemLogSmsRoute(rg *gin.RouterGroup) {
|
||||||
handle := system_log_sms.SystemLogSmsHandler{}
|
handle := system_log_sms.SystemLogSmsHandler{}
|
||||||
@@ -48,9 +48,9 @@ func SystemLogSmsRoute(rg *gin.RouterGroup) {
|
|||||||
r.GET("/system_log_sms/list", handle.List)
|
r.GET("/system_log_sms/list", handle.List)
|
||||||
r.GET("/system_log_sms/listAll", handle.ListAll)
|
r.GET("/system_log_sms/listAll", handle.ListAll)
|
||||||
r.GET("/system_log_sms/detail", handle.Detail)
|
r.GET("/system_log_sms/detail", handle.Detail)
|
||||||
r.POST("/system_log_sms/add", middleware.RecordLog("系统短信日志新增"), handle.Add)
|
r.POST("/system_log_sms/add",middleware.RecordLog("系统短信日志新增"), handle.Add)
|
||||||
r.POST("/system_log_sms/edit", middleware.RecordLog("系统短信日志编辑"), handle.Edit)
|
r.POST("/system_log_sms/edit",middleware.RecordLog("系统短信日志编辑"), handle.Edit)
|
||||||
r.POST("/system_log_sms/del", middleware.RecordLog("系统短信日志删除"), handle.Del)
|
r.POST("/system_log_sms/del", middleware.RecordLog("系统短信日志删除"), handle.Del)
|
||||||
r.GET("/system_log_sms/ExportFile", middleware.RecordLog("系统短信日志导出"), handle.ExportFile)
|
r.GET("/system_log_sms/ExportFile", middleware.RecordLog("系统短信日志导出"), handle.ExportFile)
|
||||||
r.POST("/system_log_sms/ImportFile", handle.ImportFile)
|
r.POST("/system_log_sms/ImportFile", handle.ImportFile)
|
||||||
}
|
}
|
122
server/core/null_int.go
Normal file
122
server/core/null_int.go
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql/driver"
|
||||||
|
"encoding/json"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
// int类型别名,支持前端传递null,int,string类型
|
||||||
|
// 忽略前端null值,接收""值时,返回0
|
||||||
|
type NullInt struct {
|
||||||
|
Int *int64
|
||||||
|
Valid bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func EncodeInt(value any) any {
|
||||||
|
switch v := value.(type) {
|
||||||
|
case map[string]any:
|
||||||
|
if v["Int"] != nil {
|
||||||
|
return v["Int"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
func DecodeInt(value any) (any, error) {
|
||||||
|
switch v := value.(type) {
|
||||||
|
case int:
|
||||||
|
i := int64(v)
|
||||||
|
return NullInt{Int: &i, Valid: true}, nil
|
||||||
|
case int64:
|
||||||
|
return NullInt{Int: &v, Valid: true}, nil
|
||||||
|
case string:
|
||||||
|
if v == "" {
|
||||||
|
return NullInt{Int: nil, Valid: false}, nil
|
||||||
|
}
|
||||||
|
i, err := strconv.ParseInt(v, 10, 64)
|
||||||
|
return NullInt{Int: &i, Valid: true}, err
|
||||||
|
case nil:
|
||||||
|
return NullInt{Int: nil, Valid: false}, nil
|
||||||
|
case NullInt:
|
||||||
|
return v, nil
|
||||||
|
}
|
||||||
|
return NullInt{Int: nil, Valid: false}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// gorm实现Scanner
|
||||||
|
func (i *NullInt) Scan(value interface{}) error {
|
||||||
|
i.Valid = false
|
||||||
|
if value == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
v := value.(int64)
|
||||||
|
i.Int, i.Valid = &v, true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// gorm实现 Valuer
|
||||||
|
func (i NullInt) Value() (driver.Value, error) {
|
||||||
|
if !i.Valid {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
v := i.Int
|
||||||
|
if v == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return *v, nil
|
||||||
|
}
|
||||||
|
func (i NullInt) String() string {
|
||||||
|
if i.Valid {
|
||||||
|
return strconv.FormatInt(*i.Int, 10)
|
||||||
|
} else {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实现json序列化接口
|
||||||
|
func (i NullInt) MarshalJSON() ([]byte, error) {
|
||||||
|
if i.Valid {
|
||||||
|
return json.Marshal(i.Int)
|
||||||
|
} else {
|
||||||
|
return json.Marshal(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实现json反序列化接口
|
||||||
|
func (i *NullInt) UnmarshalJSON(data []byte) error {
|
||||||
|
var x any
|
||||||
|
if err := json.Unmarshal(data, &x); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
switch v := x.(type) {
|
||||||
|
case int64:
|
||||||
|
i.Int = &v
|
||||||
|
i.Valid = true
|
||||||
|
return nil
|
||||||
|
case float64:
|
||||||
|
i64 := int64(v)
|
||||||
|
i.Int = &i64
|
||||||
|
i.Valid = true
|
||||||
|
return nil
|
||||||
|
case string:
|
||||||
|
if v == "" {
|
||||||
|
i.Int = nil
|
||||||
|
i.Valid = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
num, err := strconv.ParseInt(v, 10, 64)
|
||||||
|
if err == nil {
|
||||||
|
i.Int = &num
|
||||||
|
i.Valid = true
|
||||||
|
} else {
|
||||||
|
i.Valid = false
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
case nil:
|
||||||
|
i.Valid = false
|
||||||
|
default:
|
||||||
|
i.Valid = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
117
server/core/null_time.go
Normal file
117
server/core/null_time.go
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql/driver"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// const DateFormat = "2006-01-02"
|
||||||
|
// const TimeFormat = "2006-01-02 15:04:05"
|
||||||
|
|
||||||
|
// NullTime 自定义时间格式
|
||||||
|
type NullTime struct {
|
||||||
|
Time *time.Time
|
||||||
|
Valid bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *NullTime) IsZero() bool {
|
||||||
|
return t.Valid
|
||||||
|
}
|
||||||
|
func (t *NullTime) UnmarshalJSON(bs []byte) error {
|
||||||
|
var date string
|
||||||
|
err := json.Unmarshal(bs, &date)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if date == "" {
|
||||||
|
*t = NullTime{
|
||||||
|
Time: nil,
|
||||||
|
Valid: false,
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
tt, _ := time.ParseInLocation(TimeFormat, date, time.Local)
|
||||||
|
*t = NullTime{
|
||||||
|
Time: &tt,
|
||||||
|
Valid: true,
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON 将NullTime类型的时间转化为JSON字符串格式
|
||||||
|
// 返回转化后的JSON字符串和错误信息
|
||||||
|
func (t NullTime) MarshalJSON() ([]byte, error) {
|
||||||
|
if t.Valid {
|
||||||
|
if t.Time == nil {
|
||||||
|
return json.Marshal(nil)
|
||||||
|
}
|
||||||
|
tt := *t.Time
|
||||||
|
tStr := tt.Format(TimeFormat)
|
||||||
|
return json.Marshal(tStr)
|
||||||
|
} else {
|
||||||
|
return json.Marshal(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入数据库gorm调用
|
||||||
|
func (t NullTime) Value() (driver.Value, error) {
|
||||||
|
timeStr := t.String()
|
||||||
|
if timeStr == "" {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return timeStr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取数据gorm调用
|
||||||
|
func (t *NullTime) Scan(v any) error {
|
||||||
|
// pt, err := time.ParseInLocation("2006-01-02 15:04:05", v.(time.Time).String(), time.Local)
|
||||||
|
if pt, ok := v.(time.Time); ok {
|
||||||
|
tt := pt.Format(TimeFormat)
|
||||||
|
if tt == "0001-01-01 00:00:00" {
|
||||||
|
*t = NullTime{
|
||||||
|
Time: &pt,
|
||||||
|
Valid: false,
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
*t = NullTime{
|
||||||
|
Time: &pt,
|
||||||
|
Valid: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("cant convert %s to time", v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t NullTime) String() string {
|
||||||
|
if !t.Valid {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if t.Time == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
tt := *t.Time
|
||||||
|
return tt.Format(TimeFormat)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (NullTime) GormDBDataType(db *gorm.DB, field *schema.Field) string {
|
||||||
|
// 使用 field.Tag、field.TagSettings 获取字段的 tag
|
||||||
|
// 查看 https://github.com/go-gorm/gorm/blob/master/schema/field.go 获取全部的选项
|
||||||
|
|
||||||
|
// 根据不同的数据库驱动返回不同的数据类型
|
||||||
|
// switch db.Dialector.Name() {
|
||||||
|
// case "mysql", "sqlite":
|
||||||
|
// return "JSON"
|
||||||
|
// case "postgres":
|
||||||
|
// return "JSONB"
|
||||||
|
// }
|
||||||
|
// return ""
|
||||||
|
return "DATETIME"
|
||||||
|
}
|
@@ -1,11 +1,5 @@
|
|||||||
package response
|
package response
|
||||||
|
|
||||||
import (
|
|
||||||
"x_admin/core"
|
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
|
||||||
)
|
|
||||||
|
|
||||||
// PageResp 分页返回值
|
// PageResp 分页返回值
|
||||||
type PageResp struct {
|
type PageResp struct {
|
||||||
Count int64 `json:"count"` // 总数
|
Count int64 `json:"count"` // 总数
|
||||||
@@ -15,10 +9,10 @@ type PageResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy 拷贝结构体
|
// Copy 拷贝结构体
|
||||||
func Copy(toValue interface{}, fromValue interface{}) interface{} {
|
// func Copy(toValue interface{}, fromValue interface{}) interface{} {
|
||||||
if err := copier.Copy(toValue, fromValue); err != nil {
|
// if err := copier.Copy(toValue, fromValue); err != nil {
|
||||||
core.Logger.Errorf("Copy err: err=[%+v]", err)
|
// core.Logger.Errorf("Copy err: err=[%+v]", err)
|
||||||
panic(SystemError)
|
// panic(SystemError)
|
||||||
}
|
// }
|
||||||
return toValue
|
// return toValue
|
||||||
}
|
// }
|
||||||
|
@@ -38,7 +38,7 @@ var (
|
|||||||
LoginAccountError = RespType{code: 330, message: "登录账号或密码错误"}
|
LoginAccountError = RespType{code: 330, message: "登录账号或密码错误"}
|
||||||
LoginDisableError = RespType{code: 331, message: "登录账号已被禁用了"}
|
LoginDisableError = RespType{code: 331, message: "登录账号已被禁用了"}
|
||||||
TokenEmpty = RespType{code: 332, message: "token参数为空"}
|
TokenEmpty = RespType{code: 332, message: "token参数为空"}
|
||||||
TokenInvalid = RespType{code: 333, message: "token参数无效"}
|
TokenInvalid = RespType{code: 333, message: "登录失效"}
|
||||||
|
|
||||||
NoPermission = RespType{code: 403, message: "无相关权限"}
|
NoPermission = RespType{code: 403, message: "无相关权限"}
|
||||||
Request404Error = RespType{code: 404, message: "请求接口不存在"}
|
Request404Error = RespType{code: 404, message: "请求接口不存在"}
|
||||||
|
@@ -16,34 +16,19 @@ const TimeFormat = "2006-01-02 15:04:05"
|
|||||||
// TsTime 自定义时间格式
|
// TsTime 自定义时间格式
|
||||||
type TsTime time.Time
|
type TsTime time.Time
|
||||||
|
|
||||||
// 通过时间字符串生成时间戳
|
func (tst *TsTime) IsZero() bool {
|
||||||
func ToUnix(date string) int64 {
|
return tst.String() == "0001-01-01 00:00:00"
|
||||||
if date == "" {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
tt, _ := time.ParseInLocation(TimeFormat, date, time.Local)
|
|
||||||
return tt.Unix()
|
|
||||||
}
|
}
|
||||||
func ParseTimeToTsTime(date time.Time) TsTime {
|
|
||||||
return TsTime(date)
|
|
||||||
}
|
|
||||||
func ParseStringToTsTime(date string) (TsTime, error) {
|
|
||||||
t, e := time.Parse(TimeFormat, date)
|
|
||||||
if e != nil {
|
|
||||||
return NowTime(), e
|
|
||||||
}
|
|
||||||
return TsTime(t), nil
|
|
||||||
}
|
|
||||||
func NowTime() TsTime {
|
|
||||||
return TsTime(time.Now())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tst *TsTime) UnmarshalJSON(bs []byte) error {
|
func (tst *TsTime) UnmarshalJSON(bs []byte) error {
|
||||||
var date string
|
var date string
|
||||||
err := json.Unmarshal(bs, &date)
|
err := json.Unmarshal(bs, &date)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if date == "" {
|
||||||
|
*tst = TsTime(time.Time{})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
tt, _ := time.ParseInLocation(TimeFormat, date, time.Local)
|
tt, _ := time.ParseInLocation(TimeFormat, date, time.Local)
|
||||||
*tst = TsTime(tt)
|
*tst = TsTime(tt)
|
||||||
return nil
|
return nil
|
||||||
@@ -53,7 +38,11 @@ func (tst *TsTime) UnmarshalJSON(bs []byte) error {
|
|||||||
// 返回转化后的JSON字符串和错误信息
|
// 返回转化后的JSON字符串和错误信息
|
||||||
func (tst TsTime) MarshalJSON() ([]byte, error) {
|
func (tst TsTime) MarshalJSON() ([]byte, error) {
|
||||||
tt := time.Time(tst).Format(TimeFormat)
|
tt := time.Time(tst).Format(TimeFormat)
|
||||||
return json.Marshal(tt)
|
if tt == "0001-01-01 00:00:00" {
|
||||||
|
return json.Marshal(nil)
|
||||||
|
} else {
|
||||||
|
return json.Marshal(tt)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入数据库gorm调用
|
// 写入数据库gorm调用
|
@@ -2143,40 +2143,6 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/admin/monitor_project/listAll": {
|
|
||||||
"get": {
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"monitor_project-错误项目"
|
|
||||||
],
|
|
||||||
"summary": "错误项目列表-所有",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "成功",
|
|
||||||
"schema": {
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/response.Response"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"data": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/monitor_project.MonitorProjectResp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/admin/monitor_web/ExportFile": {
|
"/api/admin/monitor_web/ExportFile": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
@@ -2601,6 +2567,458 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/admin/system_log_sms/ExportFile": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志导出",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/ImportFile": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志导入",
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/add": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志新增",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "formData"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/del": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志删除",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "id",
|
||||||
|
"name": "Id",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/detail": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志详情",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id",
|
||||||
|
"name": "Id",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" data": {
|
||||||
|
"$ref": "#/definitions/system_log_sms.SystemLogSmsResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/edit": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志编辑",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "id",
|
||||||
|
"name": "Id",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "发送时间",
|
||||||
|
"name": "SendTime",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/list": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志列表",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "页码",
|
||||||
|
"name": "PageNo",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "每页数量",
|
||||||
|
"name": "PageSize",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" data": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.PageResp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" lists": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/system_log_sms.SystemLogSmsResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/listAll": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志列表-所有",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" data": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/system_log_sms.SystemLogSmsResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/article_collect/list": {
|
"/api/article_collect/list": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
@@ -2695,6 +3113,28 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"core.NullInt": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"int": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"valid": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"core.NullTime": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"time": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"valid": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"flow_apply.FlowApplyResp": {
|
"flow_apply.FlowApplyResp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -3006,6 +3446,67 @@ const docTemplate = `{
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"system_log_sms.SystemLogSmsResp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"content": {
|
||||||
|
"description": "发送内容",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"createTime": {
|
||||||
|
"description": "创建时间",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullTime"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"description": "id",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"mobile": {
|
||||||
|
"description": "手机号码",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"results": {
|
||||||
|
"description": "短信结果",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"scene": {
|
||||||
|
"description": "场景编号",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullInt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sendTime": {
|
||||||
|
"description": "发送时间",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullTime"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullInt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"updateTime": {
|
||||||
|
"description": "更新时间",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullTime"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"securityDefinitions": {
|
"securityDefinitions": {
|
||||||
|
@@ -2137,40 +2137,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/admin/monitor_project/listAll": {
|
|
||||||
"get": {
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"monitor_project-错误项目"
|
|
||||||
],
|
|
||||||
"summary": "错误项目列表-所有",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "成功",
|
|
||||||
"schema": {
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/response.Response"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"data": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/monitor_project.MonitorProjectResp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/admin/monitor_web/ExportFile": {
|
"/api/admin/monitor_web/ExportFile": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
@@ -2595,6 +2561,458 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/admin/system_log_sms/ExportFile": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志导出",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/ImportFile": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志导入",
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/add": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志新增",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "formData"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/del": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志删除",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "id",
|
||||||
|
"name": "Id",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/detail": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志详情",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id",
|
||||||
|
"name": "Id",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" data": {
|
||||||
|
"$ref": "#/definitions/system_log_sms.SystemLogSmsResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/edit": {
|
||||||
|
"post": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志编辑",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "id",
|
||||||
|
"name": "Id",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "发送时间",
|
||||||
|
"name": "SendTime",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/list": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志列表",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "token",
|
||||||
|
"name": "Token",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "页码",
|
||||||
|
"name": "PageNo",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "每页数量",
|
||||||
|
"name": "PageSize",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" data": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.PageResp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" lists": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/system_log_sms.SystemLogSmsResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/admin/system_log_sms/listAll": {
|
||||||
|
"get": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"system_log_sms-系统短信日志"
|
||||||
|
],
|
||||||
|
"summary": "系统短信日志列表-所有",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "场景编号",
|
||||||
|
"name": "Scene",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "手机号码",
|
||||||
|
"name": "Mobile",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "发送内容",
|
||||||
|
"name": "Content",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"name": "Status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "短信结果",
|
||||||
|
"name": "Results",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
" data": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/system_log_sms.SystemLogSmsResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/article_collect/list": {
|
"/api/article_collect/list": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
@@ -2689,6 +3107,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"core.NullInt": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"int": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"valid": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"core.NullTime": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"time": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"valid": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"flow_apply.FlowApplyResp": {
|
"flow_apply.FlowApplyResp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -3000,6 +3440,67 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"system_log_sms.SystemLogSmsResp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"content": {
|
||||||
|
"description": "发送内容",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"createTime": {
|
||||||
|
"description": "创建时间",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullTime"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"description": "id",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"mobile": {
|
||||||
|
"description": "手机号码",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"results": {
|
||||||
|
"description": "短信结果",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"scene": {
|
||||||
|
"description": "场景编号",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullInt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sendTime": {
|
||||||
|
"description": "发送时间",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullTime"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"description": "发送状态:[0=发送中, 1=发送成功, 2=发送失败]",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullInt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"updateTime": {
|
||||||
|
"description": "更新时间",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/core.NullTime"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"securityDefinitions": {
|
"securityDefinitions": {
|
||||||
|
@@ -1,5 +1,19 @@
|
|||||||
basePath: /
|
basePath: /
|
||||||
definitions:
|
definitions:
|
||||||
|
core.NullInt:
|
||||||
|
properties:
|
||||||
|
int:
|
||||||
|
type: integer
|
||||||
|
valid:
|
||||||
|
type: boolean
|
||||||
|
type: object
|
||||||
|
core.NullTime:
|
||||||
|
properties:
|
||||||
|
time:
|
||||||
|
type: string
|
||||||
|
valid:
|
||||||
|
type: boolean
|
||||||
|
type: object
|
||||||
flow_apply.FlowApplyResp:
|
flow_apply.FlowApplyResp:
|
||||||
properties:
|
properties:
|
||||||
applyUserId:
|
applyUserId:
|
||||||
@@ -227,6 +241,41 @@ definitions:
|
|||||||
message:
|
message:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
system_log_sms.SystemLogSmsResp:
|
||||||
|
properties:
|
||||||
|
content:
|
||||||
|
description: 发送内容
|
||||||
|
type: string
|
||||||
|
createTime:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/core.NullTime'
|
||||||
|
description: 创建时间
|
||||||
|
id:
|
||||||
|
description: id
|
||||||
|
type: integer
|
||||||
|
mobile:
|
||||||
|
description: 手机号码
|
||||||
|
type: string
|
||||||
|
results:
|
||||||
|
description: 短信结果
|
||||||
|
type: string
|
||||||
|
scene:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/core.NullInt'
|
||||||
|
description: 场景编号
|
||||||
|
sendTime:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/core.NullTime'
|
||||||
|
description: 发送时间
|
||||||
|
status:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/core.NullInt'
|
||||||
|
description: 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
|
updateTime:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/core.NullTime'
|
||||||
|
description: 更新时间
|
||||||
|
type: object
|
||||||
externalDocs:
|
externalDocs:
|
||||||
description: OpenAPI
|
description: OpenAPI
|
||||||
url: https://swagger.io/resources/open-api/
|
url: https://swagger.io/resources/open-api/
|
||||||
@@ -1566,25 +1615,6 @@ paths:
|
|||||||
summary: 错误项目列表
|
summary: 错误项目列表
|
||||||
tags:
|
tags:
|
||||||
- monitor_project-错误项目
|
- monitor_project-错误项目
|
||||||
/api/admin/monitor_project/listAll:
|
|
||||||
get:
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: 成功
|
|
||||||
schema:
|
|
||||||
allOf:
|
|
||||||
- $ref: '#/definitions/response.Response'
|
|
||||||
- properties:
|
|
||||||
data:
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/monitor_project.MonitorProjectResp'
|
|
||||||
type: array
|
|
||||||
type: object
|
|
||||||
summary: 错误项目列表-所有
|
|
||||||
tags:
|
|
||||||
- monitor_project-错误项目
|
|
||||||
/api/admin/monitor_web/ExportFile:
|
/api/admin/monitor_web/ExportFile:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -1859,6 +1889,289 @@ paths:
|
|||||||
summary: 错误收集error列表-所有
|
summary: 错误收集error列表-所有
|
||||||
tags:
|
tags:
|
||||||
- monitor_web-错误收集error
|
- monitor_web-错误收集error
|
||||||
|
/api/admin/system_log_sms/ExportFile:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- description: token
|
||||||
|
in: header
|
||||||
|
name: Token
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 场景编号
|
||||||
|
in: query
|
||||||
|
name: Scene
|
||||||
|
type: integer
|
||||||
|
- description: 手机号码
|
||||||
|
in: query
|
||||||
|
name: Mobile
|
||||||
|
type: string
|
||||||
|
- description: 发送内容
|
||||||
|
in: query
|
||||||
|
name: Content
|
||||||
|
type: string
|
||||||
|
- description: 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
|
in: query
|
||||||
|
name: Status
|
||||||
|
type: integer
|
||||||
|
- description: 短信结果
|
||||||
|
in: query
|
||||||
|
name: Results
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses: {}
|
||||||
|
summary: 系统短信日志导出
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
|
/api/admin/system_log_sms/ImportFile:
|
||||||
|
post:
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses: {}
|
||||||
|
summary: 系统短信日志导入
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
|
/api/admin/system_log_sms/add:
|
||||||
|
post:
|
||||||
|
parameters:
|
||||||
|
- description: token
|
||||||
|
in: header
|
||||||
|
name: Token
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 场景编号
|
||||||
|
in: formData
|
||||||
|
name: Scene
|
||||||
|
type: integer
|
||||||
|
- description: 手机号码
|
||||||
|
in: formData
|
||||||
|
name: Mobile
|
||||||
|
type: string
|
||||||
|
- description: 发送内容
|
||||||
|
in: formData
|
||||||
|
name: Content
|
||||||
|
type: string
|
||||||
|
- description: 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
|
in: formData
|
||||||
|
name: Status
|
||||||
|
type: integer
|
||||||
|
- description: 短信结果
|
||||||
|
in: formData
|
||||||
|
name: Results
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 成功
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/response.Response'
|
||||||
|
summary: 系统短信日志新增
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
|
/api/admin/system_log_sms/del:
|
||||||
|
post:
|
||||||
|
parameters:
|
||||||
|
- description: token
|
||||||
|
in: header
|
||||||
|
name: Token
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: id
|
||||||
|
in: body
|
||||||
|
name: Id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 成功
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/response.Response'
|
||||||
|
summary: 系统短信日志删除
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
|
/api/admin/system_log_sms/detail:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- description: token
|
||||||
|
in: header
|
||||||
|
name: Token
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: id
|
||||||
|
in: query
|
||||||
|
name: Id
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
' data':
|
||||||
|
$ref: '#/definitions/system_log_sms.SystemLogSmsResp'
|
||||||
|
type: object
|
||||||
|
summary: 系统短信日志详情
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
|
/api/admin/system_log_sms/edit:
|
||||||
|
post:
|
||||||
|
parameters:
|
||||||
|
- description: token
|
||||||
|
in: header
|
||||||
|
name: Token
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: id
|
||||||
|
in: body
|
||||||
|
name: Id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- description: 场景编号
|
||||||
|
in: body
|
||||||
|
name: Scene
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- description: 手机号码
|
||||||
|
in: body
|
||||||
|
name: Mobile
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- description: 发送内容
|
||||||
|
in: body
|
||||||
|
name: Content
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- description: 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
|
in: body
|
||||||
|
name: Status
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- description: 短信结果
|
||||||
|
in: body
|
||||||
|
name: Results
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- description: 发送时间
|
||||||
|
in: body
|
||||||
|
name: SendTime
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 成功
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/response.Response'
|
||||||
|
summary: 系统短信日志编辑
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
|
/api/admin/system_log_sms/list:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- description: token
|
||||||
|
in: header
|
||||||
|
name: Token
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 页码
|
||||||
|
in: query
|
||||||
|
name: PageNo
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: 每页数量
|
||||||
|
in: query
|
||||||
|
name: PageSize
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: 场景编号
|
||||||
|
in: query
|
||||||
|
name: Scene
|
||||||
|
type: integer
|
||||||
|
- description: 手机号码
|
||||||
|
in: query
|
||||||
|
name: Mobile
|
||||||
|
type: string
|
||||||
|
- description: 发送内容
|
||||||
|
in: query
|
||||||
|
name: Content
|
||||||
|
type: string
|
||||||
|
- description: 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
|
in: query
|
||||||
|
name: Status
|
||||||
|
type: integer
|
||||||
|
- description: 短信结果
|
||||||
|
in: query
|
||||||
|
name: Results
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
' data':
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.PageResp'
|
||||||
|
- properties:
|
||||||
|
' lists':
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/system_log_sms.SystemLogSmsResp'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
type: object
|
||||||
|
summary: 系统短信日志列表
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
|
/api/admin/system_log_sms/listAll:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- description: 场景编号
|
||||||
|
in: query
|
||||||
|
name: Scene
|
||||||
|
type: integer
|
||||||
|
- description: 手机号码
|
||||||
|
in: query
|
||||||
|
name: Mobile
|
||||||
|
type: string
|
||||||
|
- description: 发送内容
|
||||||
|
in: query
|
||||||
|
name: Content
|
||||||
|
type: string
|
||||||
|
- description: 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
|
in: query
|
||||||
|
name: Status
|
||||||
|
type: integer
|
||||||
|
- description: 短信结果
|
||||||
|
in: query
|
||||||
|
name: Results
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
' data':
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/system_log_sms.SystemLogSmsResp'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
summary: 系统短信日志列表-所有
|
||||||
|
tags:
|
||||||
|
- system_log_sms-系统短信日志
|
||||||
/api/article_collect/list:
|
/api/article_collect/list:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
|
@@ -96,8 +96,8 @@ func RecordLog(title string, reqTypes ...requestType) gin.HandlerFunc {
|
|||||||
err := core.GetDB().Create(&system_model.SystemLogOperate{
|
err := core.GetDB().Create(&system_model.SystemLogOperate{
|
||||||
AdminId: adminId, Type: reqMethod, Title: title, Ip: ip,
|
AdminId: adminId, Type: reqMethod, Title: title, Ip: ip,
|
||||||
Url: urlPath, Method: method, Args: args, Error: errStr, Status: status,
|
Url: urlPath, Method: method, Args: args, Error: errStr, Status: status,
|
||||||
StartTime: core.ParseTimeToTsTime(startTime),
|
StartTime: util.NullTimeUtil.ParseTime(startTime),
|
||||||
EndTime: core.ParseTimeToTsTime(endTime),
|
EndTime: util.NullTimeUtil.ParseTime(endTime),
|
||||||
TaskTime: taskTime,
|
TaskTime: taskTime,
|
||||||
}).Error
|
}).Error
|
||||||
response.CheckErr(err, "RecordLog recover Create err")
|
response.CheckErr(err, "RecordLog recover Create err")
|
||||||
@@ -108,6 +108,9 @@ func RecordLog(title string, reqTypes ...requestType) gin.HandlerFunc {
|
|||||||
}()
|
}()
|
||||||
// 执行方法
|
// 执行方法
|
||||||
c.Next()
|
c.Next()
|
||||||
|
if config.Config.GinMode != "release" {
|
||||||
|
return
|
||||||
|
}
|
||||||
if len(c.Errors) > 0 {
|
if len(c.Errors) > 0 {
|
||||||
errStr = c.Errors.String()
|
errStr = c.Errors.String()
|
||||||
status = 2
|
status = 2
|
||||||
@@ -122,10 +125,17 @@ func RecordLog(title string, reqTypes ...requestType) gin.HandlerFunc {
|
|||||||
ip := c.ClientIP()
|
ip := c.ClientIP()
|
||||||
method := c.HandlerName()
|
method := c.HandlerName()
|
||||||
err := core.GetDB().Create(&system_model.SystemLogOperate{
|
err := core.GetDB().Create(&system_model.SystemLogOperate{
|
||||||
AdminId: adminId, Type: reqMethod, Title: title, Ip: ip,
|
AdminId: adminId,
|
||||||
Url: urlPath, Method: method, Args: args, Error: errStr, Status: status,
|
Type: reqMethod,
|
||||||
StartTime: core.ParseTimeToTsTime(startTime),
|
Title: title,
|
||||||
EndTime: core.ParseTimeToTsTime(endTime),
|
Ip: ip,
|
||||||
|
Url: urlPath,
|
||||||
|
Method: method,
|
||||||
|
Args: args,
|
||||||
|
Error: errStr,
|
||||||
|
Status: status,
|
||||||
|
StartTime: util.NullTimeUtil.ParseTime(startTime),
|
||||||
|
EndTime: util.NullTimeUtil.ParseTime(endTime),
|
||||||
TaskTime: taskTime,
|
TaskTime: taskTime,
|
||||||
}).Error
|
}).Error
|
||||||
response.CheckErr(err, "RecordLog Create err")
|
response.CheckErr(err, "RecordLog Create err")
|
||||||
|
@@ -12,7 +12,7 @@ type ArticleCollect struct {
|
|||||||
UserId int `gorm:"comment:'用户ID'"` // 用户ID
|
UserId int `gorm:"comment:'用户ID'"` // 用户ID
|
||||||
ArticleId int `gorm:"comment:'文章ID'"` // 文章ID
|
ArticleId int `gorm:"comment:'文章ID'"` // 文章ID
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,9 @@ type Album struct {
|
|||||||
Ext string `gorm:"not null;default:'';comment:'文件扩展'"`
|
Ext string `gorm:"not null;default:'';comment:'文件扩展'"`
|
||||||
Size int64 `gorm:"not null;default:0;comment:文件大小"`
|
Size int64 `gorm:"not null;default:0;comment:文件大小"`
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AlbumCate 相册分类实体
|
// AlbumCate 相册分类实体
|
||||||
@@ -30,7 +30,7 @@ type AlbumCate struct {
|
|||||||
Type int `gorm:"not null;default:10;comment:'文件类型: [10=图片, 20=视频]''"`
|
Type int `gorm:"not null;default:10;comment:'文件类型: [10=图片, 20=视频]''"`
|
||||||
Name string `gorm:"not null;default:'';comment:'分类名称''"`
|
Name string `gorm:"not null;default:'';comment:'分类名称''"`
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"`
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ type FlowApply struct {
|
|||||||
FormValue string `gorm:"comment:'表单值'"` // 表单值
|
FormValue string `gorm:"comment:'表单值'"` // 表单值
|
||||||
Status int `gorm:"comment:'状态:1待提交,2审批中,3审批完成,4审批失败'"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
Status int `gorm:"comment:'状态:1待提交,2审批中,3审批完成,4审批失败'"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
||||||
}
|
}
|
||||||
|
@@ -28,10 +28,10 @@ type FlowHistory struct {
|
|||||||
|
|
||||||
PassRemark string `gorm:"comment:'通过备注'"` // 通过备注
|
PassRemark string `gorm:"comment:'通过备注'"` // 通过备注
|
||||||
|
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||||
|
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||||
|
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@ type FlowTemplate struct {
|
|||||||
FlowProcessDataList string `gorm:"comment:'流程配置list数据'"` // 流程配置list数据
|
FlowProcessDataList string `gorm:"comment:'流程配置list数据'"` // 流程配置list数据
|
||||||
|
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
||||||
}
|
}
|
||||||
|
@@ -18,33 +18,33 @@ type GenTable struct {
|
|||||||
TreeName string `gorm:"not null;default:'';comment:'树显示字段'"`
|
TreeName string `gorm:"not null;default:'';comment:'树显示字段'"`
|
||||||
GenTpl string `gorm:"not null;default:'crud';comment:'生成模板方式: [crud=单表, tree=树表]'"`
|
GenTpl string `gorm:"not null;default:'crud';comment:'生成模板方式: [crud=单表, tree=树表]'"`
|
||||||
|
|
||||||
Remarks string `gorm:"not null;default:'';comment:'备注信息'"`
|
Remarks string `gorm:"not null;default:'';comment:'备注信息'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//GenTableColumn 代码生成表列实体
|
//GenTableColumn 代码生成表列实体
|
||||||
type GenTableColumn struct {
|
type GenTableColumn struct {
|
||||||
ID uint `gorm:"primarykey;comment:'列主键'"`
|
ID uint `gorm:"primarykey;comment:'列主键'"`
|
||||||
TableID uint `gorm:"not null;default:0;comment:'表外键'"`
|
TableID uint `gorm:"not null;default:0;comment:'表外键'"`
|
||||||
ColumnName string `gorm:"not null;default:'';comment:'列名称'"`
|
ColumnName string `gorm:"not null;default:'';comment:'列名称'"`
|
||||||
ColumnComment string `gorm:"not null;default:'';comment:'列描述'"`
|
ColumnComment string `gorm:"not null;default:'';comment:'列描述'"`
|
||||||
ColumnLength int `gorm:"not null;default:0;comment:'列长度'"`
|
ColumnLength int `gorm:"not null;default:0;comment:'列长度'"`
|
||||||
ColumnType string `gorm:"not null;default:'';comment:'列类型'"`
|
ColumnType string `gorm:"not null;default:'';comment:'列类型'"`
|
||||||
GoType string `gorm:"not null;default:'';comment:'类型'"`
|
GoType string `gorm:"not null;default:'';comment:'类型'"`
|
||||||
GoField string `gorm:"not null;default:'';comment:'字段名'"`
|
GoField string `gorm:"not null;default:'';comment:'字段名'"`
|
||||||
IsPk uint8 `gorm:"not null;default:0;comment:'是否主键: [1=是, 0=否]'"`
|
IsPk uint8 `gorm:"not null;default:0;comment:'是否主键: [1=是, 0=否]'"`
|
||||||
IsIncrement uint8 `gorm:"not null;default:0;comment:'是否自增: [1=是, 0=否]'"`
|
IsIncrement uint8 `gorm:"not null;default:0;comment:'是否自增: [1=是, 0=否]'"`
|
||||||
IsRequired uint8 `gorm:"not null;default:0;comment:'是否必填: [1=是, 0=否]'"`
|
IsRequired uint8 `gorm:"not null;default:0;comment:'是否必填: [1=是, 0=否]'"`
|
||||||
IsInsert uint8 `gorm:"not null;default:0;comment:'是否为插入字段: [1=是, 0=否]'"`
|
IsInsert uint8 `gorm:"not null;default:0;comment:'是否为插入字段: [1=是, 0=否]'"`
|
||||||
IsEdit uint8 `gorm:"not null;default:0;comment:'是否编辑字段: [1=是, 0=否]'"`
|
IsEdit uint8 `gorm:"not null;default:0;comment:'是否编辑字段: [1=是, 0=否]'"`
|
||||||
IsList uint8 `gorm:"not null;default:0;comment:'是否列表字段: [1=是, 0=否]'"`
|
IsList uint8 `gorm:"not null;default:0;comment:'是否列表字段: [1=是, 0=否]'"`
|
||||||
IsQuery uint8 `gorm:"not null;default:0;comment:'是否查询字段: [1=是, 0=否]'"`
|
IsQuery uint8 `gorm:"not null;default:0;comment:'是否查询字段: [1=是, 0=否]'"`
|
||||||
QueryType string `gorm:"not null;default:'=';comment:'查询方式: [等于、不等于、大于、小于、范围]'"`
|
QueryType string `gorm:"not null;default:'=';comment:'查询方式: [等于、不等于、大于、小于、范围]'"`
|
||||||
HtmlType string `gorm:"not null;default:'';comment:'显示类型: [文本框、文本域、下拉框、复选框、单选框、日期控件]'"`
|
HtmlType string `gorm:"not null;default:'';comment:'显示类型: [文本框、文本域、下拉框、复选框、单选框、日期控件]'"`
|
||||||
DictType string `gorm:"not null;default:'';comment:'字典类型'"`
|
DictType string `gorm:"not null;default:'';comment:'字典类型'"`
|
||||||
ListAllApi string `gorm:"not null;default:'';comment:'列表数据来源'"`
|
ListAllApi string `gorm:"not null;default:'';comment:'列表数据来源'"`
|
||||||
Sort int `gorm:"not null;default:0;comment:'排序编号'"`
|
Sort int `gorm:"not null;default:0;comment:'排序编号'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
}
|
}
|
||||||
|
@@ -26,8 +26,8 @@ type MonitorClient struct {
|
|||||||
|
|
||||||
Ua string `gorm:"comment:'ua记录'" excel:"name:ua记录;"` // ua记录
|
Ua string `gorm:"comment:'ua记录'" excel:"name:ua记录;"` // ua记录
|
||||||
|
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'" excel:"name:创建时间;"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'" excel:"name:创建时间;"` // 创建时间
|
||||||
|
|
||||||
ClientTime core.TsTime `gorm:"comment:'更新时间'" excel:"name:更新时间;"` // 更新时间
|
ClientTime core.NullTime `gorm:"comment:'更新时间'" excel:"name:更新时间;"` // 更新时间
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,10 @@ type MonitorProject struct {
|
|||||||
|
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
|
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||||
|
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||||
|
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,8 @@ type MonitorWeb struct {
|
|||||||
|
|
||||||
Stack string `gorm:"comment:'错误堆栈'"` // 错误堆栈
|
Stack string `gorm:"comment:'错误堆栈'"` // 错误堆栈
|
||||||
|
|
||||||
ClientTime core.TsTime `gorm:"comment:'客户端时间'"` // 客户端时间
|
ClientTime core.NullTime `gorm:"comment:'客户端时间'"` // 客户端时间
|
||||||
|
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@ type DictData struct {
|
|||||||
Sort uint16 `gorm:"not null;default:0;comment:'排序'"`
|
Sort uint16 `gorm:"not null;default:0;comment:'排序'"`
|
||||||
Status uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
|
Status uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"`
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ type DictType struct {
|
|||||||
DictRemark string `gorm:"not null;default:'';comment:'字典备注'"`
|
DictRemark string `gorm:"not null;default:'';comment:'字典备注'"`
|
||||||
DictStatus uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
|
DictStatus uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"`
|
||||||
}
|
}
|
||||||
|
@@ -6,35 +6,13 @@ import (
|
|||||||
|
|
||||||
// SystemLogSms 系统短信日志实体
|
// SystemLogSms 系统短信日志实体
|
||||||
type SystemLogSms struct {
|
type SystemLogSms struct {
|
||||||
Id int `gorm:"primarykey;"` // id
|
Id int `gorm:"primarykey;comment:'id'"` // id
|
||||||
Scene int `` // 场景编号
|
Scene core.NullInt `gorm:"comment:'场景编号'"` // 场景编号
|
||||||
Mobile string `` // 手机号码
|
Mobile string `gorm:"comment:'手机号码'"` // 手机号码
|
||||||
Content string `` // 发送内容
|
Content string `gorm:"comment:'发送内容'"` // 发送内容
|
||||||
Status int `` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
Status core.NullInt `gorm:"comment:'发送状态:[0=发送中, 1=发送成功, 2=发送失败]'"` // 发送状态:[0=发送中, 1=发送成功, 2=发送失败]
|
||||||
Results string `` // 短信结果
|
Results string `gorm:"comment:'短信结果'"` // 短信结果
|
||||||
SendTime int `` // 发送时间
|
SendTime core.NullTime `gorm:"comment:'发送时间'"` // 发送时间
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// func (t *SystemLogSms) BeforeCreate(tx *gorm.DB) (err error) {
|
|
||||||
// // u.Id = uuid.New()
|
|
||||||
// // t.CreateTime = core.NowTime().String()
|
|
||||||
|
|
||||||
// t.CreateTime = core.NowTime()
|
|
||||||
// t.UpdateTime = core.NowTime()
|
|
||||||
// tx.Statement.SetColumn("CreateTime", t.CreateTime.String())
|
|
||||||
// tx.Statement.SetColumn("UpdateTime", t.UpdateTime.String())
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// func (t *SystemLogSms) BeforeSave(tx *gorm.DB) (err error) {
|
|
||||||
|
|
||||||
// t.UpdateTime = core.NowTime()
|
|
||||||
// tx.Statement.SetColumn("UpdateTime", t.UpdateTime.String())
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// func (t *SystemLogSms) BeforeDelete(tx *gorm.DB) (err error) {
|
|
||||||
// t.UpdateTime = core.NowTime()
|
|
||||||
// tx.Statement.SetColumn("UpdateTime", t.UpdateTime.String())
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
@@ -8,12 +8,12 @@ import (
|
|||||||
|
|
||||||
// SystemConfig 系统配置实体
|
// SystemConfig 系统配置实体
|
||||||
type SystemConfig struct {
|
type SystemConfig struct {
|
||||||
ID uint `gorm:"primarykey;comment:'主键'"`
|
ID uint `gorm:"primarykey;comment:'主键'"`
|
||||||
Type string `gorm:"default:'';comment:'类型''"`
|
Type string `gorm:"default:'';comment:'类型''"`
|
||||||
Name string `gorm:"not null;default:'';comment:'键'"`
|
Name string `gorm:"not null;default:'';comment:'键'"`
|
||||||
Value string `gorm:"type:text;not null;default:'';comment:'值'"`
|
Value string `gorm:"type:text;not null;default:'';comment:'值'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemAuthAdmin 系统管理员实体
|
// SystemAuthAdmin 系统管理员实体
|
||||||
@@ -31,10 +31,10 @@ type SystemAuthAdmin struct {
|
|||||||
IsDisable uint8 `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"`
|
IsDisable uint8 `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"`
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
LastLoginIp string `gorm:"not null;default:'';comment:'最后登录IP'"`
|
LastLoginIp string `gorm:"not null;default:'';comment:'最后登录IP'"`
|
||||||
LastLoginTime core.TsTime `gorm:"default:null;comment:'最后登录时间'"`
|
LastLoginTime core.NullTime `gorm:"default:null;comment:'最后登录时间'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemAuthMenu 系统菜单实体
|
// SystemAuthMenu 系统菜单实体
|
||||||
@@ -53,8 +53,8 @@ type SystemAuthMenu struct {
|
|||||||
IsCache uint8 `gorm:"not null;default:0;comment:'是否缓存: 0=否, 1=是''"`
|
IsCache uint8 `gorm:"not null;default:0;comment:'是否缓存: 0=否, 1=是''"`
|
||||||
IsShow uint8 `gorm:"not null;default:1;comment:'是否显示: 0=否, 1=是'"`
|
IsShow uint8 `gorm:"not null;default:1;comment:'是否显示: 0=否, 1=是'"`
|
||||||
IsDisable soft_delete.DeletedAt `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"`
|
IsDisable soft_delete.DeletedAt `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemAuthPerm 系统角色菜单实体
|
// SystemAuthPerm 系统角色菜单实体
|
||||||
@@ -66,13 +66,13 @@ type SystemAuthPerm struct {
|
|||||||
|
|
||||||
// SystemAuthRole 系统角色实体
|
// SystemAuthRole 系统角色实体
|
||||||
type SystemAuthRole struct {
|
type SystemAuthRole struct {
|
||||||
ID uint `gorm:"primarykey;comment:'主键'"`
|
ID uint `gorm:"primarykey;comment:'主键'"`
|
||||||
Name string `gorm:"not null;default:'';comment:'角色名称''"`
|
Name string `gorm:"not null;default:'';comment:'角色名称''"`
|
||||||
Remark string `gorm:"not null;default:'';comment:'备注信息'"`
|
Remark string `gorm:"not null;default:'';comment:'备注信息'"`
|
||||||
IsDisable uint8 `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"`
|
IsDisable uint8 `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"`
|
||||||
Sort uint16 `gorm:"not null;default:0;comment:'角色排序'"`
|
Sort uint16 `gorm:"not null;default:0;comment:'角色排序'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemAuthDept 系统部门实体
|
// SystemAuthDept 系统部门实体
|
||||||
@@ -86,9 +86,9 @@ type SystemAuthDept struct {
|
|||||||
Sort uint16 `gorm:"not null;default:0;comment:'排序编号'"`
|
Sort uint16 `gorm:"not null;default:0;comment:'排序编号'"`
|
||||||
IsStop uint8 `gorm:"not null;default:0;comment:'是否停用: 0=否, 1=是'"`
|
IsStop uint8 `gorm:"not null;default:0;comment:'是否停用: 0=否, 1=是'"`
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
DeleteTime core.TsTime `gorm:"default:0;comment:'删除时间'"`
|
DeleteTime core.NullTime `gorm:"default:0;comment:'删除时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemAuthPost 系统岗位管理
|
// SystemAuthPost 系统岗位管理
|
||||||
@@ -100,37 +100,37 @@ type SystemAuthPost struct {
|
|||||||
Sort uint16 `gorm:"not null;default:0;comment:'岗位排序'"`
|
Sort uint16 `gorm:"not null;default:0;comment:'岗位排序'"`
|
||||||
IsStop uint8 `gorm:"not null;default:0;comment:'是否停用: 0=否, 1=是'"`
|
IsStop uint8 `gorm:"not null;default:0;comment:'是否停用: 0=否, 1=是'"`
|
||||||
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
UpdateTime core.NullTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
|
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemLogLogin 系统登录日志实体
|
// SystemLogLogin 系统登录日志实体
|
||||||
type SystemLogLogin struct {
|
type SystemLogLogin struct {
|
||||||
ID uint `gorm:"primarykey;comment:'主键'"`
|
ID uint `gorm:"primarykey;comment:'主键'"`
|
||||||
AdminId uint `gorm:"not null;default:0;comment:'管理员ID'"`
|
AdminId uint `gorm:"not null;default:0;comment:'管理员ID'"`
|
||||||
Username string `gorm:"not null;default:'';comment:'登录账号'"`
|
Username string `gorm:"not null;default:'';comment:'登录账号'"`
|
||||||
Ip string `gorm:"not null;default:'';comment:'登录地址'"`
|
Ip string `gorm:"not null;default:'';comment:'登录地址'"`
|
||||||
Os string `gorm:"not null;default:'';comment:'操作系统'"`
|
Os string `gorm:"not null;default:'';comment:'操作系统'"`
|
||||||
Browser string `gorm:"not null;default:'';comment:'浏览器'"`
|
Browser string `gorm:"not null;default:'';comment:'浏览器'"`
|
||||||
Status uint8 `gorm:"not null;default:0;comment:'操作状态: 1=成功, 0=失败'"`
|
Status uint8 `gorm:"not null;default:0;comment:'操作状态: 1=成功, 0=失败'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemLogOperate 系统操作日志实体
|
// SystemLogOperate 系统操作日志实体
|
||||||
type SystemLogOperate struct {
|
type SystemLogOperate struct {
|
||||||
ID uint `gorm:"primarykey;comment:'主键'"`
|
ID uint `gorm:"primarykey;comment:'主键'"`
|
||||||
AdminId uint `gorm:"not null;default:0;comment:'操作人ID'"`
|
AdminId uint `gorm:"not null;default:0;comment:'操作人ID'"`
|
||||||
Type string `gorm:"not null;default:'';comment:'请求类型: GET/POST/PUT'"`
|
Type string `gorm:"not null;default:'';comment:'请求类型: GET/POST/PUT'"`
|
||||||
Title string `gorm:"default:'';comment:'操作标题'"`
|
Title string `gorm:"default:'';comment:'操作标题'"`
|
||||||
Ip string `gorm:"not null;default:'';comment:'请求IP'"`
|
Ip string `gorm:"not null;default:'';comment:'请求IP'"`
|
||||||
Url string `gorm:"not null;default:'';comment:'请求接口'"`
|
Url string `gorm:"not null;default:'';comment:'请求接口'"`
|
||||||
Method string `gorm:"not null;default:'';comment:'请求方法'"`
|
Method string `gorm:"not null;default:'';comment:'请求方法'"`
|
||||||
Args string `gorm:"comment:'请求参数'"`
|
Args string `gorm:"comment:'请求参数'"`
|
||||||
Error string `gorm:"comment:'错误信息'"`
|
Error string `gorm:"comment:'错误信息'"`
|
||||||
Status uint8 `gorm:"not null;default:0;comment:'执行状态: 1=成功, 2=失败'"`
|
Status uint8 `gorm:"not null;default:0;comment:'执行状态: 1=成功, 2=失败'"`
|
||||||
StartTime core.TsTime `gorm:"not null;default:0;comment:'开始时间'"`
|
StartTime core.NullTime `gorm:"not null;default:0;comment:'开始时间'"`
|
||||||
EndTime core.TsTime `gorm:"not null;default:0;comment:'结束时间'"`
|
EndTime core.NullTime `gorm:"not null;default:0;comment:'结束时间'"`
|
||||||
TaskTime int64 `gorm:"not null;default:0;comment:'执行耗时'"`
|
TaskTime int64 `gorm:"not null;default:0;comment:'执行耗时'"`
|
||||||
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
CreateTime core.NullTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,6 @@ func (c convertUtil) StructsToMaps(from interface{}) (data []map[string]interfac
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
for _, v := range objList {
|
for _, v := range objList {
|
||||||
// data = append(data, structs.Map(v))
|
|
||||||
data = append(data, c.StructToMap(v))
|
data = append(data, c.StructToMap(v))
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
@@ -44,10 +43,18 @@ func (c convertUtil) MapToStruct(from interface{}, to interface{}) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// StructToStruct 将结构体from弱类型转换成结构体to,需要tag:json,mapstructure
|
// StructToStruct 将结构体from弱类型转换成结构体to
|
||||||
func (c convertUtil) StructToStruct(from interface{}, to interface{}) (err error) {
|
func (c convertUtil) StructToStruct(from interface{}, to interface{}) (err error) {
|
||||||
m := c.StructToMap(from)
|
m := c.StructToMap(from)
|
||||||
err = c.MapToStruct(m, to)
|
err = c.MapToStruct(m, to)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c convertUtil) Copy(toValue interface{}, fromValue interface{}) interface{} {
|
||||||
|
if err := copier.Copy(toValue, fromValue); err != nil {
|
||||||
|
core.Logger.Errorf("Copy err: err=[%+v]", err)
|
||||||
|
panic("SystemError")
|
||||||
|
}
|
||||||
|
return toValue
|
||||||
|
}
|
||||||
|
@@ -16,16 +16,16 @@ type Excel struct {
|
|||||||
type Col struct {
|
type Col struct {
|
||||||
Name string
|
Name string
|
||||||
Key string
|
Key string
|
||||||
Width int
|
Width int // 宽度
|
||||||
Replace map[string]any
|
Replace map[string]any //实现值的替换
|
||||||
Encode func(value any) any //暂未使用
|
Encode func(value any) any //暂未使用
|
||||||
Decode func(value any) any
|
Decode func(value any) (any, error) //实现类型、值的替换
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下载
|
// 下载
|
||||||
func DownLoadExcel(fileName string, res http.ResponseWriter, file *excelize.File) {
|
func DownLoadExcel(fileName string, res http.ResponseWriter, file *excelize.File) {
|
||||||
// 设置响应头
|
// 设置响应头
|
||||||
res.Header().Set("Content-Type", "text/html; charset=UTF-8")
|
// res.Header().Set("Content-Type", "text/html; charset=UTF-8")
|
||||||
res.Header().Set("Content-Type", "application/octet-stream")
|
res.Header().Set("Content-Type", "application/octet-stream")
|
||||||
res.Header().Set("Content-Disposition", "attachment; filename="+fileName+".xlsx")
|
res.Header().Set("Content-Disposition", "attachment; filename="+fileName+".xlsx")
|
||||||
res.Header().Set("Access-Control-Expose-Headers", "Content-Disposition")
|
res.Header().Set("Access-Control-Expose-Headers", "Content-Disposition")
|
||||||
|
@@ -18,17 +18,17 @@ func GetExcelColumnName(columnNumber int) string {
|
|||||||
return columnName
|
return columnName
|
||||||
}
|
}
|
||||||
|
|
||||||
// NormalDynamicExport 导出excel
|
// Export 导出excel
|
||||||
// lists 要导出的数据
|
// lists 要导出的数据
|
||||||
// cols 列
|
// cols 列
|
||||||
// sheet 文档
|
// sheet 文档
|
||||||
// title 标题
|
// title 标题
|
||||||
func NormalDynamicExport(lists any, cols []Col, sheet string, title string) (file *excelize.File, err error) {
|
func Export(lists any, cols []Col, sheet string, title string) (file *excelize.File, err error) {
|
||||||
e := ExcelInit()
|
e := ExcelInit()
|
||||||
|
|
||||||
listsAny := util.ConvertUtil.StructsToMaps(lists)
|
data := util.ConvertUtil.StructsToMaps(lists)
|
||||||
|
|
||||||
err = ExportExcel(sheet, title, listsAny, cols, e)
|
err = ExportExcel(sheet, title, data, cols, e)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -42,17 +42,17 @@ func ExportExcel(sheet, title string, lists []map[string]interface{}, cols []Col
|
|||||||
e.F.NewSheet(sheet)
|
e.F.NewSheet(sheet)
|
||||||
}
|
}
|
||||||
// 构造表头
|
// 构造表头
|
||||||
endColName, startDataRow, err := normalBuildTitle(e, sheet, title, cols)
|
endColName, startDataRow, err := buildTitle(e, sheet, title, cols)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 构造数据行
|
// 构造数据行
|
||||||
err = normalBuildDataRow(e, sheet, endColName, startDataRow, lists, cols)
|
err = buildDataRow(e, sheet, endColName, startDataRow, lists, cols)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构造表头(endColName 最后一列的列名 startDataRow 数据行开始的行号)
|
// 构造表头(endColName 最后一列的列名 startDataRow 数据行开始的行号)
|
||||||
func normalBuildTitle(e *Excel, sheet, title string, cols []Col) (endColName string, startDataRow int, err error) {
|
func buildTitle(e *Excel, sheet, title string, cols []Col) (endColName string, startDataRow int, err error) {
|
||||||
var titleRowData []interface{} // 列头行
|
var titleRowData []interface{} // 列头行
|
||||||
for i, colTitle := range cols {
|
for i, colTitle := range cols {
|
||||||
endColName := GetExcelColumnName(i + 1)
|
endColName := GetExcelColumnName(i + 1)
|
||||||
@@ -87,7 +87,7 @@ func normalBuildTitle(e *Excel, sheet, title string, cols []Col) (endColName str
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 构造数据行
|
// 构造数据行
|
||||||
func normalBuildDataRow(e *Excel, sheet, endColName string, startDataRow int, lists []map[string]interface{}, cols []Col) (err error) {
|
func buildDataRow(e *Excel, sheet, endColName string, startDataRow int, lists []map[string]interface{}, cols []Col) (err error) {
|
||||||
//实时写入数据
|
//实时写入数据
|
||||||
for i := 0; i < len(lists); i++ {
|
for i := 0; i < len(lists); i++ {
|
||||||
startCol := fmt.Sprintf("A%d", startDataRow)
|
startCol := fmt.Sprintf("A%d", startDataRow)
|
||||||
@@ -102,6 +102,11 @@ func normalBuildDataRow(e *Excel, sheet, endColName string, startDataRow int, li
|
|||||||
|
|
||||||
val := list[col.Key]
|
val := list[col.Key]
|
||||||
|
|
||||||
|
// 先编码
|
||||||
|
if col.Encode != nil {
|
||||||
|
val = col.Encode(val)
|
||||||
|
}
|
||||||
|
// 再替换
|
||||||
for replaceKey, v := range replace {
|
for replaceKey, v := range replace {
|
||||||
|
|
||||||
if replaceKey == fmt.Sprintf("%v", val) {
|
if replaceKey == fmt.Sprintf("%v", val) {
|
||||||
|
@@ -79,16 +79,19 @@ func importData(f *excelize.File, dst interface{}, sheetName string, startRow in
|
|||||||
replace := col.Replace
|
replace := col.Replace
|
||||||
|
|
||||||
val := rows[i][j]
|
val := rows[i][j]
|
||||||
// 将val替换为key
|
// 先替换,将val替换为key
|
||||||
for replaceKey, v := range replace {
|
for replaceKey, v := range replace {
|
||||||
if fmt.Sprintf("%v", v) == fmt.Sprintf("%v", val) {
|
if fmt.Sprintf("%v", v) == fmt.Sprintf("%v", val) {
|
||||||
val = fmt.Sprintf("%v", replaceKey)
|
val = fmt.Sprintf("%v", replaceKey)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 再解码
|
||||||
if col.Decode != nil {
|
if col.Decode != nil {
|
||||||
rowMap[key] = col.Decode(val)
|
v, e := col.Decode(val)
|
||||||
|
if e == nil {
|
||||||
|
rowMap[key] = v
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rowMap[key] = val
|
rowMap[key] = val
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ func TestExport(t *testing.T) {
|
|||||||
"备注备注备注备注com哈哈哈哈哈哈哈哈这里是最大行高测试哈哈哈哈哈哈哈哈这里是最大行高测试哈哈哈哈哈哈哈哈这里是最大行高测里是最大行高测试哈哈哈哈哈哈哈哈这里是最大行高测试"},
|
"备注备注备注备注com哈哈哈哈哈哈哈哈这里是最大行高测试哈哈哈哈哈哈哈哈这里是最大行高测试哈哈哈哈哈哈哈哈这里是最大行高测里是最大行高测试哈哈哈哈哈哈哈哈这里是最大行高测试"},
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := NormalDynamicExport(testList, cols, "Sheet1", "用户信息")
|
f, err := Export(testList, cols, "Sheet1", "用户信息")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return
|
return
|
||||||
|
108
server/util/null_time.go
Normal file
108
server/util/null_time.go
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
"x_admin/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
var NullTimeUtil = nullTimeUtil{
|
||||||
|
DateFormat: "2006-01-02",
|
||||||
|
TimeFormat: "2006-01-02 15:04:05",
|
||||||
|
}
|
||||||
|
|
||||||
|
// arrayUtil 数组工具类
|
||||||
|
type nullTimeUtil struct {
|
||||||
|
DateFormat string
|
||||||
|
TimeFormat string
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecodeTime 时间解码
|
||||||
|
func (t nullTimeUtil) DecodeTime(value any) (any, error) {
|
||||||
|
tt, e := t.Parse(value)
|
||||||
|
return tt, e
|
||||||
|
}
|
||||||
|
|
||||||
|
// EncodeTime 时间编码
|
||||||
|
func (t nullTimeUtil) EncodeTime(value any) any {
|
||||||
|
var str = ""
|
||||||
|
switch v := value.(type) {
|
||||||
|
case map[string]interface{}:
|
||||||
|
tt := v["Time"]
|
||||||
|
|
||||||
|
ttt, _ := t.Parse(tt)
|
||||||
|
str = ttt.String()
|
||||||
|
}
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToUnix 时间戳转时间戳
|
||||||
|
func (t nullTimeUtil) ToUnix(date any) int64 {
|
||||||
|
switch v := date.(type) {
|
||||||
|
case string:
|
||||||
|
if v == "" {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
tt, e := time.Parse(t.TimeFormat, v)
|
||||||
|
if e != nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return time.Time(tt).Unix()
|
||||||
|
case time.Time:
|
||||||
|
return v.Unix()
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse 时间戳转时间
|
||||||
|
func (t nullTimeUtil) Parse(value interface{}) (core.NullTime, error) {
|
||||||
|
switch v := value.(type) {
|
||||||
|
case string:
|
||||||
|
tt, e := t.ParseString(v)
|
||||||
|
return tt, e
|
||||||
|
case time.Time:
|
||||||
|
tt := t.ParseTime(v)
|
||||||
|
return tt, nil
|
||||||
|
case core.NullTime:
|
||||||
|
return v, nil
|
||||||
|
default:
|
||||||
|
return t.Null(), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseTime 时间转时间戳
|
||||||
|
func (t nullTimeUtil) ParseTime(date time.Time) core.NullTime {
|
||||||
|
return core.NullTime{
|
||||||
|
Time: &date,
|
||||||
|
Valid: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseString 时间字符串转时间戳
|
||||||
|
func (t nullTimeUtil) ParseString(date string) (core.NullTime, error) {
|
||||||
|
tt, e := time.Parse(t.TimeFormat, date)
|
||||||
|
if e != nil {
|
||||||
|
return t.Null(), e
|
||||||
|
}
|
||||||
|
return core.NullTime{
|
||||||
|
Time: &tt,
|
||||||
|
Valid: true,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NowTime 当前时间
|
||||||
|
func (t nullTimeUtil) Null() core.NullTime {
|
||||||
|
return core.NullTime{
|
||||||
|
Time: nil,
|
||||||
|
Valid: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NowTime 当前时间
|
||||||
|
func (t nullTimeUtil) Now() core.NullTime {
|
||||||
|
now := time.Now()
|
||||||
|
return core.NullTime{
|
||||||
|
Time: &now,
|
||||||
|
Valid: true,
|
||||||
|
}
|
||||||
|
}
|
76
server/util/time.go
Normal file
76
server/util/time.go
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"time"
|
||||||
|
"x_admin/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
var TimeUtil = timeUtil{
|
||||||
|
DateFormat: "2006-01-02",
|
||||||
|
TimeFormat: "2006-01-02 15:04:05",
|
||||||
|
}
|
||||||
|
|
||||||
|
// arrayUtil 数组工具类
|
||||||
|
type timeUtil struct {
|
||||||
|
DateFormat string
|
||||||
|
TimeFormat string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToUnix 时间戳转时间戳
|
||||||
|
func (t timeUtil) ToUnix(date any) int64 {
|
||||||
|
switch v := date.(type) {
|
||||||
|
case string:
|
||||||
|
if v == "" {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
tt, e := time.Parse(t.TimeFormat, v)
|
||||||
|
if e != nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return time.Time(tt).Unix()
|
||||||
|
case time.Time:
|
||||||
|
return v.Unix()
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseTsTime 时间戳转时间
|
||||||
|
func (t timeUtil) ParseTsTime(value any) (core.TsTime, error) {
|
||||||
|
switch v := value.(type) {
|
||||||
|
case string:
|
||||||
|
tt, e := t.ParseString(v)
|
||||||
|
return tt, e
|
||||||
|
case time.Time:
|
||||||
|
tt := t.ParseTime(v)
|
||||||
|
return tt, nil
|
||||||
|
default:
|
||||||
|
return t.NowTime(), errors.New("not support type")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseTime 时间转时间戳
|
||||||
|
func (t timeUtil) ParseTime(date time.Time) core.TsTime {
|
||||||
|
return core.TsTime(date)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseString 时间字符串转时间戳
|
||||||
|
func (t timeUtil) ParseString(date string) (core.TsTime, error) {
|
||||||
|
tt, e := time.Parse(t.TimeFormat, date)
|
||||||
|
if e != nil {
|
||||||
|
return t.NowTime(), e
|
||||||
|
}
|
||||||
|
return core.TsTime(tt), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NowTime 当前时间
|
||||||
|
func (t timeUtil) NowTime() core.TsTime {
|
||||||
|
return core.TsTime(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecodeTime 时间解码
|
||||||
|
func (t timeUtil) DecodeTime(value any) (any, error) {
|
||||||
|
tt, e := t.ParseTsTime(value)
|
||||||
|
return tt, e
|
||||||
|
}
|
@@ -68,19 +68,7 @@ func (vu verifyUtil) VerifyJSON(c *gin.Context, obj any) (e error) {
|
|||||||
e = response.ParamsValidError.SetData(errs.Translate(trans))
|
e = response.ParamsValidError.SetData(errs.Translate(trans))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// response.Copy(obj, reqInfo)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
// if err := c.ShouldBindBodyWith(obj, binding.JSON); err != nil {
|
|
||||||
// errs, ok := err.(validator.ValidationErrors)
|
|
||||||
// if !ok {
|
|
||||||
// e = response.ParamsValidError.SetData(err.Error())
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// e = response.ParamsValidError.SetData(errs.Translate(trans))
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (vu verifyUtil) VerifyJSONArray(c *gin.Context, obj any) (e error) {
|
func (vu verifyUtil) VerifyJSONArray(c *gin.Context, obj any) (e error) {
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
import { request } from '@/utils/request'
|
import { request } from '@/utils/request'
|
||||||
import type { Pages } from '@/utils/request'
|
import type { Pages } from '@/utils/request'
|
||||||
|
import { clearObjEmpty } from "@/utils/utils";
|
||||||
|
|
||||||
export type type_system_log_sms = {
|
export type type_system_log_sms = {
|
||||||
id?: number;
|
id?: number;
|
||||||
scene?: number;
|
scene?: number;
|
||||||
@@ -7,7 +9,7 @@ export type type_system_log_sms = {
|
|||||||
content?: string;
|
content?: string;
|
||||||
status?: number;
|
status?: number;
|
||||||
results?: string;
|
results?: string;
|
||||||
send_time?: number;
|
send_time?: string;
|
||||||
create_time?: string;
|
create_time?: string;
|
||||||
update_time?: string;
|
update_time?: string;
|
||||||
}
|
}
|
||||||
@@ -18,10 +20,11 @@ export type type_system_log_sms_query = {
|
|||||||
content?: string;
|
content?: string;
|
||||||
status?: number;
|
status?: number;
|
||||||
results?: string;
|
results?: string;
|
||||||
send_time?: number;
|
send_time_start?: string;
|
||||||
create_timeStart?: string;
|
send_timeEnd?: string;
|
||||||
|
create_time_start?: string;
|
||||||
create_timeEnd?: string;
|
create_timeEnd?: string;
|
||||||
update_timeStart?: string;
|
update_time_start?: string;
|
||||||
update_timeEnd?: string;
|
update_timeEnd?: string;
|
||||||
}
|
}
|
||||||
// 添加编辑
|
// 添加编辑
|
||||||
@@ -32,7 +35,7 @@ export type type_system_log_sms_edit = {
|
|||||||
content?: string;
|
content?: string;
|
||||||
status?: number;
|
status?: number;
|
||||||
results?: string;
|
results?: string;
|
||||||
send_time?: number;
|
send_time?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +44,7 @@ export function system_log_sms_list(params?: type_system_log_sms_query) {
|
|||||||
return request<Pages<type_system_log_sms>>({
|
return request<Pages<type_system_log_sms>>({
|
||||||
url: '/system_log_sms/list',
|
url: '/system_log_sms/list',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: params
|
data: clearObjEmpty(params)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 系统短信日志列表-所有
|
// 系统短信日志列表-所有
|
||||||
@@ -49,7 +52,7 @@ export function system_log_sms_list_all(params?: type_system_log_sms_query) {
|
|||||||
return request<type_system_log_sms[]>({
|
return request<type_system_log_sms[]>({
|
||||||
url: '/system_log_sms/listAll',
|
url: '/system_log_sms/listAll',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: params
|
data: clearObjEmpty(params)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
<uv-textarea v-model="form.results" border="surround"></uv-textarea>
|
<uv-textarea v-model="form.results" border="surround"></uv-textarea>
|
||||||
</uv-form-item>
|
</uv-form-item>
|
||||||
<uv-form-item label="发送时间" prop="send_time" borderBottom>
|
<uv-form-item label="发送时间" prop="send_time" borderBottom>
|
||||||
<uv-number-box v-model="form.send_time" :min="-99999999" :max="99999999" :integer="true"></uv-number-box>
|
<x-date v-model:time="form.send_time"></x-date>
|
||||||
</uv-form-item>
|
</uv-form-item>
|
||||||
|
|
||||||
<uv-button type="primary" text="提交" customStyle="margin: 40rpx 0"
|
<uv-button type="primary" text="提交" customStyle="margin: 40rpx 0"
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
content: '',
|
content: '',
|
||||||
status: '',
|
status: '',
|
||||||
results: '',
|
results: '',
|
||||||
send_time: 0,
|
send_time: '',
|
||||||
});
|
});
|
||||||
const formRules = {
|
const formRules = {
|
||||||
id: [
|
id: [
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
send_time: [
|
send_time: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入发送时间',
|
message: '请选择发送时间',
|
||||||
trigger: ['blur']
|
trigger: ['blur']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@@ -74,11 +74,12 @@ const queryParams = reactive<type_system_log_sms_query>({
|
|||||||
content: '',
|
content: '',
|
||||||
status: '',
|
status: '',
|
||||||
results: '',
|
results: '',
|
||||||
send_time: '',
|
send_time_start: '',
|
||||||
create_timeStart: '',
|
send_time_end: '',
|
||||||
create_timeEnd: '',
|
create_time_start: '',
|
||||||
update_timeStart: '',
|
create_time_end: '',
|
||||||
update_timeEnd: '',
|
update_time_start: '',
|
||||||
|
update_time_end: '',
|
||||||
});
|
});
|
||||||
let activeFab = ref(false);
|
let activeFab = ref(false);
|
||||||
let fromSearch=ref(false);
|
let fromSearch=ref(false);
|
||||||
|
@@ -14,14 +14,16 @@
|
|||||||
<uv-form-item label="短信结果" prop="results" borderBottom>
|
<uv-form-item label="短信结果" prop="results" borderBottom>
|
||||||
</uv-form-item>
|
</uv-form-item>
|
||||||
<uv-form-item label="发送时间" prop="send_time" borderBottom>
|
<uv-form-item label="发送时间" prop="send_time" borderBottom>
|
||||||
|
<x-date-range v-model:startTime="form.send_time_start"
|
||||||
|
v-model:endTime="form.send_time_end"></x-date-range>
|
||||||
</uv-form-item>
|
</uv-form-item>
|
||||||
<uv-form-item label="创建时间" prop="create_time" borderBottom>
|
<uv-form-item label="创建时间" prop="create_time" borderBottom>
|
||||||
<x-date-range v-model:startTime="form.create_timeStart"
|
<x-date-range v-model:startTime="form.create_time_start"
|
||||||
v-model:endTime="form.create_timeEnd"></x-date-range>
|
v-model:endTime="form.create_time_end"></x-date-range>
|
||||||
</uv-form-item>
|
</uv-form-item>
|
||||||
<uv-form-item label="更新时间" prop="update_time" borderBottom>
|
<uv-form-item label="更新时间" prop="update_time" borderBottom>
|
||||||
<x-date-range v-model:startTime="form.update_timeStart"
|
<x-date-range v-model:startTime="form.update_time_start"
|
||||||
v-model:endTime="form.update_timeEnd"></x-date-range>
|
v-model:endTime="form.update_time_end"></x-date-range>
|
||||||
</uv-form-item>
|
</uv-form-item>
|
||||||
|
|
||||||
<uv-button type="primary" text="搜索" customStyle="margin-top: 20rpx" @click="submit"></uv-button>
|
<uv-button type="primary" text="搜索" customStyle="margin-top: 20rpx" @click="submit"></uv-button>
|
||||||
@@ -59,11 +61,12 @@ const { dictData } = useDictData<{
|
|||||||
content: null,
|
content: null,
|
||||||
status: null,
|
status: null,
|
||||||
results: null,
|
results: null,
|
||||||
send_time: null,
|
send_time_start: null,
|
||||||
create_timeStart: null,
|
send_time_end: null,
|
||||||
create_timeEnd: null,
|
create_time_start: null,
|
||||||
update_timeStart: null,
|
create_time_end: null,
|
||||||
update_timeEnd: null,
|
update_time_start: null,
|
||||||
|
update_time_end: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
|
Reference in New Issue
Block a user