mirror of
https://gitee.com/blackfox/geekai.git
synced 2024-12-02 04:07:41 +08:00
fix bug: remove chat role failed
This commit is contained in:
parent
bbc8fe2b40
commit
dc4c1f7877
@ -144,18 +144,13 @@ func (h *ChatRoleHandler) Set(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *ChatRoleHandler) Remove(c *gin.Context) {
|
func (h *ChatRoleHandler) 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", id).Delete(&model.ChatRole{})
|
||||||
resp.ERROR(c, types.InvalidArgs)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res := h.DB.Where("id = ?", data.Id).Delete(&model.ChatRole{})
|
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
resp.ERROR(c, "删除失败!")
|
resp.ERROR(c, "删除失败!")
|
||||||
return
|
return
|
||||||
|
@ -335,7 +335,7 @@ func main() {
|
|||||||
group.POST("save", h.Save)
|
group.POST("save", h.Save)
|
||||||
group.POST("sort", h.Sort)
|
group.POST("sort", h.Sort)
|
||||||
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.RewardHandler) {
|
fx.Invoke(func(s *core.AppServer, h *admin.RewardHandler) {
|
||||||
group := s.Engine.Group("/api/admin/reward/")
|
group := s.Engine.Group("/api/admin/reward/")
|
||||||
|
@ -268,8 +268,8 @@ onMounted(() => {
|
|||||||
const sorts = []
|
const sorts = []
|
||||||
sortedData.forEach((id, index) => {
|
sortedData.forEach((id, index) => {
|
||||||
ids.push(parseInt(id))
|
ids.push(parseInt(id))
|
||||||
sorts.push(index)
|
sorts.push(index + 1)
|
||||||
items.value[index].sort_num = index
|
items.value[index].sort_num = index + 1
|
||||||
})
|
})
|
||||||
|
|
||||||
httpPost("/api/admin/model/sort", {ids: ids, sorts: sorts}).then(() => {
|
httpPost("/api/admin/model/sort", {ids: ids, sorts: sorts}).then(() => {
|
||||||
|
@ -138,7 +138,8 @@ onMounted(() => {
|
|||||||
const sorts = []
|
const sorts = []
|
||||||
sortedData.forEach((id, index) => {
|
sortedData.forEach((id, index) => {
|
||||||
ids.push(parseInt(id))
|
ids.push(parseInt(id))
|
||||||
sorts.push(index)
|
sorts.push(index + 1)
|
||||||
|
items.value[index].sort_num = index + 1
|
||||||
})
|
})
|
||||||
|
|
||||||
httpPost("/api/admin/menu/sort", {ids: ids, sorts: sorts}).catch(e => {
|
httpPost("/api/admin/menu/sort", {ids: ids, sorts: sorts}).catch(e => {
|
||||||
|
@ -142,7 +142,8 @@ onMounted(() => {
|
|||||||
const sorts = []
|
const sorts = []
|
||||||
sortedData.forEach((id, index) => {
|
sortedData.forEach((id, index) => {
|
||||||
ids.push(parseInt(id))
|
ids.push(parseInt(id))
|
||||||
sorts.push(index)
|
sorts.push(index + 1)
|
||||||
|
items.value[index].sort_num = index + 1
|
||||||
})
|
})
|
||||||
|
|
||||||
httpPost("/api/admin/product/sort", {ids: ids, sorts: sorts}).catch(e => {
|
httpPost("/api/admin/product/sort", {ids: ids, sorts: sorts}).catch(e => {
|
||||||
|
@ -228,7 +228,8 @@ const fetchData = () => {
|
|||||||
const sorts = []
|
const sorts = []
|
||||||
sortedData.forEach((id, index) => {
|
sortedData.forEach((id, index) => {
|
||||||
ids.push(parseInt(id))
|
ids.push(parseInt(id))
|
||||||
sorts.push(index)
|
sorts.push(index+1)
|
||||||
|
items.value[index].sort_num = index + 1
|
||||||
})
|
})
|
||||||
|
|
||||||
httpPost("/api/admin/role/sort", {ids: ids, sorts: sorts}).catch(e => {
|
httpPost("/api/admin/role/sort", {ids: ids, sorts: sorts}).catch(e => {
|
||||||
|
Loading…
Reference in New Issue
Block a user