添加AllModels
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"fusenapi/utils/basic"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type UserSaveBasicInfoLogic struct {
|
||||
@@ -51,7 +52,7 @@ func (l *UserSaveBasicInfoLogic) UserSaveBasicInfo(req *types.RequestBasicInfoFo
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
switch err {
|
||||
case gmodel.ErrRecordNotFound:
|
||||
case gorm.ErrRecordNotFound:
|
||||
return resp.SetStatus(basic.CodeUserIdNotFoundErr)
|
||||
default:
|
||||
return resp.SetStatusWithMessage(basic.CodeDbUpdateErr, err.Error())
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/initalize"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/server/home-user-auth/internal/config"
|
||||
"net/http"
|
||||
|
||||
@@ -14,12 +15,14 @@ import (
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
MysqlConn *gorm.DB
|
||||
AllModels *gmodel.AllModelsGen
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
MysqlConn: initalize.InitMysql(c.SourceMysql),
|
||||
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user