@@ -0,0 +1,45 @@
|
||||
package ai_mate_v2_ctrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/aiser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/laosiji_app"
|
||||
"91porn-server/common/log"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/cache/sysconfdata"
|
||||
"91porn-server/models/v/sysconfmod"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// URL doc
|
||||
// @Summary AI女友V2
|
||||
// @Description 主钱包金币上分并获取AI女友授权链接
|
||||
// @Tags AI女友V2
|
||||
// @Produce json
|
||||
// @Success 200 {object} aiser.GetAuthURLResp
|
||||
// @Router /api/app/aimatev2/url [post]
|
||||
func URL(ctx *gin.Context) {
|
||||
uid, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, nil)
|
||||
return
|
||||
}
|
||||
config, err := sysconfdata.GetAllFromCache()
|
||||
if err != nil {
|
||||
log.Warn("get AI girlfriend switch failed", log.Any("uid", uid), log.E(err))
|
||||
common.ServeJSON(ctx, stderr.Failure, nil)
|
||||
return
|
||||
}
|
||||
if !config.GetBool(sysconfmod.VCodeAiGirlFriend) || !laosiji_app.Configured() {
|
||||
common.ServeJSON(ctx, stderr.FunctionNotEnabled, nil)
|
||||
return
|
||||
}
|
||||
resp, err := aiser.GetAuthURL(ctx.Request.Context(), uid)
|
||||
if err != nil {
|
||||
log.Error("get AI girlfriend V2 URL failed", log.Any("uid", uid), log.E(err))
|
||||
common.ServeJSON(ctx, stderr.Failure, nil)
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, resp)
|
||||
}
|
||||
Reference in New Issue
Block a user