From 0fdd4fc6e302142e887e29dc6a6004b0c56d63e3 Mon Sep 17 00:00:00 2001
From: CaIon <1808837298@qq.com>
Date: Thu, 14 Dec 2023 15:16:51 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BE=8E=E5=8C=96=E7=BB=98=E7=94=BBIU?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/constants.go | 2 +-
controller/midjourney.go | 6 ++
web/src/components/MjLogsTable.js | 97 +++++++++++++++----------------
3 files changed, 55 insertions(+), 50 deletions(-)
diff --git a/common/constants.go b/common/constants.go
index 4db4090..939b62f 100644
--- a/common/constants.go
+++ b/common/constants.go
@@ -11,7 +11,7 @@ import (
var StartTime = time.Now().Unix() // unit: second
var Version = "v0.0.0" // this hard coding will be replaced automatically when building, no need to manually change
-var SystemName = "One API"
+var SystemName = "New API"
var ServerAddress = "http://localhost:3000"
var PayAddress = ""
var EpayId = ""
diff --git a/controller/midjourney.go b/controller/midjourney.go
index f416fdc..677f916 100644
--- a/controller/midjourney.go
+++ b/controller/midjourney.go
@@ -187,6 +187,12 @@ func GetUserMidjourney(c *gin.Context) {
if logs == nil {
logs = make([]*model.Midjourney, 0)
}
+ if !strings.Contains(common.ServerAddress, "localhost") {
+ for i, midjourney := range logs {
+ midjourney.ImageUrl = common.ServerAddress + "/mj/image/" + midjourney.MjId
+ logs[i] = midjourney
+ }
+ }
c.JSON(200, gin.H{
"success": true,
"message": "",
diff --git a/web/src/components/MjLogsTable.js b/web/src/components/MjLogsTable.js
index 2673542..7719869 100644
--- a/web/src/components/MjLogsTable.js
+++ b/web/src/components/MjLogsTable.js
@@ -2,7 +2,19 @@ import React, {useEffect, useState} from 'react';
import {Label} from 'semantic-ui-react';
import {API, copy, isAdmin, showError, showSuccess, timestamp2string} from '../helpers';
-import {Table, Avatar, Tag, Form, Button, Layout, Select, Popover, Modal } from '@douyinfe/semi-ui';
+import {
+ Table,
+ Avatar,
+ Tag,
+ Form,
+ Button,
+ Layout,
+ Select,
+ Popover,
+ Modal,
+ ImagePreview,
+ Typography
+} from '@douyinfe/semi-ui';
import {ITEMS_PER_PAGE} from '../constants';
import {renderNumber, renderQuota, stringToColor} from '../helpers/render';
@@ -194,19 +206,16 @@ const LogsTable = () => {
}
return (
- text.length > 10 ?
- <>
- {text.slice(0, 10)}
-
- >
- : text
+
{modalContent}
- {/* 模态框组件,用于展示图片 */} -