Merge branch 'main' into dev
This commit is contained in:
commit
c5fb2b7788
8
DockerBuildProd.bat
Normal file
8
DockerBuildProd.bat
Normal file
@ -0,0 +1,8 @@
|
||||
go env -w GOOS=linux
|
||||
go build -ldflags "-s -w" -o ./build/artShowServerProd ./cmd/app.go
|
||||
docker rmi artshow-server-prod
|
||||
docker rmi 192.168.12.3:9015/artshow-server
|
||||
docker build . -f .\DockerfileProd -t artshow-server-prod
|
||||
docker tag artshow-server-prod 192.168.12.3:9015/artshow-server
|
||||
docker push 192.168.12.3:9015/artshow-server
|
||||
pause
|
8
DockerBuildTest.bat
Normal file
8
DockerBuildTest.bat
Normal file
@ -0,0 +1,8 @@
|
||||
go env -w GOOS=linux
|
||||
go build -ldflags "-s -w" -o ./build/artShowServerTest ./cmd/app.go
|
||||
docker rmi artshow-server-test
|
||||
docker rmi 121.229.45.214:9006/artshow-server
|
||||
docker build . -f .\Dockerfile -t artshow-server-test
|
||||
docker tag artshow-server-test 121.229.45.214:9006/artshow-server
|
||||
docker push 121.229.45.214:9006/artshow-server
|
||||
pause
|
19
Dockerfile
19
Dockerfile
@ -1,28 +1,29 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
#ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
|
||||
#ENV MODE_ENV test
|
||||
ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOOS linux
|
||||
ENV GOPROXY https://goproxy.cn,direct
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
#RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
|
||||
WORKDIR /build
|
||||
COPY ./utils ../utils
|
||||
ADD ./fonchain-artshow/go.mod .
|
||||
ADD ./fonchain-artshow/go.sum .
|
||||
RUN go mod download
|
||||
COPY ./fonchain-artshow .
|
||||
#COPY ./utils ../utils
|
||||
#ADD ./fonchain-artshow/go.mod .
|
||||
#ADD ./fonchain-artshow/go.sum .
|
||||
#RUN go mod download
|
||||
#COPY ./fonchain-artshow .
|
||||
|
||||
RUN go build -ldflags "-s -w" -o /app/artshowServer ./cmd/app.go
|
||||
#RUN go build -ldflags "-s -w" -o /app/artshowServer ./cmd/app.go
|
||||
COPY ./build/artShowServerTest /app/artshowServer
|
||||
|
||||
FROM alpine
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update --no-cache
|
||||
RUN apk add --no-cache ca-certificates
|
||||
RUN apk add --no-cache tzdata
|
||||
COPY ./fonchain-artshow/conf /app/conf
|
||||
COPY ./conf /app/conf
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
#ENV MODE_ENV test
|
||||
|
32
Dockerfile1
Normal file
32
Dockerfile1
Normal file
@ -0,0 +1,32 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
#ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
|
||||
#ENV MODE_ENV test
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOPROXY https://goproxy.cn,direct
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
#RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
|
||||
WORKDIR /build
|
||||
#COPY ./utils ../utils
|
||||
#ADD ./fonchain-artshow/go.mod .
|
||||
#ADD ./fonchain-artshow/go.sum .
|
||||
#RUN go mod download
|
||||
#COPY ./fonchain-artshow .
|
||||
|
||||
RUN go build -ldflags "-s -w" -o /app/artshowServer ./cmd/app.go
|
||||
|
||||
FROM alpine
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update --no-cache
|
||||
RUN apk add --no-cache ca-certificates
|
||||
RUN apk add --no-cache tzdata
|
||||
COPY ./fonchain-artshow/conf /app/conf
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
#ENV MODE_ENV test
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/artshowServer .
|
||||
#EXPOSE 9022
|
||||
CMD ["/app/artshowServer"]
|
33
DockerfileProd
Normal file
33
DockerfileProd
Normal file
@ -0,0 +1,33 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOOS linux
|
||||
ENV GOPROXY https://goproxy.cn,direct
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
#RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
|
||||
WORKDIR /build
|
||||
#COPY ./utils ../utils
|
||||
#ADD ./fonchain-artshow/go.mod .
|
||||
#ADD ./fonchain-artshow/go.sum .
|
||||
#RUN go mod download
|
||||
#COPY ./fonchain-artshow .
|
||||
|
||||
#RUN go build -ldflags "-s -w" -o /app/artshowServer ./cmd/app.go
|
||||
COPY ./build/artShowServerProd /app/artshowServer
|
||||
|
||||
FROM alpine
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update --no-cache
|
||||
RUN apk add --no-cache ca-certificates
|
||||
RUN apk add --no-cache tzdata
|
||||
COPY ./conf /app/conf
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
#ENV MODE_ENV test
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/artshowServer .
|
||||
#EXPOSE 9022
|
||||
CMD ["/app/artshowServer"]
|
BIN
build/artShowServerProd
Normal file
BIN
build/artShowServerProd
Normal file
Binary file not shown.
BIN
build/artShowServerTest
Normal file
BIN
build/artShowServerTest
Normal file
Binary file not shown.
2
clear.sh
Normal file
2
clear.sh
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
ls pb/artShow/*.pb.go | xargs -n1 -IX bash -c 'sed s/,omitempty// X > X.tmp && mv X{.tmp,}';
|
@ -13,36 +13,42 @@ type ArtShowProvider struct {
|
||||
artShow.UnimplementedArtShowServer
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) CreateShow(ctx context.Context, req *artShow.SaveShowReq) (res *artShow.SaveShowRes, err error) {
|
||||
func (p *ArtShowProvider) CreateShow(_ context.Context, req *artShow.SaveShowReq) (res *artShow.SaveShowRes, err error) {
|
||||
//fmt.Println("artShow create info ======== ", req.ShowSeq)
|
||||
if req.ShowName == "" {
|
||||
err = errors.New(m.ERROR_SHOW_NAME)
|
||||
return nil, err
|
||||
}
|
||||
if req.ShowTime == "" {
|
||||
if req.CreateTime == "" {
|
||||
err = errors.New(m.ERROR_TIME)
|
||||
return nil, err
|
||||
}
|
||||
if req.ShowSeq == "" {
|
||||
err = errors.New(m.ERROR_NOT_ARTIST_SEQ)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = new(artShow.SaveShowRes)
|
||||
err, showID := service.CreateArtShowWithArtworkPrice(req)
|
||||
err, showUID := service.CreateArtShowWithArtworkPrice(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_CREATE)
|
||||
err = errors.New(err.Error())
|
||||
return res, err
|
||||
}
|
||||
res.Msg = m.CREATE_SUCCESS
|
||||
res.ShowID = int64(showID)
|
||||
res.ShowUID = showUID
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) UpdateShow(ctx context.Context, req *artShow.SaveShowReq) (res *artShow.SaveShowRes, err error) {
|
||||
if req.ID == 0 {
|
||||
func (p *ArtShowProvider) UpdateShow(_ context.Context, req *artShow.SaveShowReq) (res *artShow.SaveShowRes, err error) {
|
||||
if req.ShowUID == "" {
|
||||
err = errors.New(m.ERROR_INVALID_ID)
|
||||
return
|
||||
}
|
||||
res = new(artShow.SaveShowRes)
|
||||
if req.IsShow == m.ARTSHOW_INSIDE {
|
||||
showRel := new(model.ShowRel)
|
||||
err, showRel = service.QueryShowRel(uint(req.ID))
|
||||
err, showRel = service.QueryShowRel_showUID(req.ShowUID)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
@ -52,33 +58,34 @@ func (p *ArtShowProvider) UpdateShow(ctx context.Context, req *artShow.SaveShowR
|
||||
}
|
||||
}
|
||||
|
||||
err, showID := service.UpdateArtShowWithArtworkPrice(req)
|
||||
err, showUID := service.UpdateArtShowWithArtworkPrice(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.UPDATE_FAILED)
|
||||
return
|
||||
}
|
||||
res.Msg = m.UPDATE_SUCCESS
|
||||
res.ShowID = int64(showID)
|
||||
res.ShowUID = showUID
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) DelShow(ctx context.Context, req *artShow.DelShowReq) (res *artShow.CommonRes, err error) {
|
||||
if len(req.ShowID) < 1 {
|
||||
func (p *ArtShowProvider) DelShow(_ context.Context, req *artShow.DelShowReq) (res *artShow.CommonRes, err error) {
|
||||
res = new(artShow.CommonRes)
|
||||
if len(req.ShowUID) == 0 {
|
||||
err = errors.New(m.ERROR_INVALID_ID)
|
||||
return
|
||||
}
|
||||
err = service.DelArtShow(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_DELETE)
|
||||
err = errors.New(err.Error())
|
||||
return
|
||||
}
|
||||
res.Msg = m.DELETE_SUCCESS
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ShowList(ctx context.Context, req *artShow.ShowListReq) (res *artShow.ShowListRes, err error) {
|
||||
func (p *ArtShowProvider) ShowList(_ context.Context, req *artShow.ShowListReq) (res *artShow.ShowListRes, err error) {
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
@ -95,8 +102,15 @@ func (p *ArtShowProvider) ShowList(ctx context.Context, req *artShow.ShowListReq
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ShowInfo(ctx context.Context, req *artShow.ShowDetailReq) (res *artShow.ShowArtworkDetailRes, err error) {
|
||||
err, res = service.ShowInfo(req)
|
||||
func (p *ArtShowProvider) ShowListWithRel(_ context.Context, req *artShow.ShowListReq) (res *artShow.ShowListRes, err error) {
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
if req.PageSize == 0 {
|
||||
req.Page = 10
|
||||
}
|
||||
res = new(artShow.ShowListRes)
|
||||
err, res = service.ArtShowListWithRel(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_QUERY)
|
||||
@ -105,7 +119,28 @@ func (p *ArtShowProvider) ShowInfo(ctx context.Context, req *artShow.ShowDetailR
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ShowStatisticalInfo(ctx context.Context, req *artShow.ShowStatisticalInfoReq) (res *artShow.ShowStatisticalInfoRes, err error) {
|
||||
func (p *ArtShowProvider) ShowArtworkInfo(_ context.Context, req *artShow.ArtworkDetailReq) (res *artShow.ShowArtworkDetailRes, err error) {
|
||||
err, res = service.ShowArtworkInfo(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_QUERY)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ShowDetail(_ context.Context, req *artShow.ShowDetailReq) (res *artShow.ShowDetailRes, err error) {
|
||||
res = new(artShow.ShowDetailRes)
|
||||
err, res = service.ShowDetail(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_QUERY)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ShowStatisticalInfo(_ context.Context, req *artShow.ShowStatisticalInfoReq) (res *artShow.ShowStatisticalInfoRes, err error) {
|
||||
res = new(artShow.ShowStatisticalInfoRes)
|
||||
err, num := service.ShowStatisticalInfo(req)
|
||||
if err != nil {
|
||||
@ -117,8 +152,8 @@ func (p *ArtShowProvider) ShowStatisticalInfo(ctx context.Context, req *artShow.
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ArtworkPrice(ctx context.Context, req *artShow.ArtworkPriceReq) (res *artShow.ArtworkPriceRes, err error) {
|
||||
if req.ArtworkID == 0 {
|
||||
func (p *ArtShowProvider) ArtworkPrice(_ context.Context, req *artShow.ArtworkPriceReq) (res *artShow.ArtworkPriceRes, err error) {
|
||||
if req.ArtworkUID == "" {
|
||||
err = errors.New(m.ERROR_INVALID_ID)
|
||||
return
|
||||
}
|
||||
@ -132,15 +167,15 @@ func (p *ArtShowProvider) ArtworkPrice(ctx context.Context, req *artShow.Artwork
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ShowListWithApply(ctx context.Context, req *artShow.ShowListReq) (res *artShow.ShowListRes, err error) {
|
||||
func (p *ArtShowProvider) ShowListWithApply(_ context.Context, req *artShow.ShowListReq) (res *artShow.ShowListRes, err error) {
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
if req.PageSize == 0 {
|
||||
req.Page = 10
|
||||
}
|
||||
if req.IsShow == 0 {
|
||||
req.IsShow = 2
|
||||
if len(req.IsShow) == 0 {
|
||||
req.IsShow = append(req.IsShow, 2)
|
||||
}
|
||||
res = new(artShow.ShowListRes)
|
||||
err, res = service.ArtShowListWithApply(req)
|
||||
@ -151,3 +186,36 @@ func (p *ArtShowProvider) ShowListWithApply(ctx context.Context, req *artShow.Sh
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ShowListForArtwork(_ context.Context, req *artShow.ShowListForArtworkReq) (res *artShow.ShowListForArtworkRes, err error) {
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
if req.PageSize == 0 {
|
||||
req.Page = 10
|
||||
}
|
||||
res = new(artShow.ShowListForArtworkRes)
|
||||
err, res = service.QueryArtShowForArtwork(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_QUERY)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ArtworkPriceList(_ context.Context, req *artShow.ShowDetailReq) (res *artShow.ArtworkPriceListRes, err error) {
|
||||
if len(req.ShowUID) != 1 && req.ShowUID[len(req.ShowUID)-1] == "" {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_QUERY)
|
||||
return
|
||||
}
|
||||
res = new(artShow.ArtworkPriceListRes)
|
||||
err, res.Data = service.ArtworkPriceList(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_QUERY)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"fonchain-artshow/pkg/m"
|
||||
)
|
||||
|
||||
func (p *ArtShowProvider) CreateApply(ctx context.Context, req *artShow.SaveApplyReq) (res *artShow.SaveApplyRes, err error) {
|
||||
func (p *ArtShowProvider) CreateApply(_ context.Context, req *artShow.SaveApplyReq) (res *artShow.SaveApplyRes, err error) {
|
||||
if req.Applicant == "" {
|
||||
err = errors.New(m.ERROR_APPLICANT)
|
||||
return
|
||||
@ -18,35 +18,35 @@ func (p *ArtShowProvider) CreateApply(ctx context.Context, req *artShow.SaveAppl
|
||||
return
|
||||
}
|
||||
res = new(artShow.SaveApplyRes)
|
||||
err, applyID := service.CreateShowApply(req)
|
||||
err, applyUID := service.CreateShowApply(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_CREATE)
|
||||
return
|
||||
}
|
||||
res.Msg = m.CREATE_SUCCESS
|
||||
res.ApplyID = int64(applyID)
|
||||
res.ApplyUID = applyUID
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) UpdateApply(ctx context.Context, req *artShow.SaveApplyReq) (res *artShow.SaveApplyRes, err error) {
|
||||
if req.ID == 0 {
|
||||
func (p *ArtShowProvider) UpdateApply(_ context.Context, req *artShow.SaveApplyReq) (res *artShow.SaveApplyRes, err error) {
|
||||
if req.ApplyUID == "" {
|
||||
err = errors.New(m.ERROR_INVALID_ID)
|
||||
return
|
||||
}
|
||||
res = new(artShow.SaveApplyRes)
|
||||
err, showID := service.UpdateShowApplyWithShowRel(req)
|
||||
err, applyUID := service.UpdateShowApplyWithShowRel(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.UPDATE_FAILED)
|
||||
return
|
||||
}
|
||||
res.Msg = m.UPDATE_SUCCESS
|
||||
res.ApplyID = int64(showID)
|
||||
res.ApplyUID = applyUID
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ApplyList(ctx context.Context, req *artShow.ApplyListReq) (res *artShow.ApplyListRes, err error) {
|
||||
func (p *ArtShowProvider) ApplyList(_ context.Context, req *artShow.ApplyListReq) (res *artShow.ApplyListRes, err error) {
|
||||
res = new(artShow.ApplyListRes)
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
@ -63,13 +63,13 @@ func (p *ArtShowProvider) ApplyList(ctx context.Context, req *artShow.ApplyListR
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) ApplyDetail(ctx context.Context, req *artShow.ApplyShowReq) (res *artShow.ApplyShowRes, err error) {
|
||||
if req.ApplyID == 0 {
|
||||
func (p *ArtShowProvider) ApplyDetail(_ context.Context, req *artShow.ApplyShowReq) (res *artShow.ApplyShowRes, err error) {
|
||||
if req.ApplyUID == "" {
|
||||
err = errors.New(m.ERROR_INVALID_ID)
|
||||
return
|
||||
}
|
||||
res = new(artShow.ApplyShowRes)
|
||||
err, res = service.ShowApplyDetail(uint(req.ApplyID))
|
||||
err, res = service.ShowApplyDetail(req.ApplyUID)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_QUERY)
|
||||
@ -78,13 +78,13 @@ func (p *ArtShowProvider) ApplyDetail(ctx context.Context, req *artShow.ApplySho
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) DelApply(ctx context.Context, req *artShow.DelApplyReq) (res *artShow.CommonRes, err error) {
|
||||
if len(req.ApplyID) < 1 {
|
||||
func (p *ArtShowProvider) DelApply(_ context.Context, req *artShow.DelApplyReq) (res *artShow.CommonRes, err error) {
|
||||
if len(req.ApplyUID) < 1 {
|
||||
err = errors.New(m.ERROR_INVALID_ID)
|
||||
return
|
||||
}
|
||||
res = new(artShow.CommonRes)
|
||||
err = service.DelApplyByApplyID(req)
|
||||
err = service.DelApplyByApplyUID(req)
|
||||
if err != nil {
|
||||
res.Msg = err.Error()
|
||||
err = errors.New(m.ERROR_DELETE)
|
||||
@ -94,8 +94,8 @@ func (p *ArtShowProvider) DelApply(ctx context.Context, req *artShow.DelApplyReq
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArtShowProvider) UpdateApplyStatus(ctx context.Context, req *artShow.UpdateApplyStatusReq) (res *artShow.CommonRes, err error) {
|
||||
if req.ApplyID == 0 {
|
||||
func (p *ArtShowProvider) UpdateApplyStatus(_ context.Context, req *artShow.UpdateApplyStatusReq) (res *artShow.CommonRes, err error) {
|
||||
if req.ApplyUID == "" {
|
||||
err = errors.New(m.ERROR_INVALID_ID)
|
||||
return
|
||||
}
|
||||
|
@ -4,17 +4,31 @@ import (
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"fonchain-artshow/pkg/db"
|
||||
"fonchain-artshow/pkg/m"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func SaveArtShow(tx *gorm.DB, artShow *model.ArtShow) (err error) {
|
||||
|
||||
if artShow.ID != uint(0) {
|
||||
err = tx.Model(&model.ArtShow{}).Omit("id").Where("id = ?", artShow.ID).Updates(&artShow).Error
|
||||
} else {
|
||||
err = tx.Model(&model.ArtShow{}).Create(artShow).Error
|
||||
uid, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
artShow.ShowUID = uid.String()
|
||||
artShow.ShowSeq = strings.Replace(artShow.ShowSeq, "T", m.ARTSHOW_PREFIX, -1)
|
||||
num := countArtistNumInShowCurrentYear(artShow.ArtistUID)
|
||||
if num < 10 {
|
||||
artShow.ShowSeq = strings.Join([]string{artShow.ShowSeq, time.Now().Format("06"), "00" + strconv.FormatInt(num, 10)}, "")
|
||||
} else if num >= 10 && num < 100 {
|
||||
artShow.ShowSeq = strings.Join([]string{artShow.ShowSeq, time.Now().Format("06"), "0" + strconv.FormatInt(num, 10)}, "")
|
||||
} else if num >= 100 {
|
||||
artShow.ShowSeq = strings.Join([]string{artShow.ShowSeq, time.Now().Format("06"), strconv.FormatInt(num, 10)}, "")
|
||||
}
|
||||
err = tx.Model(&model.ArtShow{}).Create(&artShow).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShow err", zap.Error(err))
|
||||
return
|
||||
@ -23,38 +37,108 @@ func SaveArtShow(tx *gorm.DB, artShow *model.ArtShow) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func ArtShowList(in *artShow.ShowListReq) (err error, total int64, out []*model.ArtShow) {
|
||||
queryDB := db.DbArtShow.Model(&model.ArtShow{})
|
||||
|
||||
if in.ArtistID != "" {
|
||||
queryDB = queryDB.Where("artist_id = ? ", in.ArtistID)
|
||||
}
|
||||
if in.StartTime != "" && in.EndTime != "" {
|
||||
queryDB = queryDB.Where("convert(show_time, date) between ? and ?", in.StartTime, in.EndTime)
|
||||
}
|
||||
if in.IsShow != 0 {
|
||||
queryDB = queryDB.Where("is_show = ?", in.IsShow)
|
||||
}
|
||||
|
||||
err = queryDB.Count(&total).Error
|
||||
func UpdateArtShow(tx *gorm.DB, artShow *model.ArtShow) (err error) {
|
||||
err = tx.Model(&model.ArtShow{}).Omit("show_uid,operator").Where("show_uid = ?", artShow.ShowUID).Updates(artShow).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowList Count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
out = make([]*model.ArtShow, 0)
|
||||
err = queryDB.Offset(int((in.Page - 1) * in.PageSize)).
|
||||
Limit(int(in.PageSize)).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowList Find err", zap.Error(err))
|
||||
zap.L().Error("ArtShow err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ArtShowList_apply(applyID uint) (err error, out []*model.ArtShow) {
|
||||
out = make([]*model.ArtShow, 0)
|
||||
err = db.DbArtShow.Table("art_show as a ").Select("a.*").Distinct("a.id").Joins(" right join show_rel as b on a.id = b.show_id").Where("b.apply_id = ? ", applyID).Find(&out).Error
|
||||
func ArtShowListWithRel(in *artShow.ShowListReq) (err error, total int64, out []*model.ArtShowRes) {
|
||||
queryDB := db.DbArtShow.Table("art_show as a ").Omit("a.created_at").Distinct("a.id").
|
||||
Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.reward ,a.create_time, a.operator, a.is_show, c.address ,c.show_time, a.created_at").
|
||||
Joins("left join artwork_price as b on a.show_uid = b.show_uid").
|
||||
Joins("left join show_rel as c on a.show_uid = c.show_uid ")
|
||||
countDB := db.DbArtShow.Table("art_show as a ").Distinct("a.id").
|
||||
Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.reward , a.create_time, a.operator, a.is_show, c.address ,c.show_time").
|
||||
Joins("left join artwork_price as b on a.show_uid = b.show_uid").
|
||||
Joins("left join show_rel as c on a.show_uid = c.show_uid ")
|
||||
if in.ArtistName != "" {
|
||||
queryDB.Where(" a.artist_name like ? ", "%"+in.ArtistName+"%")
|
||||
countDB.Where(" a.artist_name like ? ", "%"+in.ArtistName+"%")
|
||||
}
|
||||
if in.ShowName != "" {
|
||||
queryDB.Where(" a.show_name like ? ", "%"+in.ShowName+"%")
|
||||
countDB.Where(" a.show_name like ? ", "%"+in.ShowName+"%")
|
||||
}
|
||||
if in.ShowSeq != "" {
|
||||
queryDB.Where(" a.show_seq like ? ", "%"+in.ShowSeq+"%")
|
||||
countDB.Where(" a.show_seq like ? ", "%"+in.ShowSeq+"%")
|
||||
}
|
||||
if in.StartShowTime != "" && in.EndShowTime != "" {
|
||||
queryDB.Where("c.show_time between ? and ?", in.StartShowTime, in.EndShowTime)
|
||||
countDB.Where("c.show_time between ? and ?", in.StartShowTime, in.EndShowTime)
|
||||
}
|
||||
if in.EndPrice != 0 {
|
||||
queryDB.Where(" a.price between ? and ?", in.StartPrice, in.EndPrice)
|
||||
countDB.Where(" a.price between ? and ?", in.StartPrice, in.EndPrice)
|
||||
}
|
||||
if in.EndReward != 0 {
|
||||
queryDB.Where(" a.reward between ? and ?", in.StartReward, in.EndReward)
|
||||
countDB.Where(" a.reward between ? and ?", in.StartReward, in.EndReward)
|
||||
}
|
||||
if in.Address != "" {
|
||||
queryDB.Where(" c.address like ?", "%"+in.Address+"%")
|
||||
countDB.Where(" c.address like ?", "%"+in.Address+"%")
|
||||
}
|
||||
if len(in.IsShow) > 0 {
|
||||
queryDB.Where(" a.is_show in ?", in.IsShow)
|
||||
countDB.Where(" a.is_show in ?", in.IsShow)
|
||||
}
|
||||
//selectDb := queryDB
|
||||
//countDb := queryDB
|
||||
|
||||
out = make([]*model.ArtShowRes, 0)
|
||||
err = queryDB.Where("a.deleted_at is null and c.deleted_at is null").Offset(int((in.Page - 1) * in.PageSize)).
|
||||
Limit(int(in.PageSize)).Order("a.created_at desc ").Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowList Find err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
err = countDB.Where("a.deleted_at is null").Group("a.id").Count(&total).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowList Count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ArtShowList(in *artShow.ShowListReq) (err error, total int64, out []*model.ArtShowRes) {
|
||||
queryDB := db.DbArtShow.Table("art_show as a ").Omit("a.created_at").Distinct("a.id").
|
||||
Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.create_time, a.operator, a.is_show, c.address ,c.show_time, a.created_at").
|
||||
Joins("left join show_rel as c on a.show_uid = c.show_uid ")
|
||||
|
||||
countDB := db.DbArtShow.Table("art_show as a ").Distinct("a.id").
|
||||
Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.create_time, a.operator, a.is_show, c.address ,c.show_time, a.created_at").
|
||||
Joins("left join show_rel as c on a.show_uid = c.show_uid ")
|
||||
|
||||
if len(in.IsShow) > 0 {
|
||||
queryDB.Where(" is_show in ?", in.IsShow)
|
||||
countDB.Where(" is_show in ?", in.IsShow)
|
||||
}
|
||||
|
||||
err = queryDB.Where("a.deleted_at is null and c.deleted_at is null").Offset(int((in.Page - 1) * in.PageSize)).
|
||||
Limit(int(in.PageSize)).Order("a.created_at desc ").Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowList Find err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
err = countDB.Where("a.deleted_at is null").Group("a.id").Count(&total).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowList Count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ArtShowList_apply(applyUID string) (err error, out []*model.ArtShowRes) {
|
||||
out = make([]*model.ArtShowRes, 0)
|
||||
err = db.DbArtShow.Table("art_show as a ").Distinct("a.show_uid").Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.reward, a.create_time, a.is_show, b.address ,b.show_time").Joins(" right join show_rel as b on a.show_uid = b.show_uid").Where("b.apply_uid = ? ", applyUID).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowList_apply Find err", zap.Error(err))
|
||||
return
|
||||
@ -62,18 +146,16 @@ func ArtShowList_apply(applyID uint) (err error, out []*model.ArtShow) {
|
||||
return
|
||||
}
|
||||
|
||||
func ArtShowListByApplyStatus(in *artShow.ShowListReq) (err error, total int64, out []*model.ArtShow) {
|
||||
out = make([]*model.ArtShow, 0)
|
||||
tx := db.DbArtShow.Table("art_show as a")
|
||||
|
||||
tx.Joins(" left join show_rel as b on b.show_id = a.id").Where("a.is_show = ?", in.IsShow)
|
||||
err = tx.Count(&total).Error
|
||||
func ArtShowListByApplyStatus(in *artShow.ShowListReq) (err error, total int64, out []*model.ArtShowRes) {
|
||||
out = make([]*model.ArtShowRes, 0)
|
||||
queryDB := db.DbArtShow.Table("art_show as a").Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.create_time, a.is_show, b.address ,b.show_time").Joins(" left join show_rel as b on b.show_uid = a.show_uid").Where("a.is_show = ?", in.IsShow[len(in.IsShow)-1])
|
||||
err = queryDB.Count(&total).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowListByApplyStatus Count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
err = tx.Offset(int((in.Page - 1) * in.PageSize)).
|
||||
err = queryDB.Offset(int((in.Page - 1) * in.PageSize)).
|
||||
Limit(int(in.PageSize)).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShowListByApplyStatus Find err", zap.Error(err))
|
||||
@ -82,17 +164,18 @@ func ArtShowListByApplyStatus(in *artShow.ShowListReq) (err error, total int64,
|
||||
return
|
||||
}
|
||||
|
||||
func DelArtShow(in *artShow.DelShowReq) (err error) {
|
||||
err = db.DbArtShow.Where("id = ?", in.ShowID).Delete(&model.ArtShow{}).Error
|
||||
func DelArtShow(tx *gorm.DB, showUid string) (err error) {
|
||||
err = tx.Where("show_uid = ?", showUid).Delete(&model.ArtShow{}).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShow delete err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
func QueryArtShow(id uint) (err error, out *model.ArtShow) {
|
||||
err = db.DbArtShow.Model(&model.ArtShow{}).Where("id = ?", id).Find(&out).Error
|
||||
func UniqueShowName(showName string) (out *model.ArtShowRes, err error) {
|
||||
out = new(model.ArtShowRes)
|
||||
err = db.DbArtShow.Table("art_show as a ").Select("a.show_uid").Joins("left join show_rel as b on a.show_uid = b.show_uid").Where("a.show_name = ?", showName).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShow Find err", zap.Error(err))
|
||||
return
|
||||
@ -100,18 +183,79 @@ func QueryArtShow(id uint) (err error, out *model.ArtShow) {
|
||||
return
|
||||
}
|
||||
|
||||
func ShowStatistical(isShow int32) (err error, artistNum int64, packageNum int64) {
|
||||
func QueryArtShow(showUids []string) (err error, out []*model.ArtShowRes) {
|
||||
out = make([]*model.ArtShowRes, 0)
|
||||
err = db.DbArtShow.Table("art_show as a ").Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.create_time, a.operator,a.is_show, b.address ,b.show_time").Joins("left join show_rel as b on a.show_uid = b.show_uid").Where("a.show_uid in ?", showUids).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ArtShow Find err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ShowStatistical(isShow int32) (err error, artistNum, packageNum, totalNum, NotShowNum, ShowHisNum int64) {
|
||||
|
||||
artistNum = 0
|
||||
err = db.DbArtShow.Model(&model.ArtShow{}).Distinct("artist_name").Where("is_show = ?", isShow).Count(&artistNum).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowStatistical artistNum count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
packageNum = 0
|
||||
err = db.DbArtShow.Model(&model.ArtShow{}).Where("is_show = ?", isShow).Count(&packageNum).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowStatistical packageNum count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
totalNum = 0
|
||||
err = db.DbArtShow.Model(&model.ArtShow{}).Count(&totalNum).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowStatistical totalNum count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
NotShowNum = 0
|
||||
err = db.DbArtShow.Table("art_show as a").Distinct("a.artist_uid").Joins(" join artwork_price as b on b.show_uid = a.show_uid").Where("a.is_show in (1,2) and a.deleted_at is null").Count(&NotShowNum).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowStatistical totalNum count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
ShowHisNum = 0
|
||||
err = db.DbArtShow.Table("art_show as a").Distinct("a.artist_uid").Joins(" join artwork_price as b on b.show_uid = a.show_uid").Where("a.is_show = 3 and a.deleted_at is null").Count(&ShowHisNum).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowStatistical totalNum count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryArtShowForArtwork(in *artShow.ShowListForArtworkReq) (err error, total int64, out []*model.ArtShowRes) {
|
||||
// 查询 画家已出展 画展包
|
||||
queryDB := db.DbArtShow.Table("art_show as a ").Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.create_time, a.is_show, b.address ,b.show_time").Joins("left join show_rel as b on a.show_uid = b.show_uid").Where("a.artist_uid = ? and a.is_show = ?", in.ArtistUID, 3)
|
||||
|
||||
err = queryDB.Count(&total).Error
|
||||
if err != nil {
|
||||
zap.L().Error("QueryArtShowForArtwork count err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
out = make([]*model.ArtShowRes, 0)
|
||||
err = queryDB.Offset(int((in.Page - 1) * in.PageSize)).
|
||||
Limit(int(in.PageSize)).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("QueryArtShowForArtwork err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func countArtistNumInShowCurrentYear(artistUid string) (num int64) {
|
||||
err := db.DbArtShow.Table("art_show").Where("artist_uid = ? and date_format(created_at,\"%Y\") = ? ", artistUid, time.Now().Format("2006")).Count(&num).Error
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
num = num + 1
|
||||
return
|
||||
}
|
||||
|
@ -3,31 +3,37 @@ package dao
|
||||
import (
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pkg/db"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func SaveArtworkPrice(tx *gorm.DB, artworks []*model.ArtworkPrice) (err error, ids []uint) {
|
||||
ids = make([]uint, 0) // 用于记录 更新的记录ID
|
||||
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
if artworks[i].ID != 0 {
|
||||
err = tx.Model(&model.ArtworkPrice{}).Omit("id").Where("id = ?", artworks[i].ID).Updates(artworks[i]).Error
|
||||
} else {
|
||||
err = tx.Model(&model.ArtworkPrice{}).Create(&artworks[i]).Error
|
||||
func SaveArtworkPrice(tx *gorm.DB, artwork *model.ArtworkPrice) (err error) {
|
||||
uid, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
artwork.ArtworkPriceUID = uid.String()
|
||||
err = tx.Model(&model.ArtworkPrice{}).Create(&artwork).Error
|
||||
if err != nil {
|
||||
zap.L().Error("Artwork price save err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
ids = append(ids, artworks[i].ID)
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateArtworkPrice(tx *gorm.DB, artwork *model.ArtworkPrice) (err error) {
|
||||
err = tx.Model(&model.ArtworkPrice{}).Omit("artwork_price_uid").Where("artwork_price_uid = ?", artwork.ArtworkPriceUID).Updates(artwork).Error
|
||||
if err != nil {
|
||||
zap.L().Error("Artwork price save err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ArtworkPriceList(showID uint) (err error, out []*model.ArtworkPrice) {
|
||||
func ArtworkPriceList(showUID string) (err error, out []*model.ArtworkPrice) {
|
||||
out = make([]*model.ArtworkPrice, 0)
|
||||
err = db.DbArtShow.Model(&model.ArtworkPrice{}).Where("show_id = ? ", showID).Find(&out).Error
|
||||
err = db.DbArtShow.Model(&model.ArtworkPrice{}).Where("show_uid = ? ", showUID).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("Artwork list err", zap.Error(err))
|
||||
return
|
||||
@ -35,9 +41,9 @@ func ArtworkPriceList(showID uint) (err error, out []*model.ArtworkPrice) {
|
||||
return
|
||||
}
|
||||
|
||||
func QueryArtworkPrice_artworkID(artworkID int64) (err error, out *model.ArtworkPrice) {
|
||||
func QueryArtworkPrice_artworkUID(artworkUID string) (err error, out *model.ArtworkPrice) {
|
||||
out = new(model.ArtworkPrice)
|
||||
err = db.DbArtShow.Model(&model.ArtworkPrice{}).Where("artwork_id = ? ", artworkID).Find(&out).Error
|
||||
err = db.DbArtShow.Model(&model.ArtworkPrice{}).Where("artwork_uid = ? ", artworkUID).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("Artwork price artwork_id query err", zap.Error(err))
|
||||
return
|
||||
@ -45,9 +51,9 @@ func QueryArtworkPrice_artworkID(artworkID int64) (err error, out *model.Artwork
|
||||
return
|
||||
}
|
||||
|
||||
func QueryArtworkPrice_id(id uint) (err error, out *model.ArtworkPrice) {
|
||||
func QueryArtworkPrice_uid(uid string) (err error, out *model.ArtworkPrice) {
|
||||
out = new(model.ArtworkPrice)
|
||||
err = db.DbArtShow.Model(&model.ArtworkPrice{}).Where("id = ? ", id).Find(&out).Error
|
||||
err = db.DbArtShow.Model(&model.ArtworkPrice{}).Where("artwork_price_uid = ? ", uid).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("Artwork price id query err", zap.Error(err))
|
||||
return
|
||||
@ -55,8 +61,17 @@ func QueryArtworkPrice_id(id uint) (err error, out *model.ArtworkPrice) {
|
||||
return
|
||||
}
|
||||
|
||||
func DelArtworkPrice(tx *gorm.DB, ids []uint) (err error) {
|
||||
err = tx.Where("id in (?)", ids).Delete(&model.ArtworkPrice{}, ids).Error
|
||||
func DelArtworkPrice(tx *gorm.DB, artworkPriceUids []string) (err error) {
|
||||
err = tx.Where("artwork_price_uid in (?)", artworkPriceUids).Delete(&model.ArtworkPrice{}).Error
|
||||
if err != nil {
|
||||
zap.L().Error("Artwork delete err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func DelArtworkPrice_showUID(tx *gorm.DB, show_uid string) (err error) {
|
||||
err = tx.Where("show_uid = ? ", show_uid).Delete(&model.ArtworkPrice{}).Error
|
||||
if err != nil {
|
||||
zap.L().Error("Artwork delete err", zap.Error(err))
|
||||
return
|
||||
|
@ -5,23 +5,36 @@ import (
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"fonchain-artshow/pkg/db"
|
||||
"fonchain-artshow/pkg/m"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func SaveShowApply(showApply *model.ShowApply) (tx *gorm.DB, err error) {
|
||||
tx = db.DbArtShow.Begin()
|
||||
|
||||
if showApply.ID != uint(0) {
|
||||
err = tx.Model(&model.ShowApply{}).Omit("id").Where("id = ?", showApply.ID).Updates(showApply).Error
|
||||
} else {
|
||||
err = tx.Model(&model.ShowApply{}).Create(showApply).Error
|
||||
func SaveShowApply(showApply *model.ShowApply) (err error) {
|
||||
uid, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
showApply.ApplyUID = uid.String()
|
||||
showApply.ApplySeq = strings.Join([]string{m.ARTSHOWAPPLY_PREFIX, time.Now().Format("20060102150405")}, "")
|
||||
showApply.Status = m.SHOWAPPLYStatusDoing
|
||||
err = db.DbArtShow.Model(&model.ShowApply{}).Create(&showApply).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowApply err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateShowApply(showApply *model.ShowApply) (tx *gorm.DB, err error) {
|
||||
tx = db.DbArtShow.Begin()
|
||||
err = tx.Model(&model.ShowApply{}).Omit("apply_uid").Where("apply_uid = ?", showApply.ApplyUID).Updates(showApply).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowApply err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -29,7 +42,7 @@ func ShowApplyList(in *artShow.ApplyListReq) (err error, total int64, out []*mod
|
||||
out = make([]*model.ShowApply, 0)
|
||||
queryDB := db.DbArtShow.Model(&model.ShowApply{})
|
||||
if in.Status == 0 {
|
||||
in.Status = m.SHOWAPPLY_ADD
|
||||
in.Status = m.SHOWAPPLYStatusOk
|
||||
}
|
||||
queryDB.Where("status = ?", in.Status)
|
||||
|
||||
@ -51,18 +64,19 @@ func ShowApplyList(in *artShow.ApplyListReq) (err error, total int64, out []*mod
|
||||
return
|
||||
}
|
||||
|
||||
func ShowApplyDetail(applyID uint) (err error, out *model.ShowApply) {
|
||||
func ShowApplyDetail(applyUID string) (err error, out *model.ShowApply) {
|
||||
out = new(model.ShowApply)
|
||||
err = db.DbArtShow.Model(&model.ShowApply{}).Where("id = ?", applyID).Find(&out).Error
|
||||
err = db.DbArtShow.Model(&model.ShowApply{}).Where("apply_uid = ?", applyUID).Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowApplyDetail err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func DelShowApply(in *artShow.DelApplyReq) (tx *gorm.DB, err error) {
|
||||
tx = db.DbArtShow.Begin()
|
||||
err = tx.Delete(&model.ShowApply{}, in.ApplyID).Error
|
||||
err = tx.Where("apply_uid = ?", in.ApplyUID).Delete(&model.ShowApply{}).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowApply delete err", zap.Error(err))
|
||||
return
|
||||
|
@ -3,29 +3,52 @@ package dao
|
||||
import (
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pkg/db"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func SaveShowRels(tx *gorm.DB, showRels []*model.ShowRel) (err error, out []uint) {
|
||||
out = make([]uint, 0)
|
||||
func SaveShowRels(tx *gorm.DB, showRels []*model.ShowRel) (err error, out []string) {
|
||||
out = make([]string, 0)
|
||||
for i := 0; i < len(showRels); i++ {
|
||||
if showRels[i].ID != 0 {
|
||||
err = tx.Model(&model.ShowRel{}).Omit("id").Where("id = ?", showRels[i].ID).Updates(showRels[i]).Error
|
||||
} else {
|
||||
err = tx.Model(&model.ShowRel{}).Create(&showRels[i]).Error
|
||||
}
|
||||
if showRels[i].ShowRelUID == "" {
|
||||
uid, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
zap.L().Error("ShowRels err", zap.Error(err))
|
||||
return err, out
|
||||
}
|
||||
showRels[i].ShowRelUID = uid.String()
|
||||
err = tx.Model(&model.ShowRel{}).Create(&showRels[i]).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowRels save err", zap.Error(err))
|
||||
return err, nil
|
||||
}
|
||||
out = append(out, showRels[i].ID)
|
||||
} else {
|
||||
err = tx.Model(&model.ShowRel{}).Where("show_uid = ? and apply_uid = ?", showRels[i].ShowUID, showRels[i].ApplyUID).First(&showRels[i]).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowRels updates err", zap.Error(err))
|
||||
return err, nil
|
||||
}
|
||||
}
|
||||
out = append(out, showRels[i].ApplyUID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateShowRels(tx *gorm.DB, showRels []*model.ShowRel) (err error, out []string) {
|
||||
out = make([]string, 0)
|
||||
for i := 0; i < len(showRels); i++ {
|
||||
results := tx.Model(&model.ShowRel{}).Where("show_uid = ? and apply_uid = ?", showRels[i].ShowUID, showRels[i].ApplyUID).First(&showRels[i])
|
||||
if results.Error != nil {
|
||||
zap.L().Error("ShowRels updates err", zap.Error(err))
|
||||
return err, nil
|
||||
}
|
||||
out = append(out, showRels[i].ApplyUID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SaveShowRel(tx *gorm.DB, showRel *model.ShowRel) (err error) {
|
||||
err = tx.Model(&model.ShowRel{}).Where("show_id = ?", showRel.ShowID).Updates(showRel).Error
|
||||
err = tx.Model(&model.ShowRel{}).Where("show_uid = ?", showRel.ShowUID).Updates(showRel).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowRel err", zap.Error(err))
|
||||
return err
|
||||
@ -33,8 +56,8 @@ func SaveShowRel(tx *gorm.DB, showRel *model.ShowRel) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func DelShowRel(tx *gorm.DB, ids []uint) (err error) {
|
||||
err = tx.Where("id in (?)", ids).Delete(&model.ShowRel{}).Error
|
||||
func DelShowRel(tx *gorm.DB, showRelUIDs []string) (err error) {
|
||||
err = tx.Where("show_rel_uid in (?)", showRelUIDs).Delete(&model.ShowRel{}).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowRel delete err", zap.Error(err))
|
||||
return
|
||||
@ -42,20 +65,20 @@ func DelShowRel(tx *gorm.DB, ids []uint) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func DelShowRelByApplyID(tx *gorm.DB, applyID uint) (err error) {
|
||||
err = tx.Where("apply_id = ? ", applyID).Delete(&model.ShowRel{}).Error
|
||||
func DelShowRelByApplyUID(tx *gorm.DB, applyUID string) (err error) {
|
||||
err = tx.Where("apply_uid = ? ", applyUID).Delete(&model.ShowRel{}).Error
|
||||
if err != nil {
|
||||
zap.L().Error("ShowRel by applyID delete err", zap.Error(err))
|
||||
zap.L().Error("ShowRel by applyUID delete err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryShowRel(showID uint) (err error, out *model.ShowRel) {
|
||||
func QueryShowRel_showUID(showUID string) (err error, out *model.ShowRel) {
|
||||
out = new(model.ShowRel)
|
||||
findDB := db.DbArtShow.Model(&model.ShowRel{})
|
||||
if showID != 0 {
|
||||
findDB = findDB.Where("id = ? ", showID)
|
||||
if showUID != "" {
|
||||
findDB = findDB.Where("show_uid = ? ", showUID)
|
||||
}
|
||||
err = findDB.Find(&out).Error
|
||||
if err != nil {
|
||||
@ -65,11 +88,11 @@ func QueryShowRel(showID uint) (err error, out *model.ShowRel) {
|
||||
return
|
||||
}
|
||||
|
||||
func QueryShowRelList(applyID uint) (err error, out []*model.ShowRel) {
|
||||
func QueryShowRelList(applyUID string) (err error, out []*model.ShowRel) {
|
||||
out = make([]*model.ShowRel, 0)
|
||||
findDB := db.DbArtShow.Model(&model.ShowRel{})
|
||||
if applyID != 0 {
|
||||
findDB = findDB.Where("apply_id = ? ", applyID)
|
||||
if applyUID != "" {
|
||||
findDB = findDB.Where("apply_uid = ? ", applyUID)
|
||||
}
|
||||
err = findDB.Find(&out).Error
|
||||
if err != nil {
|
||||
@ -78,3 +101,20 @@ func QueryShowRelList(applyID uint) (err error, out []*model.ShowRel) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryShowRel(applyUID, showUID string) (err error, out *model.ShowRel) {
|
||||
out = new(model.ShowRel)
|
||||
findDB := db.DbArtShow.Model(&model.ShowRel{})
|
||||
if showUID != "" {
|
||||
findDB = findDB.Where("show_uid = ? ", showUID)
|
||||
}
|
||||
if applyUID != "" {
|
||||
findDB = findDB.Where("apply_uid = ? ", applyUID)
|
||||
}
|
||||
err = findDB.Find(&out).Error
|
||||
if err != nil {
|
||||
zap.L().Error("QueryShowRel err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
13
cmd/main.go
13
cmd/main.go
@ -2,20 +2,19 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
//grpc_go "github.com/dubbogo/grpc-go"
|
||||
"fonchain-artshow/cmd/controller"
|
||||
grpc2 "fonchain-artshow/pb/grpc"
|
||||
"net"
|
||||
|
||||
"fonchain-artshow/cmd/controller"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"fonchain-artshow/pkg/db"
|
||||
"fonchain-artshow/pkg/logger"
|
||||
"fonchain-artshow/pkg/m"
|
||||
)
|
||||
|
||||
type server struct {
|
||||
artShow.UnimplementedArtShowServer
|
||||
grpc2.UnimplementedArtShowServer
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -26,7 +25,7 @@ func main() {
|
||||
}
|
||||
|
||||
s := grpc.NewServer() // 创建gRPC服务器
|
||||
artShow.RegisterArtShowServer(s, &controller.ArtShowProvider{}) // 在gRPC服务端注册服务
|
||||
grpc2.RegisterArtShowServer(s, &controller.ArtShowProvider{}) // 在gRPC服务端注册服务
|
||||
|
||||
db.Init(m.SERVER_CONFIG)
|
||||
//初始化zap
|
||||
|
@ -5,14 +5,34 @@ import "gorm.io/gorm"
|
||||
type ArtShow struct {
|
||||
gorm.Model
|
||||
|
||||
ShowUID string `json:"show_uid" gorm:"show_uid"`
|
||||
ShowSeq string `json:"show_seq" gorm:"show_seq"` // 画展包序列
|
||||
ShowName string `json:"show_name" gorm:"show_name"` // 画展包名称
|
||||
ArtistName string `json:"artist_name" gorm:"artist_name"` // 画家
|
||||
ArtistID string `json:"artist_id" gorm:"artist_id"` // 画家ID
|
||||
ArtistUID string `json:"artist_uid" gorm:"artist_uid"` // 画家ID
|
||||
ArtworkNum int32 `json:"artwork_num" gorm:"artwork_num"` // 画作数量
|
||||
Ruler int32 `json:"ruler" gorm:"ruler"` // 画作总平尺
|
||||
Price int64 `json:"price" gorm:"price"` // 画展包价格
|
||||
Reward int64 `json:"reward" gorm:"reward"` // 润格
|
||||
ShowTime string `json:"show_time" gorm:"show_time"` // 画展时间
|
||||
CreateTime string `json:"create_time" gorm:"create_time"` // 创建时间
|
||||
Operator string `json:"operator" gorm:"operator"` // 操作人
|
||||
IsShow int8 `json:"is_show" gorm:"is_show"` // 是否出展 1,内部(default) 2,可展 3,已展
|
||||
}
|
||||
|
||||
type ArtShowRes struct {
|
||||
ShowUID string `json:"show_uid" gorm:"show_uid"`
|
||||
ShowSeq string `json:"show_seq" gorm:"show_seq"` // 画展包序列
|
||||
ShowName string `json:"show_name" gorm:"show_name"` // 画展包名称
|
||||
ArtistName string `json:"artist_name" gorm:"artist_name"` // 画家
|
||||
ArtistUID string `json:"artist_uid" gorm:"artist_uid"` // 画家ID
|
||||
ArtworkNum int32 `json:"artwork_num" gorm:"artwork_num"` // 画作数量
|
||||
Ruler int32 `json:"ruler" gorm:"ruler"` // 画作总平尺
|
||||
Price int64 `json:"price" gorm:"price"` // 画展包价格
|
||||
Reward int64 `json:"reward" gorm:"reward"` // 润格
|
||||
CreateTime string `json:"create_time" gorm:"create_time"` // 创建时间
|
||||
Operator string `json:"operator" gorm:"operator"` // 操作人
|
||||
IsShow int8 `json:"is_show" gorm:"is_show"` // 是否出展 1,内部(default) 2,可展 3,已展
|
||||
|
||||
Address string `json:"address" gorm:"address"` // 地点
|
||||
ShowTime string `json:"show_time" gorm:"show_time"` // 时间
|
||||
}
|
||||
|
@ -5,13 +5,16 @@ import "gorm.io/gorm"
|
||||
type ArtworkPrice struct {
|
||||
gorm.Model
|
||||
|
||||
ShowID uint `json:"show_id" gorm:"show_id"` // 画展ID
|
||||
ArtworkID int64 `json:"artwork_id" gorm:"artwork_id"` // 画作ID
|
||||
ArtworkPriceUID string `json:"artwork_price_uid" gorm:"artwork_price_uid"`
|
||||
ShowUID string `json:"show_uid" gorm:"show_uid"` // 画展ID
|
||||
ArtworkUID string `json:"artwork_uid" gorm:"artwork_uid"` // 画作ID
|
||||
ArtworkName string `json:"artwork_name" gorm:"artwork_name"` // 画作名称
|
||||
ArtistName string `json:"artist_name" gorm:"artist_name"` // 画家名称
|
||||
SmallPic string `json:"small_pic" gorm:"small_pic"` // 画作小图
|
||||
Price int64 `json:"price" gorm:"price"` // 总价
|
||||
RulerPrice int64 `json:"ruler_price" gorm:"ruler_price"` // 平尺价
|
||||
Length int32 `json:"length" gorm:"length"` // 画作长度
|
||||
Width int32 `json:"width" gorm:"width"` // 画作宽度
|
||||
Ruler int32 `json:"ruler" gorm:"ruler"` // 画作平尺
|
||||
ArtworkPrice int64 `json:"artwork_price" gorm:"artwork_price"` // 画作价格
|
||||
MarketPrice int64 `json:"market_price" gorm:"market_price"` // 市场价
|
||||
|
@ -7,11 +7,12 @@ import (
|
||||
type ShowApply struct {
|
||||
gorm.Model
|
||||
|
||||
ApplyUID string `json:"apply_uid" gorm:"apply_uid"`
|
||||
ApplySeq string `json:"apply_seq" gorm:"apply_seq"` // 画展包申请序列号
|
||||
Applicant string `json:"applicant" gorm:"applicant"` // 申请人
|
||||
ApplicantID uint `json:"applicant_id" gorm:"applicant_id"` // 申请人
|
||||
ApplicantID string `json:"applicant_id" gorm:"applicant_id"` // 申请人
|
||||
Num int32 `json:"num" gorm:"num"` // 申请画展包数量
|
||||
ApplyTime string `json:"apply_time" gorm:"apply_time"` // 申请时间
|
||||
Status int `json:"status" gorm:"status"` // 申请画展包状态 10,创建 11,数量审批 12,数量审批驳回 13,关联画展包 14,画展包关联审批 15,关联审批驳回 16,可展
|
||||
Status int `json:"status" gorm:"status"` // 申请画展包状态
|
||||
Remark string `json:"remark" gorm:"remark"` // 备注
|
||||
}
|
||||
|
@ -5,12 +5,10 @@ import "gorm.io/gorm"
|
||||
type ShowRel struct {
|
||||
gorm.Model
|
||||
|
||||
//ShowSeq string `json:"show_seq" gorm:"show_seq"` // 画展包序列
|
||||
ShowID uint `json:"show_id" gorm:"show_id"` // 画展包ID
|
||||
//ApplySeq string `json:"apply_seq" gorm:"apply_seq"` // 申请序列
|
||||
ApplyID uint `json:"apply_id" gorm:"apply_id"` // 申请ID
|
||||
ShowRelUID string `json:"show_rel_uid" gorm:"show_rel_uid"` // 画展包申请关联画展UID
|
||||
ShowUID string `json:"show_uid" gorm:"show_uid"` // 画展包ID
|
||||
ApplyUID string `json:"apply_uid" gorm:"show_uid"` // 申请ID
|
||||
Index int32 `json:"index" gorm:"index"` // 申请下标
|
||||
Address string `json:"address" gorm:"address"` // 参展地址
|
||||
//Status int32 `json:"status" gorm:"status"` // 参展状态 1、待展 2、驳回 3、可展
|
||||
//Remark string `json:"remark" gorm:"remark"` // 备注
|
||||
ShowTime string `json:"show_time" gorm:"show_time"` // 画展时间
|
||||
}
|
||||
|
@ -1,18 +1,28 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fonchain-artshow/cmd/dao"
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"fonchain-artshow/pkg/db"
|
||||
"fonchain-artshow/pkg/m"
|
||||
"fonchain-artshow/pkg/serializer"
|
||||
"fonchain-artshow/pkg/utils"
|
||||
)
|
||||
|
||||
func CreateArtShowWithArtworkPrice(in *artShow.SaveShowReq) (err error, showID uint) {
|
||||
// 创建 画展包 及 关联画作
|
||||
func CreateArtShowWithArtworkPrice(in *artShow.SaveShowReq) (err error, showUID string) {
|
||||
artShowM := serializer.BuildArtShowM(in)
|
||||
|
||||
out, err := dao.UniqueShowName(in.ShowName)
|
||||
if err != nil {
|
||||
return err, ""
|
||||
}
|
||||
|
||||
if out.ShowUID != "" {
|
||||
return errors.New(m.ERROR_SHOW_EXIST), ""
|
||||
}
|
||||
|
||||
tx := db.DbArtShow.Begin()
|
||||
|
||||
err = dao.SaveArtShow(tx, artShowM)
|
||||
@ -21,111 +31,145 @@ func CreateArtShowWithArtworkPrice(in *artShow.SaveShowReq) (err error, showID u
|
||||
return
|
||||
}
|
||||
|
||||
artworks := serializer.BuildShowArtworkM(in.ShowArtwork, artShowM.ID)
|
||||
|
||||
err, artworks = serializer.CalcPrice(artworks, artShowM.Ruler, artShowM.Price)
|
||||
if err != nil {
|
||||
return
|
||||
if len(in.Artwork) > 0 {
|
||||
artworks := serializer.BuildShowArtworkM(in.Artwork, artShowM.ShowUID)
|
||||
if in.Price > 0 && in.Ruler > 0 {
|
||||
artworks = serializer.CalcPrice(artShowM.Price, artShowM.Ruler, artworks)
|
||||
}
|
||||
err, artworks = serializer.CalcReward(artworks, artShowM.Reward)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err, _ = dao.SaveArtworkPrice(tx, artworks)
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
err = dao.SaveArtworkPrice(tx, artworks[i])
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
return errors.New(m.ERROR_ARTWORK_CREATE), ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = tx.Commit().Error
|
||||
|
||||
return err, artShowM.ID
|
||||
return err, artShowM.ShowUID
|
||||
}
|
||||
|
||||
func UpdateArtShowWithArtworkPrice(in *artShow.SaveShowReq) (err error, showID uint) {
|
||||
|
||||
err, artworkPrices := dao.ArtworkPriceList(uint(in.ID))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 更新 画展包 及 关联画作
|
||||
func UpdateArtShowWithArtworkPrice(in *artShow.SaveShowReq) (err error, showUID string) {
|
||||
tx := db.DbArtShow.Begin()
|
||||
artShowM := serializer.BuildArtShowM(in) // 构建画展包数据
|
||||
artworks := make([]*model.ArtworkPrice, 0)
|
||||
if len(in.ShowArtwork) < 1 && (in.Price != 0 || in.Reward != 0) {
|
||||
artworks = artworkPrices
|
||||
} else {
|
||||
artworks = serializer.BuildShowArtworkM(in.ShowArtwork, uint(in.ID))
|
||||
for i := 0; i < len(artworks); i++ { // 查找 已存在 artwork_price 获取 ruler 信息
|
||||
if artworks[i].Ruler == 0 {
|
||||
err, artwork := dao.QueryArtworkPrice_id(artworks[i].ID)
|
||||
|
||||
// 查询是否已有画作存在
|
||||
/*err, artworkPrices := dao.ArtworkPriceList(in.ShowUID)
|
||||
if err != nil {
|
||||
return err, 0
|
||||
return
|
||||
}
|
||||
artworks[i].Ruler = artwork.Ruler
|
||||
fmt.Println("artworkPrices ==== ", artworkPrices)
|
||||
|
||||
if len(artworkPrices) > 0 {
|
||||
artworks = append(artworks, artworkPrices...)
|
||||
}*/
|
||||
|
||||
// 判断是否有新增画作
|
||||
if len(in.Artwork) > 0 {
|
||||
for i := 0; i < len(in.Artwork); i++ {
|
||||
if in.Artwork[i].ArtworkPriceUID != "" {
|
||||
queryErr, oldArtwork := dao.QueryArtworkPrice_uid(in.Artwork[i].ArtworkPriceUID)
|
||||
if queryErr != nil {
|
||||
return queryErr, ""
|
||||
}
|
||||
artworks = append(artworks, oldArtwork)
|
||||
//fmt.Println("artworkPrices ==== ", oldArtwork)
|
||||
} else {
|
||||
newArtwork := serializer.BuildShowArtwork(in.Artwork[i], in.ShowUID)
|
||||
artworks = append(artworks, newArtwork)
|
||||
//fmt.Println("artworkPrices ==== ", newArtwork)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新 画作
|
||||
if len(artworks) > 0 {
|
||||
if in.Price != 0 {
|
||||
err, artworks = serializer.CalcPrice(artworks, artShowM.Ruler, artShowM.Price)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if in.Reward != 0 {
|
||||
err, artworks = serializer.CalcReward(artworks, artShowM.Reward)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if in.Price > 0 && in.Ruler > 0 {
|
||||
artworks = serializer.CalcPrice(artShowM.Price, artShowM.Ruler, artworks)
|
||||
}
|
||||
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
if artworks[i].ArtworkPriceUID != "" {
|
||||
// 更新画作价格
|
||||
err, newIDs := dao.SaveArtworkPrice(tx, artworks)
|
||||
err := dao.UpdateArtworkPrice(tx, artworks[i])
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, 0
|
||||
return err, ""
|
||||
}
|
||||
} else {
|
||||
err = dao.SaveArtworkPrice(tx, artworks[i])
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 删除旧画作
|
||||
_, del, _ := utils.BeUniqueSlice_uint(serializer.BuildArtworkPriceIDs(artworkPrices), newIDs)
|
||||
if len(del) > 0 {
|
||||
if len(in.DelArtwork) > 0 {
|
||||
del := make([]string, 0)
|
||||
for i := 0; i < len(in.DelArtwork); i++ {
|
||||
del = append(del, in.DelArtwork[i].ArtworkPriceUID)
|
||||
}
|
||||
err = dao.DelArtworkPrice(tx, del)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, 0
|
||||
}
|
||||
return err, ""
|
||||
}
|
||||
}
|
||||
|
||||
// 更新画展包
|
||||
err = dao.SaveArtShow(tx, artShowM)
|
||||
err = dao.UpdateArtShow(tx, artShowM)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
err = tx.Commit().Error
|
||||
return err, artShowM.ID
|
||||
return err, artShowM.ShowUID
|
||||
}
|
||||
|
||||
// 删除画展包
|
||||
func DelArtShow(in *artShow.DelShowReq) (err error) {
|
||||
err = dao.DelArtShow(in)
|
||||
if err != nil {
|
||||
return
|
||||
queryShowErr, shows := dao.QueryArtShow(in.ShowUID)
|
||||
if queryShowErr != nil {
|
||||
return queryShowErr
|
||||
}
|
||||
// 暂不处理 画展包里的 画作
|
||||
tx := db.DbArtShow.Begin()
|
||||
for i := 0; i < len(shows); i++ {
|
||||
if shows[i].IsShow != m.ARTSHOW_SHOWING {
|
||||
delArtShowErr := dao.DelArtShow(tx, in.ShowUID[i])
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return delArtShowErr
|
||||
}
|
||||
delArtworkPriceErr := dao.DelArtworkPrice_showUID(tx, in.ShowUID[i])
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return delArtworkPriceErr
|
||||
}
|
||||
} else {
|
||||
tx.Rollback()
|
||||
return errors.New("存在画展包被使用,无法删除")
|
||||
}
|
||||
}
|
||||
err = tx.Commit().Error
|
||||
return
|
||||
}
|
||||
|
||||
// 画展包列表 不携带 画展地址 画展时间
|
||||
func ArtShowList(in *artShow.ShowListReq) (err error, out *artShow.ShowListRes) {
|
||||
out = new(artShow.ShowListRes)
|
||||
artShows := make([]*model.ArtShow, 0)
|
||||
artShows := make([]*model.ArtShowRes, 0)
|
||||
err, out.Total, artShows = dao.ArtShowList(in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err, out.TotalArtistNum, out.TotalPackageNum = dao.ShowStatistical(m.ARTSHOW_PASS)
|
||||
err, out.TotalArtistNum, out.TotalPackageNum, _, _, _ = dao.ShowStatistical(m.ARTSHOW_PASS)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -133,10 +177,27 @@ func ArtShowList(in *artShow.ShowListReq) (err error, out *artShow.ShowListRes)
|
||||
return
|
||||
}
|
||||
|
||||
func ShowInfo(in *artShow.ShowDetailReq) (err error, out *artShow.ShowArtworkDetailRes) {
|
||||
// 画展包列表 携带 画展地址 画展时间
|
||||
func ArtShowListWithRel(in *artShow.ShowListReq) (err error, out *artShow.ShowListRes) {
|
||||
out = new(artShow.ShowListRes)
|
||||
artShows := make([]*model.ArtShowRes, 0)
|
||||
err, out.Total, artShows = dao.ArtShowListWithRel(in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err, out.TotalArtistNum, out.TotalPackageNum, _, _, _ = dao.ShowStatistical(m.ARTSHOW_PASS)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
out.Data = serializer.BuildArtShowListRes(artShows)
|
||||
return
|
||||
}
|
||||
|
||||
// 画展包关联画作信息
|
||||
func ShowArtworkInfo(in *artShow.ArtworkDetailReq) (err error, out *artShow.ShowArtworkDetailRes) {
|
||||
out = new(artShow.ShowArtworkDetailRes)
|
||||
artworkPriceS := make([]*model.ArtworkPrice, 0)
|
||||
err, artworkPriceS = dao.ArtworkPriceList(uint(in.ShowID))
|
||||
err, artworkPriceS = dao.ArtworkPriceList(in.ShowUID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -144,11 +205,23 @@ func ShowInfo(in *artShow.ShowDetailReq) (err error, out *artShow.ShowArtworkDet
|
||||
return
|
||||
}
|
||||
|
||||
// 画展包详情
|
||||
func ShowDetail(in *artShow.ShowDetailReq) (err error, out *artShow.ShowDetailRes) {
|
||||
out = new(artShow.ShowDetailRes)
|
||||
shows := make([]*model.ArtShowRes, 0)
|
||||
err, shows = dao.QueryArtShow(in.ShowUID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
out.Data = serializer.BuildArtShowListRes(shows)
|
||||
return
|
||||
}
|
||||
|
||||
func ArtShowListWithApply(in *artShow.ShowListReq) (err error, out *artShow.ShowListRes) {
|
||||
out = new(artShow.ShowListRes)
|
||||
artShows := make([]*model.ArtShow, 0)
|
||||
artShows := make([]*model.ArtShowRes, 0)
|
||||
err, out.Total, artShows = dao.ArtShowListByApplyStatus(in)
|
||||
err, out.TotalArtistNum, out.TotalPackageNum = dao.ShowStatistical(m.ARTSHOW_PASS)
|
||||
err, out.TotalArtistNum, out.TotalPackageNum, _, _, _ = dao.ShowStatistical(m.ARTSHOW_PASS)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -158,9 +231,22 @@ func ArtShowListWithApply(in *artShow.ShowListReq) (err error, out *artShow.Show
|
||||
|
||||
func ShowStatisticalInfo(in *artShow.ShowStatisticalInfoReq) (err error, out *artShow.ShowStatisticalInfoRes_Num) {
|
||||
out = new(artShow.ShowStatisticalInfoRes_Num)
|
||||
err, out.ArtistNum, out.PackageNum = dao.ShowStatistical(in.IsShow)
|
||||
err, out.ArtistNum, out.PackageNum, out.TotalNum, out.NotShowNum, out.ShowHisNum = dao.ShowStatistical(in.IsShow)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryArtShowForArtwork(in *artShow.ShowListForArtworkReq) (err error, out *artShow.ShowListForArtworkRes) {
|
||||
out = new(artShow.ShowListForArtworkRes)
|
||||
err, total, shows := dao.QueryArtShowForArtwork(in)
|
||||
if err != nil {
|
||||
return err, out
|
||||
}
|
||||
if len(shows) > 0 {
|
||||
out.Total = total
|
||||
out.Data = serializer.BuildArtShowListRes(shows)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -1,80 +1,104 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"fonchain-artshow/cmd/dao"
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"fonchain-artshow/pkg/m"
|
||||
"fonchain-artshow/pkg/serializer"
|
||||
"fonchain-artshow/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
)
|
||||
|
||||
func CreateShowApply(in *artShow.SaveApplyReq) (err error, applyID uint) {
|
||||
// 创建画展包申请
|
||||
func CreateShowApply(in *artShow.SaveApplyReq) (err error, applyUID string) {
|
||||
showApply := serializer.BuildShowApply(in)
|
||||
|
||||
tx, err := dao.SaveShowApply(showApply)
|
||||
err = dao.SaveShowApply(showApply)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
err = tx.Commit().Error
|
||||
|
||||
// 申请画展包时,暂时不携带画展包信息
|
||||
/* showRels := serializer.BuildShowRel(in.Rel, showApply.ID)
|
||||
err = dao.SaveShowRels(tx, showRels)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
err = tx.Commit().Error*/
|
||||
return err, showApply.ID
|
||||
return err, showApply.ApplyUID
|
||||
}
|
||||
|
||||
func UpdateShowApplyWithShowRel(in *artShow.SaveApplyReq) (err error, applyID uint) {
|
||||
// 更新画展包申请 及 关联记录
|
||||
func UpdateShowApplyWithShowRel(in *artShow.SaveApplyReq) (err error, applyUID string) {
|
||||
|
||||
// 更新画展包申请
|
||||
showApply := serializer.BuildShowApply(in)
|
||||
tx, err := dao.SaveShowApply(showApply)
|
||||
tx, err := dao.UpdateShowApply(showApply)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
// 更新画展包申请关系
|
||||
// 更新 关联的 画展包的状态 为 已展
|
||||
if len(in.Rel) > 0 {
|
||||
err, oldShowRelS := dao.QueryShowRelList(showApply.ID) // 查找 旧 show_rel
|
||||
// 保存 新 show_rel
|
||||
newShowRelS := serializer.BuildShowRelM(in.Rel, showApply.ApplyUID)
|
||||
for i := 0; i < len(newShowRelS); i++ {
|
||||
log.Printf("%+v\n", newShowRelS[i])
|
||||
err, showRel := dao.QueryShowRel(newShowRelS[i].ApplyUID, newShowRelS[i].ShowUID)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, showApply.ID
|
||||
return err, showApply.ApplyUID
|
||||
}
|
||||
if showRel.ShowRelUID != "" {
|
||||
newShowRelS[i].ShowRelUID = showRel.ShowRelUID
|
||||
}
|
||||
}
|
||||
|
||||
newShowRelS := serializer.BuildShowRelM(in.Rel, showApply.ID)
|
||||
err, newIds := dao.SaveShowRels(tx, newShowRelS) // 保存 新 show_rel
|
||||
err, _ = dao.SaveShowRels(tx, newShowRelS)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, showApply.ApplyUID
|
||||
}
|
||||
|
||||
if len(oldShowRelS) > 0 { // 如果 旧 show_rel 有数据 则 删除 旧记录(去除 保留下来的)
|
||||
_, del, _ := utils.BeUniqueSlice_uint(serializer.BuildShowRelIDs(oldShowRelS), newIds)
|
||||
if len(del) > 0 {
|
||||
for i := 0; i < len(newShowRelS); i++ {
|
||||
// 更新 画展包状态 为 已展
|
||||
show := serializer.BuildArtShowIsShowM(newShowRelS[i].ShowUID, m.ARTSHOW_SHOWING)
|
||||
err := dao.UpdateArtShow(tx, show)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, showApply.ApplyUID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新 取消关联的 画展包的状态 为 可展
|
||||
if len(in.DelRel) > 0 {
|
||||
del := make([]string, 0)
|
||||
for i := 0; i < len(in.DelRel); i++ {
|
||||
del = append(del, in.DelRel[i].ShowRelUID)
|
||||
|
||||
// 更新 画展包状态 为 可展
|
||||
show := serializer.BuildArtShowIsShowM(in.DelRel[i].ShowUID, m.ARTSHOW_PASS)
|
||||
err := dao.UpdateArtShow(tx, show)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, showApply.ApplyUID
|
||||
}
|
||||
}
|
||||
|
||||
// 删除关联记录
|
||||
err = dao.DelShowRel(tx, del)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err, showApply.ID
|
||||
}
|
||||
}
|
||||
return err, showApply.ApplyUID
|
||||
}
|
||||
}
|
||||
|
||||
err = tx.Commit().Error
|
||||
return err, showApply.ID
|
||||
return err, showApply.ApplyUID
|
||||
}
|
||||
|
||||
// 更新画展包申请状态
|
||||
func UpdateShowApplyStatus(in *artShow.UpdateApplyStatusReq) (err error) {
|
||||
|
||||
// 更新画展包申请 状态
|
||||
showApply := &model.ShowApply{
|
||||
Model: gorm.Model{ID: uint(in.ApplyID)},
|
||||
ApplyUID: in.ApplyUID,
|
||||
Status: int(in.Status),
|
||||
Remark: in.Remark,
|
||||
}
|
||||
tx, err := dao.SaveShowApply(showApply)
|
||||
tx, err := dao.UpdateShowApply(showApply)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
@ -83,6 +107,7 @@ func UpdateShowApplyStatus(in *artShow.UpdateApplyStatusReq) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// 查询画展包申请列表
|
||||
func ShowApplyList(in *artShow.ApplyListReq) (err error, total int64, out []*artShow.ApplyDetail) {
|
||||
out = make([]*artShow.ApplyDetail, 0)
|
||||
err, total, applyList := dao.ShowApplyList(in)
|
||||
@ -98,44 +123,65 @@ func ShowApplyList(in *artShow.ApplyListReq) (err error, total int64, out []*art
|
||||
return
|
||||
}
|
||||
|
||||
func ShowApplyDetail(applyID uint) (err error, out *artShow.ApplyShowRes) {
|
||||
// 查询画展包申请详情
|
||||
func ShowApplyDetail(applyUID string) (err error, out *artShow.ApplyShowRes) {
|
||||
out = new(artShow.ApplyShowRes)
|
||||
|
||||
err, showApply := dao.ShowApplyDetail(applyID)
|
||||
err, showApply := dao.ShowApplyDetail(applyUID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
out.Apply = serializer.BuildShowApplyRes(showApply)
|
||||
|
||||
err, artShow := dao.ArtShowList_apply(applyID)
|
||||
err, artShow := dao.ArtShowList_apply(applyUID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
out.Show = serializer.BuildArtShowListRes(artShow)
|
||||
fmt.Println(out.Show)
|
||||
return
|
||||
}
|
||||
|
||||
func DelApplyByApplyID(in *artShow.DelApplyReq) (err error) {
|
||||
// 删除画展包申请记录
|
||||
func DelApplyByApplyUID(in *artShow.DelApplyReq) (err error) {
|
||||
tx, err := dao.DelShowApply(in)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
for i := 0; i < len(in.ApplyID); i++ {
|
||||
err = dao.DelShowRelByApplyID(tx, uint(in.ApplyID[i]))
|
||||
for i := 0; i < len(in.ApplyUID); i++ {
|
||||
err = dao.DelShowRelByApplyUID(tx, in.ApplyUID[i])
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
queryShowRelErr, showRels := dao.QueryShowRelList(in.ApplyUID[i])
|
||||
if queryShowRelErr != nil {
|
||||
tx.Rollback()
|
||||
return queryShowRelErr
|
||||
}
|
||||
if len(showRels) > 0 {
|
||||
for i := 0; i < len(showRels); i++ {
|
||||
// 更新 画展包状态 为 可展
|
||||
show := serializer.BuildArtShowIsShowM(showRels[i].ShowUID, m.ARTSHOW_PASS)
|
||||
updateArtShowErr := dao.UpdateArtShow(tx, show)
|
||||
if updateArtShowErr != nil {
|
||||
tx.Rollback()
|
||||
return updateArtShowErr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
err = tx.Commit().Error
|
||||
return
|
||||
}
|
||||
|
||||
func QueryShowRel(showID uint) (err error, out *model.ShowRel) {
|
||||
// 查询画展包申请关联记录
|
||||
func QueryShowRel_showUID(showUID string) (err error, out *model.ShowRel) {
|
||||
out = new(model.ShowRel)
|
||||
err, out = dao.QueryShowRel(showID)
|
||||
err, out = dao.QueryShowRel_showUID(showUID)
|
||||
if err != nil {
|
||||
return err, nil
|
||||
}
|
||||
|
@ -2,15 +2,26 @@ package service
|
||||
|
||||
import (
|
||||
"fonchain-artshow/cmd/dao"
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"fonchain-artshow/pkg/serializer"
|
||||
)
|
||||
|
||||
func ArtworkPriceInfo(in *artShow.ArtworkPriceReq) (err error, artworkPriceRes *artShow.ArtworkPriceRes) {
|
||||
err, artworkPrice := dao.QueryArtworkPrice_artworkID(in.ArtworkID)
|
||||
err, artworkPrice := dao.QueryArtworkPrice_artworkUID(in.ArtworkUID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
artworkPriceRes = serializer.BuildArtworkPriceRes(artworkPrice)
|
||||
return
|
||||
}
|
||||
|
||||
func ArtworkPriceList(in *artShow.ShowDetailReq) (err error, artworkPriceList []*artShow.ArtworkPriceDetail) {
|
||||
list := make([]*model.ArtworkPrice, 0)
|
||||
artworkPriceList = make([]*artShow.ArtworkPriceDetail, 0)
|
||||
err, list = dao.ArtworkPriceList(in.ShowUID[len(in.ShowUID)-1])
|
||||
if len(list) > 0 {
|
||||
artworkPriceList = serializer.BuildShowArtworkListRpc(list)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -1,14 +1,61 @@
|
||||
[system]
|
||||
mode = dev #正式prod #测试dev
|
||||
;mode = prod #正式prod #测试dev
|
||||
mode = prod #正式prod #测试dev
|
||||
|
||||
;本地测试
|
||||
;[mysql]
|
||||
;Db = mysql
|
||||
;DbHost = 127.0.0.1
|
||||
;DbPort = 3306
|
||||
;DbUser = root
|
||||
;DbPassWord = 123456
|
||||
;DbName = art_show
|
||||
|
||||
;正式服 192.168.12.3 old
|
||||
;[mysql]
|
||||
;Db = mysql
|
||||
;DbHost = mysql
|
||||
;DbPort = 3306
|
||||
;DbUser = root
|
||||
;DbPassWord = sLl0b7stlbwvZ883TV
|
||||
;DbName = art_show
|
||||
|
||||
;正式服 172.16.100.30 now
|
||||
[mysql]
|
||||
Db = mysql
|
||||
DbHost = 172.16.100.99
|
||||
DbPort = 9007
|
||||
DbUser = artuser
|
||||
DbPassWord = C250PflXIWv2SQm8
|
||||
DbHost = 172.16.100.30
|
||||
DbPort = 3306
|
||||
DbUser = root
|
||||
DbPassWord = IhQmhg8HZjDmU=Ove5PnA^D
|
||||
DbName = art_show
|
||||
|
||||
;188
|
||||
;[mysql]
|
||||
;Db = mysql
|
||||
;DbHost = 172.16.100.22
|
||||
;DbPort = 9005
|
||||
;DbUser = root
|
||||
;DbPassWord = sLl0b7stlbwvZ883TV
|
||||
;DbName = art_show
|
||||
|
||||
;214
|
||||
[mysql]
|
||||
;Db = mysql
|
||||
;DbHost = 172.16.100.99 #214
|
||||
;;DbHost = 172.16.39.93 #214
|
||||
;DbPort = 9007
|
||||
;DbUser = artuser
|
||||
;DbPassWord = "C250PflXIWv2SQm8"
|
||||
;DbName = art_show
|
||||
|
||||
;[mysql]
|
||||
;Db = mysql
|
||||
;DbHost = 121.229.45.214 #214
|
||||
;DbPort = 9007
|
||||
;DbUser = artuser
|
||||
;DbPassWord = "C250PflXIWv2SQm8"
|
||||
;DbName = art_show
|
||||
|
||||
[redis]
|
||||
RedisDB =
|
||||
RedisAddr = 127.0.0.1:6379
|
||||
@ -17,7 +64,7 @@ RedisDBNAme =
|
||||
|
||||
[zap_log]
|
||||
level: "info"
|
||||
filename: "./runtime/log/artwork_server.log"
|
||||
filename: "./runtime/log/artshow_server.log"
|
||||
max_size: 200
|
||||
max_age: 30
|
||||
max_backups: 7
|
@ -3,7 +3,8 @@ dubbo:
|
||||
demoZK:
|
||||
protocol: zookeeper
|
||||
timeout: 3s
|
||||
address: 127.0.0.1:2181
|
||||
address: zookeeper:2181 # 正式服务
|
||||
# address: 127.0.0.1:2181 # 测试服务
|
||||
protocols:
|
||||
triple: #triple
|
||||
name: tri
|
||||
|
2
go.mod
2
go.mod
@ -14,6 +14,7 @@ require (
|
||||
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f
|
||||
github.com/mwitkow/go-proto-validators v0.3.2
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible
|
||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
|
||||
github.com/spf13/cast v1.3.0
|
||||
go.uber.org/zap v1.21.0
|
||||
google.golang.org/grpc v1.47.0
|
||||
@ -110,7 +111,6 @@ require (
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
|
||||
github.com/shirou/gopsutil v3.20.11+incompatible // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,17 @@ var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *SaveShowReq) Validate() error {
|
||||
for _, item := range this.ShowArtwork {
|
||||
for _, item := range this.Artwork {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ShowArtwork", err)
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Artwork", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.DelArtwork {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("DelArtwork", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37,6 +44,14 @@ func (this *ShowDetailReq) Validate() error {
|
||||
func (this *ShowDetail) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ShowDetailRes) Validate() error {
|
||||
if this.Data != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ShowArtworkDetailRes) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
@ -50,6 +65,9 @@ func (this *ShowArtworkDetailRes) Validate() error {
|
||||
func (this *ShowListReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ShowListForArtworkReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ShowListRes) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
@ -60,10 +78,36 @@ func (this *ShowListRes) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ShowListForArtworkRes) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *DelShowReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ShowArtworkDetail) Validate() error {
|
||||
func (this *ArtworkDetail) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ArtworkPriceDetail) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ArtworkPriceListRes) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *DelArtworkDetail) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ShowStatisticalInfoReq) Validate() error {
|
||||
@ -97,6 +141,9 @@ func (this *ArtworkPriceRes_PriceInfo) Validate() error {
|
||||
func (this *ShowRel) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *DelShowRel) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SaveApplyReq) Validate() error {
|
||||
for _, item := range this.Rel {
|
||||
if item != nil {
|
||||
@ -105,6 +152,13 @@ func (this *SaveApplyReq) Validate() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.DelRel {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("DelRel", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SaveApplyRes) Validate() error {
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.4
|
||||
// - protoc v3.10.1
|
||||
// source: pb/artshow.proto
|
||||
|
||||
package artShow
|
||||
@ -32,7 +32,10 @@ type ArtShowClient interface {
|
||||
UpdateShow(ctx context.Context, in *SaveShowReq, opts ...grpc_go.CallOption) (*SaveShowRes, common.ErrorWithAttachment)
|
||||
DelShow(ctx context.Context, in *DelShowReq, opts ...grpc_go.CallOption) (*CommonRes, common.ErrorWithAttachment)
|
||||
ShowList(ctx context.Context, in *ShowListReq, opts ...grpc_go.CallOption) (*ShowListRes, common.ErrorWithAttachment)
|
||||
ShowInfo(ctx context.Context, in *ShowDetailReq, opts ...grpc_go.CallOption) (*ShowArtworkDetailRes, common.ErrorWithAttachment)
|
||||
ShowListWithRel(ctx context.Context, in *ShowListReq, opts ...grpc_go.CallOption) (*ShowListRes, common.ErrorWithAttachment)
|
||||
ShowListForArtwork(ctx context.Context, in *ShowListForArtworkReq, opts ...grpc_go.CallOption) (*ShowListForArtworkRes, common.ErrorWithAttachment)
|
||||
ShowArtworkInfo(ctx context.Context, in *ArtworkDetailReq, opts ...grpc_go.CallOption) (*ShowArtworkDetailRes, common.ErrorWithAttachment)
|
||||
ShowDetail(ctx context.Context, in *ShowDetailReq, opts ...grpc_go.CallOption) (*ShowDetailRes, common.ErrorWithAttachment)
|
||||
ShowStatisticalInfo(ctx context.Context, in *ShowStatisticalInfoReq, opts ...grpc_go.CallOption) (*ShowStatisticalInfoRes, common.ErrorWithAttachment)
|
||||
ArtworkPrice(ctx context.Context, in *ArtworkPriceReq, opts ...grpc_go.CallOption) (*ArtworkPriceRes, common.ErrorWithAttachment)
|
||||
CreateApply(ctx context.Context, in *SaveApplyReq, opts ...grpc_go.CallOption) (*SaveApplyRes, common.ErrorWithAttachment)
|
||||
@ -42,6 +45,7 @@ type ArtShowClient interface {
|
||||
UpdateApplyStatus(ctx context.Context, in *UpdateApplyStatusReq, opts ...grpc_go.CallOption) (*CommonRes, common.ErrorWithAttachment)
|
||||
ApplyList(ctx context.Context, in *ApplyListReq, opts ...grpc_go.CallOption) (*ApplyListRes, common.ErrorWithAttachment)
|
||||
ApplyDetail(ctx context.Context, in *ApplyShowReq, opts ...grpc_go.CallOption) (*ApplyShowRes, common.ErrorWithAttachment)
|
||||
ArtworkPriceList(ctx context.Context, in *ShowDetailReq, opts ...grpc_go.CallOption) (*ArtworkPriceListRes, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type artShowClient struct {
|
||||
@ -53,7 +57,10 @@ type ArtShowClientImpl struct {
|
||||
UpdateShow func(ctx context.Context, in *SaveShowReq) (*SaveShowRes, error)
|
||||
DelShow func(ctx context.Context, in *DelShowReq) (*CommonRes, error)
|
||||
ShowList func(ctx context.Context, in *ShowListReq) (*ShowListRes, error)
|
||||
ShowInfo func(ctx context.Context, in *ShowDetailReq) (*ShowArtworkDetailRes, error)
|
||||
ShowListWithRel func(ctx context.Context, in *ShowListReq) (*ShowListRes, error)
|
||||
ShowListForArtwork func(ctx context.Context, in *ShowListForArtworkReq) (*ShowListForArtworkRes, error)
|
||||
ShowArtworkInfo func(ctx context.Context, in *ArtworkDetailReq) (*ShowArtworkDetailRes, error)
|
||||
ShowDetail func(ctx context.Context, in *ShowDetailReq) (*ShowDetailRes, error)
|
||||
ShowStatisticalInfo func(ctx context.Context, in *ShowStatisticalInfoReq) (*ShowStatisticalInfoRes, error)
|
||||
ArtworkPrice func(ctx context.Context, in *ArtworkPriceReq) (*ArtworkPriceRes, error)
|
||||
CreateApply func(ctx context.Context, in *SaveApplyReq) (*SaveApplyRes, error)
|
||||
@ -63,6 +70,7 @@ type ArtShowClientImpl struct {
|
||||
UpdateApplyStatus func(ctx context.Context, in *UpdateApplyStatusReq) (*CommonRes, error)
|
||||
ApplyList func(ctx context.Context, in *ApplyListReq) (*ApplyListRes, error)
|
||||
ApplyDetail func(ctx context.Context, in *ApplyShowReq) (*ApplyShowRes, error)
|
||||
ArtworkPriceList func(ctx context.Context, in *ShowDetailReq) (*ArtworkPriceListRes, error)
|
||||
}
|
||||
|
||||
func (c *ArtShowClientImpl) GetDubboStub(cc *triple.TripleConn) ArtShowClient {
|
||||
@ -101,10 +109,28 @@ func (c *artShowClient) ShowList(ctx context.Context, in *ShowListReq, opts ...g
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ShowList", in, out)
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowInfo(ctx context.Context, in *ShowDetailReq, opts ...grpc_go.CallOption) (*ShowArtworkDetailRes, common.ErrorWithAttachment) {
|
||||
func (c *artShowClient) ShowListWithRel(ctx context.Context, in *ShowListReq, opts ...grpc_go.CallOption) (*ShowListRes, common.ErrorWithAttachment) {
|
||||
out := new(ShowListRes)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ShowListWithRel", in, out)
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowListForArtwork(ctx context.Context, in *ShowListForArtworkReq, opts ...grpc_go.CallOption) (*ShowListForArtworkRes, common.ErrorWithAttachment) {
|
||||
out := new(ShowListForArtworkRes)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ShowListForArtwork", in, out)
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowArtworkInfo(ctx context.Context, in *ArtworkDetailReq, opts ...grpc_go.CallOption) (*ShowArtworkDetailRes, common.ErrorWithAttachment) {
|
||||
out := new(ShowArtworkDetailRes)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ShowInfo", in, out)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ShowArtworkInfo", in, out)
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowDetail(ctx context.Context, in *ShowDetailReq, opts ...grpc_go.CallOption) (*ShowDetailRes, common.ErrorWithAttachment) {
|
||||
out := new(ShowDetailRes)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ShowDetail", in, out)
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowStatisticalInfo(ctx context.Context, in *ShowStatisticalInfoReq, opts ...grpc_go.CallOption) (*ShowStatisticalInfoRes, common.ErrorWithAttachment) {
|
||||
@ -161,6 +187,12 @@ func (c *artShowClient) ApplyDetail(ctx context.Context, in *ApplyShowReq, opts
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ApplyDetail", in, out)
|
||||
}
|
||||
|
||||
func (c *artShowClient) ArtworkPriceList(ctx context.Context, in *ShowDetailReq, opts ...grpc_go.CallOption) (*ArtworkPriceListRes, common.ErrorWithAttachment) {
|
||||
out := new(ArtworkPriceListRes)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ArtworkPriceList", in, out)
|
||||
}
|
||||
|
||||
// ArtShowServer is the server API for ArtShow service.
|
||||
// All implementations must embed UnimplementedArtShowServer
|
||||
// for forward compatibility
|
||||
@ -169,7 +201,10 @@ type ArtShowServer interface {
|
||||
UpdateShow(context.Context, *SaveShowReq) (*SaveShowRes, error)
|
||||
DelShow(context.Context, *DelShowReq) (*CommonRes, error)
|
||||
ShowList(context.Context, *ShowListReq) (*ShowListRes, error)
|
||||
ShowInfo(context.Context, *ShowDetailReq) (*ShowArtworkDetailRes, error)
|
||||
ShowListWithRel(context.Context, *ShowListReq) (*ShowListRes, error)
|
||||
ShowListForArtwork(context.Context, *ShowListForArtworkReq) (*ShowListForArtworkRes, error)
|
||||
ShowArtworkInfo(context.Context, *ArtworkDetailReq) (*ShowArtworkDetailRes, error)
|
||||
ShowDetail(context.Context, *ShowDetailReq) (*ShowDetailRes, error)
|
||||
ShowStatisticalInfo(context.Context, *ShowStatisticalInfoReq) (*ShowStatisticalInfoRes, error)
|
||||
ArtworkPrice(context.Context, *ArtworkPriceReq) (*ArtworkPriceRes, error)
|
||||
CreateApply(context.Context, *SaveApplyReq) (*SaveApplyRes, error)
|
||||
@ -179,6 +214,7 @@ type ArtShowServer interface {
|
||||
UpdateApplyStatus(context.Context, *UpdateApplyStatusReq) (*CommonRes, error)
|
||||
ApplyList(context.Context, *ApplyListReq) (*ApplyListRes, error)
|
||||
ApplyDetail(context.Context, *ApplyShowReq) (*ApplyShowRes, error)
|
||||
ArtworkPriceList(context.Context, *ShowDetailReq) (*ArtworkPriceListRes, error)
|
||||
mustEmbedUnimplementedArtShowServer()
|
||||
}
|
||||
|
||||
@ -199,8 +235,17 @@ func (UnimplementedArtShowServer) DelShow(context.Context, *DelShowReq) (*Common
|
||||
func (UnimplementedArtShowServer) ShowList(context.Context, *ShowListReq) (*ShowListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowList not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowInfo(context.Context, *ShowDetailReq) (*ShowArtworkDetailRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowInfo not implemented")
|
||||
func (UnimplementedArtShowServer) ShowListWithRel(context.Context, *ShowListReq) (*ShowListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowListWithRel not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowListForArtwork(context.Context, *ShowListForArtworkReq) (*ShowListForArtworkRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowListForArtwork not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowArtworkInfo(context.Context, *ArtworkDetailReq) (*ShowArtworkDetailRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowArtworkInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowDetail(context.Context, *ShowDetailReq) (*ShowDetailRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowDetail not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowStatisticalInfo(context.Context, *ShowStatisticalInfoReq) (*ShowStatisticalInfoRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowStatisticalInfo not implemented")
|
||||
@ -229,6 +274,9 @@ func (UnimplementedArtShowServer) ApplyList(context.Context, *ApplyListReq) (*Ap
|
||||
func (UnimplementedArtShowServer) ApplyDetail(context.Context, *ApplyShowReq) (*ApplyShowRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ApplyDetail not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ArtworkPriceList(context.Context, *ShowDetailReq) (*ArtworkPriceListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ArtworkPriceList not implemented")
|
||||
}
|
||||
func (s *UnimplementedArtShowServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -373,7 +421,94 @@ func _ArtShow_ShowList_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _ArtShow_ShowListWithRel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ShowListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ShowListWithRel", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowListForArtwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ShowListForArtworkReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ShowListForArtwork", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowArtworkInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ArtworkDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ShowArtworkInfo", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ShowDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@ -386,7 +521,7 @@ func _ArtShow_ShowInfo_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ShowInfo", args, invAttachment)
|
||||
invo := invocation.NewRPCInvocation("ShowDetail", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
@ -663,6 +798,35 @@ func _ArtShow_ApplyDetail_Handler(srv interface{}, ctx context.Context, dec func
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ArtworkPriceList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ShowDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ArtworkPriceList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ArtShow_ServiceDesc is the grpc_go.ServiceDesc for ArtShow service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -687,8 +851,20 @@ var ArtShow_ServiceDesc = grpc_go.ServiceDesc{
|
||||
Handler: _ArtShow_ShowList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowInfo",
|
||||
Handler: _ArtShow_ShowInfo_Handler,
|
||||
MethodName: "ShowListWithRel",
|
||||
Handler: _ArtShow_ShowListWithRel_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowListForArtwork",
|
||||
Handler: _ArtShow_ShowListForArtwork_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowArtworkInfo",
|
||||
Handler: _ArtShow_ShowArtworkInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowDetail",
|
||||
Handler: _ArtShow_ShowDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowStatisticalInfo",
|
||||
@ -726,6 +902,10 @@ var ArtShow_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "ApplyDetail",
|
||||
Handler: _ArtShow_ApplyDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ArtworkPriceList",
|
||||
Handler: _ArtShow_ArtworkPriceList_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/artshow.proto",
|
||||
|
158
pb/artshow.proto
158
pb/artshow.proto
@ -7,8 +7,11 @@ service ArtShow {
|
||||
rpc CreateShow (SaveShowReq) returns (SaveShowRes) {} // 画展包创建操作
|
||||
rpc UpdateShow (SaveShowReq) returns (SaveShowRes) {} // 画展包更新操作
|
||||
rpc DelShow (DelShowReq) returns (CommonRes) {} // 画展包删除操作
|
||||
rpc ShowList (ShowListReq) returns (ShowListRes) {} // 画展包列表展示
|
||||
rpc ShowInfo (ShowDetailReq) returns (ShowArtworkDetailRes) {} // 画展包展示
|
||||
rpc ShowList (ShowListReq) returns (ShowListRes) {} // 画展包列表展示 不携带 画展时间 画展地址
|
||||
rpc ShowListWithRel (ShowListReq) returns (ShowListRes) {} // 画展包列表展示 携带 画展时间 画展地址
|
||||
rpc ShowListForArtwork (ShowListForArtworkReq) returns (ShowListForArtworkRes) {} // 画展包列表展示 画作使用
|
||||
rpc ShowArtworkInfo (ArtworkDetailReq) returns (ShowArtworkDetailRes) {} // 画展包画作展示
|
||||
rpc ShowDetail (ShowDetailReq) returns (ShowDetailRes) {} // 画展包展示
|
||||
rpc ShowStatisticalInfo (ShowStatisticalInfoReq) returns (ShowStatisticalInfoRes) {} // 画展统计(画作数量、画家数量)
|
||||
rpc ArtworkPrice (ArtworkPriceReq) returns (ArtworkPriceRes) {} // 画作价格
|
||||
rpc CreateApply (SaveApplyReq) returns (SaveApplyRes) {} // 创建画展包申请
|
||||
@ -18,28 +21,34 @@ service ArtShow {
|
||||
rpc UpdateApplyStatus (UpdateApplyStatusReq) returns (CommonRes) {} // 更新画展包状态
|
||||
rpc ApplyList (ApplyListReq) returns (ApplyListRes) {} // 画展包申请列表
|
||||
rpc ApplyDetail (ApplyShowReq) returns (ApplyShowRes) {} // 画展包申请列表
|
||||
rpc ArtworkPriceList (ShowDetailReq) returns (ArtworkPriceListRes) {} // 画作详情列表
|
||||
}
|
||||
|
||||
// 创建 更新画展包
|
||||
|
||||
message SaveShowReq {
|
||||
string ShowName = 1 [json_name = "show_name"];
|
||||
string ArtistName = 2 [json_name = "artist_name"];
|
||||
string ArtistID = 3 [json_name = "artist_id"];
|
||||
string ArtistUID = 3 [json_name = "artist_uid"];
|
||||
int32 ArtworkNum = 4 [json_name = "artwork_num"];
|
||||
int32 Ruler = 5 [json_name = "ruler"];
|
||||
int64 Price = 6 [json_name = "price"];
|
||||
int64 Reward = 7 [json_name = "reward"];
|
||||
int32 IsShow = 8 [json_name = "is_show"];
|
||||
string ShowTime = 9 [json_name = "show_time"];
|
||||
string CreateTime = 9 [json_name = "create_time"];
|
||||
string Operator = 10 [json_name = "operator"];
|
||||
string ShowSeq = 11 [json_name = "show_seq"];
|
||||
|
||||
repeated ShowArtworkDetail ShowArtwork = 10 [json_name = "show_artwork"];
|
||||
string ShowUID = 12 [json_name = "id"];
|
||||
|
||||
repeated ArtworkDetail Artwork = 13 [json_name = "show_artwork"];
|
||||
repeated DelArtworkDetail DelArtwork = 14 [json_name = "del_show_artwork"];
|
||||
|
||||
int64 ID = 11 [json_name = "id"];
|
||||
}
|
||||
|
||||
message SaveShowRes {
|
||||
string Msg = 1 [json_name = "msg"];
|
||||
int64 ShowID = 2 [json_name = "show_id"];
|
||||
string ShowUID = 2 [json_name = "show_uid"];
|
||||
}
|
||||
|
||||
message CommonRes {
|
||||
@ -48,25 +57,38 @@ message CommonRes {
|
||||
|
||||
// 画展包详情
|
||||
message ShowDetailReq {
|
||||
int64 ShowID = 1 [json_name = "show_id"];
|
||||
repeated string ShowUID = 1 [json_name = "show_uid"];
|
||||
}
|
||||
|
||||
message ArtworkDetailReq {
|
||||
string ShowUID = 1 [json_name = "show_uid"];
|
||||
}
|
||||
|
||||
message ShowDetail {
|
||||
int64 ID = 1 [json_name = "id"];
|
||||
string ShowUID = 1 [json_name = "show_uid"];
|
||||
string ShowSeq = 2 [json_name = "show_seq"];
|
||||
string ShowName = 3 [json_name = "show_name"];
|
||||
string ArtistName = 4 [json_name = "artist_name"];
|
||||
string ArtistID = 5 [json_name = "artist_id"];
|
||||
string ArtistUID = 5 [json_name = "artist_uid"];
|
||||
int32 ArtworkNum = 6 [json_name = "artwork_num"];
|
||||
int32 Ruler = 7 [json_name = "ruler"];
|
||||
int64 Price = 8 [json_name = "price"];
|
||||
int64 Reward = 9 [json_name = "reward"];
|
||||
string ShowTime = 10 [json_name = "show_time"];
|
||||
int32 IsShow = 11 [json_name = "is_show"];
|
||||
string CreateTime = 10 [json_name = "create_time"];
|
||||
string Operator = 11 [json_name = "operator"];
|
||||
int32 IsShow = 12 [json_name = "is_show"];
|
||||
|
||||
string ShowTime = 13 [json_name = "show_time"];
|
||||
string Address = 14 [json_name = "address"];
|
||||
}
|
||||
|
||||
message ShowDetailRes {
|
||||
repeated ShowDetail Data = 1 [json_name = "data"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
message ShowArtworkDetailRes {
|
||||
repeated ShowArtworkDetail data = 1 [json_name = "data"];
|
||||
repeated ArtworkDetail data = 1 [json_name = "data"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
@ -75,10 +97,24 @@ message ShowListReq {
|
||||
int32 Page = 1 [json_name = "page"];
|
||||
int32 PageSize = 2 [json_name = "page_size"];
|
||||
|
||||
string StartTime = 3 [json_name = "start_time"];
|
||||
string EndTime = 4 [json_name = "end_time"];
|
||||
string ArtistID = 5 [json_name = "artist_id"];
|
||||
int32 IsShow = 6 [json_name = "is_show"];
|
||||
string StartShowTime = 3 [json_name = "start_show_time"];
|
||||
string EndShowTime = 4 [json_name = "end_show_time"];
|
||||
string ShowSeq = 5 [json_name = "show_seq"];
|
||||
string ShowName = 6 [json_name = "show_name"];
|
||||
string ArtistName = 7 [json_name = "artist_name"];
|
||||
int64 StartPrice = 8 [json_name = "start_price"];
|
||||
int64 EndPrice = 9 [json_name = "end_price"];
|
||||
int64 StartReward = 10 [json_name = "start_reward"];
|
||||
int64 EndReward = 11 [json_name = "end_reward"];
|
||||
string Address = 12 [json_name = "address"];
|
||||
repeated int32 IsShow = 13 [json_name = "is_show"];
|
||||
}
|
||||
|
||||
message ShowListForArtworkReq {
|
||||
int32 Page = 1 [json_name = "page"];
|
||||
int32 PageSize = 2 [json_name = "page_size"];
|
||||
|
||||
string ArtistUID = 3 [json_name = "artist_uid"];
|
||||
}
|
||||
|
||||
message ShowListRes {
|
||||
@ -90,20 +126,58 @@ message ShowListRes {
|
||||
string Msg = 5 [json_name = "msg"];
|
||||
}
|
||||
|
||||
message ShowListForArtworkRes {
|
||||
int64 Total = 1 [json_name = "total"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
repeated ShowDetail Data = 3 [json_name = "data"];
|
||||
}
|
||||
|
||||
|
||||
// 删除画展包
|
||||
message DelShowReq {
|
||||
repeated int64 ShowID = 1 [json_name = "show_id"];
|
||||
repeated string ShowUID = 1 [json_name = "show_uid"];
|
||||
}
|
||||
|
||||
// 画展包中画作详情 除价格
|
||||
message ShowArtworkDetail {
|
||||
int64 ID = 1 [json_name = "id"];
|
||||
int64 ShowID =2 [json_name = "show_id"];
|
||||
int64 ArtworkID = 3 [json_name = "artwork_id"];
|
||||
message ArtworkDetail {
|
||||
string ArtworkPriceUID = 1 [json_name = "artwork_price_uid"];
|
||||
string ShowUID =2 [json_name = "show_uid"];
|
||||
string ArtworkUID = 3 [json_name = "artwork_uid"];
|
||||
string ArtworkName = 4 [json_name = "artwork_name"];
|
||||
string ArtistName = 5 [json_name = "artist_name"];
|
||||
int32 Ruler = 6 [json_name = "ruler"];
|
||||
string SmallPic = 7 [json_name = "small_pic"];
|
||||
int32 Length = 6 [json_name = "length"];
|
||||
int32 Width = 7 [json_name = "width"];
|
||||
int32 Ruler = 8 [json_name = "ruler"];
|
||||
string SmallPic = 9 [json_name = "small_pic"];
|
||||
}
|
||||
|
||||
// 画作详情
|
||||
message ArtworkPriceDetail {
|
||||
string ArtworkPriceUID = 1 [json_name = "artwork_price_uid"];
|
||||
string ShowUID =2 [json_name = "show_uid"];
|
||||
string ArtworkUID = 3 [json_name = "artwork_uid"];
|
||||
string ArtworkName = 4 [json_name = "artwork_name"];
|
||||
string ArtistName = 5 [json_name = "artist_name"];
|
||||
int32 Length = 6 [json_name = "length"];
|
||||
int32 Width = 7 [json_name = "width"];
|
||||
int32 Ruler = 8 [json_name = "ruler"];
|
||||
string SmallPic = 9 [json_name = "small_pic"];
|
||||
int64 Price = 10 [json_name = "price"];
|
||||
int64 RulerPrice = 11 [json_name = "ruler_price"];
|
||||
int64 ArtworkPrice = 12 [json_name = "artwork_price"];
|
||||
int64 MarketPrice = 13 [json_name = "market_price"];
|
||||
int64 CopyrightPrice = 14 [json_name = "copyright_price"];
|
||||
}
|
||||
|
||||
message ArtworkPriceListRes {
|
||||
repeated ArtworkPriceDetail Data = 1 [json_name = "data"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
}
|
||||
|
||||
// 画展包 删除的画作信息
|
||||
message DelArtworkDetail {
|
||||
string ArtworkPriceUID = 1 [json_name = "artwork_price_uid"];
|
||||
string ArtworkUID = 2 [json_name = "artwork_uid"];
|
||||
}
|
||||
|
||||
// 画展包 画家 画作 统计数据
|
||||
@ -115,6 +189,9 @@ message ShowStatisticalInfoRes {
|
||||
message Num {
|
||||
int64 ArtistNum = 1 [json_name = "artist_num"];
|
||||
int64 PackageNum = 2 [json_name = "package_num"];
|
||||
int64 TotalNum = 3 [json_name = "total_num"];
|
||||
int64 NotShowNum = 4 [json_name = "not_show_num"];
|
||||
int64 ShowHisNum = 5 [json_name = "show_his_num"];
|
||||
}
|
||||
|
||||
Num Data = 1 [json_name = "data"];
|
||||
@ -122,7 +199,7 @@ message ShowStatisticalInfoRes {
|
||||
}
|
||||
|
||||
message ArtworkPriceReq {
|
||||
int64 ArtworkID = 1 [json_name = "artwork_id"];
|
||||
string ArtworkUID = 1 [json_name = "artwork_uid"];
|
||||
}
|
||||
|
||||
message ArtworkPriceRes {
|
||||
@ -139,29 +216,36 @@ message ArtworkPriceRes {
|
||||
|
||||
|
||||
message ShowRel {
|
||||
int64 ID = 1 [json_name = "id"];
|
||||
int64 ApplyID = 2 [json_name = "apply_id"];
|
||||
int64 ShowID = 3 [json_name = "show_id"];
|
||||
string ShowRelUID = 1 [json_name = "show_rel_uid"];
|
||||
string ApplyUID = 2 [json_name = "apply_uid"];
|
||||
string ShowUID = 3 [json_name = "show_uid"];
|
||||
int32 Index = 4 [json_name = "index"];
|
||||
string Address = 5 [json_name = "address"];
|
||||
string ShowTime = 6 [json_name = "show_time"];
|
||||
}
|
||||
|
||||
message DelShowRel {
|
||||
string ShowRelUID = 1 [json_name = "show_rel_uid"];
|
||||
string ShowUID = 2 [json_name = "show_uid"];
|
||||
}
|
||||
|
||||
|
||||
message SaveApplyReq {
|
||||
string Applicant = 1 [json_name = "applicant"];
|
||||
int64 ApplicantID = 2 [json_name = "applicant_id"];
|
||||
string ApplicantID = 2 [json_name = "applicant_id"];
|
||||
int32 Num = 3 [json_name = "num"];
|
||||
string ApplyTime = 4 [json_name = "apply_time"];
|
||||
int64 ID = 5 [json_name = "id"];
|
||||
string ApplyUID = 5 [json_name = "apply_uid"];
|
||||
int32 Status = 6 [json_name = "status"];
|
||||
string Remark = 7 [json_name = "remark"];
|
||||
|
||||
repeated ShowRel Rel = 8 [json_name = "rel"];
|
||||
repeated DelShowRel DelRel = 9 [json_name = "del_rel"];
|
||||
}
|
||||
|
||||
message SaveApplyRes {
|
||||
string Msg = 1 [json_name = "msg"];
|
||||
int64 ApplyID = 2 [json_name = "apply_id"];
|
||||
string ApplyUID = 2 [json_name = "apply_uid"];
|
||||
}
|
||||
|
||||
message ApplyListReq {
|
||||
@ -177,7 +261,7 @@ message ApplyListRes {
|
||||
}
|
||||
|
||||
message ApplyShowReq {
|
||||
int64 ApplyID = 1 [json_name = "apply_id"];
|
||||
string ApplyUID = 1 [json_name = "apply_uid"];
|
||||
}
|
||||
|
||||
message ApplyShowRes {
|
||||
@ -187,10 +271,10 @@ message ApplyShowRes {
|
||||
}
|
||||
|
||||
message ApplyDetail {
|
||||
int64 ID = 1 [json_name = "id"];
|
||||
string ApplyUID = 1 [json_name = "apply_uid"];
|
||||
string ApplySeq = 2 [json_name = "apply_seq"];
|
||||
string Applicant = 3 [json_name = "applicant"];
|
||||
int64 ApplicantID = 4 [json_name = "applicant_id"];
|
||||
string ApplicantID = 4 [json_name = "applicant_id"];
|
||||
int32 Num = 5 [json_name = "num"];
|
||||
string ApplyTime = 6 [json_name = "apply_time"];
|
||||
int32 Status = 7 [json_name = "status"];
|
||||
@ -198,7 +282,7 @@ message ApplyDetail {
|
||||
}
|
||||
|
||||
message ShowRelListReq {
|
||||
int64 ApplyID = 1 [json_name = "apply_id"];
|
||||
string ApplyUID = 1 [json_name = "apply_uid"];
|
||||
}
|
||||
|
||||
message ShowRelListRes {
|
||||
@ -209,9 +293,9 @@ message ShowRelListRes {
|
||||
message UpdateApplyStatusReq {
|
||||
int32 Status = 1 [json_name = "status"];
|
||||
string Remark = 2 [json_name = "remark"];
|
||||
int64 ApplyID = 3 [json_name = "apply_id"];
|
||||
string ApplyUID = 3 [json_name = "apply_uid"];
|
||||
}
|
||||
|
||||
message DelApplyReq {
|
||||
repeated int64 ApplyID = 1 [json_name = "apply_id"];
|
||||
repeated string ApplyUID = 1 [json_name = "apply_uid"];
|
||||
}
|
||||
|
718
pb/grpc/artshow_grpc.pb.go
Normal file
718
pb/grpc/artshow_grpc.pb.go
Normal file
@ -0,0 +1,718 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.10.1
|
||||
// source: pb/artshow.proto
|
||||
|
||||
package grpc
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// ArtShowClient is the client API for ArtShow service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ArtShowClient interface {
|
||||
CreateShow(ctx context.Context, in *artShow.SaveShowReq, opts ...grpc.CallOption) (*artShow.SaveShowRes, error)
|
||||
UpdateShow(ctx context.Context, in *artShow.SaveShowReq, opts ...grpc.CallOption) (*artShow.SaveShowRes, error)
|
||||
DelShow(ctx context.Context, in *artShow.DelShowReq, opts ...grpc.CallOption) (*artShow.CommonRes, error)
|
||||
ShowList(ctx context.Context, in *artShow.ShowListReq, opts ...grpc.CallOption) (*artShow.ShowListRes, error)
|
||||
ShowListWithRel(ctx context.Context, in *artShow.ShowListReq, opts ...grpc.CallOption) (*artShow.ShowListRes, error)
|
||||
ShowListForArtwork(ctx context.Context, in *artShow.ShowListForArtworkReq, opts ...grpc.CallOption) (*artShow.ShowListForArtworkRes, error)
|
||||
ShowArtworkInfo(ctx context.Context, in *artShow.ArtworkDetailReq, opts ...grpc.CallOption) (*artShow.ShowArtworkDetailRes, error)
|
||||
ShowDetail(ctx context.Context, in *artShow.ShowDetailReq, opts ...grpc.CallOption) (*artShow.ShowDetailRes, error)
|
||||
ShowStatisticalInfo(ctx context.Context, in *artShow.ShowStatisticalInfoReq, opts ...grpc.CallOption) (*artShow.ShowStatisticalInfoRes, error)
|
||||
ArtworkPrice(ctx context.Context, in *artShow.ArtworkPriceReq, opts ...grpc.CallOption) (*artShow.ArtworkPriceRes, error)
|
||||
CreateApply(ctx context.Context, in *artShow.SaveApplyReq, opts ...grpc.CallOption) (*artShow.SaveApplyRes, error)
|
||||
UpdateApply(ctx context.Context, in *artShow.SaveApplyReq, opts ...grpc.CallOption) (*artShow.SaveApplyRes, error)
|
||||
DelApply(ctx context.Context, in *artShow.DelApplyReq, opts ...grpc.CallOption) (*artShow.CommonRes, error)
|
||||
ShowListWithApply(ctx context.Context, in *artShow.ShowListReq, opts ...grpc.CallOption) (*artShow.ShowListRes, error)
|
||||
UpdateApplyStatus(ctx context.Context, in *artShow.UpdateApplyStatusReq, opts ...grpc.CallOption) (*artShow.CommonRes, error)
|
||||
ApplyList(ctx context.Context, in *artShow.ApplyListReq, opts ...grpc.CallOption) (*artShow.ApplyListRes, error)
|
||||
ApplyDetail(ctx context.Context, in *artShow.ApplyShowReq, opts ...grpc.CallOption) (*artShow.ApplyShowRes, error)
|
||||
ArtworkPriceList(ctx context.Context, in *artShow.ShowDetailReq, opts ...grpc.CallOption) (*artShow.ArtworkPriceListRes, error)
|
||||
}
|
||||
|
||||
type artShowClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewArtShowClient(cc grpc.ClientConnInterface) ArtShowClient {
|
||||
return &artShowClient{cc}
|
||||
}
|
||||
|
||||
func (c *artShowClient) CreateShow(ctx context.Context, in *artShow.SaveShowReq, opts ...grpc.CallOption) (*artShow.SaveShowRes, error) {
|
||||
out := new(artShow.SaveShowRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/CreateShow", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) UpdateShow(ctx context.Context, in *artShow.SaveShowReq, opts ...grpc.CallOption) (*artShow.SaveShowRes, error) {
|
||||
out := new(artShow.SaveShowRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/UpdateShow", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) DelShow(ctx context.Context, in *artShow.DelShowReq, opts ...grpc.CallOption) (*artShow.CommonRes, error) {
|
||||
out := new(artShow.CommonRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/DelShow", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowList(ctx context.Context, in *artShow.ShowListReq, opts ...grpc.CallOption) (*artShow.ShowListRes, error) {
|
||||
out := new(artShow.ShowListRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ShowList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowListWithRel(ctx context.Context, in *artShow.ShowListReq, opts ...grpc.CallOption) (*artShow.ShowListRes, error) {
|
||||
out := new(artShow.ShowListRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ShowListWithRel", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowListForArtwork(ctx context.Context, in *artShow.ShowListForArtworkReq, opts ...grpc.CallOption) (*artShow.ShowListForArtworkRes, error) {
|
||||
out := new(artShow.ShowListForArtworkRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ShowListForArtwork", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowArtworkInfo(ctx context.Context, in *artShow.ArtworkDetailReq, opts ...grpc.CallOption) (*artShow.ShowArtworkDetailRes, error) {
|
||||
out := new(artShow.ShowArtworkDetailRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ShowArtworkInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowDetail(ctx context.Context, in *artShow.ShowDetailReq, opts ...grpc.CallOption) (*artShow.ShowDetailRes, error) {
|
||||
out := new(artShow.ShowDetailRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ShowDetail", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowStatisticalInfo(ctx context.Context, in *artShow.ShowStatisticalInfoReq, opts ...grpc.CallOption) (*artShow.ShowStatisticalInfoRes, error) {
|
||||
out := new(artShow.ShowStatisticalInfoRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ShowStatisticalInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ArtworkPrice(ctx context.Context, in *artShow.ArtworkPriceReq, opts ...grpc.CallOption) (*artShow.ArtworkPriceRes, error) {
|
||||
out := new(artShow.ArtworkPriceRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ArtworkPrice", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) CreateApply(ctx context.Context, in *artShow.SaveApplyReq, opts ...grpc.CallOption) (*artShow.SaveApplyRes, error) {
|
||||
out := new(artShow.SaveApplyRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/CreateApply", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) UpdateApply(ctx context.Context, in *artShow.SaveApplyReq, opts ...grpc.CallOption) (*artShow.SaveApplyRes, error) {
|
||||
out := new(artShow.SaveApplyRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/UpdateApply", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) DelApply(ctx context.Context, in *artShow.DelApplyReq, opts ...grpc.CallOption) (*artShow.CommonRes, error) {
|
||||
out := new(artShow.CommonRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/DelApply", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ShowListWithApply(ctx context.Context, in *artShow.ShowListReq, opts ...grpc.CallOption) (*artShow.ShowListRes, error) {
|
||||
out := new(artShow.ShowListRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ShowListWithApply", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) UpdateApplyStatus(ctx context.Context, in *artShow.UpdateApplyStatusReq, opts ...grpc.CallOption) (*artShow.CommonRes, error) {
|
||||
out := new(artShow.CommonRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/UpdateApplyStatus", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ApplyList(ctx context.Context, in *artShow.ApplyListReq, opts ...grpc.CallOption) (*artShow.ApplyListRes, error) {
|
||||
out := new(artShow.ApplyListRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ApplyList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ApplyDetail(ctx context.Context, in *artShow.ApplyShowReq, opts ...grpc.CallOption) (*artShow.ApplyShowRes, error) {
|
||||
out := new(artShow.ApplyShowRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ApplyDetail", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *artShowClient) ArtworkPriceList(ctx context.Context, in *artShow.ShowDetailReq, opts ...grpc.CallOption) (*artShow.ArtworkPriceListRes, error) {
|
||||
out := new(artShow.ArtworkPriceListRes)
|
||||
err := c.cc.Invoke(ctx, "/ArtShow.ArtShow/ArtworkPriceList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ArtShowServer is the server API for ArtShow service.
|
||||
// All implementations must embed UnimplementedArtShowServer
|
||||
// for forward compatibility
|
||||
type ArtShowServer interface {
|
||||
CreateShow(context.Context, *artShow.SaveShowReq) (*artShow.SaveShowRes, error)
|
||||
UpdateShow(context.Context, *artShow.SaveShowReq) (*artShow.SaveShowRes, error)
|
||||
DelShow(context.Context, *artShow.DelShowReq) (*artShow.CommonRes, error)
|
||||
ShowList(context.Context, *artShow.ShowListReq) (*artShow.ShowListRes, error)
|
||||
ShowListWithRel(context.Context, *artShow.ShowListReq) (*artShow.ShowListRes, error)
|
||||
ShowListForArtwork(context.Context, *artShow.ShowListForArtworkReq) (*artShow.ShowListForArtworkRes, error)
|
||||
ShowArtworkInfo(context.Context, *artShow.ArtworkDetailReq) (*artShow.ShowArtworkDetailRes, error)
|
||||
ShowDetail(context.Context, *artShow.ShowDetailReq) (*artShow.ShowDetailRes, error)
|
||||
ShowStatisticalInfo(context.Context, *artShow.ShowStatisticalInfoReq) (*artShow.ShowStatisticalInfoRes, error)
|
||||
ArtworkPrice(context.Context, *artShow.ArtworkPriceReq) (*artShow.ArtworkPriceRes, error)
|
||||
CreateApply(context.Context, *artShow.SaveApplyReq) (*artShow.SaveApplyRes, error)
|
||||
UpdateApply(context.Context, *artShow.SaveApplyReq) (*artShow.SaveApplyRes, error)
|
||||
DelApply(context.Context, *artShow.DelApplyReq) (*artShow.CommonRes, error)
|
||||
ShowListWithApply(context.Context, *artShow.ShowListReq) (*artShow.ShowListRes, error)
|
||||
UpdateApplyStatus(context.Context, *artShow.UpdateApplyStatusReq) (*artShow.CommonRes, error)
|
||||
ApplyList(context.Context, *artShow.ApplyListReq) (*artShow.ApplyListRes, error)
|
||||
ApplyDetail(context.Context, *artShow.ApplyShowReq) (*artShow.ApplyShowRes, error)
|
||||
ArtworkPriceList(context.Context, *artShow.ShowDetailReq) (*artShow.ArtworkPriceListRes, error)
|
||||
mustEmbedUnimplementedArtShowServer()
|
||||
}
|
||||
|
||||
// UnimplementedArtShowServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedArtShowServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedArtShowServer) CreateShow(context.Context, *artShow.SaveShowReq) (*artShow.SaveShowRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateShow not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) UpdateShow(context.Context, *artShow.SaveShowReq) (*artShow.SaveShowRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateShow not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) DelShow(context.Context, *artShow.DelShowReq) (*artShow.CommonRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DelShow not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowList(context.Context, *artShow.ShowListReq) (*artShow.ShowListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowList not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowListWithRel(context.Context, *artShow.ShowListReq) (*artShow.ShowListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowListWithRel not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowListForArtwork(context.Context, *artShow.ShowListForArtworkReq) (*artShow.ShowListForArtworkRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowListForArtwork not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowArtworkInfo(context.Context, *artShow.ArtworkDetailReq) (*artShow.ShowArtworkDetailRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowArtworkInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowDetail(context.Context, *artShow.ShowDetailReq) (*artShow.ShowDetailRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowDetail not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowStatisticalInfo(context.Context, *artShow.ShowStatisticalInfoReq) (*artShow.ShowStatisticalInfoRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowStatisticalInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ArtworkPrice(context.Context, *artShow.ArtworkPriceReq) (*artShow.ArtworkPriceRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ArtworkPrice not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) CreateApply(context.Context, *artShow.SaveApplyReq) (*artShow.SaveApplyRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateApply not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) UpdateApply(context.Context, *artShow.SaveApplyReq) (*artShow.SaveApplyRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateApply not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) DelApply(context.Context, *artShow.DelApplyReq) (*artShow.CommonRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DelApply not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ShowListWithApply(context.Context, *artShow.ShowListReq) (*artShow.ShowListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ShowListWithApply not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) UpdateApplyStatus(context.Context, *artShow.UpdateApplyStatusReq) (*artShow.CommonRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateApplyStatus not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ApplyList(context.Context, *artShow.ApplyListReq) (*artShow.ApplyListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ApplyList not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ApplyDetail(context.Context, *artShow.ApplyShowReq) (*artShow.ApplyShowRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ApplyDetail not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) ArtworkPriceList(context.Context, *artShow.ShowDetailReq) (*artShow.ArtworkPriceListRes, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ArtworkPriceList not implemented")
|
||||
}
|
||||
func (UnimplementedArtShowServer) mustEmbedUnimplementedArtShowServer() {}
|
||||
|
||||
// UnsafeArtShowServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ArtShowServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeArtShowServer interface {
|
||||
mustEmbedUnimplementedArtShowServer()
|
||||
}
|
||||
|
||||
func RegisterArtShowServer(s grpc.ServiceRegistrar, srv ArtShowServer) {
|
||||
s.RegisterService(&ArtShow_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ArtShow_CreateShow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.SaveShowReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).CreateShow(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/CreateShow",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).CreateShow(ctx, req.(*artShow.SaveShowReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_UpdateShow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.SaveShowReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).UpdateShow(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/UpdateShow",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).UpdateShow(ctx, req.(*artShow.SaveShowReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_DelShow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.DelShowReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).DelShow(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/DelShow",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).DelShow(ctx, req.(*artShow.DelShowReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ShowListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ShowList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ShowList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ShowList(ctx, req.(*artShow.ShowListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowListWithRel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ShowListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ShowListWithRel(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ShowListWithRel",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ShowListWithRel(ctx, req.(*artShow.ShowListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowListForArtwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ShowListForArtworkReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ShowListForArtwork(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ShowListForArtwork",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ShowListForArtwork(ctx, req.(*artShow.ShowListForArtworkReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowArtworkInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ArtworkDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ShowArtworkInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ShowArtworkInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ShowArtworkInfo(ctx, req.(*artShow.ArtworkDetailReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ShowDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ShowDetail(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ShowDetail",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ShowDetail(ctx, req.(*artShow.ShowDetailReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowStatisticalInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ShowStatisticalInfoReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ShowStatisticalInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ShowStatisticalInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ShowStatisticalInfo(ctx, req.(*artShow.ShowStatisticalInfoReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ArtworkPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ArtworkPriceReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ArtworkPrice(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ArtworkPrice",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ArtworkPrice(ctx, req.(*artShow.ArtworkPriceReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_CreateApply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.SaveApplyReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).CreateApply(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/CreateApply",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).CreateApply(ctx, req.(*artShow.SaveApplyReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_UpdateApply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.SaveApplyReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).UpdateApply(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/UpdateApply",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).UpdateApply(ctx, req.(*artShow.SaveApplyReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_DelApply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.DelApplyReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).DelApply(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/DelApply",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).DelApply(ctx, req.(*artShow.DelApplyReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ShowListWithApply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ShowListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ShowListWithApply(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ShowListWithApply",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ShowListWithApply(ctx, req.(*artShow.ShowListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_UpdateApplyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.UpdateApplyStatusReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).UpdateApplyStatus(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/UpdateApplyStatus",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).UpdateApplyStatus(ctx, req.(*artShow.UpdateApplyStatusReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ApplyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ApplyListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ApplyList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ApplyList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ApplyList(ctx, req.(*artShow.ApplyListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ApplyDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ApplyShowReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ApplyDetail(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ApplyDetail",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ApplyDetail(ctx, req.(*artShow.ApplyShowReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArtShow_ArtworkPriceList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(artShow.ShowDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArtShowServer).ArtworkPriceList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ArtShow.ArtShow/ArtworkPriceList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArtShowServer).ArtworkPriceList(ctx, req.(*artShow.ShowDetailReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ArtShow_ServiceDesc is the grpc.ServiceDesc for ArtShow service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ArtShow_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "ArtShow.ArtShow",
|
||||
HandlerType: (*ArtShowServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateShow",
|
||||
Handler: _ArtShow_CreateShow_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateShow",
|
||||
Handler: _ArtShow_UpdateShow_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DelShow",
|
||||
Handler: _ArtShow_DelShow_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowList",
|
||||
Handler: _ArtShow_ShowList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowListWithRel",
|
||||
Handler: _ArtShow_ShowListWithRel_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowListForArtwork",
|
||||
Handler: _ArtShow_ShowListForArtwork_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowArtworkInfo",
|
||||
Handler: _ArtShow_ShowArtworkInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowDetail",
|
||||
Handler: _ArtShow_ShowDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowStatisticalInfo",
|
||||
Handler: _ArtShow_ShowStatisticalInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ArtworkPrice",
|
||||
Handler: _ArtShow_ArtworkPrice_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateApply",
|
||||
Handler: _ArtShow_CreateApply_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateApply",
|
||||
Handler: _ArtShow_UpdateApply_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DelApply",
|
||||
Handler: _ArtShow_DelApply_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ShowListWithApply",
|
||||
Handler: _ArtShow_ShowListWithApply_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateApplyStatus",
|
||||
Handler: _ArtShow_UpdateApplyStatus_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ApplyList",
|
||||
Handler: _ArtShow_ApplyList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ApplyDetail",
|
||||
Handler: _ArtShow_ApplyDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ArtworkPriceList",
|
||||
Handler: _ArtShow_ArtworkPriceList_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "pb/artshow.proto",
|
||||
}
|
@ -40,7 +40,7 @@ func Init(confPath string) {
|
||||
path := strings.Join([]string{DbUser, ":", DbPassWord, "@tcp(", DbHost, ":", DbPort, ")/", DbName, "?charset=utf8&parseTime=true"}, "")
|
||||
//连接数据库
|
||||
Database(path)
|
||||
migration() //迁移表 按需打开
|
||||
//migration() //迁移表 按需打开
|
||||
}
|
||||
|
||||
func LoadMysqlData(file *ini.File) {
|
||||
|
@ -43,6 +43,10 @@ const (
|
||||
SHOWAPPLY_SHOW // 画展包关联审批
|
||||
SHOWAPPLY_SHOW_REJECT // 关联审批驳回
|
||||
SHOWAPPLY_PASS // 可展
|
||||
|
||||
SHOWAPPLYStatusDoing = 1
|
||||
SHOWAPPLYStatusOk = 2
|
||||
SHOWAPPLYStatusFail = 3
|
||||
)
|
||||
|
||||
const (
|
||||
@ -63,6 +67,8 @@ const (
|
||||
|
||||
// 画展包创建错误
|
||||
ERROR_SHOW_NAME = "画展包名缺失"
|
||||
ERROR_SHOW_EXIST = "画展包名已存在"
|
||||
ERROR_ARTWORK_CREATE = "画展包画作创建失败"
|
||||
ERROR_TIME = "生成时间缺失"
|
||||
|
||||
ERROR_INVALID_ID = "无效的记录ID"
|
||||
@ -74,4 +80,5 @@ const (
|
||||
ERROR_NUM = "数量错误"
|
||||
|
||||
ERROR_NOT_UPDATE_ISSHOW = "画展包已被使用"
|
||||
ERROR_NOT_ARTIST_SEQ = "无效的画家编号"
|
||||
)
|
||||
|
@ -4,25 +4,22 @@ import (
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"fonchain-artshow/pkg/m"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func BuildArtShowM(in *artShow.SaveShowReq) (out *model.ArtShow) {
|
||||
out = new(model.ArtShow)
|
||||
if in.ID == 0 {
|
||||
out.ShowSeq = strings.Join([]string{m.ARTSHOW_PREFIX, time.Now().Format("20060102150405")}, "")
|
||||
} else {
|
||||
out.ID = uint(in.ID)
|
||||
}
|
||||
|
||||
out.ShowUID = in.ShowUID
|
||||
out.ShowName = in.ShowName
|
||||
out.ArtistName = in.ArtistName
|
||||
out.ArtistID = in.ArtistID
|
||||
out.ArtistUID = in.ArtistUID
|
||||
out.ShowSeq = in.ShowSeq
|
||||
out.ArtworkNum = in.ArtworkNum
|
||||
out.Price = in.Price
|
||||
out.Ruler = in.Ruler
|
||||
out.Reward = in.Reward
|
||||
out.ShowTime = in.ShowTime
|
||||
out.CreateTime = in.CreateTime
|
||||
out.Operator = in.Operator
|
||||
if in.IsShow == 0 {
|
||||
out.IsShow = m.ARTSHOW_INSIDE
|
||||
} else {
|
||||
@ -32,7 +29,7 @@ func BuildArtShowM(in *artShow.SaveShowReq) (out *model.ArtShow) {
|
||||
return
|
||||
}
|
||||
|
||||
func BuildArtShowListRes(artShows []*model.ArtShow) (out []*artShow.ShowDetail) {
|
||||
func BuildArtShowListRes(artShows []*model.ArtShowRes) (out []*artShow.ShowDetail) {
|
||||
out = make([]*artShow.ShowDetail, 0)
|
||||
for i := 0; i < len(artShows); i++ {
|
||||
artShowM := BuildArtShowRpc(artShows[i])
|
||||
@ -41,17 +38,28 @@ func BuildArtShowListRes(artShows []*model.ArtShow) (out []*artShow.ShowDetail)
|
||||
return
|
||||
}
|
||||
|
||||
func BuildArtShowRpc(artShowM *model.ArtShow) (out *artShow.ShowDetail) {
|
||||
func BuildArtShowRpc(artShowM *model.ArtShowRes) (out *artShow.ShowDetail) {
|
||||
out = new(artShow.ShowDetail)
|
||||
out.ID = int64(artShowM.ID)
|
||||
out.ShowUID = artShowM.ShowUID
|
||||
out.ShowSeq = artShowM.ShowSeq
|
||||
out.ShowName = artShowM.ShowName
|
||||
out.ArtistName = artShowM.ArtistName
|
||||
out.ArtistUID = artShowM.ArtistUID
|
||||
out.ArtworkNum = artShowM.ArtworkNum
|
||||
out.Ruler = artShowM.Ruler
|
||||
out.Price = artShowM.Price
|
||||
out.Reward = artShowM.Reward
|
||||
out.ShowTime = artShowM.ShowTime
|
||||
out.CreateTime = artShowM.CreateTime
|
||||
out.Operator = artShowM.Operator
|
||||
out.IsShow = int32(artShowM.IsShow)
|
||||
out.Address = artShowM.Address
|
||||
out.ShowTime = artShowM.ShowTime
|
||||
return
|
||||
}
|
||||
|
||||
func BuildArtShowIsShowM(show_uid string, isShow int8) (out *model.ArtShow) {
|
||||
out = new(model.ArtShow)
|
||||
out.ShowUID = show_uid
|
||||
out.IsShow = isShow
|
||||
return
|
||||
}
|
||||
|
@ -5,38 +5,83 @@ import (
|
||||
"fonchain-artshow/pb/artShow"
|
||||
)
|
||||
|
||||
func BuildShowArtworkM(in []*artShow.ShowArtworkDetail, showID uint) (out []*model.ArtworkPrice) {
|
||||
func BuildShowArtworkM(in []*artShow.ArtworkDetail, showUID string) (out []*model.ArtworkPrice) {
|
||||
out = make([]*model.ArtworkPrice, len(in))
|
||||
for i := 0; i < len(in); i++ {
|
||||
artworkPrice := new(model.ArtworkPrice)
|
||||
artworkPrice.ArtworkID = in[i].ArtworkID
|
||||
artworkPrice.ArtworkUID = in[i].ArtworkUID
|
||||
artworkPrice.ArtworkName = in[i].ArtworkName
|
||||
artworkPrice.ArtistName = in[i].ArtistName
|
||||
artworkPrice.SmallPic = in[i].SmallPic
|
||||
artworkPrice.Ruler = in[i].Ruler
|
||||
if in[i].ID != 0 {
|
||||
artworkPrice.ID = uint(in[i].ID)
|
||||
}
|
||||
if in[i].ShowID == 0 {
|
||||
artworkPrice.ShowID = showID
|
||||
artworkPrice.Length = in[i].Length
|
||||
artworkPrice.Width = in[i].Width
|
||||
artworkPrice.ArtworkPriceUID = in[i].ArtworkPriceUID
|
||||
if showUID != "" {
|
||||
artworkPrice.ShowUID = showUID
|
||||
} else {
|
||||
artworkPrice.ShowID = uint(in[i].ShowID)
|
||||
artworkPrice.ShowUID = in[i].ShowUID
|
||||
}
|
||||
out[i] = artworkPrice
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func BuildShowArtworkRpc(in []*model.ArtworkPrice) (out []*artShow.ShowArtworkDetail) {
|
||||
out = make([]*artShow.ShowArtworkDetail, len(in))
|
||||
func BuildShowArtwork(in *artShow.ArtworkDetail, showUID string) (out *model.ArtworkPrice) {
|
||||
out = new(model.ArtworkPrice)
|
||||
out.ArtworkUID = in.ArtworkUID
|
||||
out.ArtworkName = in.ArtworkName
|
||||
out.ArtistName = in.ArtistName
|
||||
out.SmallPic = in.SmallPic
|
||||
out.Ruler = in.Ruler
|
||||
out.Length = in.Length
|
||||
out.Width = in.Width
|
||||
out.ArtworkPriceUID = in.ArtworkPriceUID
|
||||
if showUID != "" {
|
||||
out.ShowUID = showUID
|
||||
} else {
|
||||
out.ShowUID = in.ShowUID
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func BuildShowArtworkRpc(in []*model.ArtworkPrice) (out []*artShow.ArtworkDetail) {
|
||||
out = make([]*artShow.ArtworkDetail, len(in))
|
||||
for i := 0; i < len(in); i++ {
|
||||
artworkPrice := new(artShow.ShowArtworkDetail)
|
||||
artworkPrice.ShowID = int64(in[i].ShowID)
|
||||
artworkPrice.ArtworkID = in[i].ArtworkID
|
||||
artworkPrice := new(artShow.ArtworkDetail)
|
||||
artworkPrice.ArtworkPriceUID = in[i].ArtworkPriceUID
|
||||
artworkPrice.ShowUID = in[i].ShowUID
|
||||
artworkPrice.ArtworkUID = in[i].ArtworkUID
|
||||
artworkPrice.ArtworkName = in[i].ArtworkName
|
||||
artworkPrice.ArtistName = in[i].ArtistName
|
||||
artworkPrice.SmallPic = in[i].SmallPic
|
||||
artworkPrice.Ruler = in[i].Ruler
|
||||
artworkPrice.Length = in[i].Length
|
||||
artworkPrice.Width = in[i].Width
|
||||
|
||||
out[i] = artworkPrice
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func BuildShowArtworkListRpc(in []*model.ArtworkPrice) (out []*artShow.ArtworkPriceDetail) {
|
||||
out = make([]*artShow.ArtworkPriceDetail, len(in))
|
||||
for i := 0; i < len(in); i++ {
|
||||
artworkPrice := new(artShow.ArtworkPriceDetail)
|
||||
artworkPrice.ArtworkPriceUID = in[i].ArtworkPriceUID
|
||||
artworkPrice.ShowUID = in[i].ShowUID
|
||||
artworkPrice.ArtworkUID = in[i].ArtworkUID
|
||||
artworkPrice.ArtworkName = in[i].ArtworkName
|
||||
artworkPrice.ArtistName = in[i].ArtistName
|
||||
artworkPrice.SmallPic = in[i].SmallPic
|
||||
artworkPrice.Ruler = in[i].Ruler
|
||||
artworkPrice.Length = in[i].Length
|
||||
artworkPrice.Width = in[i].Width
|
||||
artworkPrice.Price = in[i].Price
|
||||
artworkPrice.RulerPrice = in[i].RulerPrice
|
||||
artworkPrice.ArtworkPrice = in[i].ArtworkPrice
|
||||
artworkPrice.MarketPrice = in[i].MarketPrice
|
||||
artworkPrice.CopyrightPrice = in[i].CopyrightPrice
|
||||
|
||||
out[i] = artworkPrice
|
||||
}
|
||||
@ -54,10 +99,18 @@ func BuildArtworkPriceRes(artworkPrice *model.ArtworkPrice) (out *artShow.Artwor
|
||||
return
|
||||
}
|
||||
|
||||
func BuildArtworkPriceIDs(in []*model.ArtworkPrice) (out []uint) {
|
||||
out = make([]uint, len(in))
|
||||
func BuildArtworkPriceIDs(in []*model.ArtworkPrice) (out []string) {
|
||||
out = make([]string, len(in))
|
||||
for i := 0; i < len(in); i++ {
|
||||
out[i] = in[i].ID
|
||||
out[i] = in[i].ArtworkPriceUID
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func BuildArtworkIDs(in []*model.ArtworkPrice) (out []string) {
|
||||
out = make([]string, len(in))
|
||||
for i := 0; i < len(in); i++ {
|
||||
out[i] = in[i].ArtworkUID
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -2,69 +2,206 @@ package serializer
|
||||
|
||||
import (
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pkg/utils"
|
||||
"math"
|
||||
"sort"
|
||||
)
|
||||
|
||||
func CalcPrice(artworks []*model.ArtworkPrice, ruler int32, totalPrice int64) (err error, save []*model.ArtworkPrice) {
|
||||
if totalPrice == 0 || ruler == 0 {
|
||||
return nil, artworks
|
||||
func CalcPrice(total_price int64, total_ruler int32, artworksPrices []*model.ArtworkPrice) []*model.ArtworkPrice {
|
||||
price := math.Floor(float64(total_price) / float64(total_ruler))
|
||||
_, f := math.Modf(float64(total_price) / float64(total_ruler))
|
||||
if f >= 0.5 {
|
||||
price += 1
|
||||
}
|
||||
|
||||
save = make([]*model.ArtworkPrice, 0)
|
||||
|
||||
var (
|
||||
needAddPriceArtworkIndex int
|
||||
currentArtworkRuler int
|
||||
currentTotalPrice int64
|
||||
maxRulerIndex int
|
||||
totalDiv float64
|
||||
current_total_price int64
|
||||
current_artwork_price int64
|
||||
current_copyright_price int64
|
||||
|
||||
add_total_balance int64
|
||||
add_artwork_balance int64
|
||||
add_copyright_balance int64
|
||||
|
||||
loss_total_price int64
|
||||
loss_artwork_price int64
|
||||
loss_copyright_price int64
|
||||
)
|
||||
|
||||
price := utils.FormatFloat(float64(totalPrice)/float64(ruler)/10, 2) * 10 // 用于计算的单价
|
||||
//ruler_price := math.Floor(float64(total_price)/float64(ruler)/10) * 10 // 保存的单价
|
||||
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
if currentArtworkRuler < int(artworks[i].Ruler) {
|
||||
currentArtworkRuler = int(artworks[i].Ruler)
|
||||
needAddPriceArtworkIndex = i
|
||||
maxRulerIndex = i
|
||||
} else if currentArtworkRuler == int(artworks[i].Ruler) {
|
||||
currentArtworkRuler = 0
|
||||
needAddPriceArtworkIndex = -1
|
||||
for total_price-current_total_price != 0 {
|
||||
current_total_price = calcTotalPrice(artworksPrices, add_total_balance, int64(price))
|
||||
if current_total_price != 0 {
|
||||
add_total_balance = total_price - current_total_price
|
||||
}
|
||||
if int(math.Abs(float64(add_total_balance))) < len(artworksPrices) {
|
||||
loss_total_price = add_total_balance
|
||||
break
|
||||
}
|
||||
artworks[i].RulerPrice = int64(price)
|
||||
artworks[i].Price = int64(price * float64(artworks[i].Ruler))
|
||||
artworkPrice := float64(artworks[i].Price) * 0.95
|
||||
artworkPrice, div1 := math.Modf(artworkPrice)
|
||||
artworks[i].ArtworkPrice = int64(artworkPrice)
|
||||
totalDiv += div1 // 小数点 省略掉的 0.5
|
||||
|
||||
copyrightPrice := artworks[i].Price - artworks[i].ArtworkPrice
|
||||
artworks[i].CopyrightPrice = copyrightPrice
|
||||
currentTotalPrice += artworks[i].Price
|
||||
}
|
||||
|
||||
if needAddPriceArtworkIndex == -1 {
|
||||
needAddPriceArtworkIndex = maxRulerIndex
|
||||
maxId, dirId := findArtworkToAdd(artworksPrices, int64(price))
|
||||
|
||||
if dirId > -1 {
|
||||
artworksPrices[dirId].Price = artworksPrices[dirId].Price + loss_total_price
|
||||
} else {
|
||||
artworksPrices[maxId].Price = artworksPrices[maxId].Price + loss_total_price
|
||||
}
|
||||
|
||||
artworks[needAddPriceArtworkIndex].RulerPrice = int64(price)
|
||||
artworks[needAddPriceArtworkIndex].FloatPrice = totalPrice - currentTotalPrice - artworks[needAddPriceArtworkIndex].Price
|
||||
artworks[needAddPriceArtworkIndex].Price = int64(float32(totalPrice) - float32(currentTotalPrice) + float32(artworks[needAddPriceArtworkIndex].Price))
|
||||
artworks[needAddPriceArtworkIndex].ArtworkPrice = int64((float64(artworks[needAddPriceArtworkIndex].Price) * 0.95) + totalDiv)
|
||||
artworks[needAddPriceArtworkIndex].CopyrightPrice = artworks[needAddPriceArtworkIndex].Price - artworks[needAddPriceArtworkIndex].ArtworkPrice
|
||||
for int64(float64(total_price)*0.95)-current_artwork_price != 0 {
|
||||
current_artwork_price = calcArtworkPrice(artworksPrices, add_artwork_balance)
|
||||
if current_artwork_price != 0 {
|
||||
add_artwork_balance = int64(float64(total_price)*0.95) - current_artwork_price
|
||||
}
|
||||
if int(math.Abs(float64(add_artwork_balance))) < len(artworksPrices) {
|
||||
_, f := math.Modf(float64(total_price) * 0.95)
|
||||
if f >= 0.5 {
|
||||
add_artwork_balance += 1
|
||||
}
|
||||
loss_artwork_price = add_artwork_balance
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil, artworks
|
||||
if dirId > -1 {
|
||||
artworksPrices[dirId].ArtworkPrice = artworksPrices[dirId].ArtworkPrice + loss_artwork_price
|
||||
} else {
|
||||
artworksPrices[maxId].ArtworkPrice = artworksPrices[maxId].ArtworkPrice + loss_artwork_price
|
||||
}
|
||||
|
||||
for int64(float64(total_price)*0.05)-current_copyright_price != 0 {
|
||||
current_copyright_price = calcCopyrightPrice(artworksPrices, add_copyright_balance)
|
||||
if current_copyright_price != 0 {
|
||||
add_copyright_balance = int64(float64(total_price)*0.05) - current_copyright_price
|
||||
}
|
||||
if int(math.Abs(float64(add_copyright_balance))) < len(artworksPrices) {
|
||||
loss_copyright_price = add_copyright_balance
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if dirId > -1 {
|
||||
artworksPrices[dirId].CopyrightPrice = artworksPrices[dirId].CopyrightPrice + loss_copyright_price
|
||||
} else {
|
||||
artworksPrices[maxId].CopyrightPrice = artworksPrices[maxId].CopyrightPrice + loss_copyright_price
|
||||
}
|
||||
|
||||
for i := 0; i < len(artworksPrices); i++ {
|
||||
artworksPrices[i].Price = artworksPrices[i].ArtworkPrice + artworksPrices[i].CopyrightPrice
|
||||
}
|
||||
|
||||
return artworksPrices
|
||||
}
|
||||
|
||||
func CalcReward(artworks []*model.ArtworkPrice, reward int64) (err error, save []*model.ArtworkPrice) {
|
||||
save = artworks
|
||||
if reward == 0 {
|
||||
return nil, artworks
|
||||
func calcArtworkPrice(artworks []*model.ArtworkPrice, add_balance int64) int64 {
|
||||
var (
|
||||
current_artwork_price int64
|
||||
add_balance_single float64
|
||||
)
|
||||
if math.Abs(float64(add_balance)) > 0 {
|
||||
add_balance_single = math.Floor(math.Abs(float64(add_balance)) / float64(len(artworks)))
|
||||
if add_balance < 0 {
|
||||
add_balance_single = 0 - add_balance_single
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
artworks[i].ArtistPrice = reward * int64(artworks[i].Ruler)
|
||||
artworks[i].ArtworkPrice = int64(math.Floor(float64(artworks[i].Price) * 0.95))
|
||||
artworks[i].ArtworkPrice += int64(add_balance_single)
|
||||
|
||||
current_artwork_price += artworks[i].ArtworkPrice
|
||||
}
|
||||
return nil, save
|
||||
return current_artwork_price
|
||||
}
|
||||
|
||||
func calcCopyrightPrice(artworks []*model.ArtworkPrice, add_balance int64) int64 {
|
||||
var (
|
||||
current_copyright_price int64
|
||||
add_balance_single float64
|
||||
)
|
||||
if math.Abs(float64(add_balance)) > 0 {
|
||||
add_balance_single = math.Floor(math.Abs(float64(add_balance)) / float64(len(artworks)))
|
||||
if add_balance < 0 {
|
||||
add_balance_single = 0 - add_balance_single
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
artworks[i].CopyrightPrice = int64(math.Floor(float64(artworks[i].Price) * 0.05))
|
||||
artworks[i].CopyrightPrice += int64(add_balance_single)
|
||||
|
||||
current_copyright_price += artworks[i].CopyrightPrice
|
||||
}
|
||||
return current_copyright_price
|
||||
}
|
||||
|
||||
func calcTotalPrice(artworks []*model.ArtworkPrice, add_balance, price int64) int64 {
|
||||
var (
|
||||
current_total_price int64
|
||||
add_balance_single float64
|
||||
)
|
||||
if math.Abs(float64(add_balance)) > 0 {
|
||||
add_balance_single = math.Floor(math.Abs(float64(add_balance)) / float64(len(artworks)))
|
||||
if add_balance < 0 {
|
||||
add_balance_single = 0 - add_balance_single
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
artworks[i].Price = int64(add_balance_single)
|
||||
artworks[i].Price += int64(artworks[i].Ruler) * price
|
||||
|
||||
artworks[i].RulerPrice = price
|
||||
|
||||
current_total_price += artworks[i].Price
|
||||
}
|
||||
return current_total_price
|
||||
}
|
||||
|
||||
func findArtworkToAdd(artworks []*model.ArtworkPrice, ruler_price int64) (int, int) {
|
||||
var (
|
||||
max_ruler = -1
|
||||
maxIndex = -1
|
||||
difIndex = -1
|
||||
)
|
||||
|
||||
bucket := make(map[int][]int, 0)
|
||||
|
||||
sortFir := make(map[int]int, 0)
|
||||
sortSec := make([]int, 0)
|
||||
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
if len(bucket[int(artworks[i].Ruler)]) > 0 {
|
||||
bucket[int(artworks[i].Ruler)] = append(bucket[int(artworks[i].Ruler)], i)
|
||||
} else {
|
||||
bucket[int(artworks[i].Ruler)] = make([]int, 0)
|
||||
bucket[int(artworks[i].Ruler)] = append(bucket[int(artworks[i].Ruler)], i)
|
||||
}
|
||||
sortFir[int(artworks[i].Ruler)] = i
|
||||
//fmt.Println(bucket[artworks[i].Ruler])
|
||||
}
|
||||
|
||||
for ruler, _ := range sortFir {
|
||||
sortSec = append(sortSec, int(ruler))
|
||||
}
|
||||
|
||||
sort.Ints(sortSec)
|
||||
|
||||
if len(sortSec) == 1 {
|
||||
maxIndex = bucket[sortSec[0]][0]
|
||||
//return maxIndex ,0
|
||||
} else {
|
||||
for i := len(sortSec); i > 0; i-- {
|
||||
if max_ruler < sortSec[i-1] {
|
||||
max_ruler = sortSec[i-1]
|
||||
}
|
||||
if len(bucket[sortSec[i-1]]) > 1 {
|
||||
continue
|
||||
}
|
||||
if len(bucket[sortSec[i-1]]) == 1 {
|
||||
difIndex = bucket[sortSec[i-1]][0]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if difIndex == -1 {
|
||||
maxIndex = bucket[max_ruler][0]
|
||||
}
|
||||
}
|
||||
|
||||
return maxIndex, difIndex
|
||||
}
|
||||
|
70
pkg/serializer/calc_price_old.go
Normal file
70
pkg/serializer/calc_price_old.go
Normal file
@ -0,0 +1,70 @@
|
||||
package serializer
|
||||
|
||||
import (
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pkg/utils"
|
||||
"math"
|
||||
)
|
||||
|
||||
func _CalcPrice(artworks []*model.ArtworkPrice, ruler int32, totalPrice int64) (err error, save []*model.ArtworkPrice) {
|
||||
if totalPrice == 0 || ruler == 0 {
|
||||
return nil, artworks
|
||||
}
|
||||
|
||||
save = make([]*model.ArtworkPrice, 0)
|
||||
|
||||
var (
|
||||
needAddPriceArtworkIndex int
|
||||
currentArtworkRuler int
|
||||
currentTotalPrice int64
|
||||
maxRulerIndex int
|
||||
totalDiv float64
|
||||
)
|
||||
|
||||
price := utils.FormatFloat(float64(totalPrice)/float64(ruler)/10, 2) * 10 // 用于计算的单价
|
||||
//ruler_price := math.Floor(float64(total_price)/float64(ruler)/10) * 10 // 保存的单价
|
||||
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
if currentArtworkRuler < int(artworks[i].Ruler) {
|
||||
currentArtworkRuler = int(artworks[i].Ruler)
|
||||
needAddPriceArtworkIndex = i
|
||||
maxRulerIndex = i
|
||||
} else if currentArtworkRuler == int(artworks[i].Ruler) {
|
||||
currentArtworkRuler = 0
|
||||
needAddPriceArtworkIndex = -1
|
||||
}
|
||||
artworks[i].RulerPrice = int64(price)
|
||||
artworks[i].Price = int64(price * float64(artworks[i].Ruler))
|
||||
artworkPrice := float64(artworks[i].Price) * 0.95
|
||||
artworkPrice, div1 := math.Modf(artworkPrice)
|
||||
artworks[i].ArtworkPrice = int64(artworkPrice)
|
||||
totalDiv += div1 // 小数点 省略掉的 0.5
|
||||
|
||||
copyrightPrice := artworks[i].Price - artworks[i].ArtworkPrice
|
||||
artworks[i].CopyrightPrice = copyrightPrice
|
||||
currentTotalPrice += artworks[i].Price
|
||||
}
|
||||
|
||||
if needAddPriceArtworkIndex == -1 {
|
||||
needAddPriceArtworkIndex = maxRulerIndex
|
||||
}
|
||||
|
||||
artworks[needAddPriceArtworkIndex].RulerPrice = int64(price)
|
||||
artworks[needAddPriceArtworkIndex].FloatPrice = totalPrice - currentTotalPrice - artworks[needAddPriceArtworkIndex].Price
|
||||
artworks[needAddPriceArtworkIndex].Price = int64(float32(totalPrice) - float32(currentTotalPrice) + float32(artworks[needAddPriceArtworkIndex].Price))
|
||||
artworks[needAddPriceArtworkIndex].ArtworkPrice = int64((float64(artworks[needAddPriceArtworkIndex].Price) * 0.95) + totalDiv)
|
||||
artworks[needAddPriceArtworkIndex].CopyrightPrice = artworks[needAddPriceArtworkIndex].Price - artworks[needAddPriceArtworkIndex].ArtworkPrice
|
||||
|
||||
return nil, artworks
|
||||
}
|
||||
|
||||
func CalcReward(artworks []*model.ArtworkPrice, reward int64) (err error, save []*model.ArtworkPrice) {
|
||||
save = artworks
|
||||
if reward == 0 {
|
||||
return nil, artworks
|
||||
}
|
||||
for i := 0; i < len(artworks); i++ {
|
||||
artworks[i].ArtistPrice = reward * int64(artworks[i].Ruler)
|
||||
}
|
||||
return nil, save
|
||||
}
|
@ -3,21 +3,14 @@ package serializer
|
||||
import (
|
||||
"fonchain-artshow/cmd/model"
|
||||
"fonchain-artshow/pb/artShow"
|
||||
"fonchain-artshow/pkg/m"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func BuildShowApply(in *artShow.SaveApplyReq) (out *model.ShowApply) {
|
||||
out = new(model.ShowApply)
|
||||
if in.ID == 0 {
|
||||
out.ApplySeq = strings.Join([]string{m.ARTSHOWAPPLY_PREFIX, time.Now().Format("20060102150405")}, "")
|
||||
out.Status = m.SHOWAPPLY_ADD
|
||||
} else {
|
||||
out.ID = uint(in.ID)
|
||||
}
|
||||
out.ApplyUID = in.ApplyUID
|
||||
out.Status = int(in.Status)
|
||||
out.Applicant = in.Applicant
|
||||
out.ApplicantID = uint(in.ApplicantID)
|
||||
out.ApplicantID = in.ApplicantID
|
||||
out.Num = in.Num
|
||||
out.ApplyTime = in.ApplyTime
|
||||
out.Remark = in.Remark
|
||||
@ -28,10 +21,10 @@ func BuildShowApply(in *artShow.SaveApplyReq) (out *model.ShowApply) {
|
||||
func BuildShowApplyRes(in *model.ShowApply) (out *artShow.ApplyDetail) {
|
||||
out = new(artShow.ApplyDetail)
|
||||
|
||||
out.ID = int64(in.ID)
|
||||
out.ApplyUID = in.ApplyUID
|
||||
out.ApplySeq = in.ApplySeq
|
||||
out.Applicant = in.Applicant
|
||||
out.ApplicantID = int64(in.ApplicantID)
|
||||
out.ApplicantID = in.ApplicantID
|
||||
out.Num = in.Num
|
||||
out.ApplyTime = in.ApplyTime
|
||||
out.Status = int32(in.Status)
|
||||
|
@ -5,16 +5,17 @@ import (
|
||||
"fonchain-artshow/pb/artShow"
|
||||
)
|
||||
|
||||
func BuildShowRelM(in []*artShow.ShowRel, applyID uint) (out []*model.ShowRel) {
|
||||
func BuildShowRelM(in []*artShow.ShowRel, applyUID string) (out []*model.ShowRel) {
|
||||
for i := 0; i < len(in); i++ {
|
||||
showRel := &model.ShowRel{
|
||||
ShowID: uint(in[i].ShowID),
|
||||
ApplyID: applyID,
|
||||
ShowUID: in[i].ShowUID,
|
||||
ApplyUID: applyUID,
|
||||
Index: in[i].Index,
|
||||
Address: in[i].Address,
|
||||
ShowTime: in[i].ShowTime,
|
||||
}
|
||||
if in[i].ID != 0 {
|
||||
showRel.ID = uint(in[i].ID)
|
||||
if in[i].ShowRelUID != "" {
|
||||
showRel.ShowRelUID = in[i].ShowRelUID
|
||||
}
|
||||
out = append(out, showRel)
|
||||
}
|
||||
@ -24,11 +25,12 @@ func BuildShowRelM(in []*artShow.ShowRel, applyID uint) (out []*model.ShowRel) {
|
||||
func BuildShowRelRes(in []*model.ShowRel) (out []*artShow.ShowRel) {
|
||||
for i := 0; i < len(in); i++ {
|
||||
showRel := &artShow.ShowRel{
|
||||
ID: int64(in[i].ID),
|
||||
ApplyID: int64(in[i].ApplyID),
|
||||
ShowID: int64(in[i].ShowID),
|
||||
ShowRelUID: in[i].ShowRelUID,
|
||||
ApplyUID: in[i].ApplyUID,
|
||||
ShowUID: in[i].ShowUID,
|
||||
Index: in[i].Index,
|
||||
Address: in[i].Address,
|
||||
ShowTime: in[i].ShowTime,
|
||||
}
|
||||
out = append(out, showRel)
|
||||
}
|
||||
|
3
runtime/log/artshow_server.log
Normal file
3
runtime/log/artshow_server.log
Normal file
@ -0,0 +1,3 @@
|
||||
{"level":"ERROR","time":"2023-01-16T14:48:39.634+0800","caller":"dao/art_show.go:66","msg":"ArtShowList Find err","error":"Error 1055: Expression #11 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'art_show.c.address' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by"}
|
||||
{"level":"ERROR","time":"2023-01-16T14:50:09.407+0800","caller":"dao/art_show.go:66","msg":"ArtShowList Find err","error":"Error 1055: Expression #11 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'art_show.c.address' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by"}
|
||||
{"level":"ERROR","time":"2023-01-16T15:01:44.067+0800","caller":"dao/art_show.go:69","msg":"ArtShowList Find err","error":"Error 1055: Expression #11 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'art_show.c.address' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by"}
|
BIN
template/applyInfo.xlsx
Normal file
BIN
template/applyInfo.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user