Merge branch 'dev' of http://gitlab.fontree.cn/bugmaker/fonchain-artistinfo into dev
This commit is contained in:
commit
1d5e4dd994
@ -2,6 +2,7 @@ package dao
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/fonchain/fonchain-artistinfo/cmd/model"
|
"github.com/fonchain/fonchain-artistinfo/cmd/model"
|
||||||
@ -21,6 +22,10 @@ func GetMgmtContractByArtistUid(artistUid string, contractType int32) (err error
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//err 为空则查询到,返回画作合同已存在的错误
|
||||||
|
if err == nil {
|
||||||
|
err = errors.New(m.ARTWORK_CONTRACT_EXISTS)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,11 +97,11 @@ func GetContractList(artistUid string, pageSize, offset int32) (contracts []*con
|
|||||||
|
|
||||||
var contractSlice []model.Contract
|
var contractSlice []model.Contract
|
||||||
if err = db.DB.Where("artist_uid = ?", artistUid).Order("ID asc").Limit(int(pageSize)).Offset(int(offset)).Find(&contractSlice).Error; err != nil {
|
if err = db.DB.Where("artist_uid = ?", artistUid).Order("ID asc").Limit(int(pageSize)).Offset(int(offset)).Find(&contractSlice).Error; err != nil {
|
||||||
zap.L().Error("create contracts info err", zap.Error(err))
|
zap.L().Error("get contracts info err", zap.Error(err))
|
||||||
err = errors.New(m.CREATE_ERROR)
|
err = errors.New(m.CREATE_ERROR)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
fmt.Println("第二处")
|
||||||
for _, v := range contractSlice {
|
for _, v := range contractSlice {
|
||||||
contcontract := &contract.Contracts{
|
contcontract := &contract.Contracts{
|
||||||
ContractUid: v.Uid,
|
ContractUid: v.Uid,
|
||||||
|
@ -54,6 +54,10 @@ func (a *Contract) CreateContract(req *contract.CreateContractRequest) (rep *con
|
|||||||
IsArtist: true,
|
IsArtist: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
fmt.Println("第一处")
|
||||||
|
fmt.Println("userInfo:", userInfo)
|
||||||
|
fmt.Println("req:", req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -124,13 +128,12 @@ func (a *Contract) CreateContract(req *contract.CreateContractRequest) (rep *con
|
|||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//创建画家画作合同,类型3
|
//创建画家画作合同,类型3
|
||||||
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 3, userInfo.LatestLockTime); err != nil {
|
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 3, userInfo.LatestLockTime); err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
for _, v := range req.ArtworkUid {
|
for _, v := range req.ArtworkUid {
|
||||||
@ -139,12 +142,12 @@ func (a *Contract) CreateContract(req *contract.CreateContractRequest) (rep *con
|
|||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//创建画家画作合同,类型3
|
//创建画家画作合同,类型3
|
||||||
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 5, userInfo.LatestLockTime); err != nil {
|
if err = dao.CreateArtworkContract(tx, req.ArtworkUid, req.ArtistUid, 5, userInfo.LatestLockTime); err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
err = errors.New("type值出错!")
|
err = errors.New("type值出错!")
|
||||||
@ -157,8 +160,17 @@ func (a *Contract) CreateContract(req *contract.CreateContractRequest) (rep *con
|
|||||||
|
|
||||||
func (a *Contract) ContractListMgmt(req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error) {
|
func (a *Contract) ContractListMgmt(req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error) {
|
||||||
rep = &contract.ContractListMgmtRespond{}
|
rep = &contract.ContractListMgmtRespond{}
|
||||||
|
|
||||||
//查看是否有该画家
|
//查看是否有该画家
|
||||||
if err = dao.GetArtistNoByUid(req.ArtistUid); err != nil {
|
userInfo, err := NewArtistInfo().FindUser(&artistInfoUser.FindUserRequest{
|
||||||
|
MgmtArtistUid: req.ArtistUid,
|
||||||
|
IsArtist: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if userInfo.Id == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user