完善logic.tpl的错误

This commit is contained in:
eson
2023-06-07 18:30:58 +08:00
parent 996874a253
commit dc73ff1679
10 changed files with 111 additions and 11 deletions

View File

@@ -1,6 +1,11 @@
package model
import "github.com/zeromicro/go-zero/core/stores/sqlx"
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
var _ FsUserModel = (*customFsUserModel)(nil)
@@ -9,6 +14,7 @@ type (
// and implement the added methods in customFsUserModel.
FsUserModel interface {
fsUserModel
UpdateVerificationToken(ctx context.Context, userid int64, token string) error
}
customFsUserModel struct {
@@ -22,3 +28,9 @@ func NewFsUserModel(conn sqlx.SqlConn) FsUserModel {
defaultFsUserModel: newFsUserModel(conn),
}
}
func (m *defaultFsUserModel) UpdateVerificationToken(ctx context.Context, userid int64, verificationToken string) error {
query := fmt.Sprintf("update %s set `verification_token` = ? where `id` = ?", m.table)
_, err := m.conn.ExecCtx(ctx, query, verificationToken, userid)
return err
}