remove new-ui files

This commit is contained in:
RockYang
2024-03-18 12:01:34 +08:00
parent 313993532e
commit 172d498618
331 changed files with 13 additions and 63668 deletions

View File

@@ -131,10 +131,13 @@ const XunFei = Platform("XunFei")
const QWen = Platform("QWen")
type SystemConfig struct {
Title string `json:"title"`
AdminTitle string `json:"admin_title"`
Logo string `json:"logo"`
InitPower int `json:"init_power"` // 新用户注册赠送算力值
Title string `json:"title"`
AdminTitle string `json:"admin_title"`
Logo string `json:"logo"`
InitPower int `json:"init_power"` // 新用户注册赠送算力值
DailyPower int `json:"daily_power"` // 每日赠送算力
InvitePower int `json:"invite_power"` // 邀请新用户赠送算力值
VipMonthPower int `json:"vip_month_power"` // VIP 会员每月赠送的算力值
RegisterWays []string `json:"register_ways"` // 注册方式:支持手机,邮箱注册
EnabledRegister bool `json:"enabled_register"` // 是否开放注册
@@ -143,11 +146,8 @@ type SystemConfig struct {
EnabledReward bool `json:"enabled_reward"` // 启用众筹功能
PowerPrice float64 `json:"power_price"` // 算力单价
OrderPayTimeout int `json:"order_pay_timeout"` //订单支付超时时间
DefaultModels []string `json:"default_models"` // 默认开通的 AI 模型
OrderPayInfoText string `json:"order_pay_info_text"` // 订单支付页面说明文字
InvitePower int `json:"invite_power"` // 邀请新用户赠送算力值
VipMonthPower int `json:"vip_month_power"` // VIP 会员每月赠送的算力值
OrderPayTimeout int `json:"order_pay_timeout"` //订单支付超时时间
DefaultModels []string `json:"default_models"` // 默认开通的 AI 模型
MjPower int `json:"mj_power"` // MJ 绘画消耗算力
SdPower int `json:"sd_power"` // SD 绘画消耗算力

View File

@@ -5,8 +5,6 @@ import (
"chatplus/handler"
"chatplus/service/oss"
"chatplus/store/model"
"chatplus/store/vo"
"chatplus/utils"
"chatplus/utils/resp"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
@@ -48,50 +46,3 @@ func (h *UploadHandler) Upload(c *gin.Context) {
resp.SUCCESS(c, file)
}
func (h *UploadHandler) List(c *gin.Context) {
userId := 0
var items []model.File
var files = make([]vo.File, 0)
h.db.Where("user_id = ?", userId).Find(&items)
if len(items) > 0 {
for _, v := range items {
var file vo.File
err := utils.CopyObject(v, &file)
if err != nil {
logger.Error(err)
continue
}
file.CreatedAt = v.CreatedAt.Unix()
files = append(files, file)
}
}
resp.SUCCESS(c, files)
}
// Remove remove files
func (h *UploadHandler) Remove(c *gin.Context) {
userId := 0
id := h.GetInt(c, "id", 0)
var file model.File
tx := h.db.Where("user_id = ? AND id = ?", userId, id).First(&file)
if tx.Error != nil || file.Id == 0 {
resp.ERROR(c, "file not existed")
return
}
// remove database
tx = h.db.Model(&model.File{}).Delete("id = ?", id)
if tx.Error != nil || tx.RowsAffected == 0 {
resp.ERROR(c, "failed to update database")
return
}
// remove files
objectKey := file.ObjKey
if objectKey == "" {
objectKey = file.URL
}
_ = h.uploaderManager.GetUploadHandler().Delete(objectKey)
resp.SUCCESS(c)
}

View File

@@ -384,8 +384,6 @@ func main() {
fx.Provide(admin.NewUploadHandler),
fx.Invoke(func(s *core.AppServer, h *admin.UploadHandler) {
s.Engine.POST("/api/admin/upload", h.Upload)
s.Engine.GET("/api/admin/upload/list", h.List)
s.Engine.GET("/api/admin/upload/remove", h.Remove)
}),
// 系统管理员