mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-04-05 20:17:53 +08:00
fix(member): use client/orm insteal of adapter/orm
- to avoid type check bug when comparing error, use newer api instead of old adapter
This commit is contained in:
parent
272316f7b4
commit
d069b7c515
@ -1,13 +1,14 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"flag"
|
||||
|
||||
"github.com/beego/beego/v2/adapter/orm"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
"github.com/mindoc-org/mindoc/conf"
|
||||
"github.com/mindoc-org/mindoc/models"
|
||||
@ -101,7 +102,7 @@ func initialization() {
|
||||
}
|
||||
|
||||
member, err := models.NewMember().FindByFieldFirst("account", "admin")
|
||||
if err == orm.ErrNoRows {
|
||||
if errors.Is(err, orm.ErrNoRows) {
|
||||
|
||||
// create admin user
|
||||
logs.Info("creating admin user")
|
||||
@ -139,6 +140,8 @@ func initialization() {
|
||||
if err := book.Insert(); err != nil {
|
||||
panic("初始化项目失败 -> " + err.Error())
|
||||
}
|
||||
} else if err != nil {
|
||||
panic(fmt.Errorf("occur errors when initialize: %s", err))
|
||||
}
|
||||
|
||||
if !models.NewItemsets().Exist(1) {
|
||||
|
Loading…
Reference in New Issue
Block a user