-
Notifications
You must be signed in to change notification settings - Fork 171
/
resetpasswordlogic.go
52 lines (43 loc) · 1.1 KB
/
resetpasswordlogic.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package userservicelogic
import (
"context"
"github.com/feihua/zero-admin/rpc/sys/gen/model"
"github.com/feihua/zero-admin/rpc/sys/gen/query"
"github.com/feihua/zero-admin/rpc/sys/sysclient"
"time"
"github.com/feihua/zero-admin/rpc/sys/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
// ReSetPasswordLogic
/*
Author: LiuFeiHua
Date: 2023/12/18 14:12
*/
type ReSetPasswordLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewReSetPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReSetPasswordLogic {
return &ReSetPasswordLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// ReSetPassword 重置用户密码
func (l *ReSetPasswordLogic) ReSetPassword(in *sysclient.ReSetPasswordReq) (*sysclient.ReSetPasswordResp, error) {
q := query.SysUser
now := time.Now()
_, err := q.WithContext(l.ctx).Updates(&model.SysUser{
ID: in.Id,
Password: "123456",
Salt: "123456",
UpdateBy: &in.UpdateBy,
UpdateTime: &now,
})
if err != nil {
return nil, err
}
return &sysclient.ReSetPasswordResp{}, nil
}