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
+103
View File
@@ -0,0 +1,103 @@
package officialWebsitectrl
import (
"91porn-server/common"
"91porn-server/common/constant"
"91porn-server/common/stderr"
"91porn-server/models/l/operatorlgmod"
officialwebsiteser "91porn-server/web/service/officialWebsiteser"
"encoding/json"
"github.com/gin-gonic/gin"
)
func ListPhotograph(ctx *gin.Context) {
req := &officialwebsiteser.ListPhotographReq{}
if err := ctx.ShouldBindQuery(req); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
total, data, err := officialwebsiteser.ListPhotograph(req)
if err != nil {
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
return
}
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
}
func CreatePhotograph(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
req := &officialwebsiteser.ModifyPhotographReq{}
if err := ctx.ShouldBindJSON(req); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
data, err := officialwebsiteser.CreatePhotograph(req)
if err != nil {
common.ServeJSON(ctx, stderr.ErrDbInsertError, err.Error())
return
}
log, _ := json.Marshal(req)
_ = operatorlgmod.RecordOperation(manager, constant.OfficialWebsiteConfig, constant.Add, string(log), ctx.Request.URL.RequestURI())
common.ServeJSON(ctx, stderr.Success, data)
}
func UpdatePhotograph(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
req := &officialwebsiteser.ModifyPhotographReq{}
if err := ctx.ShouldBindJSON(req); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
data, err := officialwebsiteser.UpdatePhotograph(req)
if err != nil {
common.ServeJSON(ctx, stderr.ErrDbUpdateError, err.Error())
return
}
log, _ := json.Marshal(req)
_ = operatorlgmod.RecordOperation(manager, constant.OfficialWebsiteConfig, constant.Modify, string(log), ctx.Request.URL.RequestURI())
common.ServeJSON(ctx, stderr.Success, data)
}
func DeletePhotograph(ctx *gin.Context) {
manager, err := common.GetAdminAct(ctx)
if err != nil {
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
return
}
req := &officialwebsiteser.DeletePhotographReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
data, err := officialwebsiteser.DeletePhotograph(req)
if err != nil {
common.ServeJSON(ctx, stderr.ErrDbDeleteError, err.Error())
return
}
log, _ := json.Marshal(req)
_ = operatorlgmod.RecordOperation(manager, constant.OfficialWebsiteConfig, constant.Delete, string(log), ctx.Request.URL.RequestURI())
common.ServeJSON(ctx, stderr.Success, data)
}
func BatchUpdatePhotograph(ctx *gin.Context) {
req := &officialwebsiteser.BatchUpdatePhotographOwnerReq{}
if err := ctx.ShouldBindJSON(req); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
data, err := officialwebsiteser.BatchUpdatePhotographOwner(req)
if err != nil {
common.ServeJSON(ctx, stderr.ErrDbUpdateError, err.Error())
return
}
common.ServeJSON(ctx, stderr.Success, data)
}