mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-20 02:06:38 +08:00
fix bug for remove api 404 errorc
This commit is contained in:
parent
7873847616
commit
86b2d5eff2
@ -8,6 +8,7 @@ import (
|
|||||||
"chatplus/store/vo"
|
"chatplus/store/vo"
|
||||||
"chatplus/utils"
|
"chatplus/utils"
|
||||||
"chatplus/utils/resp"
|
"chatplus/utils/resp"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@ -111,19 +112,16 @@ func (h *ApiKeyHandler) Set(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *ApiKeyHandler) Remove(c *gin.Context) {
|
func (h *ApiKeyHandler) Remove(c *gin.Context) {
|
||||||
var data struct {
|
id := h.GetInt(c, "id", 0)
|
||||||
Id uint
|
if id <= 0 {
|
||||||
}
|
|
||||||
if err := c.ShouldBindJSON(&data); err != nil {
|
|
||||||
resp.ERROR(c, types.InvalidArgs)
|
resp.ERROR(c, types.InvalidArgs)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if data.Id > 0 {
|
|
||||||
res := h.DB.Where("id = ?", data.Id).Delete(&model.ApiKey{})
|
res := h.DB.Where("id", id).Delete(&model.ApiKey{})
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
resp.ERROR(c, "更新数据库失败!")
|
resp.ERROR(c, "更新数据库失败!")
|
||||||
return
|
return
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resp.SUCCESS(c)
|
resp.SUCCESS(c)
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ func main() {
|
|||||||
group.POST("save", h.Save)
|
group.POST("save", h.Save)
|
||||||
group.GET("list", h.List)
|
group.GET("list", h.List)
|
||||||
group.POST("set", h.Set)
|
group.POST("set", h.Set)
|
||||||
group.POST("remove", h.Remove)
|
group.GET("remove", h.Remove)
|
||||||
}),
|
}),
|
||||||
fx.Invoke(func(s *core.AppServer, h *admin.UserHandler) {
|
fx.Invoke(func(s *core.AppServer, h *admin.UserHandler) {
|
||||||
group := s.Engine.Group("/api/admin/user/")
|
group := s.Engine.Group("/api/admin/user/")
|
||||||
|
@ -130,6 +130,7 @@ func (s *Service) Run() {
|
|||||||
atomic.AddInt32(&s.HandledTaskNum, 1)
|
atomic.AddInt32(&s.HandledTaskNum, 1)
|
||||||
// 更新任务 ID/频道
|
// 更新任务 ID/频道
|
||||||
job.TaskId = res.Result
|
job.TaskId = res.Result
|
||||||
|
job.MessageId = res.Result
|
||||||
job.ChannelId = s.Name
|
job.ChannelId = s.Name
|
||||||
s.db.Updates(&job)
|
s.db.Updates(&job)
|
||||||
}
|
}
|
||||||
@ -198,7 +199,6 @@ func (s *Service) Notify(job model.MidJourneyJob) error {
|
|||||||
if task.ImageUrl != "" {
|
if task.ImageUrl != "" {
|
||||||
job.OrgURL = task.ImageUrl
|
job.OrgURL = task.ImageUrl
|
||||||
}
|
}
|
||||||
job.MessageId = task.Id
|
|
||||||
tx := s.db.Updates(&job)
|
tx := s.db.Updates(&job)
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
return fmt.Errorf("error with update database: %v", tx.Error)
|
return fmt.Errorf("error with update database: %v", tx.Error)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# GO api docker 镜像创建
|
# GO api docker 镜像创建
|
||||||
FROM alpine:3.18.2
|
FROM --platform=linux/amd64 alpine:3.18.2
|
||||||
|
|
||||||
MAINTAINER yangjian<yangjian102621@163.com>
|
MAINTAINER yangjian<yangjian102621@163.com>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# 前端 Vue 项目构建
|
# 前端 Vue 项目构建
|
||||||
FROM nginx:1.20.2
|
FROM --platform=linux/amd64 nginx:1.20.2
|
||||||
|
|
||||||
MAINTAINER yangjian<yangjian102621@163.com>
|
MAINTAINER yangjian<yangjian102621@163.com>
|
||||||
|
|
||||||
|
@ -226,10 +226,9 @@ import {httpGet, httpPost} from "@/utils/http";
|
|||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
import {setUserToken} from "@/store/session";
|
import {setUserToken} from "@/store/session";
|
||||||
import {validateEmail, validateMobile} from "@/utils/validate";
|
import {validateEmail, validateMobile} from "@/utils/validate";
|
||||||
import {Checked, Close, Iphone, Lock, Message, Position, User} from "@element-plus/icons-vue";
|
import {Checked, Close, Iphone, Lock, Message} from "@element-plus/icons-vue";
|
||||||
import SendMsg from "@/components/SendMsg.vue";
|
import SendMsg from "@/components/SendMsg.vue";
|
||||||
import {arrayContains} from "@/utils/libs";
|
import {arrayContains} from "@/utils/libs";
|
||||||
import {useRouter} from "vue-router";
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -359,7 +358,7 @@ const close = function () {
|
|||||||
.close-icon {
|
.close-icon {
|
||||||
cursor pointer
|
cursor pointer
|
||||||
position absolute
|
position absolute
|
||||||
right -10px
|
right 0
|
||||||
top 0
|
top 0
|
||||||
font-weight normal
|
font-weight normal
|
||||||
font-size 20px
|
font-size 20px
|
||||||
|
@ -89,7 +89,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-items {
|
.nav-items {
|
||||||
margin-top: 20px;
|
margin-top: 10px;
|
||||||
padding 0 5px
|
padding 0 5px
|
||||||
|
|
||||||
li {
|
li {
|
||||||
|
@ -994,7 +994,7 @@ const generate = () => {
|
|||||||
httpPost("/api/mj/image", params.value).then(() => {
|
httpPost("/api/mj/image", params.value).then(() => {
|
||||||
ElMessage.success("绘画任务推送成功,请耐心等待任务执行...")
|
ElMessage.success("绘画任务推送成功,请耐心等待任务执行...")
|
||||||
power.value -= mjPower.value
|
power.value -= mjPower.value
|
||||||
params.value = copyObj(initParams)
|
//params.value = copyObj(initParams)
|
||||||
imgList.value = []
|
imgList.value = []
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
ElMessage.error("任务推送失败:" + e.message)
|
ElMessage.error("任务推送失败:" + e.message)
|
||||||
|
@ -125,8 +125,8 @@
|
|||||||
import {onMounted, onUnmounted, reactive, ref} from "vue";
|
import {onMounted, onUnmounted, reactive, ref} from "vue";
|
||||||
import {httpGet, httpPost} from "@/utils/http";
|
import {httpGet, httpPost} from "@/utils/http";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
import {dateFormat, disabledDate, removeArrayItem, substr} from "@/utils/libs";
|
import {dateFormat, removeArrayItem, substr} from "@/utils/libs";
|
||||||
import {DocumentCopy, InfoFilled, Plus, ShoppingCart} from "@element-plus/icons-vue";
|
import {DocumentCopy, Plus, ShoppingCart} from "@element-plus/icons-vue";
|
||||||
import ClipboardJS from "clipboard";
|
import ClipboardJS from "clipboard";
|
||||||
|
|
||||||
// 变量定义
|
// 变量定义
|
||||||
@ -215,7 +215,7 @@ httpGet('/api/admin/apikey/list').then((res) => {
|
|||||||
const add = function () {
|
const add = function () {
|
||||||
showDialog.value = true
|
showDialog.value = true
|
||||||
title.value = "新增 API KEY"
|
title.value = "新增 API KEY"
|
||||||
item.value = {}
|
item.value = {enabled: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
const edit = function (row) {
|
const edit = function (row) {
|
||||||
|
Loading…
Reference in New Issue
Block a user