fusenapi/model/gmodel/fs_user_logic.go
2023-06-15 16:08:43 +08:00

23 lines
794 B
Go

package gmodel
import (
"context"
)
// TODO: 使用model的属性做你想做的
func (u *FsUserModel) FindUserByEmail(ctx context.Context, emailname string) (resp *FsUser, err error) {
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`email` = ?", emailname).First(resp).Error
return resp, err
}
func (u *FsUserModel) FindUserById(ctx context.Context, Id int64) (resp *FsUser, err error) {
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ?", Id, 0).First(resp).Error
return resp, err
}
func (u *FsUserModel) UpdateUserBasicInfoById(ctx context.Context, Id int64, user *FsUser) (resp *FsUser, err error) {
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ? and status = ?", user.Id, 0, 1).Updates(user).Error
return resp, err
}