feat: rbac迁移完成,并已部署至dev服务器
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
"sundynix-micro-go/common/utils/hash"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
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)}
|
||||
}
|
||||
|
||||
func (l *ResetPasswordLogic) ResetPassword(in *system.ResetPasswordReq) (*system.CommonResp, error) {
|
||||
if err := l.svcCtx.DB.Model(&sysModel.SundynixUser{}).Where("id = ?", in.Id).
|
||||
Update("password", hash.BcryptHash(in.Password)).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &system.CommonResp{Code: 200, Msg: "success"}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user