@@ -0,0 +1,89 @@
|
||||
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 ListAlbum(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.AlbumListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListAlbum(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateAlbum(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyAlbumReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateAlbum(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 UpdateAlbum(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyAlbumReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateAlbum(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 DeleteAlbum(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteAlbumReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteAlbum(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)
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/constant"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/l/operatorlgmod"
|
||||
"91porn-server/web/service/officialWebsiteser"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetBasicData(ctx *gin.Context) {
|
||||
data, err := officialwebsiteser.GetBasicData()
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
|
||||
func CreateBasicData(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyBasicDataReq{}
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateBasicData(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 UpdateBasicData(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyBasicDataReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateBasicData(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 DeleteBasicData(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteBasicDataReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteBasicData(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)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 ListBusiness(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.BusinessListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListBusiness(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateBusiness(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyBusinessReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateBusiness(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 UpdateBusiness(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyBusinessReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateBusiness(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 DeleteBusiness(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteBusinessReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteBusiness(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)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 ListHero(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.HeroListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListHero(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateHero(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyHeroReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateHero(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 UpdateHero(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyHeroReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateHero(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 DeleteHero(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteHeroReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteHero(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)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 ListJobList(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.JobListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListJobList(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateJobList(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyJobReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateJobList(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 UpdateJobList(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyJobReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateJobList(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 DeleteJobList(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteJobReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteJobList(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)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 ListNews(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.NewsListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListNews(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateNews(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyNewsReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateNews(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 UpdateNews(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyNewsReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateNews(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 DeleteNews(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteNewsReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteNews(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)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 ListPartner(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.PartnerListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListPartner(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreatePartner(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyPartnerReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreatePartner(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 UpdatePartner(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyPartnerReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdatePartner(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 DeletePartner(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeletePartnerReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeletePartner(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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 ListRecruitForm(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.RecruitFormListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListRecruitForm(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateRecruitForm(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyRecruitFormReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateRecruitForm(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 UpdateRecruitForm(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyRecruitFormReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateRecruitForm(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 DeleteRecruitForm(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteRecruitFormReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteRecruitForm(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)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 ListTag(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.TagListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListTag(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateTag(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyTagReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateTag(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 UpdateTag(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyTagReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateTag(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 DeleteTag(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteTagReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteTag(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)
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
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 ListVideo(ctx *gin.Context) {
|
||||
req := &officialwebsiteser.VideoListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
total, data, err := officialwebsiteser.ListVideo(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"total": total, "list": data})
|
||||
}
|
||||
|
||||
func CreateVideo(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyVideoReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.CreateVideo(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 UpdateVideo(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.ModifyVideoReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.UpdateVideo(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 DeleteVideo(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.DeleteVideoReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.DeleteVideo(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 BatchUpdateVideos(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.BatchUpdateVideoOwnerReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.BatchUpdateVideoOwner(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 BatchImportVideos(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := &officialwebsiteser.BatchImportVideoReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialwebsiteser.BatchImportVideo(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.OfficialWebsiteImportVideoFailed, 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)
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/v/tagmod"
|
||||
"91porn-server/models/v/vidmod"
|
||||
officialwebsiteser "91porn-server/web/service/officialWebsiteser"
|
||||
"91porn-server/web/service/vidser"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type VideoListFromVidResp struct {
|
||||
VInfos []*VideoResp `json:"vInfos"` // 帖子列表
|
||||
Total int64 `json:"total"` // 帖子总量
|
||||
}
|
||||
|
||||
type VideoResp struct {
|
||||
*vidmod.WebVideo
|
||||
AddedInfoOfficialWebsite bool `json:"added_info_official_website"`
|
||||
}
|
||||
|
||||
func ListVideoFromVid(ctx *gin.Context) {
|
||||
req := vidmod.ListReq{}
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
m, sort, err := assembleConditions(req)
|
||||
if err != stderr.Success {
|
||||
common.ServeJSON(ctx, err, err)
|
||||
return
|
||||
}
|
||||
code, data := vidser.GetVidList(m, sort, req.PageNumber, req.PageSize, req.IsPush)
|
||||
|
||||
videoList := make([]*VideoResp, 0)
|
||||
var ids []primitive.ObjectID
|
||||
for _, v := range data.VInfos {
|
||||
ids = append(ids, v.ID)
|
||||
videoList = append(videoList, &VideoResp{
|
||||
WebVideo: v,
|
||||
AddedInfoOfficialWebsite: false,
|
||||
})
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
common.ServeJSON(ctx, code, videoList)
|
||||
return
|
||||
}
|
||||
|
||||
checkData, checkErr := officialwebsiteser.CheckVideoExistByVid(ids)
|
||||
if checkErr != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, nil)
|
||||
return
|
||||
}
|
||||
for i := range videoList {
|
||||
for j := range checkData {
|
||||
if videoList[i].WebVideo.ID == checkData[j].ID {
|
||||
videoList[i].AddedInfoOfficialWebsite = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
common.ServeJSON(ctx, code, &VideoListFromVidResp{
|
||||
VInfos: videoList,
|
||||
Total: data.Total,
|
||||
})
|
||||
}
|
||||
|
||||
func assembleConditions(req vidmod.ListReq) (m map[string]interface{}, sort vidser.SortModeList, err stderr.Code) {
|
||||
sort = vidser.SortModeList{{Field: "createdAt", Value: -1}}
|
||||
m = make(map[string]interface{})
|
||||
if req.ShowType != nil {
|
||||
m["showType"] = *req.ShowType
|
||||
}
|
||||
if req.Status != 4 {
|
||||
if req.Status == 7 {
|
||||
m["status"] = map[string]int{"$gt": 0}
|
||||
} else {
|
||||
m["status"] = req.Status
|
||||
}
|
||||
}
|
||||
if req.IsFree == 0 {
|
||||
m["coins"] = map[string]int{"$gt": 0}
|
||||
}
|
||||
if req.IsFree == 1 {
|
||||
m["coins"] = map[string]int{"$eq": 0}
|
||||
}
|
||||
if req.IsUserUp == 2 {
|
||||
m["publisherID"] = map[string]int{"$lt": 115000}
|
||||
}
|
||||
if req.IsUserUp == 1 {
|
||||
m["publisherID"] = map[string]int{"$gt": 115000}
|
||||
}
|
||||
if len(req.Title) != 0 {
|
||||
m["title"] = map[string]string{"$regex": req.Title, "$options": "i"}
|
||||
}
|
||||
if req.UID > 0 {
|
||||
m["publisherID"] = req.UID
|
||||
}
|
||||
if req.Chosen == 1 {
|
||||
m["chosen"] = true
|
||||
}
|
||||
if req.Chosen == 2 {
|
||||
m["chosen"] = false
|
||||
}
|
||||
if req.FreeArea == 1 {
|
||||
m["freeArea"] = true
|
||||
}
|
||||
if req.FreeArea == 2 {
|
||||
m["freeArea"] = false
|
||||
}
|
||||
if !req.End.IsZero() {
|
||||
m["createdAt"] = map[string]time.Time{"$gte": req.Start, "$lt": req.End}
|
||||
}
|
||||
if req.ReviewAccount != "" {
|
||||
m["reviewAccount"] = req.ReviewAccount
|
||||
}
|
||||
if len(req.Tag) != 0 {
|
||||
id, err := tagmod.GetTagIDByName(req.Tag)
|
||||
if err != nil {
|
||||
return m, sort, stderr.ErrDbQueryError
|
||||
}
|
||||
m["tags"] = id
|
||||
//sort = vidser.SortModeList{{Field: "tagSort." + id.Hex(), Value: -1}, {Field: "createdAt", Value: -1}}
|
||||
}
|
||||
if len(req.ID) != 0 {
|
||||
oid, err := primitive.ObjectIDFromHex(req.ID)
|
||||
if err != nil {
|
||||
return m, sort, stderr.ErrParamError
|
||||
}
|
||||
m["_id"] = oid
|
||||
}
|
||||
//通过初始价格判断是否是马甲账号
|
||||
if req.IsPretendAcc == 1 {
|
||||
m["coins"] = vidmod.PretendAccInitCoins
|
||||
}
|
||||
if req.IsPretendAcc == 2 {
|
||||
//i := make(map[string]int64)
|
||||
//i["$ne"] = vidmod.PretendAccInitCoins
|
||||
m["coins"] = map[string]int64{"$ne": vidmod.PretendAccInitCoins}
|
||||
}
|
||||
m["deleteAt"] = bson.M{"$exists": false}
|
||||
if req.NewsType != "" {
|
||||
m["newsType"] = req.NewsType
|
||||
}
|
||||
|
||||
if req.LiaoBaTop != nil {
|
||||
if *req.LiaoBaTop {
|
||||
sort = vidser.LiaoBaTopSortModeList()
|
||||
m["liaoBaTopSort"] = bson.M{"$gt": 0}
|
||||
} else {
|
||||
m["liaoBaTopSort"] = 0
|
||||
}
|
||||
}
|
||||
if req.SectionID != "" {
|
||||
m["sectionID"] = req.SectionID
|
||||
}
|
||||
m["isSortedUnderModule"] = req.IsSortedUnderModule
|
||||
if req.IsSortedUnderModule {
|
||||
sort = nil
|
||||
}
|
||||
if req.IsRecommended != nil {
|
||||
if *req.IsRecommended {
|
||||
m["recoWeight"] = bson.M{"$gte": 0}
|
||||
} else {
|
||||
m["recoWeight"] = bson.M{"$lt": 0}
|
||||
}
|
||||
}
|
||||
if req.Key == "likeRate" || req.Key == "purchaseRate" {
|
||||
m[req.Key] = req.Value
|
||||
}
|
||||
if req.IsHappinessPlazaTop != nil && *req.IsHappinessPlazaTop {
|
||||
if *req.IsHappinessPlazaTop {
|
||||
m["happinessPlazaTop"] = bson.M{"$gt": 0}
|
||||
} else {
|
||||
m["happinessPlazaTop"] = bson.M{"$lte": 0}
|
||||
}
|
||||
}
|
||||
return m, sort, stderr.Success
|
||||
}
|
||||
Reference in New Issue
Block a user