mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 05:03:49 +08:00
This commit is contained in:
@@ -5,11 +5,7 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalAdminMemberDao is internal type for wrapping internal DAO implements.
|
||||
@@ -29,66 +25,3 @@ var (
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
|
||||
// IsUniqueName 判断用户名是否唯一
|
||||
func (dao *adminMemberDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminDept
|
||||
m := dao.Ctx(ctx).Where("username", name)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsUniqueEmail 判断邮箱是否唯一
|
||||
func (dao *adminMemberDao) IsUniqueEmail(ctx context.Context, id int64, email string) (bool, error) {
|
||||
var data *entity.AdminMember
|
||||
m := dao.Ctx(ctx).Where("email", email)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsUniqueMobile 判断手机号是否唯一
|
||||
func (dao *adminMemberDao) IsUniqueMobile(ctx context.Context, id int64, mobile string) (bool, error) {
|
||||
var data *entity.AdminMember
|
||||
m := dao.Ctx(ctx).Where("mobile", mobile)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ type AdminMemberColumns struct {
|
||||
Pid string // 上级管理员ID
|
||||
Level string // 关系树等级
|
||||
Tree string // 关系树
|
||||
InviteCode string // 邀请码
|
||||
Cash string // 提现配置
|
||||
LastActiveAt string // 最后活跃时间
|
||||
Remark string // 备注
|
||||
@@ -72,6 +73,7 @@ var adminMemberColumns = AdminMemberColumns{
|
||||
Pid: "pid",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
InviteCode: "invite_code",
|
||||
Cash: "cash",
|
||||
LastActiveAt: "last_active_at",
|
||||
Remark: "remark",
|
||||
|
||||
Reference in New Issue
Block a user