- 广告获取改走 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>
67 lines
1.9 KiB
Go
67 lines
1.9 KiB
Go
package configser
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"net/http"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"videoweb/app/appg"
|
|
"videoweb/pub/common/godef"
|
|
"videoweb/pub/common/httputil"
|
|
"videoweb/pub/common/log"
|
|
)
|
|
|
|
type advertiseClickReq struct {
|
|
Id int64 `json:"id"`
|
|
AppId int32 `json:"appId"`
|
|
}
|
|
|
|
type advertiseClickResp struct {
|
|
Code int64 `json:"code"`
|
|
}
|
|
|
|
// resolveAdvertiseAppId 请求带了 AppId 用请求的,否则回落到默认 advertiseAppId
|
|
func resolveAdvertiseAppId(reqAppId int32) int32 {
|
|
if reqAppId > 0 {
|
|
return reqAppId
|
|
}
|
|
return advertiseAppId
|
|
}
|
|
|
|
// AdvertiseClickCenter 同步上报单条广告点击到广告中心。
|
|
// appId<=0 时回落到默认 advertiseAppId。
|
|
func AdvertiseClickCenter(advertiseId int64, appId int32) error {
|
|
versionUrl := strings.TrimRight(strings.TrimSpace(appg.Conf.VersionUrl), "/")
|
|
if versionUrl == "" {
|
|
return fmt.Errorf("versionUrl 未配置")
|
|
}
|
|
url := versionUrl + "/api/stat/advitise/v2/click"
|
|
body, _ := json.Marshal(advertiseClickReq{Id: advertiseId, AppId: resolveAdvertiseAppId(appId)})
|
|
var resp advertiseClickResp
|
|
code, err := httputil.Client().POSTJsonWithJResp(&resp, url, map[string]string{"Content-Type": "application/json"}, body)
|
|
if err != nil {
|
|
log.Error("AdvertiseClickCenter POST fail", log.Any("url", url), log.Any("id", advertiseId), log.E(err))
|
|
return err
|
|
}
|
|
if code != http.StatusOK {
|
|
log.Error("AdvertiseClickCenter response status", log.Any("code", code), log.Any("id", advertiseId))
|
|
return fmt.Errorf("response status %d", code)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// AsyncAdvertiseClick 异步上报广告点击,非数字 id 忽略。
|
|
// appId<=0 时回落到默认 advertiseAppId。
|
|
func AsyncAdvertiseClick(id string, appId int32) {
|
|
advertiseId, err := strconv.ParseInt(strings.TrimSpace(id), 10, 64)
|
|
if err != nil {
|
|
log.Warn("AsyncAdvertiseClick invalid id", log.Any("id", id))
|
|
return
|
|
}
|
|
godef.Go(func() {
|
|
_ = AdvertiseClickCenter(advertiseId, appId)
|
|
})
|
|
}
|