diff --git a/cmd/internal/dao/artistInfo_user.go b/cmd/internal/dao/artistInfo_user.go index 702b813..2129101 100644 --- a/cmd/internal/dao/artistInfo_user.go +++ b/cmd/internal/dao/artistInfo_user.go @@ -477,6 +477,7 @@ func FindUser(req *artistInfoUser.FindUserRequest) (rep *artistInfoUser.UserInfo InvitationCode: []string{inviterCode.InviteCode}, }) if err != nil { + fmt.Println("AccountProvider.ListByID error", err.Error()) return nil, err } if len(inviterAccount.Data) > 0 { diff --git a/cmd/internal/dao/contract.go b/cmd/internal/dao/contract.go index 4011a3f..a089cb2 100644 --- a/cmd/internal/dao/contract.go +++ b/cmd/internal/dao/contract.go @@ -14,6 +14,16 @@ import ( "gorm.io/gorm" ) +func GetArtistInfoByArtistUid(artistUid string) (user model.User, err error) { + if err = db.DB.Where("mgmt_artist_uid = ?", artistUid).First(&user).Error; err != nil { + zap.L().Error("get user info err", zap.Error(err)) + err = errors.New(m.ERROR_SELECT) + return + } + + return +} + func GetMgmtContractByArtistUid(artistUid string, contractType int32) (err error) { var contract model.Contract if err = db.DB.Where("artist_uid = ? AND type = ?", artistUid, contractType).First(&contract).Error; err != nil && err != gorm.ErrRecordNotFound { diff --git a/cmd/internal/logic/contract.go b/cmd/internal/logic/contract.go index 4d13b9a..b063ae4 100644 --- a/cmd/internal/logic/contract.go +++ b/cmd/internal/logic/contract.go @@ -11,7 +11,6 @@ import ( "github.com/fonchain/fonchain-artistinfo/cmd/internal/dao" "github.com/fonchain/fonchain-artistinfo/cmd/model" "github.com/fonchain/fonchain-artistinfo/pb/artist" - "github.com/fonchain/fonchain-artistinfo/pb/artistInfoUser" "github.com/fonchain/fonchain-artistinfo/pb/artwork" contract "github.com/fonchain/fonchain-artistinfo/pb/contract" contractMicroservice "github.com/fonchain/fonchain-artistinfo/pb/contract_microservice" @@ -49,22 +48,12 @@ func (a *Contract) CreateContract(req *contract.CreateContractRequest) (rep *con //遇到错误数据库回滚 tx := db.DB.Begin() - userInfo, err := NewArtistInfo().FindUser(&artistInfoUser.FindUserRequest{ - MgmtArtistUid: req.ArtistUid, - IsArtist: true, - }) - - fmt.Println("第一处") - fmt.Println("userInfo:", userInfo) - fmt.Println("req:", req) - + userInfo, err := dao.GetArtistInfoByArtistUid(req.ArtistUid) if err != nil { return } - if userInfo.Id == 0 { - return - } + fmt.Println("第二处111111111111111") switch req.Type { //1 画家合同(不涉及画家的画作) case 1: @@ -162,17 +151,10 @@ func (a *Contract) ContractListMgmt(req *contract.ContractListMgmtRequest) (rep rep = &contract.ContractListMgmtRespond{} //查看是否有该画家 - userInfo, err := NewArtistInfo().FindUser(&artistInfoUser.FindUserRequest{ - MgmtArtistUid: req.ArtistUid, - IsArtist: true, - }) - + _, err = dao.GetArtistInfoByArtistUid(req.ArtistUid) if err != nil { return } - if userInfo.Id == 0 { - return - } //合同分页查询操作 if req.Page < 1 {