@@ -0,0 +1,48 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/cachev2"
|
||||
"91porn-server/common/constant/redisconst"
|
||||
"91porn-server/common/stderr"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func AlbumList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.AlbumListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
var data officialWebsiteser.AlbumListResp
|
||||
_, err := cachev2.Classes().
|
||||
CacheTime(redisconst.OfficialWebsiteAlbumListCacheExpire).
|
||||
AutoListKey(fmt.Sprintf(redisconst.OfficialWebsiteAlbumListCacheKey, req.PageNumber, req.PageSize)).
|
||||
ResBind(&data).Cache(officialWebsiteser.AlbumList, req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, &data)
|
||||
}
|
||||
|
||||
func AlbumDetail(ctx *gin.Context) {
|
||||
var req = &officialWebsiteser.AlbumDetailReq{}
|
||||
if err := ctx.ShouldBindUri(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.AlbumDetail(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/cachev2"
|
||||
"91porn-server/common/constant/redisconst"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/v/sourcemod"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetBasicData(ctx *gin.Context) {
|
||||
var data = officialWebsiteser.GetBasicDataResp{}
|
||||
_, err := cachev2.Classes().
|
||||
CacheTime(redisconst.OfficialWebsiteBasicDataCacheExpire).
|
||||
AutoListKey(redisconst.OfficialWebsiteBasicDataCacheKey).
|
||||
ResBind(&data).
|
||||
Cache(officialWebsiteser.GetBasicData)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
// 域名信息实时获取,不随基础数据大缓存(12h),避免下发已失效的域名
|
||||
data.Domain, data.SourceList = sourcemod.PingList()
|
||||
common.ServeJSON(ctx, stderr.Success, &data)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func BusinessList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.BusinessListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.BusinessList(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/cachev2"
|
||||
"91porn-server/common/constant/redisconst"
|
||||
"91porn-server/common/stderr"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func HeroList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.HeroListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
var data officialWebsiteser.HeroListResp
|
||||
_, err := cachev2.Classes().
|
||||
CacheTime(redisconst.OfficialWebsiteHeroListCacheExpire).
|
||||
AutoListKey(fmt.Sprintf(redisconst.OfficialWebsiteHeroListCacheKey, req.SortType, req.PageNumber, req.PageSize)).
|
||||
ResBind(&data).Cache(officialWebsiteser.HeroList, req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
|
||||
func HeroDetail(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.HeroDetailReq{}
|
||||
if err := ctx.ShouldBindUri(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.HeroDetail(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func JobList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.JobListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.JobList(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/cachev2"
|
||||
"91porn-server/common/constant/redisconst"
|
||||
"91porn-server/common/stderr"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func NewsList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.NewsListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
var data officialWebsiteser.NewsListResp
|
||||
_, err := cachev2.Classes().
|
||||
CacheTime(redisconst.OfficialWebsiteNewsListCacheExpire).
|
||||
AutoListKey(fmt.Sprintf(redisconst.OfficialWebsiteNewsListCacheKey, req.PageNumber, req.PageSize)).
|
||||
ResBind(&data).Cache(officialWebsiteser.NewsList, req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{"hasNext": data.HasNext, "list": data.List})
|
||||
}
|
||||
|
||||
func NewsDetail(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.NewsDetailReq{}
|
||||
if err := ctx.ShouldBindUri(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.NewsDetail(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/cachev2"
|
||||
"91porn-server/common/constant/redisconst"
|
||||
"91porn-server/common/stderr"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func PartnerList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.PartnerListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
var data officialWebsiteser.PartnerListResp
|
||||
_, err := cachev2.Classes().
|
||||
CacheTime(redisconst.OfficialWebsitePartnerListCacheExpire).
|
||||
AutoListKey(redisconst.OfficialWebsitePartnerListCacheKey).
|
||||
ResBind(&data).Cache(officialWebsiteser.PartnerList, req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RecruitForm(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.RecruitFormReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.RecruitForm(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func TagList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.TagListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.TagList(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package officialWebsitectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/officialWebsiteser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/cachev2"
|
||||
"91porn-server/common/constant/redisconst"
|
||||
"91porn-server/common/stderr"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func VideoList(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.VideoListReq{}
|
||||
if err := ctx.ShouldBindQuery(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
var data officialWebsiteser.VideoListResp
|
||||
_, err := cachev2.Classes().
|
||||
CacheTime(redisconst.OfficialWebsiteVideoListCacheExpire).
|
||||
AutoListKey(fmt.Sprintf(redisconst.OfficialWebsiteVideoListCacheKey, req.Type, req.ID, req.Sort, req.PageNumber, req.PageSize)).
|
||||
ResBind(&data).Cache(officialWebsiteser.VideoList, req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
|
||||
func VideoDetail(ctx *gin.Context) {
|
||||
req := &officialWebsiteser.VideoDetailReq{}
|
||||
if err := ctx.ShouldBindUri(req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := officialWebsiteser.VideoDetail(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
|
||||
func VideoCheck(ctx *gin.Context) {
|
||||
source := ctx.Param("source")
|
||||
if source == "" {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, "")
|
||||
ctx.Abort()
|
||||
}
|
||||
|
||||
id := ctx.Param("id")
|
||||
var req = &officialWebsiteser.VideoDetailReq{ID: id}
|
||||
data, err := officialWebsiteser.VideoDetail(req)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
ctx.Abort()
|
||||
}
|
||||
if data.ID == "" {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, "")
|
||||
ctx.Abort()
|
||||
}
|
||||
if !strings.Contains(source, data.Url) {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, "")
|
||||
ctx.Abort()
|
||||
}
|
||||
ctx.Next()
|
||||
}
|
||||
Reference in New Issue
Block a user