feat: 弃用腾讯tts,改用火山引擎tts
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
location "sundynix-go/utils/location"
|
||||
"sundynix-go/utils/uniqueid"
|
||||
"sundynix-go/utils/wechat"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
@@ -72,6 +73,9 @@ func (userService *UserService) GetUserList(info systemReq.GetUserList) (list in
|
||||
db := global.DB.Model(&system.User{})
|
||||
var userList []system.User
|
||||
|
||||
if info.IsVip != nil {
|
||||
db = db.Where("is_vip = ?", *info.IsVip)
|
||||
}
|
||||
if info.Account != "" {
|
||||
db = db.Where("account LIKE ?", "%"+info.Account+"%")
|
||||
}
|
||||
@@ -82,7 +86,7 @@ func (userService *UserService) GetUserList(info systemReq.GetUserList) (list in
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = db.Limit(limit).Offset(offset).Find(&userList).Error
|
||||
err = db.Limit(limit).Offset(offset).Order("created_at desc").Find(&userList).Error
|
||||
return userList, total, err
|
||||
}
|
||||
|
||||
@@ -144,6 +148,7 @@ func (userService *UserService) MiniLogin(code, ip string) (result *system.User,
|
||||
|
||||
// 7. 根据openid查询用户 存在--> 更新session_key 返回数据
|
||||
var user system.User
|
||||
now := time.Now()
|
||||
err = global.DB.Where("open_id = ?", wxResp.Openid).Preload("Avatar").First(&user).Error
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
// 8. 使用 Transaction 闭包管理事务
|
||||
@@ -154,6 +159,7 @@ func (userService *UserService) MiniLogin(code, ip string) (result *system.User,
|
||||
OpenId: wxResp.Openid,
|
||||
SessionKey: wxResp.SessionKey,
|
||||
LastLoginIp: ip,
|
||||
LastLoginAt: &now,
|
||||
}
|
||||
if err := tx.Create(&newUser).Error; err != nil {
|
||||
return err
|
||||
@@ -174,6 +180,7 @@ func (userService *UserService) MiniLogin(code, ip string) (result *system.User,
|
||||
updateData := map[string]interface{}{
|
||||
"session_key": wxResp.SessionKey,
|
||||
"last_login_ip": ip,
|
||||
"last_login_at": &now,
|
||||
}
|
||||
if err = global.DB.Model(&user).Updates(updateData).Error; err != nil {
|
||||
global.Logger.Error("更新session_key失败", zap.Error(err))
|
||||
|
||||
Reference in New Issue
Block a user