Compare commits
8 Commits
462c476141
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| cd061668f9 | |||
| cee1687373 | |||
| 28aec98414 | |||
| 6d379714cd | |||
| 8c615d01b1 | |||
| d4eb597575 | |||
| f8022662aa | |||
| 1c7d71e688 |
@@ -11,7 +11,11 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 构建Docker镜像
|
- name: 构建Docker镜像
|
||||||
run: docker build -t dypid:latest .
|
run: |
|
||||||
|
set -x
|
||||||
|
git_hash=$(git rev-parse --short "$GITHUB_SHA")
|
||||||
|
build_date=$(TZ=Asia/Shanghai date +"%Y%m%d%H%M")
|
||||||
|
docker build --build-arg VERSION="dev - $build_date - $git_hash" -t dypid:latest .
|
||||||
|
|
||||||
- name: 导出镜像
|
- name: 导出镜像
|
||||||
run: mkdir release && docker save -o release/dypid.tar dypid:latest && docker rmi dypid:latest
|
run: mkdir release && docker save -o release/dypid.tar dypid:latest && docker rmi dypid:latest
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 构建Docker镜像
|
- name: 构建Docker镜像
|
||||||
run: docker build -t dypid:latest .
|
run: |
|
||||||
|
set -x
|
||||||
|
git_hash=$(git rev-parse --short "$GITHUB_SHA")
|
||||||
|
build_date=$(TZ=Asia/Shanghai date +"%Y%m%d%H%M")
|
||||||
|
docker build --build-arg VERSION="release - $build_date - $git_hash" -t dypid:latest .
|
||||||
|
|
||||||
- name: 导出镜像
|
- name: 导出镜像
|
||||||
run: mkdir release && docker save -o release/dypid.tar dypid:latest && docker rmi dypid:latest
|
run: mkdir release && docker save -o release/dypid.tar dypid:latest && docker rmi dypid:latest
|
||||||
|
|||||||
+5
-1
@@ -15,9 +15,13 @@ WORKDIR /build
|
|||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=webBuilder /build/dist ./web/dist
|
COPY --from=webBuilder /build/dist ./web/dist
|
||||||
|
|
||||||
|
ARG VERSION
|
||||||
|
|
||||||
RUN go env -w CGO_ENABLED=0 \
|
RUN go env -w CGO_ENABLED=0 \
|
||||||
&& go mod tidy \
|
&& go mod tidy \
|
||||||
&& go build -o dypid
|
&& go build \
|
||||||
|
-ldflags="-s -w -X 'dypid/global.Version=$VERSION'" \
|
||||||
|
-o dypid
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
|
|||||||
+10
@@ -1,8 +1,10 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"dypid/global"
|
||||||
"dypid/internal/controller"
|
"dypid/internal/controller"
|
||||||
"embed"
|
"embed"
|
||||||
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@@ -11,6 +13,14 @@ import (
|
|||||||
|
|
||||||
func RegRoutes(r *gin.Engine) {
|
func RegRoutes(r *gin.Engine) {
|
||||||
g := r.Group("/api") //初始化路由组 /api/xxxx
|
g := r.Group("/api") //初始化路由组 /api/xxxx
|
||||||
|
{
|
||||||
|
g.GET("/test", func(context *gin.Context) {
|
||||||
|
context.String(http.StatusOK, "ok")
|
||||||
|
})
|
||||||
|
g.GET("/version", func(context *gin.Context) {
|
||||||
|
context.String(http.StatusOK, fmt.Sprintf("程序版本: %s\nGin: %s", global.Version, gin.Version))
|
||||||
|
})
|
||||||
|
}
|
||||||
{
|
{
|
||||||
g.GET("/token", controller.ListTokenHandler) //获取token列表
|
g.GET("/token", controller.ListTokenHandler) //获取token列表
|
||||||
g.POST("/token", controller.CreateTokenHandler) //创建token
|
g.POST("/token", controller.CreateTokenHandler) //创建token
|
||||||
|
|||||||
@@ -8,3 +8,5 @@ import (
|
|||||||
|
|
||||||
var RDB *redis.Client
|
var RDB *redis.Client
|
||||||
var RCtx = context.Background()
|
var RCtx = context.Background()
|
||||||
|
|
||||||
|
var Version = "dev"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module dypid
|
module dypid
|
||||||
|
|
||||||
go 1.25
|
go 1.26
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gin-contrib/cors v1.7.6
|
github.com/gin-contrib/cors v1.7.6
|
||||||
|
|||||||
+78
-21
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import {ref} from 'vue'
|
||||||
|
|
||||||
const themeMode = ref('light')
|
const themeMode = ref('light')
|
||||||
</script>
|
</script>
|
||||||
@@ -104,30 +104,87 @@ html, body, #app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Gap 间距 */
|
/* Gap 间距 */
|
||||||
.gap-sm { gap: 8px; }
|
.gap-sm {
|
||||||
.gap-md { gap: 12px; }
|
gap: 8px;
|
||||||
.gap-lg { gap: 16px; }
|
}
|
||||||
|
|
||||||
|
.gap-md {
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gap-lg {
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
/* 间距工具类 */
|
/* 间距工具类 */
|
||||||
.mt-sm { margin-top: 8px; }
|
.mt-sm {
|
||||||
.mt-md { margin-top: 16px; }
|
margin-top: 8px;
|
||||||
.mt-lg { margin-top: 24px; }
|
}
|
||||||
.mb-sm { margin-bottom: 8px; }
|
|
||||||
.mb-md { margin-bottom: 16px; }
|
.mt-md {
|
||||||
.mb-lg { margin-bottom: 24px; }
|
margin-top: 16px;
|
||||||
.ml-sm { margin-left: 8px; }
|
}
|
||||||
.ml-md { margin-left: 12px; }
|
|
||||||
.ml-lg { margin-left: 16px; }
|
.mt-lg {
|
||||||
.mr-sm { margin-right: 8px; }
|
margin-top: 24px;
|
||||||
.mr-md { margin-right: 12px; }
|
}
|
||||||
.mr-lg { margin-right: 16px; }
|
|
||||||
|
.mb-sm {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb-md {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb-lg {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ml-sm {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ml-md {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ml-lg {
|
||||||
|
margin-left: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mr-sm {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mr-md {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mr-lg {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
/* 文本工具类 */
|
/* 文本工具类 */
|
||||||
.text-primary { color: var(--text-primary); }
|
.text-primary {
|
||||||
.text-success { color: var(--success-color); }
|
color: var(--text-primary);
|
||||||
.text-warning { color: var(--warning-color); }
|
}
|
||||||
.text-danger { color: var(--danger-color); }
|
|
||||||
.text-info { color: var(--info-color); }
|
.text-success {
|
||||||
|
color: var(--success-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-warning {
|
||||||
|
color: var(--warning-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-danger {
|
||||||
|
color: var(--danger-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-info {
|
||||||
|
color: var(--info-color);
|
||||||
|
}
|
||||||
|
|
||||||
/* 加载动画 */
|
/* 加载动画 */
|
||||||
.loading-container {
|
.loading-container {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed} from "vue"
|
import {computed, ref} from "vue"
|
||||||
import axios from "@/axios.ts"
|
import axios from "@/axios.ts"
|
||||||
import {ElMessage} from 'element-plus'
|
import {ElMessage} from 'element-plus'
|
||||||
import {Upload} from '@element-plus/icons-vue'
|
import {Upload} from '@element-plus/icons-vue'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {ref, computed} from 'vue'
|
import {ref} from 'vue'
|
||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
|
|
||||||
export const useCounterStore = defineStore('counter', () => {
|
export const useCounterStore = defineStore('counter', () => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, watch, computed} from 'vue'
|
import {ref, watch} from 'vue'
|
||||||
import {useRoute, useRouter} from "vue-router"
|
import {useRoute, useRouter} from "vue-router"
|
||||||
import {useCounterStore} from "@/stores/counter.ts"
|
import {useCounterStore} from "@/stores/counter.ts"
|
||||||
import {Edit, Delete, Clock, User, Document, CloseBold} from '@element-plus/icons-vue'
|
import {CloseBold, Document, Edit, User} from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, onMounted, onUnmounted} from 'vue'
|
import {onMounted, onUnmounted, ref} from 'vue'
|
||||||
import axios from "@/axios.ts"
|
import axios from "@/axios.ts"
|
||||||
import {useRoute} from "vue-router"
|
import {useRoute} from "vue-router"
|
||||||
import {ElMessage} from "element-plus"
|
import {ElMessage} from "element-plus"
|
||||||
import {
|
import {DataAnalysis, Document, Key, Search, Upload, Warning} from '@element-plus/icons-vue'
|
||||||
Key, Refresh, Delete, DataAnalysis,
|
import AddDataDialog from "@/components/AddDataDialog.vue";
|
||||||
Document, Warning, Search, InfoFilled
|
|
||||||
} from '@element-plus/icons-vue'
|
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const token = ref(route.query.token as string || '')
|
const token = ref(route.query.token as string || '')
|
||||||
@@ -14,6 +12,7 @@ const input = ref(route.query.token as string || '')
|
|||||||
const result = ref<any>(null)
|
const result = ref<any>(null)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const lastUpdate = ref('')
|
const lastUpdate = ref('')
|
||||||
|
const showAddDataDialog = ref(false)
|
||||||
|
|
||||||
const updateTime = () => {
|
const updateTime = () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
@@ -87,8 +86,16 @@ const statCards = [
|
|||||||
<el-button type="primary" size="large" @click="fetchInfo" :loading="loading">
|
<el-button type="primary" size="large" @click="fetchInfo" :loading="loading">
|
||||||
查询
|
查询
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="success" size="large" @click="showAddDataDialog = true">
|
||||||
|
<el-icon>
|
||||||
|
<Upload/>
|
||||||
|
</el-icon>
|
||||||
|
增加数据
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AddDataDialog v-model="showAddDataDialog" :token="token"/>
|
||||||
|
|
||||||
<div v-if="result" class="result-section">
|
<div v-if="result" class="result-section">
|
||||||
<div class="result-header">
|
<div class="result-header">
|
||||||
<span class="section-title">Token 信息</span>
|
<span class="section-title">Token 信息</span>
|
||||||
@@ -148,8 +155,7 @@ const statCards = [
|
|||||||
}
|
}
|
||||||
|
|
||||||
.token-input {
|
.token-input {
|
||||||
flex: 1;
|
max-width: 400px;
|
||||||
max-width: 600px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.result-section {
|
.result-section {
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, onMounted, onUnmounted, watch} from 'vue'
|
import {onMounted, onUnmounted, ref, watch} from 'vue'
|
||||||
import {useCounterStore} from "@/stores/counter.ts"
|
import {useCounterStore} from "@/stores/counter.ts"
|
||||||
import axios from "@/axios.ts"
|
import axios from "@/axios.ts"
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
import {
|
import {DataAnalysis, Delete, Document, InfoFilled, Key, Refresh, Search, Warning} from '@element-plus/icons-vue'
|
||||||
Key, Refresh, Delete, DataAnalysis,
|
|
||||||
Document, Warning, Search, InfoFilled
|
|
||||||
} from '@element-plus/icons-vue'
|
|
||||||
|
|
||||||
const store = useCounterStore()
|
const store = useCounterStore()
|
||||||
const result = ref<any>(null)
|
const result = ref<any>(null)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, onMounted} from "vue"
|
import {onMounted, ref} from "vue"
|
||||||
import axios from "@/axios.ts"
|
import axios from "@/axios.ts"
|
||||||
import {ElMessage} from 'element-plus'
|
import {ElMessage} from 'element-plus'
|
||||||
import {useCounterStore} from "@/stores/counter.ts"
|
import {useCounterStore} from "@/stores/counter.ts"
|
||||||
import {useRouter} from "vue-router"
|
import {useRouter} from "vue-router"
|
||||||
import {Plus, View, Edit, Delete, Key, Document, Memo, Search, Lock, DocumentAdd} from '@element-plus/icons-vue'
|
import {Delete, Edit, Key, Lock, Memo, Plus, View} from '@element-plus/icons-vue'
|
||||||
import AddDataDialog from '@/components/AddDataDialog.vue'
|
import AddDataDialog from '@/components/AddDataDialog.vue'
|
||||||
|
|
||||||
const store = useCounterStore()
|
const store = useCounterStore()
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { fileURLToPath, URL } from 'node:url'
|
import {fileURLToPath, URL} from 'node:url'
|
||||||
|
|
||||||
import { defineConfig } from 'vite'
|
import {defineConfig} from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user