Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+178
View File
@@ -0,0 +1,178 @@
package aiplazactrl
import (
"encoding/json"
"91porn-server/common"
"91porn-server/common/stderr"
"91porn-server/models/l/operatorlgmod"
"91porn-server/web/service/aiplazaser"
"github.com/gin-gonic/gin"
)
// List doc
// @Summary 获取ai广场帖子列表
// @Description 获取ai广场帖子列表
// @Tags 后台-ai广场帖子
// @Accept mpfd,json
// @Produce json
// @Param q query aiplazaser.WebListReq false "请求参数"
// @Success 200 object aiplazaser.WebListRes "成功"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/aiplaza/list [get]
func List(ctx *gin.Context) {
var req = &aiplazaser.WebListReq{}
if err := ctx.ShouldBind(&req); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
res, err := req.GetList()
if err != nil {
common.ServeJSON(ctx, stderr.ErrDbQueryError, "")
return
}
common.ServeJSON(ctx, stderr.Success, res)
}
// Create doc
// @Summary 新增ai广场帖子
// @Description 新增ai广场帖子
// @Tags 后台-ai广场帖子
// @Accept mpfd,json
// @Produce json
// @Param q body aiplazaser.WebCreateReq false "请求参数"
// @Success 200 {string} json "{"msg": "操作成功"}"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/aiplaza/create [post]
func Create(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
p := &aiplazaser.WebCreateReq{}
err = ctx.ShouldBindJSON(&p)
if err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
// 创建
err = p.Create()
if err != nil {
common.ServeJSON(ctx, stderr.Failure, err.Error())
return
}
log, _ := json.Marshal(p)
_ = operatorlgmod.RecordOperation(manager, "ai广场帖子管理", "创建", string(log), ctx.Request.URL.RequestURI())
common.ServeJSON(ctx, stderr.Success, "")
}
// Update doc
// @Summary 更新ai广场帖子
// @Description 更新ai广场帖子
// @Tags 后台-ai广场帖子
// @Accept mpfd,json
// @Produce json
// @Param q body aiplazaser.WebUpdateReq false "请求参数"
// @Success 200 {string} json "{"msg": "操作成功"}"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/aiplaza/update [post]
func Update(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
p := &aiplazaser.WebUpdateReq{}
err = ctx.ShouldBindJSON(&p)
if err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
// 更新
err = p.Update()
if err != nil {
common.ServeJSON(ctx, stderr.Failure, err.Error())
return
}
log, _ := json.Marshal(p)
_ = operatorlgmod.RecordOperation(manager, "ai广场帖子管理", "更新", string(log), ctx.Request.URL.RequestURI())
common.ServeJSON(ctx, stderr.Success, "")
}
// BatchUpdate doc
// @Summary 更新ai广场帖子
// @Description 更新ai广场帖子
// @Tags 后台-ai广场帖子
// @Accept mpfd,json
// @Produce json
// @Param q body aiplazaser.WebBatchUpdateReq false "请求参数"
// @Success 200 {string} json "{"msg": "操作成功"}"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/aiplaza/batch/update [post]
func BatchUpdate(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
p := &aiplazaser.WebBatchUpdateReq{}
err = ctx.ShouldBindJSON(&p)
if err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
// 更新
err = p.Update()
if err != nil {
common.ServeJSON(ctx, stderr.Failure, err.Error())
return
}
log, _ := json.Marshal(p)
_ = operatorlgmod.RecordOperation(manager, "ai广场帖子管理", "更新", string(log), ctx.Request.URL.RequestURI())
common.ServeJSON(ctx, stderr.Success, "")
}
// Delete doc
// @Summary 删除ai广场帖子
// @Description 删除ai广场帖子
// @Tags 后台-ai广场帖子
// @Accept mpfd,json
// @Produce json
// @Param q body aiplazaser.WebDeleteReq false "请求参数"
// @Success 200 {string} json "{"msg": "操作成功"}"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/aiplaza/delete [post]
func Delete(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
p := &aiplazaser.WebDeleteReq{}
err = ctx.ShouldBindJSON(&p)
if err != nil || len(p.ID) == 0 {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
// 删除
err = p.Delete()
if err != nil {
common.ServeJSON(ctx, stderr.Failure, err.Error())
return
}
log, _ := json.Marshal(p)
_ = operatorlgmod.RecordOperation(manager, "ai广场帖子管理", "删除", string(log), ctx.Request.URL.RequestURI())
common.ServeJSON(ctx, stderr.Success, "")
}