对齐 web_huangguo2 的四项改造
- 广告获取改走 versionUrl /api/stat/advitise/v2/get(appId=12),移除 adcenter(Jt) 调用;新增 /api/app/ads/click 异步上报点击;proto.AdvitiseData 别名为 proxy.AdvitiseData,AList/BList 字段改名 AppInfoAList/AppInfoBList。 - web 后台登录取消谷歌验证码(srv_mwacc.AccLogin 去掉 code 参数),密码正确即 发放 token。 - app 端取消注册/登录/找回密码/游客登录接口及密码、token 相关代码;鉴权中间件 不再校验 token,按 X-User-Agent 中的 devID 识别用户,首次访问自动建号, Redis 缓存 10 分钟;修改资料不再支持改密码。 - app m3u8 ticket 校验失败不再降级到 fallback 路径,仍按原 m3u8Name 返回。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,10 @@ const (
|
||||
FiveMVisit = "bd_visitFmt:%s"
|
||||
BloomUser = "bd_bloom_user:%d"
|
||||
AppUserToken = "bd_app_user_token:%d"
|
||||
appDeviceUserFmt = "app:device:user:%s"
|
||||
appDeviceUserLockFmt = "app:device:user:lock:%s"
|
||||
AppDeviceUserExpire = 10 * time.Minute
|
||||
AppDeviceUserLockExpire = 5 * time.Second
|
||||
captchaKey = "bd_captcha_mobile_%s"
|
||||
CaptchaExpire = 5 * time.Minute
|
||||
replayNonceKey = "bd_replay:nonce:_%s"
|
||||
@@ -209,3 +213,13 @@ func M3U8DailyMediaUserKey(userId int64, mediaId int64) string {
|
||||
func M3U8UserVipExpireKey(userId int64) string {
|
||||
return fmt.Sprintf(m3u8UserVipExpireFmt, userId)
|
||||
}
|
||||
|
||||
// AppDeviceUserKey 设备ID到用户ID的缓存
|
||||
func AppDeviceUserKey(devID string) string {
|
||||
return fmt.Sprintf(appDeviceUserFmt, devID)
|
||||
}
|
||||
|
||||
// AppDeviceUserLockKey 按设备ID创建用户时的并发锁
|
||||
func AppDeviceUserLockKey(devID string) string {
|
||||
return fmt.Sprintf(appDeviceUserLockFmt, devID)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"time"
|
||||
"videoweb/pub/models/videoinformationmod"
|
||||
@@ -425,6 +426,33 @@ type AdvitiseInfo struct {
|
||||
Images string `json:"images" bson:"images"` // 视频banner
|
||||
Link string `json:"link" bson:"link"` // 链接
|
||||
}
|
||||
|
||||
// UnmarshalJSON 兼容远端 id 返回数字或字符串两种格式,统一解析为字符串,避免大整数(雪花ID)在 JS 端丢精度
|
||||
func (a *AdvitiseInfo) UnmarshalJSON(data []byte) error {
|
||||
type alias AdvitiseInfo
|
||||
aux := &struct {
|
||||
Id json.RawMessage `json:"id"`
|
||||
*alias
|
||||
}{alias: (*alias)(a)}
|
||||
if err := json.Unmarshal(data, aux); err != nil {
|
||||
return err
|
||||
}
|
||||
raw := strings.TrimSpace(string(aux.Id))
|
||||
switch {
|
||||
case raw == "" || raw == "null":
|
||||
a.Id = ""
|
||||
case strings.HasPrefix(raw, `"`):
|
||||
var s string
|
||||
if err := json.Unmarshal([]byte(raw), &s); err != nil {
|
||||
return err
|
||||
}
|
||||
a.Id = s
|
||||
default:
|
||||
a.Id = raw
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AdvitiseData struct {
|
||||
DialogList []AdvitiseInfo `json:"dialogList" bson:"dialogList"` // 弹窗广告
|
||||
HomeList []AdvitiseInfo `json:"homeList" bson:"homeList"` // 首页列表
|
||||
|
||||
Reference in New Issue
Block a user