- 广告获取改走 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>
115 lines
3.1 KiB
Go
115 lines
3.1 KiB
Go
package web_acc
|
|
|
|
import (
|
|
"videoweb/pub/common"
|
|
"videoweb/pub/common/srvdef"
|
|
"videoweb/pub/models/mwacc"
|
|
"videoweb/web/service/srv_mwacc"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Tags 登录
|
|
// @Summary 登录-登录
|
|
// @Description 登录-登录
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body MainWebLoginReq true "参数列表"
|
|
// @Success 200 {object} MainWebLoginResp "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Router /api/web/login/acc [POST]
|
|
func AccLogin(c *gin.Context) {
|
|
var req MainWebLoginReq
|
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
|
|
accInfo, err := srv_mwacc.AccLogin(c, req.Acc, req.Pwd)
|
|
if err != nil || accInfo == nil {
|
|
common.ServerJSON(c, err.Code, err.Msg)
|
|
return
|
|
}
|
|
|
|
resp := MainWebLoginResp{}
|
|
|
|
if len(accInfo.Qurl) != 0 {
|
|
resp.Qurl = accInfo.Qurl
|
|
} else {
|
|
// 成功保存token
|
|
if ok, _ := mwacc.SaveToken(c, accInfo.Id, accInfo.Token); ok != true {
|
|
common.ServerJSON(c, srvdef.GenerateTokenFailed, srvdef.GenerateTokenFailed.Msg())
|
|
}
|
|
|
|
resp.AccId = accInfo.Id
|
|
resp.Acc = accInfo.Acc
|
|
resp.RoleId = accInfo.RoleId
|
|
resp.Token = accInfo.Token
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, resp)
|
|
return
|
|
}
|
|
|
|
// SLogin doc
|
|
// @Summary 管理员sso登陆
|
|
// @Description 管理员sso登陆
|
|
// @Tags web-单点登陆
|
|
// @Accept mpfd,json
|
|
// @Produce json,html
|
|
// @Param name formData string true "账号"
|
|
// @Param password formData string true "密码"
|
|
// @Success 200 {string} json "{"msg": "管理员信息""}"
|
|
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
|
// @Router /api/web/login/slogin [post]
|
|
func SLogin(c *gin.Context) {
|
|
var req MainWebLoginReq
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
accInfo, err := srv_mwacc.AccSLogin(c, req.Acc, req.Pwd)
|
|
if err != nil || accInfo == nil {
|
|
common.ServerJSON(c, err.Code, err.Msg)
|
|
return
|
|
}
|
|
resp := MainWebLoginResp{}
|
|
// 成功保存token
|
|
if ok, _ := mwacc.SaveToken(c, accInfo.Id, accInfo.Token); ok != true {
|
|
common.ServerJSON(c, srvdef.GenerateTokenFailed, srvdef.GenerateTokenFailed.Msg())
|
|
}
|
|
resp.AccId = accInfo.Id
|
|
resp.Acc = accInfo.Acc
|
|
resp.RoleId = accInfo.RoleId
|
|
resp.Token = accInfo.Token
|
|
|
|
common.ServerJSON(c, srvdef.Success, resp)
|
|
return
|
|
}
|
|
|
|
// @Tags 登录
|
|
// @Summary 登录-绑定二维码
|
|
// @Description 登录-绑定二维码
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body BindQurlReq true "参数列表"
|
|
// @Success 200 {object} BindQurlResp "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Router /api/web/login/bind [POST]
|
|
func BindQurl(c *gin.Context) {
|
|
var req BindQurlReq
|
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, "tone AccLogin arg error "+err.Error())
|
|
return
|
|
}
|
|
|
|
ok, _ := mwacc.BindAccQurl(c, req.Acc)
|
|
if !ok {
|
|
common.ServerJSON(c, srvdef.Failure, BindQurlResp{Result: false})
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, BindQurlResp{Result: true})
|
|
return
|
|
}
|