diff --git a/assets/admin.js b/assets/admin.js index 885c374..9fd37a9 100644 --- a/assets/admin.js +++ b/assets/admin.js @@ -177,7 +177,7 @@ function sign_out_config() { function export_accesslog() { $('body').modal('confirm','温馨提示','确认导出访问日志?', function(choice){ if (choice) { - $("#form-export-logs-btn").click() + $("#form-export-logs").submit(); } }); } \ No newline at end of file diff --git a/controller/admin_controller.go b/controller/admin_controller.go index b5816f4..92c720c 100644 --- a/controller/admin_controller.go +++ b/controller/admin_controller.go @@ -233,6 +233,7 @@ func AccessLogsPage(c *gin.Context) { func AccessLogsExport(c *gin.Context) { url := c.PostForm("url") logs, err := service.GetAllAccessLogs(strings.TrimSpace(url)) + if err != nil { c.HTML(http.StatusOK, "access_logs.html", gin.H{ "title": "访问日志查询 - ohUrlShortener", @@ -243,6 +244,7 @@ func AccessLogsExport(c *gin.Context) { }) return } + fileContent, err := export.AccessLogToExcel(logs) if err != nil { c.HTML(http.StatusOK, "access_logs.html", gin.H{ diff --git a/docker/admin.Dockerfile b/docker/admin.Dockerfile index 4176df4..fd600ff 100644 --- a/docker/admin.Dockerfile +++ b/docker/admin.Dockerfile @@ -7,9 +7,6 @@ ENV GOPROXY=https://proxy.golang.com.cn,direct ADD . /app WORKDIR /app RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ohurlshortener -RUN apk add upx && \ - mv ohurlshortener ohurlshortener_tmp && \ - upx --best -o ohurlshortener ohurlshortener_tmp ## ## Deploy diff --git a/docker/local_build.yml b/docker/local_build.yml index 97638d7..6f47b99 100644 --- a/docker/local_build.yml +++ b/docker/local_build.yml @@ -55,7 +55,9 @@ services: test: [ "CMD", "psql", "-U","${PG_SUPER_USER}","-d","oh_url_shortener" ] timeout: 10s interval: 3s - retries: 10 + retries: 10 + ports: + - ${PG_LOCAL_PORT}:5432 networks: - ohurlshortener @@ -68,6 +70,8 @@ services: timeout: 10s interval: 3s retries: 10 + ports: + - ${RD_LOCAL_PORT}:6379 networks: - ohurlshortener diff --git a/docker/portal.Dockerfile b/docker/portal.Dockerfile index ac53fc9..d112ad0 100644 --- a/docker/portal.Dockerfile +++ b/docker/portal.Dockerfile @@ -7,9 +7,6 @@ ENV GOPROXY=https://proxy.golang.com.cn,direct ADD . /app WORKDIR /app RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ohurlshortener -RUN apk add upx && \ - mv ohurlshortener ohurlshortener_tmp && \ - upx --best -o ohurlshortener ohurlshortener_tmp ## ## Deploy diff --git a/docker/vars.env b/docker/vars.env index 87009b2..ad0e1b8 100644 --- a/docker/vars.env +++ b/docker/vars.env @@ -2,12 +2,12 @@ # ohUrlShortenerAdmin OH_ADMIN_PORT=9092 -OH_ADMIN_VERSION=1.2 +OH_ADMIN_VERSION=1.3 OH_ADMIN_CONTAINER_NAME=ohurlshortener_admin # ohUrlShortenerPortal OH_PORTAL_PORT=9091 -OH_PORTAL_VERSION=1.2 +OH_PORTAL_VERSION=1.3 OH_PORTAL_CONTAINER_NAME=ohurlshortener_portal # Postgresql Vars @@ -15,7 +15,9 @@ PG_VERSION=9.6 PG_CONTAINER_NAME=ohurlshortener_pg PG_SUPER_USER=postgres PG_SUPER_PWD=0DePm!oG_12Cz^kd_m +PG_LOCAL_PORT=55432 #Redis Vars RD_VERSION=6.2.6 RD_CONTAINER_NAME=ohurlshortener_redis +RD_LOCAL_PORT=56379 diff --git a/templates/admin/access_logs.html b/templates/admin/access_logs.html index 4021166..a671052 100644 --- a/templates/admin/access_logs.html +++ b/templates/admin/access_logs.html @@ -21,8 +21,7 @@ 导出
diff --git a/templates/admin/stats.html b/templates/admin/stats.html index fc5cd0f..c948467 100644 --- a/templates/admin/stats.html +++ b/templates/admin/stats.html @@ -10,7 +10,7 @@+ | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
短链接 | -生成时间 | +生成时间 | +备注 | 今日点击量 | 今日独立IP数 | 昨日点击量 | @@ -42,6 +43,7 @@||||||||||||||||||||
{{.ShortUrl.ShortUrl}} | {{.CreatedAt | date "2006-01-02 15:04:05"}} | +{{if .ShortUrl.Memo.Valid}}{{.ShortUrl.Memo.String}}{{else}}--{{end}} | {{.TodayCount}} | {{.DistinctTodayCount}} | {{.YesterdayCount}} | @@ -58,7 +60,7 @@|||||||||||||||||||||
+ | {{if not .first_page}} 上一页 {{end}} |