Initial commit: web_hghl_server

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 16:28:14 +08:00
co-authored by Claude Opus 4.7
commit 65fca60622
653 changed files with 135901 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package pubdef
// CommentObjectType 评论对象类型
type CommentObjectType int64
const (
CommentObjectTypeVideo CommentObjectType = 0 // 视频
CommentObjectTypePlaylet CommentObjectType = 4 // 短剧
CommentObjectTypePlayletChapter CommentObjectType = 11 // 短剧剧集
)
var commentObjectTypeNameMap = map[CommentObjectType]string{
CommentObjectTypeVideo: "视频",
CommentObjectTypePlaylet: "短剧",
CommentObjectTypePlayletChapter: "短剧剧集",
}
// CommentObjectTypeName 返回对象类型对应的展示名称
func CommentObjectTypeName(objectType CommentObjectType) string {
return commentObjectTypeNameMap[objectType]
}
// ValidCommentObjectType 判断评论对象类型是否合法
func ValidCommentObjectType(objectType CommentObjectType) bool {
_, ok := commentObjectTypeNameMap[objectType]
return ok
}
+36
View File
@@ -0,0 +1,36 @@
package pubdef
type Flow struct {
WatchTimes int64 `json:"watchTimes" bson:"watchTimes"` // 真实观看次数
ShowTimes int64 `json:"showTimes" bson:"showTimes"` // 展示次数
Comments int64 `json:"comments" bson:"comments"` // 评论条数
Likes int64 `json:"likes" bson:"likes"` // 真实点赞数(收藏总量)
WeekWatchs int64 `json:"weekWatchs" bson:"weekWatchs"` // 本周观看次数
MonthWatchs int64 `json:"monthWatchs" bson:"monthWatchs"` // 本月观看次数
YearWatchs int64 `json:"yearWatchs" bson:"yearWatchs"` // 本年观看次数
TodayWatchs int64 `json:"todayWatchs" bson:"todayWatchs"` // 当日观看次数
WeekLikes int64 `json:"weekLikes" bson:"weekLikes"` // 近7日收藏量
MonthLikes int64 `json:"monthLikes" bson:"monthLikes"` // 近30日收藏量
YearLikes int64 `json:"yearLikes" bson:"yearLikes"` // 近365日收藏量
}
type FakeFlow struct {
WatchTimes int64 `json:"watchTimes" bson:"watchTimes"` // 假观看次数
Likes int64 `json:"likes" bson:"likes"` // 假点赞数
}
type InformationStatus int32
const (
InformationStatusWaiting InformationStatus = 0 // 初始化
InformationStatusVerifyOK InformationStatus = 1 // 上架
InformationStatusVerifyCancel InformationStatus = 2 // 下架
)
type InformationUpdateStatus int32
const (
InformationUpdateStatusWaiting InformationUpdateStatus = 0 // 待发布
InformationUpdateStatusLoading InformationUpdateStatus = 1 // 连载中
InformationUpdateStatusEnd InformationUpdateStatus = 2 // 已完结
)
+8
View File
@@ -0,0 +1,8 @@
package pubdef
type ContentType int64
const (
ContentType_Video ContentType = 1 // 视频
ContentType_Collection ContentType = 2 // 合集
)
+83
View File
@@ -0,0 +1,83 @@
package pubdef
import "fmt"
type Page struct {
PageNum int64 `form:"pageNum" json:"pageNum,omitempty"`
PageSize int64 `form:"pageSize" json:"pageSize,omitempty"`
}
const (
DateISO = "2006-01-02"
TimeISO = "2006-01-02 15:04:05"
AppId = 1046 // 91pron
AppName = "海角社区"
DefaultChannelCode = "hjsq"
// CompanyPlatform 是内容中台授权的产品名,对应 company_platform 字段
CompanyPlatform = "海角社区"
// seoPushEnabled 对外推送总开关。需要推送时改为 true 后重新发版。
// false 时不登记任务,开启后再按当前页面地址生成并推送。
// 真正提交还要求 runMod=prod,测试环境即使打开开关也只 dry-run。
seoPushEnabled = false
)
func ReportAppId() string {
return fmt.Sprintf("JHA-%d", AppId)
}
// Enabled 业务开关是否打开(不含环境判断)。
func Enabled() bool {
return seoPushEnabled
}
const PageSize int64 = 40
func GetTotalPage(total int64, page int64) int64 {
totalPage := total / PageSize
if total%PageSize > 0 {
totalPage++
}
return totalPage
}
type SeoValue struct {
Title string `json:"title" bson:"webTitle"` // 网站SEO标题
Keyworld []string `json:"keyworld" bson:"webKeyworld"` // 网站SEO关键字
Description string `json:"description" bson:"webDescription"` // 网站SEO描述
}
// DisplayMode 分类展示方式
type DisplayMode int64
const (
DisplayModeDefault DisplayMode = 0 // 默认(上图下标题多列)
DisplayModeCardCarousel DisplayMode = 1 // 卡片层叠轮播
DisplayModeAvatarList DisplayMode = 2 // 头像列表
DisplayModeImageText DisplayMode = 3 // 图文列表(左图右标题多列)
DisplayModeBigCover DisplayMode = 4 // 大封面列表(一大图两列)
)
// CategoryDisplayPosition 分类显示位置
type CategoryDisplayPosition int64
const (
CategoryDisplayPositionTabOnly CategoryDisplayPosition = 0 // 仅TAB
CategoryDisplayPositionHomeOnly CategoryDisplayPosition = 1 // 仅首页
CategoryDisplayPositionBoth CategoryDisplayPosition = 2 // TAB和首页都显示
)
// CategorySortType 首页分类内容排序方式。
type CategorySortType int64
const (
CategorySortTypeAddedTimeDesc CategorySortType = 0 // 上架时间降序
CategorySortTypeWatchDesc CategorySortType = 1 // 观看次数降序
CategorySortTypeLikeDesc CategorySortType = 2 // 点赞(收藏)次数降序
CategorySortTypeAddedTimeAsc CategorySortType = 3 // 上架时间升序
CategorySortTypeWatchAsc CategorySortType = 4 // 观看次数升序
CategorySortTypeLikeAsc CategorySortType = 5 // 点赞(收藏)次数升序
CategorySortTypeUpdateTimeDesc CategorySortType = 6 // 更新时间降序
CategorySortTypeUpdateTimeAsc CategorySortType = 7 // 更新时间升序
CategorySortTypeSortType CategorySortType = 8 // 自定义排序
)
+26
View File
@@ -0,0 +1,26 @@
package pubdef
// TranslationType 导航类型
type TranslationType int64
const (
TranslationTypeUrl TranslationType = 1 // URL模式
TranslationTypeSub TranslationType = 2 // 二级导航
TranslationTypeBottom TranslationType = 3 // 底部导航
)
const (
TranslationPath_Video = "/video" // 视频首页
TranslationPath_VideoAll = "/video/all" // 全部视频
TranslationPath_VideoRank = "/video/rank" // 视频排行榜
TranslationPath_ActressRank = "/actress/rank" // 女优排行榜
TranslationPath_VideoMore = "/video/more/%d" // 视频分类
)
// FixedNavItem 固定导航路径对应的名称(与路径常量一一对应,供各端统一使用)
const (
TranslationName_Video = "视频首页"
TranslationName_VideoAll = "全部视频"
TranslationName_VideoRank = "视频排行榜"
TranslationName_ActressRank = "女优排行榜"
)
+70
View File
@@ -0,0 +1,70 @@
package pubdef
type UserStatus int32
const (
UserStatusNormal UserStatus = 0 // 正常
UserStatusDisable UserStatus = 1 // 封禁
UserStatusSlient UserStatus = 2 // 禁言
)
var UserStatusMap = map[UserStatus]string{
UserStatusNormal: "正常",
UserStatusDisable: "封禁",
UserStatusSlient: "禁止登陆",
}
type LoginType int32
const (
LoginTypeDevice LoginType = 0 + iota // 设备登陆
LoginTypeMobile // 手机登陆
LoginTypeQrCode // 二维码登陆
LoginTypeAccount // 账号登陆
)
// SysType 客户端系统/平台类型
type SysType string
const (
ST_None SysType = ""
ST_IOS SysType = "ios"
ST_Android SysType = "android"
ST_H5 SysType = "h5"
ST_PC SysType = "pc"
ST_H5IOS SysType = "h5_ios"
ST_H5Android SysType = "h5_android"
ST_H5PC SysType = "h5_pc"
ST_Light SysType = "light"
ST_TG SysType = "tg"
ST_Web SysType = "web"
)
func (s SysType) String() string { return string(s) }
// IsH5 判断是否为 H5/Web 端
func (s SysType) IsH5() bool {
return s == ST_H5IOS || s == ST_H5Android || s == ST_H5PC ||
s == ST_H5 || s == ST_Light || s == ST_TG || s == ST_Web
}
// IsIOS 判断是否为 iOS 原生
func (s SysType) IsIOS() bool { return s == ST_IOS }
// IsAndroid 判断是否为 Android 原生
func (s SysType) IsAndroid() bool { return s == ST_Android }
// IsWeb 判断是否为 Web 端
func (s SysType) IsWeb() bool { return s == ST_Web }
// SysTypeFromString 将字符串转换为 SysType
func SysTypeFromString(s string) SysType {
switch SysType(s) {
case ST_IOS, ST_Android, ST_H5, ST_PC,
ST_H5IOS, ST_H5Android, ST_H5PC,
ST_Light, ST_TG, ST_Web:
return SysType(s)
default:
return ST_None
}
}