🐛 fixed multiavatar api unavailable issue
This commit is contained in:
@@ -3,20 +3,22 @@ package captcha_controller
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
ginI18n "github.com/gin-contrib/i18n"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/wenlng/go-captcha-assets/helper"
|
||||
"github.com/wenlng/go-captcha/v2/click"
|
||||
"github.com/wenlng/go-captcha/v2/rotate"
|
||||
"github.com/wenlng/go-captcha/v2/slide"
|
||||
"log"
|
||||
|
||||
"schisandra-cloud-album/common/constant"
|
||||
"schisandra-cloud-album/common/redis"
|
||||
"schisandra-cloud-album/common/result"
|
||||
"schisandra-cloud-album/global"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CaptchaController struct{}
|
||||
|
@@ -1,15 +1,17 @@
|
||||
package client_controller
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ccpwcn/kgo"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"schisandra-cloud-album/common/constant"
|
||||
"schisandra-cloud-album/common/redis"
|
||||
"schisandra-cloud-album/common/result"
|
||||
"schisandra-cloud-album/global"
|
||||
"schisandra-cloud-album/utils"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ClientController struct{}
|
||||
@@ -36,16 +38,12 @@ func (ClientController) GenerateClientId(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
// 生成新的客户端ID
|
||||
uid, err := uuid.NewUUID()
|
||||
simpleUuid := kgo.SimpleUuid()
|
||||
err := redis.Set(constant.UserLoginClientRedisKey+ip, simpleUuid, time.Hour*24*7).Err()
|
||||
if err != nil {
|
||||
global.LOG.Error(err)
|
||||
return
|
||||
}
|
||||
err = redis.Set(constant.UserLoginClientRedisKey+ip, uid.String(), time.Hour*24*7).Err()
|
||||
if err != nil {
|
||||
global.LOG.Error(err)
|
||||
return
|
||||
}
|
||||
result.OkWithData(uid.String(), c)
|
||||
result.OkWithData(simpleUuid, c)
|
||||
return
|
||||
}
|
||||
|
@@ -1,18 +1,20 @@
|
||||
package sms_controller
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
ginI18n "github.com/gin-contrib/i18n"
|
||||
"github.com/gin-gonic/gin"
|
||||
gosms "github.com/pkg6/go-sms"
|
||||
"github.com/pkg6/go-sms/gateways"
|
||||
"github.com/pkg6/go-sms/gateways/aliyun"
|
||||
"github.com/pkg6/go-sms/gateways/smsbao"
|
||||
|
||||
"schisandra-cloud-album/common/constant"
|
||||
"schisandra-cloud-album/common/redis"
|
||||
"schisandra-cloud-album/common/result"
|
||||
"schisandra-cloud-album/global"
|
||||
"schisandra-cloud-album/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SmsController struct{}
|
||||
@@ -62,7 +64,7 @@ func (SmsController) SendMessageByAli(c *gin.Context) {
|
||||
_, err = sms.Send(smsRequest.Phone, gosms.MapStringAny{
|
||||
"content": "您的验证码是:****。请不要把验证码泄露给其他人。",
|
||||
"template": global.CONFIG.SMS.Ali.TemplateID,
|
||||
//"signName": global.CONFIG.SMS.Ali.Signature,
|
||||
// "signName": global.CONFIG.SMS.Ali.Signature,
|
||||
"data": gosms.MapStrings{
|
||||
"code": code,
|
||||
},
|
||||
|
@@ -2,12 +2,16 @@ package user_controller
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
ginI18n "github.com/gin-contrib/i18n"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/mssola/useragent"
|
||||
"github.com/yitter/idgenerator-go/idgen"
|
||||
"gorm.io/gorm"
|
||||
"reflect"
|
||||
|
||||
"schisandra-cloud-album/common/constant"
|
||||
"schisandra-cloud-album/common/enum"
|
||||
"schisandra-cloud-album/common/randomname"
|
||||
@@ -17,8 +21,6 @@ import (
|
||||
"schisandra-cloud-album/model"
|
||||
"schisandra-cloud-album/service/impl"
|
||||
"schisandra-cloud-album/utils"
|
||||
"strconv"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type UserController struct{}
|
||||
@@ -111,7 +113,7 @@ func (UserController) AccountLogin(c *gin.Context) {
|
||||
accountLoginRequest := AccountLoginRequest{}
|
||||
err := c.ShouldBindJSON(&accountLoginRequest)
|
||||
if err != nil {
|
||||
result.FailWithMessage(ginI18n.MustGetMessage(c, "ParamsError"), c)
|
||||
global.LOG.Error(err)
|
||||
return
|
||||
}
|
||||
rotateData := utils.CheckRotateData(accountLoginRequest.Angle, accountLoginRequest.Key)
|
||||
@@ -161,7 +163,7 @@ func (UserController) PhoneLogin(c *gin.Context) {
|
||||
request := PhoneLoginRequest{}
|
||||
err := c.ShouldBind(&request)
|
||||
if err != nil {
|
||||
result.FailWithMessage(ginI18n.MustGetMessage(c, "ParamsError"), c)
|
||||
global.LOG.Error(err)
|
||||
return
|
||||
}
|
||||
phone := request.Phone
|
||||
@@ -244,7 +246,7 @@ func (UserController) PhoneLogin(c *gin.Context) {
|
||||
func (UserController) RefreshHandler(c *gin.Context) {
|
||||
request := RefreshTokenRequest{}
|
||||
if err := c.ShouldBindJSON(&request); err != nil {
|
||||
result.FailWithMessage(ginI18n.MustGetMessage(c, "ParamsError"), c)
|
||||
global.LOG.Error(err)
|
||||
return
|
||||
}
|
||||
data, res := userService.RefreshTokenService(request.RefreshToken)
|
||||
|
Reference in New Issue
Block a user