Files
huangguo_server/models/v/usermod/app.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

320 lines
20 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package usermod
import (
"reflect"
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
"91porn-server/models/v/videocoupon"
)
const (
DevIDLogin = 0
TokenLogin = 1
MobileLogin = 2
QrCodeLogin = 3
CouponPositionUnUsed = "unused" // 未使用
CouponPositionUsed = "used" // 已使用
)
// UserSelector 用户修改参数
type UserSelector struct {
Gender *string `json:"gender,omitempty" bson:"gender,omitempty"` //性别
Name *string `json:"name,omitempty" bson:"name,omitempty"`
Portrait *string `json:"portrait,omitempty" bson:"portrait,omitempty"` //头像
Background *[]string `json:"background,omitempty" bson:"background,omitempty"` //背景图
Summary *string `json:"summary,omitempty" bson:"summary,omitempty"` //简介
HasPrivateZone *bool `json:"hasPrivateZone,omitempty" bson:"hasPrivateZone,omitempty"` // 已关闭私密圈权限
Region *string `json:"region,omitempty" bson:"region,omitempty"` //地区
Birthday *string `json:"birthday,omitempty" bson:"birthday,omitempty"` //生日
VipLevel *int `json:"vipLevel,omitempty" bson:"vipLevel,omitempty"` //vip等级
VipExpireDate *time.Time `json:"vipExpireDate,omitempty" bson:"vipExpireDate,omitempty"` //vip过期时间
CoinMouthExpireDate *time.Time `json:"coinMouthExpireDate" bson:"coinMouthExpireDate"` //金币月卡过期时间
HasLocked *bool `json:"hasLocked,omitempty" bson:"hasLocked,omitempty"` //已禁止登陆
HasBanned *bool `json:"hasBanned,omitempty" bson:"hasBanned,omitempty"` //已禁言
LockReason *string `json:"lockReason,omitempty" bson:"lockReason,omitempty"` //禁止登录的原因
LockImg *string `json:"lockImg,omitempty" bson:"lockImg,omitempty"` //禁止登录的原因截图
LockAt *time.Time `json:"lockAt,omitempty" bson:"lockAt,omitempty"` //封禁开始时间
ForbidUpload *bool `json:"forbidUpload,omitempty" bson:"forbidUpload,omitempty"` //是否禁止上传文件
Token *string `json:"token,omitempty" bson:"token,omitempty"` //用户令牌
WatchCount *uint64 `json:"watchCount,omitempty" bson:"watchCount,omitempty"` //观看次数
UpdatedAt *time.Time `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"` //更新时间
LastVisitAt *time.Time `json:"lastVisitAt,omitempty" bson:"lastVisitAt,omitempty"` //最后登陆时间
AppLock *string `json:"appLock,omitempty" bson:"appLock,omitempty"` //设备锁
IsDAgent *bool `json:"isDAgent,omitempty" bson:"isDAgent,omitempty"` //是商圈代理
LastVer *string `json:"lastVer,omitempty" bson:"lastVer,omitempty"` //最后登陆版本
TrueScore *int64 `json:"trueScore,omitempty" bson:"trueScore,omitempty"` //用户真实性得分
IsDirect *bool `json:"isDirect,omitempty" bson:"isDirect,omitempty"` //是直推用户
DiscCode *string `json:"districtCode,omitempty" bson:"districtCode,omitempty"` //商区码
PromSeqe *string `json:"promSeqe,omitempty" bson:"promSeqe,omitempty"` //推广序列
SuperUser *bool `json:"superUser" bson:"superUser,omitempty"` //大v
OfficialCert *bool `json:"officialCert" bson:"officialCert,omitempty"` //是否官方认证
TaxLevel *int64 `json:"taxLevel" bson:"taxLevel,omitempty"` //扣税等级,默认03.7
ChatPrice *int64 `json:"chatPrice" bson:"chatPrice,omitempty"` //私信价格
LastSysType *string `json:"lastSysType,omitempty" bson:"lastSysType,omitempty"` //最后登陆系统类型
SnapVip *int `json:"snapVip,omitempty" bson:"snapVip,omitempty"` //临时vip
OriginVipExpire *time.Time `json:"originVipExpire,omitempty" bson:"originVipExpire,omitempty"` //临时vip记录的原始vip时间
OriginVipLevel *int `json:"originVipLevel,omitempty" bson:"originVipLevel,omitempty"` //临时vip记录的原始vip等级
AutoFollow *bool `json:"autoFollow" bson:"autoFollow,omitempty"` //是否配置被自动关注
HasEnteredGame *bool `json:"hasEnteredGame" bson:"hasEnteredGame,omitempty"` //是否进入过游戏
BankActName *string `json:"bankActName,omitempty" bson:"bankActName,omitempty"` //银行卡绑定名字
GoldVideoFreeExpire *time.Time `json:"goldVideoFreeExpire" bson:"goldVideoFreeExpire,omitempty"` //金币视频免费日期
GoldVideoFreeLimit *int64 `json:"goldVideoFreeLimit" bson:"goldVideoFreeLimit,omitempty"` // 金币视频免费限制门槛(包含acg)
WeeklyActiveValue *int64 `json:"weeklyActiveValue" bson:"weeklyActiveValue,omitempty"` //每周活跃度
OriginalSort *int `json:"originalSort" bson:"originalSort"` // 新版原创排序
VideoDeduction *float64 `json:"videoDeduction,omitempty" bson:"videoDeduction,omitempty"` //视频扣量,1:博主10单扣1单, 以此类推
VideoDeductionPayCount *int `json:"videoDeductionPayCount,omitempty" bson:"videoDeductionPayCount,omitempty"` //视频扣量购买次数
VideoDeductionCount *int `json:"videoDeductionCount,omitempty" bson:"videoDeductionCount,omitempty"` //视频扣量次数
MerchantAccount *string `json:"merchantAccount" bson:"merchantAccount,omitempty"` //商家账号
HasFirstChargeWaLi *bool `json:"hasFirstChargeWaLi,omitempty" bson:"hasFirstChargeWaLi,omitempty"` //是否首充充值瓦力
IsAdvertiser *bool `json:"isAdvertiser" bson:"isAdvertiser"` // 是否是打广告用户
HasWhoringCard *bool `json:"hasWhoringCard,omitempty" bson:"hasWhoringCard,omitempty"` // 是否有白嫖卡
PayVidDiscount *int `json:"payVidDiscount,omitempty" bson:"payVidDiscount,omitempty"` //支付视频折扣
GoldVideoCoupon *[]UserGoldVideoCoupon `json:"goldVideoCoupon,omitempty" bson:"goldVideoCoupon,omitempty"`
VideoFreeExpiration *time.Time `json:"videoFreeExpiration,omitempty" bson:"videoFreeExpiration,omitempty"` //视频免费过期时间
PassWord *string `json:"passWord,omitempty" bson:"passWord,omitempty"` //密码
VipName *string `json:"vipName,omitempty" bson:"vipName,omitempty"` //会员卡名称
LoufengBookDiscount *int `json:"loufengBookDiscount" bson:"loufengBookDiscount,omitempty"`
LoufengBookDiscountExpiration *time.Time `json:"loufengBookDiscountExpiration" bson:"loufengBookDiscountExpiration,omitempty"`
BannedTime *time.Time `json:"bannedTime" bson:"bannedTime,omitempty"` // 禁言时间
AllGoldVideoFree *bool `json:"allGoldVideoFree" bson:"allGoldVideoFree,omitempty"` // 是否所有金币视频免费
AiMateUid *string `json:"aiMateUid" bson:"aiMateUid,omitempty"` // ai伴侣uid
BroadcastExpire *time.Time `json:"broadcastExpire" bson:"broadcastExpire,omitempty"` //直播有效期
DramaExpire *time.Time `json:"dramaExpire" bson:"dramaExpire,omitempty"` //短剧权益有效期
}
// RenewDramaExpire 从当前有效期顺延短剧权益;已过期时从本次发放时间起算。
func RenewDramaExpire(current, now time.Time, days int) time.Time {
if current.After(now) {
return current.AddDate(0, 0, days)
}
return now.AddDate(0, 0, days)
}
func (u UserSelector) IsEmpty() bool {
return reflect.DeepEqual(u, UserSelector{})
}
// UserSelector 用户修改参数
type UserModifyReq struct {
Gender *string `json:"gender,omitempty" bson:"gender,omitempty"` //性别
Name *string `json:"name,omitempty" bson:"name,omitempty"`
Portrait *string `json:"portrait,omitempty" bson:"portrait,omitempty"` //头像
Background *[]string `json:"background,omitempty" bson:"background,omitempty"` //背景图
Summary *string `json:"summary,omitempty" bson:"summary,omitempty"` //简介
Region *string `json:"region,omitempty" bson:"region,omitempty"` //地区
Birthday *string `json:"birthday,omitempty" bson:"birthday,omitempty"` //生日
AppLock *string `json:"appLock,omitempty" bson:"appLock,omitempty"` //设备锁
UpdatedAt *time.Time `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"`
}
type UserOpt struct {
//显示全民代理
ShowProxy bool `json:"showProxy"`
}
// RechargeLevel 充值等级
type RechargeLevel struct {
//等级
Level int `json:"level"`
//当前位置
Current int `json:"current"`
//当前等级最大值
Limit int `json:"limit"`
}
// AwardsExpireResp 奖章返回数据
type AwardsExpireResp struct {
Number int `json:"number" bson:"number,omitempty"` // 奖章价值
IsExpire bool `json:"isExpire" bson:"isExpire,omitempty"` // 奖章是否过期 true有效 false无效
}
type UserRes struct {
//年龄
Age int `form:"age" json:"age" bson:"age"`
//作品总数
CollectionCount int64 `form:"collectionCount" json:"collectionCount"`
//是否是vip
IsVIP bool `json:"isVip" bson:"isVip"`
//推广落地页
PromoteURL string `json:"promoteURL" bson:"promoteURL"`
// 邀请者推广码
InviterCode string `json:"inviterCode" bson:"inviterCode"`
//用户当前定位城市
City string `json:"city"`
//用户购买视频总数
BuyVidCount int64 `json:"buyVidCount"`
//用户访问web携带的Token
WebToken string `json:"webToken"`
//用户登陆方式
LoginType int `json:"loginType"`
// 邀请者推广码
AppStoreCode string `json:"appStoreCode" bson:"appStoreCode"`
// 视频折扣卡到期时间
VideoDiscountExpiration time.Time `json:"videoDiscountExpiration"`
// 新版金币视频观影券
NewGoldVideoCoupon []GoldVideoCoupon `json:"newGoldVideoCoupon"`
//我的图片作品总数
HappinessPlazaCount int64 `form:"happinessPlazaCount" json:"happinessPlazaCount"`
TotalInvite int64 `form:"totalInvite" json:"totalInvite"`
IsFollow bool `json:"isFollow"`
//是否弹领取框
IsPopUps bool `form:"isPopUps" json:"isPopUps"` //是否弹出领取框
WhoringCard WhoringCardInfo `json:"whoringCard" bson:"whoringCard"` // 白嫖卡信息
AdverAbTestShowType int `json:"adverAbTestShowType"` // 广告ab测展示类型 -1-首次免广告 0-所有广告都可以观看 其他数字N-新人注册N分钟内免广告
ImEnabled bool `json:"imEnabled"` // IM 功能是否启用
ImToken string `json:"imToken"` // IM 客户端登录 token
ImUserID int64 `json:"imUserId"` // IM 平台用户 ID
ImDynamicDomain string `json:"dynamicConfigDomain"` // IM SDK 动态配置域名
ImSocketURL string `json:"socketURL"` // IM SDK WebSocket 地址
User
UserOpt
RechargeLevel
IsUpgrade bool `json:"isUpgrade" bson:"isUpgrade"` // 是否vip升级
}
type WhoringCardInfo struct {
HasWhoringCard bool `json:"hasWhoringCard" bson:"hasWhoringCard"` // 是否有白嫖卡
DetailInfo []DetailInfo `json:"detailInfo" bson:"detailInfo"` // 详细信息
}
type DetailInfo struct {
ID primitive.ObjectID `json:"id" bson:"id"` // 白嫖卡ID
HasReturn bool `json:"hasReturn" bson:"hasReturn"` // 是否返现白嫖卡
TotalDays int64 `json:"totalDays" bson:"totalDays"` // 需要打卡天数
CurrentSignDays int64 `json:"currentSignDays" bson:"currentSignDays"` // 连续打卡天数
ForgetSignDays int64 `json:"forgetSignDays" bson:"forgetSignDays"` // 忘记打卡天数
RenewalSignDays int64 `json:"renewalSignDays" bson:"renewalSignDays"` // 补签打卡天数
RenewalSignPrice int64 `json:"renewalSignPrice" bson:"renewalSignPrice"` // 补签打卡价格
StartTime time.Time `json:"startTime" bson:"startTime"` // 开始时间
EndTime time.Time `json:"endTime" bson:"endTime"` // 结束时间
RecordTime []Record `json:"recordTime" bson:"recordTime"` // 打卡时间
}
type Record struct {
SignTime string `json:"signTime" bson:"signTime"` // 打卡时间
IsSign bool `json:"isSign" bson:"isSign"` // 是否打卡
}
// DevLoginP 块设备登陆参数
type DevLoginP struct {
DevID string `json:"devID"`
DevType string `json:"devType" ` //设备型号
SysType string `json:"sysType"` //操作系统类型 安卓 IOS
Ver string `json:"ver" ` //APP版本号
DevToken string `json:"devToken" bson:"devToken"` //设备token ios 推送用
CutInfos string `json:"cutInfos"` //剪切板信息
Mobile string `json:"mobile"` //手机号
QrCnt string `json:"qrCnt"` //二维码内容
}
// BaseInfo 返回的用户信息
type BaseInfo struct {
UID uint64 `json:"uid" bson:"uid"`
Name string `json:"name" bson:"name"`
Gender string `json:"gender" bson:"gender"`
Portrait string `json:"portrait" bson:"portrait"`
HasLocked bool `json:"hasLocked" bson:"hasLocked"` //已禁止登陆
HasBanned bool `json:"hasBanned" bson:"hasBanned"` //已禁言
}
// BaseInfoVip 返回的用户信息
type BaseInfoVip struct {
//用户id
UID uint64 `json:"uid"`
//姓名
Name string `json:"name"`
//性别
Gender string `json:"gender"`
//头像
Portrait string `json:"portrait"`
//已禁止登陆
HasLocked bool `json:"hasLocked"`
//已禁言
HasBanned bool `json:"hasBanned"`
//vip登记
VipLevel int `json:"vipLevel"`
//是否是vip
IsVip bool `json:"isVip"`
//充值等级
RechargeLevel int `json:"rechargeLevel" ` //头像显示的vip等级,累计充值决定
//是否是大v
SuperUser bool `json:"superUser"` //大v
//活跃值
ActiveValue int `json:"activeValue"` //活跃度
//是否官方认证
OfficialCert bool `json:"officialCert"` //是否官方认证
//年龄
Age int `json:"age"`
//关注数
Follows int64 `json:"follows"`
//粉丝数
Fans int64 `json:"fans"`
TotalWorks int64 `json:"totalWorks" bson:"totalWorks"` // 总作品数
Summary *string `json:"summary,omitempty" bson:"summary,omitempty"` // 简介
Awards []int `json:"awards"` // 用户奖章
UpTag string `json:"upTag" bson:"upTag"` // 用户标签
VipName string `json:"vipName" bson:"vipName"` // 用户VIP名称
VipExpireDate time.Time `json:"vipExpireDate" bson:"vipExpireDate"` // VIP过期时间
}
// UserInfo 用户基本信息和状态信息
type UserInfo struct {
BaseInfo
}
// LoginWithH5 h5登陆参数
type LoginWithH5 struct {
Mobile string `json:"mobile" ` // 手机号
Email string `json:"email"` // email
Account string `json:"account"` // 账号
Code string `json:"code" ` // 短信码
PassWord string `json:"passWord"` // 密码
DevID string `json:"devID" binding:"required"` // 设备id
SysType string `json:"sysType" binding:"required"` // 操作系统类型 安卓 IOS
CutInfos string `json:"cutInfos"` // 剪切板信息
IsAppStore bool `json:"isAppStore"` // 是否商店包用户
}
// LoginH5ByQRCode H5用户通过二维码登录
type LoginH5ByQRCode struct {
Content string `json:"content" binding:"required"` // 二维码内容
}
// GoldVideoCouponDetail 新版观影券详情
type GoldVideoCouponDetail struct {
Num int `json:"num"` // 观影券面值
Count int `json:"count"` // 观影券数量
Source videocoupon.GoldVideoCouponSource `json:"source"` // 观影券获得方式
}
// GoldVideoCoupon 观影券
type GoldVideoCoupon struct {
Position string `json:"position"` // 观影券位置,如“已获得”、“已使用”
Coupons []GoldVideoCouponDetail `json:"coupons"` // 观影券
}
type UserRights struct {
UID uint64 `json:"uid"` // 用户ID
GoldVideoCoupons []GoldVideoCoupon `json:"goldVideoCoupons"` // 观影券
Cards []Card `json:"cards"` // 各种会员卡特权卡信息
GoldVideoDiscount int `json:"videoDiscount"` // 视频折扣
VipExpireDate time.Time `json:"vipExpireDate"` // 会员到期时间
GoldVideoFreeExpire time.Time `json:"goldVideoFreeExpire"` // 金币视频免费到期时间
}
type Card struct {
Name string `json:"name"` // 卡片名称Name
Expiration time.Time `json:"expiration"` // 到期时间
}
type ResetPasswordRequest struct {
Email string `json:"email"` // email
Mobile string `json:"mobile"` // 电话号码
UID uint64 `json:"uid"` // 用户ID
TimeStamp int64 `json:"timestamp"` // 时间戳
RandNum int64 `json:"randNum"` // 随机数
}