mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-11 03:33:53 +08:00
优化服务监控定时器,移除notify功能包
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"
|
||||
)
|
||||
|
||||
// internalAdminPostDao is internal type for wrapping internal DAO implements.
|
||||
@@ -28,44 +24,4 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// IsUniqueName 判断名称是否唯一
|
||||
func (dao *adminPostDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminPost
|
||||
m := dao.Ctx(ctx).Where("name", 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
|
||||
}
|
||||
|
||||
// IsUniqueCode 判断编码是否唯一
|
||||
func (dao *adminPostDao) IsUniqueCode(ctx context.Context, id int64, code string) (bool, error) {
|
||||
var data *entity.AdminPost
|
||||
m := dao.Ctx(ctx).Where("code", code)
|
||||
|
||||
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
|
||||
}
|
||||
// Fill with you ideas below.
|
||||
|
||||
Reference in New Issue
Block a user