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
+167
View File
@@ -0,0 +1,167 @@
package ai_template_module_ctrl
import (
"encoding/json"
"91porn-server/common"
"91porn-server/common/stderr"
"91porn-server/models/l/operatorlgmod"
"91porn-server/web/service/ai_template_module_ser"
"github.com/gin-gonic/gin"
)
// List doc
// @Summary 获取AI模版模块列表列表
// @Description 获取AI模版模块列表列表
// @Tags 后台-AI模版模块列表
// @Accept mpfd,json
// @Produce json
// @Param q query ai_template_module_ser.WebListReq false "请求参数"
// @Success 200 object ai_template_module_ser.WebListRes "成功"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/ai_template_module/list [get]
func List(ctx *gin.Context) {
var req = &ai_template_module_ser.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)
}
// AllList doc
// @Summary 获取所有AI模版模块接口
// @Description 获取所有AI模版模块
// @Tags 后台-AI模版模块列表
// @Accept mpfd,json
// @Produce json
// @Param q query ai_template_module_ser.WebAllListReq false "请求参数"
// @Success 200 object ai_template_module_ser.WebAllListRes "成功"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/ai_template_module/all [get]
func AllList(ctx *gin.Context) {
var req = &ai_template_module_ser.WebAllListReq{}
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 ai_template_module_ser.WebCreateReq false "请求参数"
// @Success 200 {string} json "{"msg": "操作成功"}"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/ai_template_module/create [post]
func Create(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
p := &ai_template_module_ser.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 ai_template_module_ser.WebUpdateReq false "请求参数"
// @Success 200 {string} json "{"msg": "操作成功"}"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/ai_template_module/update [post]
func Update(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
p := &ai_template_module_ser.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, "")
}
// Delete doc
// @Summary 删除AI模版模块列表
// @Description 删除AI模版模块列表
// @Tags 后台-AI模版模块列表
// @Accept mpfd,json
// @Produce json
// @Param q body ai_template_module_ser.WebDeleteReq false "请求参数"
// @Success 200 {string} json "{"msg": "操作成功"}"
// @Failure 400 {string} json "{"msg": "操作失败"}"
// @Router /api/web/admin/ai_template_module/delete [post]
func Delete(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
p := &ai_template_module_ser.WebDeleteReq{}
err = ctx.ShouldBindJSON(&p)
if err != nil {
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, "")
}