This commit is contained in:
wyt 2023-01-18 17:03:15 +08:00
parent dc70be1042
commit 22f8143e85
70 changed files with 15952 additions and 0 deletions

33
DockerfileWindowsTest Normal file
View File

@ -0,0 +1,33 @@
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-backup/go.mod .
ADD ./fonchain-backup/go.sum .
RUN go mod download
COPY ./fonchain-backup .
RUN go build -ldflags "-s -w" -o /app/backup ./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-backup/conf /app/conf
COPY ./fonchain-backup/conf /conf
ENV TZ Asia/Shanghai
ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
WORKDIR /app
COPY --from=builder /app/backup .
EXPOSE 9021
CMD ["/app/backup"]

26
cmd/app.go Normal file
View File

@ -0,0 +1,26 @@
package main
import (
"fmt"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/imports"
"github.com/fonchain-artistserver/cmd/internal/controller"
"github.com/fonchain-artistserver/pkg/cache"
db "github.com/fonchain-artistserver/pkg/db"
"github.com/fonchain-artistserver/pkg/m"
)
// export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-server/conf/dubbogo.yaml
func main() {
fmt.Println("第一处")
config.SetProviderService(&controller.ArtistInfoProvider{})
db.Init(m.SERVER_CONFIG)
cache.InitRedis(m.SERVER_CONFIG)
if err := config.Load(); err != nil {
panic(err)
}
select {}
}

View File

@ -0,0 +1,59 @@
package controller
import (
"context"
"fmt"
"github.com/fonchain-artistserver/cmd/internal/logic"
"github.com/fonchain-artistserver/pb/artistinfo"
)
type ArtistInfoProvider struct {
artistinfo.UnimplementedArtistInfoServer
artistInfoLogic *logic.ArtistInfo
}
func (a *ArtistInfoProvider) registerUser(ctx context.Context, req *artistinfo.RegisterUserRequest) (rep *artistinfo.RegisterUserRespond, err error) {
fmt.Println("第一处")
// backup := &artistInfo.GetUserInfoRespond{}
if rep, err = a.artistInfoLogic.RegisterUser(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtistInfoProvider) GetUser(ctx context.Context, req *artistinfo.GetUserRequest) (rep *artistinfo.GetUserRespond, err error) {
fmt.Println("第一处")
// backup := &artistInfo.GetUserInfoRespond{}
if rep, err = a.artistInfoLogic.GetUser(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtistInfoProvider) UpdateRealName(ctx context.Context, req *artistinfo.UpdateRealNameRequest) (rep *artistinfo.UpdateRealNameRespond, err error) {
fmt.Println("第一处")
// backup := &artistInfo.GetUserInfoRespond{}
if rep, err = a.artistInfoLogic.UpdateRealName(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtistInfoProvider) FinishVerify(ctx context.Context, req *artistinfo.FinishVerifyRequest) (rep *artistinfo.FinishVerifyRespond, err error) {
fmt.Println("第一处")
// backup := &artistInfo.GetUserInfoRespond{}
if rep, err = a.artistInfoLogic.FinishVerify(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtistInfoProvider) CheckUserLock(ctx context.Context, req *artistinfo.CheckUserLockRequest) (rep *artistinfo.CheckUserLockRespond, err error) {
fmt.Println("第一处")
// backup := &artistInfo.GetUserInfoRespond{}
if rep, err = a.artistInfoLogic.CheckUserLock(req); err != nil {
return nil, err
}
return rep, nil
}

View File

@ -0,0 +1,62 @@
package controller
import (
"context"
"fmt"
"github.com/fonchain-artistserver/cmd/internal/logic"
"github.com/fonchain-artistserver/pb/artwork"
)
type ArtWorkProvider struct {
artwork.UnimplementedArtworkServer
artWorkLogic *logic.ArtWork
}
func (a *ArtWorkProvider) ArtworkAdd(ctx context.Context, req *artwork.ArtworkAddRequest) (rep *artwork.ArtworkAddRespond, err error) {
fmt.Println("第一处")
if rep, err = a.artWorkLogic.ArtworkAdd(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtWorkProvider) UpdateArtwork(ctx context.Context, req *artwork.UpdateArtworkRequest) (rep *artwork.UpdateArtworkRespond, err error) {
fmt.Println("第一处")
if rep, err = a.artWorkLogic.UpdateArtwork(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtWorkProvider) DelArtwork(ctx context.Context, req *artwork.DelArtworkRequest) (rep *artwork.DelArtworkRespond, err error) {
fmt.Println("第一处")
if rep, err = a.artWorkLogic.DelArtwork(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtWorkProvider) GetArtworkList(ctx context.Context, req *artwork.GetArtworkListRequest) (rep *artwork.GetArtworkListRespond, err error) {
fmt.Println("第一处")
if rep, err = a.artWorkLogic.GetArtworkList(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtWorkProvider) GetArtwork(ctx context.Context, req *artwork.GetArtworkRequest) (rep *artwork.GetArtworkRespond, err error) {
fmt.Println("第一处")
if rep, err = a.artWorkLogic.GetArtwork(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *ArtWorkProvider) UploadArtwork(ctx context.Context, req *artwork.UploadArtworkRequest) (rep *artwork.UploadArtworkRespond, err error) {
fmt.Println("第一处")
if rep, err = a.artWorkLogic.UploadArtwork(req); err != nil {
return nil, err
}
return rep, nil
}

View File

@ -0,0 +1,59 @@
package controller
import (
"context"
"fmt"
"github.com/fonchain-artistserver/cmd/internal/logic"
"github.com/fonchain-artistserver/pb/contract"
)
type ContractProvider struct {
contract.UnimplementedContractServer
contractLogic *logic.Contract
}
func (c *ContractProvider) FinishContract(ctx context.Context, req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error) {
fmt.Println("第一处")
if rep, err = c.contractLogic.FinishContract(req); err != nil {
return nil, err
}
return rep, nil
}
func (c *ContractProvider) ContractList(ctx context.Context, req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
fmt.Println("第一处")
if rep, err = c.contractLogic.ContractList(req); err != nil {
return nil, err
}
return rep, nil
}
func (c *ContractProvider) GetContract(ctx context.Context, req *contract.GetContractRequest) (rep *contract.ContractData, err error) {
fmt.Println("第一处")
if rep, err = c.contractLogic.GetContract(req); err != nil {
return nil, err
}
return rep, nil
}
func (c *ContractProvider) ContractTxList(ctx context.Context, req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
fmt.Println("第一处")
if rep, err = c.contractLogic.ContractTxList(req); err != nil {
return nil, err
}
return rep, nil
}
func (c *ContractProvider) UpdateContract(ctx context.Context, req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error) {
fmt.Println("第一处")
if rep, err = c.contractLogic.UpdateContract(req); err != nil {
return nil, err
}
return rep, nil
}
func (c *ContractProvider) UpdateContractTx(ctx context.Context, req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error) {
fmt.Println("第一处")
if rep, err = c.contractLogic.UpdateContractTx(req); err != nil {
return nil, err
}
return rep, nil
}

View File

@ -0,0 +1,110 @@
package controller
import (
"context"
"fmt"
"github.com/fonchain-artistserver/cmd/internal/logic"
"github.com/fonchain-artistserver/pb/supplyinfo"
)
type SupplyProvider struct {
supplyinfo.UnimplementedSupplyInfoServer
SupplyLogic *logic.Supply
}
func (a *SupplyProvider) GetSupplyInfoList(ctx context.Context, req *supplyinfo.GetSupplyInfoListRequest) (rep *supplyinfo.GetSupplyInfoListRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetSupplyInfoList(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) GetSupplyInfo(ctx context.Context, req *supplyinfo.GetSupplyInfoRequest) (rep *supplyinfo.GetSupplyInfoData, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetSupplyInfo(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) UpdateSupplyInfo(ctx context.Context, req *supplyinfo.UpdateSupplyInfoRequest) (rep *supplyinfo.UpdateSupplyInfoRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.UpdateSupplyInfo(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) GetVideoList(ctx context.Context, req *supplyinfo.GetVideoListRequest) (rep *supplyinfo.GetVideoListRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetVideoList(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) GetVideo(ctx context.Context, req *supplyinfo.GetVideoRequest) (rep *supplyinfo.GetVideoListData, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetVideo(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) UpdateVideo(ctx context.Context, req *supplyinfo.UpdateVideoRequest) (rep *supplyinfo.UpdateVideoRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.UpdateVideo(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) GetExam(ctx context.Context, req *supplyinfo.GetExamRequest) (rep *supplyinfo.GetExamListData, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetExam(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) GetExamList(ctx context.Context, req *supplyinfo.GetExamListRequest) (rep *supplyinfo.GetExamListRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetExamList(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) UpdateExam(ctx context.Context, req *supplyinfo.UpdateExamRequest) (rep *supplyinfo.UpdateExamRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.UpdateExam(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) GetArtistInfoList(ctx context.Context, req *supplyinfo.GetArtistInfoListRequest) (rep *supplyinfo.GetArtistInfoListRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetArtistInfoList(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) GetArtistInfo(ctx context.Context, req *supplyinfo.GetArtistInfoRequest) (rep *supplyinfo.GetArtistInfoListData, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.GetArtistInfo(req); err != nil {
return nil, err
}
return rep, nil
}
func (a *SupplyProvider) UpdateArtistInfo(ctx context.Context, req *supplyinfo.UpdateArtistInfoRequest) (rep *supplyinfo.UpdateArtistInfoRespond, err error) {
fmt.Println("第一处")
if rep, err = a.SupplyLogic.UpdateArtistInfo(req); err != nil {
return nil, err
}
return rep, nil
}

View File

@ -0,0 +1,427 @@
package dao
import (
"errors"
"github.com/fonchain-artistserver/cmd/model"
"github.com/fonchain-artistserver/pb/artistinfo"
db "github.com/fonchain-artistserver/pkg/db"
"github.com/fonchain-artistserver/pkg/m"
"go.uber.org/zap"
)
func RegisterUser(req *artistinfo.RegisterUserRequest) (rep *artistinfo.RegisterUserRespond, err error) {
var user model.User
user.TelNum = req.TelNum
user.MgmtArtistId = req.MgmtArtistId
if err := db.DB.Create(&user).Error; err != nil {
zap.L().Error("register user err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
return
}
func GetUser(req *artistinfo.GetUserRequest) (rep *artistinfo.GetUserRespond, err error) {
rep = &artistinfo.GetUserRespond{}
// service := &artist.UserUpdateInfoService{}
var user model.User
if err = db.DB.First(&user, "telnum = ?", req.TelNum).Error; err != nil {
zap.L().Error("get user info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
// rep.
rep.Id = user.ID
rep.MgmtUserId = user.MgmtUserId
rep.MgmtArtistId = user.MgmtArtistId
rep.TelNum = user.TelNum
rep.IsFdd = user.IsFdd
rep.IsRealName = user.IsRealName
rep.Ruler = user.Ruler
// service.QrCodeImg = fmt.Sprintf("https://cdn.fontree.cn/artistmgmt/static/qrcode/%v.png", user.InvitedCode)
// service.QrCodeImgDownload = fmt.Sprintf("https://cdn.fontree.cn/artistmgmt/static/qrcode/%v-2.png", user.InvitedCode)
// rep.Data = service
return rep, nil
}
func GetUserById(req *artistinfo.GetUserByIdRequest) (rep *artistinfo.GetUserByIdRespond, err error) {
rep = &artistinfo.GetUserByIdRespond{}
// service := &artist.UserUpdateInfoService{}
var user model.User
if err = db.DB.First(&user, "id = ?", req.Id).Error; err != nil {
zap.L().Error("get user info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
// rep.
rep.Id = user.ID
rep.MgmtUserId = user.MgmtUserId
rep.MgmtArtistId = user.MgmtArtistId
rep.TelNum = user.TelNum
rep.IsFdd = user.IsFdd
rep.IsRealName = user.IsRealName
rep.Ruler = user.Ruler
return rep, nil
}
func UpdateRealName(req *artistinfo.UpdateRealNameRequest) (rep *artistinfo.UpdateRealNameRespond, err error) {
var user model.User
user.ID = req.Id
if err = db.DB.Model(&user).Update("isrealname", 1).Error; err != nil {
zap.L().Error("get user info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
return rep, nil
}
func FinishVerify(req *artistinfo.FinishVerifyRequest) (rep *artistinfo.FinishVerifyRespond, err error) {
var user model.User
user.ID = req.Id
if err = db.DB.Model(&user).Update("isfdd", 2).Error; err != nil {
zap.L().Error("get user info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
return rep, nil
}
// // Update 用户修改信息
// func Create(reqs *artist.CreateUserInfoRequest) (rep *artist.CreateUserInfoRespond, err error) {
// req := reqs.Data
// rep = &artist.CreateUserInfoRespond{}
// data := &artist.User{}
// // user := rep.User
// var user model.User
// // user := rep.User
// if err = db.DB.First(&user, "id = ?", int32(reqs.Id)).Error; err != nil {
// //数据库操作异常
// zap.L().Error("get user info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return nil, err
// }
// var realNameFind model.RealName
// if err = db.DB.First(&realNameFind, "id_num = ?", req.IdCard).Error; err != nil {
// zap.L().Error("get realName info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return nil, err
// } else {
// if realNameFind.ID != 0 {
// return nil, errors.New(m.ERROR_ALREADY_AUTH)
// }
// }
// var realname = model.RealName{
// Name: req.RealName,
// IDNum: req.IdCard,
// TelNum: req.TelNum,
// IdcardFront: req.IdCardFront,
// IdcardBack: req.IdCardBack,
// }
// if err = db.DB.Save(&realname).Error; err != nil {
// zap.L().Error("save realName info err", zap.Error(err))
// err = errors.New(m.SAVE_ERROR)
// return nil, err
// }
// if err = db.DB.First(&realname, "id_num=?", realname.IDNum).Error; err != nil {
// zap.L().Error("get realName info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return nil, err
// }
// // user.ID = int32(reqs.Id)
// user.Name = req.RealName
// user.PenName = req.PenName
// user.RealNameID = int32(realname.ID)
// user.StageName = req.StageName
// user.Age = int32(util.IdCardTurnAge(realname.IDNum))
// user.Sex = int32(req.Sex)
// user.JoinAssoTime = req.JoinAssoTime
// user.CertificateNum = req.CertificateNum
// conAddessByte, err := json.Marshal(req.ConAddress)
// if err != nil {
// zap.L().Error("conAddress marshal err", zap.Error(err))
// err = errors.New(m.ERROR_MARSHAL)
// return nil, err
// }
// user.ConAddress = string(conAddessByte)
// user.CreateAt = time.Now().Unix()
// user.Photo = req.Photo
// user.WxAccount = req.WxAccount
// user.CertificateImg = req.CertificateImg
// user.Video = req.Video
// // user.IsRealName = true
// var invite model.Invite
// if err = db.DB.Where("user_id = ?", user.ID).First(&invite).Error; err != nil {
// zap.L().Error("get invite info err", zap.Error(err))
// if err.Error() == "record not found" {
// } else {
// err = errors.New(m.SAVE_ERROR)
// return nil, err
// }
// }
// if invite.ID == 0 {
// res, err := CheckInvitedCode(req.InvitedCode)
// if err != nil {
// Createinvite(user.ID, res.ID)
// }
// }
// user.ID = int32(reqs.Id)
// if err = db.DB.Save(user).Error; err != nil {
// zap.L().Error("save user info err", zap.Error(err))
// err = errors.New(m.SAVE_ERROR)
// return nil, err
// }
// copyOpt := util.CopyOption{
// Src: &user,
// Dst: data,
// }
// util.CopyStructSuper(copyOpt)
// rep.User = data
// return rep, nil
// }
// // Get 用户修改信息
// func GetUserInfoSelf(id int64) (rep *model.UserUpdateInfoService, err error) {
// rep = &model.UserUpdateInfoService{}
// var user model.User
// if err = db.DB.First(&user, "id = ?", int32(id)).Error; err != nil {
// zap.L().Error("get user info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// var realName model.RealName
// if err = db.DB.First(&realName, "id = ?", user.RealNameID).Error; err != nil {
// zap.L().Error("get realName info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// var artworkList []model.Artwork
// if err = db.DB.Where("artist_id = ? ", uint(id)).Find(&artworkList).Error; err != nil {
// zap.L().Error("get artworkList info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// for _, v := range artworkList {
// if v.State == 3 {
// rep.Ruler = rep.Ruler + int32(v.Ruler)
// }
// }
// rep.TelNum = user.TelNum
// rep.CertificateNum = user.CertificateNum
// if user.CertificateImg != "" {
// rep.CertificateImg = fmt.Sprintf("%v?v=%d", user.CertificateImg, user.UpdatedAt.Unix())
// }
// rep.RealName = realName.Name
// rep.PenName = user.PenName
// rep.Age = int32(util.IdCardTurnAge(realName.IDNum))
// rep.IdCard = realName.IDNum
// rep.StageName = user.StageName
// rep.WxAccount = user.WxAccount
// rep.JoinAssoTime = user.JoinAssoTime
// rep.IdCardFront = fmt.Sprintf("%v?v=%d", realName.IdcardFront, realName.UpdatedAt.Unix())
// rep.IdCardBack = fmt.Sprintf("%v?v=%d", realName.IdcardBack, realName.UpdatedAt.Unix())
// var conAddressArr []string
// err = json.Unmarshal([]byte(user.ConAddress), &conAddressArr)
// if err != nil {
// zap.L().Error("conAddressArr unmarshal err", zap.Error(err))
// err = errors.New(m.ERROR_UNMARSHAL)
// return nil, err
// }
// rep.ConAddress = conAddressArr
// rep.InvitedCode = user.InvitedCode
// var invited model.Invite
// if err = db.DB.Where("user_id=?", user.ID).First(&invited).Error; err != nil {
// zap.L().Error("get invited info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// var invitedUser model.User
// if err = db.DB.Where("id=?", invited.InvitedId).First(&invitedUser).Error; err != nil {
// zap.L().Error("get invitedUser info err", zap.Error(err))
// err = errors.New(m.ERROR_UNMARSHAL)
// return
// }
// rep.InvitedName = invitedUser.Name
// rep.Sex = user.Sex
// rep.FddState = user.FddState
// rep.CustomerId = user.CustomerId
// rep.Photo = fmt.Sprintf("%v?v=%d", user.Photo, user.UpdatedAt.Unix())
// if user.Video != "" {
// rep.Video = fmt.Sprintf("%v?v=%d", user.Video, user.UpdatedAt.Unix())
// }
// rep.QrCodeImg = fmt.Sprintf("https://cdn.fontree.cn/artistmgmt/static/qrcode/%v.png", user.InvitedCode)
// rep.QrCodeImgDownload = fmt.Sprintf("https://cdn.fontree.cn/artistmgmt/static/qrcode/%v-2.png", user.InvitedCode)
// return rep, nil
// }
// func Update(req *artist.UpdateUserInfoRequest) (rep *artist.UpdateUserInfoRespond, err error) {
// rep = &artist.UpdateUserInfoRespond{}
// data := &artist.User{}
// var user model.User
// if err = db.DB.First(&user, "id = ?", int32(req.Id)).Error; err != nil {
// zap.L().Error("get user info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// user.PenName = req.Data.PenName
// user.Photo = req.Data.Photo
// user.Video = req.Data.Video
// user.CertificateImg = req.Data.CertificateImg
// conAddessByte, err := json.Marshal(req.Data.ConAddress)
// if err != nil {
// zap.L().Error("conAddress marshal err", zap.Error(err))
// err = errors.New(m.ERROR_MARSHAL)
// return nil, err
// }
// user.ConAddress = string(conAddessByte)
// user.WxAccount = req.Data.WxAccount
// user.CertificateNum = req.Data.CertificateNum
// if err = db.DB.Save(&user).Error; err != nil {
// zap.L().Error("save user info err", zap.Error(err))
// err = errors.New(m.SAVE_ERROR)
// return
// }
// var realName model.RealName
// if err = db.DB.First(&realName, "id = ?", user.RealNameID).Error; err != nil {
// zap.L().Error("get RealName info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// realName.IdcardBack = req.Data.IdCardBack
// realName.IdcardFront = req.Data.IdCardFront
// if err = db.DB.Save(&realName).Error; err != nil {
// zap.L().Error("save realName info err", zap.Error(err))
// err = errors.New(m.SAVE_ERROR)
// return
// }
// copyOpt := util.CopyOption{
// Src: &user,
// Dst: data,
// }
// util.CopyStructSuper(copyOpt)
// rep.User = data
// return
// }
// func UpdateTel(req *artist.UserUpdateTelRequest) (rep *artist.UserUpdateTelRespond, err error) {
// rep = &artist.UserUpdateTelRespond{}
// var user model.User
// if err = db.DB.First(&user, int32(req.Id)).Error; err != nil {
// zap.L().Error("get user info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// str := cache.RedisClient.Get(req.TelNum)
// verCode := str.Val()
// if verCode != req.VerCode {
// zap.L().Error("verCode err", zap.Error(err))
// err = errors.New(m.ERRORCODE)
// return
// }
// if user.TelNum == req.TelNum {
// zap.L().Error("TelNum err", zap.Error(err))
// err = errors.New(m.ERROT_SAME_TEL)
// return
// }
// user.TelNum = req.TelNum
// if err = db.DB.Save(&user).Error; err != nil {
// zap.L().Error("save user info err", zap.Error(err))
// err = errors.New(m.SAVE_ERROR)
// return
// }
// rep.TelNum = user.TelNum
// return
// }
// func UpdateMsg(req *artist.UserUpdateMsgRequest) (rep *artist.UserUpdateMsgRespond, err error) {
// var user model.User
// user.IsRealName = true
// user.ID = int32(req.Id)
// if err = db.DB.Model(&user).Update("is_read", 1).Error; err != nil {
// zap.L().Error("user update failed", zap.Error(err))
// err = errors.New(m.UPDATE_FAILED)
// return
// }
// return
// }
// func VerifyFdd(req *artist.VerifyfddRequest) (rep *artist.VerifyfddRespond, err error) {
// rep = &artist.VerifyfddRespond{}
// var user model.User
// if err = db.DB.Where("id = ?", int32(req.Id)).First(&user).Error; err != nil {
// zap.L().Error("get user info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return
// }
// if user.FddState != 2 {
// return
// }
// rep.Ready = true
// return
// }
// func FinishVerify(req *artist.FinishVerifyRequest) (rep *artist.FinishVerifyRespond, err error) {
// rep = &artist.FinishVerifyRespond{}
// data := &artist.User{}
// var user model.User
// user.ID = int32(req.Id)
// if err = db.DB.Model(&user).Update("fdd_state", 2).Error; err != nil {
// zap.L().Error("user update failed", zap.Error(err))
// err = errors.New(m.UPDATE_FAILED)
// return
// }
// copyOpt := util.CopyOption{
// Src: &user,
// Dst: data,
// }
// util.CopyStructSuper(copyOpt)
// rep.User = data
// return
// }
// func CheckInvitedCode(invitedCode string) (user *model.User, err error) {
// user = &model.User{}
// //找到用户
// if err := db.DB.Where("invited_code =?", invitedCode).Find(user).Error; err != nil {
// zap.L().Error("get user info err", zap.Error(err))
// err = errors.New(m.ERROR_SELECT)
// return nil, err
// }
// if user.ID == 0 {
// err = errors.New(m.INVITE_CODE_INVALID)
// return nil, err
// }
// return user, nil
// }
// func Createinvite(userId, invitedId int32) (invite *model.Invite, err error) {
// invite = &model.Invite{}
// invite.UserId = userId
// invite.InvitedId = invitedId
// if err := db.DB.Create(&invite).Error; err != nil {
// zap.L().Error("create invite info err", zap.Error(err))
// err = errors.New(m.CREATE_ERROR)
// return nil, err
// }
// return invite, nil
// }

194
cmd/internal/dao/artwork.go Normal file
View File

@ -0,0 +1,194 @@
package dao
import (
"encoding/json"
"errors"
"github.com/fonchain-artistserver/cmd/model"
"github.com/fonchain-artistserver/pb/artwork"
db "github.com/fonchain-artistserver/pkg/db"
"github.com/fonchain-artistserver/pkg/m"
"go.uber.org/zap"
)
func ArtworkAdd(res *artwork.ArtworkAddRequest) (req *artwork.ArtworkAddRespond, err error) {
CreataAddByte, err := json.Marshal(res.CreateAddress)
if err != nil {
zap.L().Error("marshal createAddress failed", zap.Error(err))
err = errors.New(m.ERROR_MARSHAL)
return
}
artwork := &model.Artwork{
ArtistId: int32(res.ArtistId),
Name: res.Name,
ModelYear: res.ModelYear,
Photo: res.Photo,
ArtistPhoto: res.ArtistPhoto,
CreateAddress: string(CreataAddByte),
Width: int32(res.Width),
AgeOfCreation: res.AgeOfCreation,
Height: int32(res.Height),
Ruler: int32(res.Ruler),
Introduct: res.Introduct,
NetworkTrace: res.NetworkTrace,
Url: res.Url,
State: int32(res.State),
}
if err = db.DB.Create(&artwork).Error; err != nil {
zap.L().Error("create artwork info err", zap.Error(err))
err = errors.New(m.CREATE_ERROR)
return
}
return
}
func CheckUserLock(id int64) (err error) {
var user model.User
if err = db.DB.Where("id = ? ", id).First(&user).Error; err != nil {
zap.L().Error("get user info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
if user.IsLock {
zap.L().Error("user is lock")
return errors.New(m.ERROR_ISLOCK)
}
return
}
func UpdateArtwork(data *artwork.UpdateArtworkRequest) (err error) {
var artwork model.Artwork
artwork.ID = int32(data.ID)
if err = db.DB.First(&artwork).Error; err != nil {
zap.L().Error("get artwork info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
CreataAddByte, _ := json.Marshal(data.CreateAddress)
artwork.ID = int32(data.ID)
artwork.ArtistId = int32(data.ArtistId)
artwork.Name = data.Name
artwork.ModelYear = data.ModelYear
artwork.Photo = data.Photo
artwork.ArtistPhoto = data.ArtistPhoto
artwork.Width = int32(data.Width)
artwork.AgeOfCreation = data.AgeOfCreation
artwork.CreateAddress = string(CreataAddByte)
artwork.Height = int32(data.Height)
artwork.Ruler = int32(data.Ruler)
artwork.Introduct = data.Introduct
artwork.NetworkTrace = data.NetworkTrace
artwork.Url = data.Url
artwork.State = 1
if err = db.DB.Save(&artwork).Error; err != nil {
zap.L().Error("save artwork info err", zap.Error(err))
err = errors.New(m.SAVE_ERROR)
return
}
return
}
func DelArtwork(id int32) (err error) {
if err = db.DB.Where("id = ?", id).Delete(&model.Artwork{}).Error; err != nil {
zap.L().Error("delete artwork info err", zap.Error(err))
err = errors.New(m.ERROR_DELETE)
return
}
return
}
func GetArtworkList(req *artwork.GetArtworkListRequest) (rep *artwork.GetArtworkListRespond, err error) {
rep = &artwork.GetArtworkListRespond{}
var datas []*artwork.UpdateArtworkRequest
var artworkList []model.Artwork
//找到用户
if err = db.DB.Order("created_at desc").Where("artist_id = ?", req.ID).Find(&artworkList).Error; err != nil {
zap.L().Error("get artwork info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
for k, v := range artworkList {
artworkList[k].CreateTime = v.CreatedAt.Format("2006-01-02")
var data artwork.UpdateArtworkRequest
var createAddressByte []string
json.Unmarshal([]byte(artworkList[k].CreateAddress), &createAddressByte)
data.ID = uint64(artworkList[k].ID)
data.ArtistId = uint64(artworkList[k].ArtistId)
data.Name = artworkList[k].Name
data.ModelYear = artworkList[k].ModelYear
data.Photo = artworkList[k].Photo
data.ArtistPhoto = artworkList[k].ArtistPhoto
data.Width = uint64(artworkList[k].Width)
data.CreateAddress = createAddressByte
data.Height = uint64(artworkList[k].Height)
data.Ruler = uint64(artworkList[k].Ruler)
data.Introduct = artworkList[k].Introduct
data.AgeOfCreation = artworkList[k].AgeOfCreation
data.CreateAt = artworkList[k].CreateTime
data.NetworkTrace = artworkList[k].NetworkTrace
data.Url = artworkList[k].Url
data.State = uint64(artworkList[k].State)
datas = append(datas, &data)
}
rep.Data = datas
return
}
func GetArtwork(id int32) (rep *artwork.GetArtworkRespond, err error) {
rep = &artwork.GetArtworkRespond{}
var artworkRes model.Artwork
if err = db.DB.Find(&artworkRes, "id = ? and deleted_at is null", id).Error; err != nil {
zap.L().Error("get artwork info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
artworkRes.CreateTime = artworkRes.CreatedAt.Format("2006-01-02")
var createAddressByte []string
json.Unmarshal([]byte(artworkRes.CreateAddress), &createAddressByte)
rep.ID = uint64(artworkRes.ID)
rep.ArtistId = uint64(artworkRes.ArtistId)
rep.Name = artworkRes.Name
rep.ModelYear = artworkRes.ModelYear
rep.Photo = artworkRes.Photo
rep.ArtistPhoto = artworkRes.ArtistPhoto
rep.Width = uint64(artworkRes.Width)
rep.CreateAddress = createAddressByte
rep.Height = uint64(artworkRes.Height)
rep.Ruler = uint64(artworkRes.Ruler)
rep.Introduct = artworkRes.Introduct
rep.AgeOfCreation = artworkRes.AgeOfCreation
rep.CreateAt = artworkRes.CreateTime
rep.NetworkTrace = artworkRes.NetworkTrace
rep.Url = artworkRes.Url
rep.State = uint64(artworkRes.State)
return
}
func UploadArtwork(Id uint64) (err error) {
var artwork model.Artwork
if err = db.DB.First(&artwork, "id = ?", Id).Error; err != nil {
zap.L().Error("get artwork info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
artwork.State = 1
if err = db.DB.Save(&artwork).Error; err != nil {
zap.L().Error("save artwork info err", zap.Error(err))
err = errors.New(m.SAVE_ERROR)
return
}
return
}

View File

@ -0,0 +1,195 @@
package dao
import (
"errors"
"time"
"github.com/fonchain-artistserver/cmd/model"
"github.com/fonchain-artistserver/pb/contract"
db "github.com/fonchain-artistserver/pkg/db"
"github.com/fonchain-artistserver/pkg/m"
"go.uber.org/zap"
)
func FinishContract(id string) (err error) {
var contracts model.Contract
if err = db.DB.Where("transaction_id = ?", id).First(&contracts).Error; err != nil {
zap.L().Error("get contract info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
if err = db.DB.Model(&contracts).Update("state", 3).Error; err != nil {
zap.L().Error("user contract failed", zap.Error(err))
err = errors.New(m.UPDATE_FAILED)
return
}
return
}
func ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
rep = &contract.ContractListRespond{}
var Data []*contract.ContractData
var user model.User
if err = db.DB.Where("id = ? ", int32(req.ID)).First(&user).Error; err != nil {
zap.L().Error("get user info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
var realName model.RealName
if err = db.DB.Where("id = ? ", user.RealNameID).First(&realName).Error; err != nil {
zap.L().Error("get realName info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
var args []interface{}
var sqlWhere = "user_id = ? and type !=4 "
args = append(args, req.ID)
if req.State != 0 {
sqlWhere += " and state = ? "
if req.State == 2 {
req.State = 3
}
args = append(args, req.State)
}
var contractModel []model.Contract
if err = db.DB.Where(sqlWhere, args...).Find(&contractModel).Error; err != nil {
zap.L().Error("get contractModels info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
for _, v := range contractModel {
contract := &contract.ContractData{}
contract.ID = uint64(v.ID)
contract.ContractId = v.ContractId
contract.DownloadUrl = v.DownloadUrl
contract.MgmtUserId = v.MgmtUserId
contract.State = int64(v.State)
contract.TransactionId = v.TransactionId
contract.Type = int64(v.Type)
contract.UserId = int64(v.UserId)
contract.ViewUrl = v.ViewUrl
contract.ExpirationTime = v.CreatedAt.Add(86400 * time.Second).Format("2006-01-02 15:04:05")
contract.SignTime = v.UpdatedAt.Format("2006-01-02")
Data = append(Data, contract)
}
rep.Data = Data
return
}
func ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
rep = &contract.ContractTxListRespond{}
var Data []*contract.ContractData
var user model.User
if err = db.DB.Where("id = ? ", int32(req.ID)).First(&user).Error; err != nil {
zap.L().Error("get user info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
var realName model.RealName
if err = db.DB.Where("id = ? ", user.RealNameID).First(&realName).Error; err != nil {
zap.L().Error("get realName info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
var args []interface{}
var sqlWhere = " card_id = ? and (type = 4 or type = 7) "
args = append(args, realName.IDNum)
if req.State != 0 {
sqlWhere += " and state = ? "
args = append(args, req.State)
}
var contractModel []model.Contract
if err = db.DB.Where(sqlWhere, args...).Find(&contractModel).Error; err != nil {
zap.L().Error("get contractModels info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
for _, v := range contractModel {
contractTmp := &contract.ContractData{}
contractTmp.ID = uint64(v.ID)
contractTmp.ContractId = v.ContractId
contractTmp.DownloadUrl = v.DownloadUrl
contractTmp.MgmtUserId = v.MgmtUserId
contractTmp.State = int64(v.State)
contractTmp.TransactionId = v.TransactionId
contractTmp.Type = int64(v.Type)
var b string
if v.Type == 4 {
b = "物权"
}
if v.Type == 7 {
b = "版权"
}
contractTmp.BatchName = b + v.BatchName[0:4] + "年" + v.BatchName[4:6] + "月" + v.BatchName[6:11] + "年" + v.BatchName[11:13] + "月"
contractTmp.UserId = int64(v.UserId)
contractTmp.ViewUrl = v.ViewUrl
contractTmp.ExpirationTime = v.CreatedAt.Add(86400 * time.Second).Format("2006-01-02 15:04:05")
contractTmp.SignTime = v.UpdatedAt.Format("2006-01-02")
Data = append(Data, contractTmp)
}
rep.Data = Data
return
}
func GetContract(id int32) (rep *contract.ContractData, err error) {
var con model.Contract
if err = db.DB.Where("id = ? ", id).First(&con).Error; err != nil {
zap.L().Error("get contract info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return
}
rep.ID = uint64(con.ID)
rep.UserId = int64(con.UserId)
rep.CardId = con.CardId
rep.MgmtUserId = con.MgmtUserId
rep.ArtworkId = con.ArtworkId
rep.ContractId = con.ContractId
rep.TransactionId = con.TransactionId
rep.Type = int64(con.Type)
rep.BatchName = con.BatchName
rep.ViewUrl = con.ViewUrl
rep.DownloadUrl = con.DownloadUrl
rep.State = int64(con.State)
return
}
// 更新交易id
func UpdateContract(req *contract.UpdateContractRequest) error {
//数据库操作异常
var con model.Contract
if err := db.DB.Model(&con).Updates(&model.Contract{ContractId: req.ContractId, ViewUrl: req.ViewUrl, DownloadUrl: req.DownloadUrl}).Error; err != nil {
return err
}
return nil
}
// 更新交易id
func UpdateContractTx(txId string, contractId int32) (err error) {
var con model.Contract
con.ID = contractId
if err = db.DB.Model(&con).Update("transaction_id", txId).Error; err != nil {
return
}
if err = db.DB.Model(&con).Update("state", 1).Error; err != nil {
return
}
return
}

398
cmd/internal/dao/supply.go Normal file
View File

@ -0,0 +1,398 @@
package dao
import (
"encoding/json"
"errors"
"github.com/fonchain-artistserver/cmd/model"
"github.com/fonchain-artistserver/pb/supplyinfo"
db "github.com/fonchain-artistserver/pkg/db"
"github.com/fonchain-artistserver/pkg/m"
"go.uber.org/zap"
)
func GetSupplyInfoList(id, num int32) (rep *supplyinfo.GetSupplyInfoListRespond, err error) {
rep = &supplyinfo.GetSupplyInfoListRespond{}
var datas []*supplyinfo.GetSupplyInfoData
var supplyInfoList []model.SupplyInfo
if err := db.DB.Where("user_id = ? and types <= ?", id, num).Find(&supplyInfoList).Error; err != nil {
zap.L().Error("get supplyInfo infos err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
for i, v := range supplyInfoList {
supplyInfoList[i].CreateTime = v.CreatedAt.Format("2006-01-02")
data := &supplyinfo.GetSupplyInfoData{}
data.ID = uint64(supplyInfoList[i].ID)
data.ArtworkId = supplyInfoList[i].ArtworkId
data.ArtistId = supplyInfoList[i].ArtistId
data.UserId = uint64(supplyInfoList[i].UserId)
data.Name = supplyInfoList[i].Name
data.ModelYear = supplyInfoList[i].ModelYear
data.Photo = supplyInfoList[i].Photo
data.ArtistPhoto = supplyInfoList[i].ArtistPhoto
data.Width = uint64(supplyInfoList[i].Width)
data.Height = uint64(supplyInfoList[i].Height)
data.Ruler = uint64(supplyInfoList[i].Ruler)
data.ExhibitInfo = supplyInfoList[i].ExhibitInfo
data.ExhibitPic1 = supplyInfoList[i].ExhibitPic1
data.ExhibitPic2 = supplyInfoList[i].ExhibitPic2
data.CreateTime = supplyInfoList[i].CreateTime
data.Introduct = supplyInfoList[i].Introduct
data.NetworkTrace = supplyInfoList[i].NetworkTrace
data.CreateAddress = supplyInfoList[i].CreateAddress
data.Url = supplyInfoList[i].Url
data.Types = supplyInfoList[i].Types
data.Remark = supplyInfoList[i].Remark
data.Remark2 = supplyInfoList[i].Remark2
data.Enable = supplyInfoList[i].Enable
datas = append(datas, data)
}
rep.Data = datas
return
}
func GetSupplyInfo(req *supplyinfo.GetSupplyInfoRequest) (rep *supplyinfo.GetSupplyInfoData, err error) {
rep = &supplyinfo.GetSupplyInfoData{}
var supplyInfoTmp model.SupplyInfo
if err := db.DB.Where("id = ?", req.Id).Find(&supplyInfoTmp).Error; err != nil {
zap.L().Error("get supplyInfo infos err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
rep.ID = uint64(supplyInfoTmp.ID)
rep.ArtworkId = supplyInfoTmp.ArtworkId
rep.ArtistId = supplyInfoTmp.ArtistId
rep.UserId = uint64(supplyInfoTmp.UserId)
rep.Name = supplyInfoTmp.Name
rep.ModelYear = supplyInfoTmp.ModelYear
rep.Photo = supplyInfoTmp.Photo
rep.ArtistPhoto = supplyInfoTmp.ArtistPhoto
rep.Width = uint64(supplyInfoTmp.Width)
rep.Height = uint64(supplyInfoTmp.Height)
rep.Ruler = uint64(supplyInfoTmp.Ruler)
rep.ExhibitInfo = supplyInfoTmp.ExhibitInfo
rep.ExhibitPic1 = supplyInfoTmp.ExhibitPic1
rep.ExhibitPic2 = supplyInfoTmp.ExhibitPic2
rep.CreateTime = supplyInfoTmp.CreateTime
rep.Introduct = supplyInfoTmp.Introduct
rep.NetworkTrace = supplyInfoTmp.NetworkTrace
rep.CreateAddress = supplyInfoTmp.CreateAddress
rep.Url = supplyInfoTmp.Url
rep.Types = supplyInfoTmp.Types
rep.Remark = supplyInfoTmp.Remark
rep.Remark2 = supplyInfoTmp.Remark2
rep.Enable = supplyInfoTmp.Enable
return
}
func UpdateSupplyInfo(req *supplyinfo.UpdateSupplyInfoRequest) (rep *supplyinfo.UpdateSupplyInfoRespond, err error) {
var SupplyInfo model.SupplyInfo
if err := db.DB.Where("id = ? ", req.ID).Find(&SupplyInfo).Error; err != nil {
zap.L().Error("get supplyInfo info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
SupplyInfo.CreateTime = req.CreateTime
SupplyInfo.ModelYear = req.ModelYear
SupplyInfo.NetworkTrace = req.NetworkTrace
SupplyInfo.Url = req.Url
SupplyInfo.Introduct = req.Introduct
SupplyInfo.Types = req.Types
SupplyInfo.ExhibitInfo = req.ExhibitInfo
SupplyInfo.ExhibitPic1 = req.ExhibitPic1
SupplyInfo.ExhibitPic2 = req.ExhibitPic2
if err = db.DB.Save(&SupplyInfo).Error; err != nil {
zap.L().Error("save supplyInfo info err", zap.Error(err))
err = errors.New(m.SAVE_ERROR)
return
}
return
}
func GetVideoList(id int32) (rep *supplyinfo.GetVideoListRespond, err error) {
rep = &supplyinfo.GetVideoListRespond{}
var datas []*supplyinfo.GetVideoListData
var ExhVideo []model.ExhVideo
if err := db.DB.Where("user_id = ? and types <=4", id).Find(&ExhVideo).Error; err != nil {
zap.L().Error("get exhVideo infos err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
for _, v := range ExhVideo {
var data supplyinfo.GetVideoListData
data.ID = uint64(v.ID)
data.UserId = uint64(v.UserId)
data.Url = v.Url
data.Types = v.Types
data.Remark = v.Remark
data.Remark2 = v.Remark2
data.Enable = v.Enable
datas = append(datas, &data)
}
rep.Data = datas
return
}
func GetVideo(req *supplyinfo.GetVideoRequest) (rep *supplyinfo.GetVideoListData, err error) {
rep = &supplyinfo.GetVideoListData{}
var ExhVideo model.ExhVideo
if err := db.DB.Where("id = ?", req.ID).First(&ExhVideo).Error; err != nil {
zap.L().Error("get exhVideo info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
rep.ID = uint64(ExhVideo.ID)
rep.UserId = uint64(ExhVideo.UserId)
rep.Url = ExhVideo.Url
rep.Types = ExhVideo.Types
rep.Remark = ExhVideo.Remark
rep.Remark2 = ExhVideo.Remark2
rep.Enable = ExhVideo.Enable
return
}
func UpdateVideo(req *supplyinfo.UpdateVideoRequest) (rep *supplyinfo.UpdateVideoRespond, err error) {
rep = &supplyinfo.UpdateVideoRespond{}
var ExhVideo model.ExhVideo
if err := db.DB.Where("id = ? ", req.ID).First(&ExhVideo).Error; err != nil {
zap.L().Error("get exhVideo info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
ExhVideo.Url = req.Url
ExhVideo.Types = req.Types
if err := db.DB.Save(&ExhVideo).Error; err != nil {
zap.L().Error("save exhVideo info err", zap.Error(err))
err = errors.New(m.SAVE_ERROR)
return nil, err
}
return
}
func GetExam(req *supplyinfo.GetExamRequest) (rep *supplyinfo.GetExamListData, err error) {
rep = &supplyinfo.GetExamListData{}
var ExhExam model.ExhExam
if err := db.DB.Where("id = ?", req.ID).First(&ExhExam).Error; err != nil {
zap.L().Error("get exhVideo info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
rep.ID = uint64(ExhExam.ID)
rep.UserId = uint64(ExhExam.UserId)
rep.Title = ExhExam.Title
rep.Class = ExhExam.Class
rep.TitleScore = uint64(ExhExam.TitleScore)
rep.Score = ExhExam.Score
rep.Types = ExhExam.Types
rep.Remark = ExhExam.Remark
rep.Remark2 = ExhExam.Remark2
rep.Enable = ExhExam.Enable
return
}
func GetExamList(req *supplyinfo.GetExamListRequest) (rep *supplyinfo.GetExamListRespond, err error) {
rep = &supplyinfo.GetExamListRespond{}
var datas []*supplyinfo.GetExamListData
var ExhExam []model.ExhExam
if err := db.DB.Where("user_id = ? and types <=4", req.ID).Find(&ExhExam).Error; err != nil {
zap.L().Error("get exhVideo infos err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
for _, v := range ExhExam {
var data supplyinfo.GetExamListData
data.ID = uint64(v.ID)
data.UserId = uint64(v.UserId)
data.Title = v.Title
data.Class = v.Class
data.TitleScore = uint64(v.TitleScore)
data.Score = v.Score
data.Types = v.Types
data.Remark = v.Remark
data.Remark2 = v.Remark2
data.Enable = v.Enable
datas = append(datas, &data)
}
rep.Data = datas
return
}
func UpdateExam(req *supplyinfo.UpdateExamRequest) (rep *supplyinfo.UpdateExamRespond, err error) {
rep = &supplyinfo.UpdateExamRespond{}
var ExhExam model.ExhExam
if err := db.DB.Where("id = ? ", req.ID).First(&ExhExam).Error; err != nil {
zap.L().Error("get exhVideo info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
ExhExam.Score = req.Score
ExhExam.Class = req.Class
ExhExam.Types = req.Types
ExhExam.Title = req.Title
ExhExam.Class = req.Class
ExhExam.TitleScore = uint(req.TitleScore)
ExhExam.Score = req.Score
ExhExam.Types = req.Types
ExhExam.Remark = req.Remark
ExhExam.Remark2 = req.Remark2
var score map[string]int32
var titleScore int32
json.Unmarshal([]byte(req.Score), &score)
for _, v := range score {
titleScore = titleScore + v
}
ExhExam.TitleScore = uint(titleScore)
if err = db.DB.Save(&ExhExam).Error; err != nil {
zap.L().Error("save supplyInfo info err", zap.Error(err))
err = errors.New(m.SAVE_ERROR)
return
}
if req.Types == "2" {
type titleScore struct {
UserId uint
Score int
}
var tmp []model.ExhExam
if err = db.DB.Where("class = ?", req.Class).Order("title_score desc").Find(&tmp).Error; err != nil {
zap.L().Error("get exhExam infos err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
var ranking int
for k, v := range tmp {
if v.UserId == uint(req.UserId) {
ranking = k
}
}
percent := (ranking + 1) / len(tmp) * 100
rep.Percent = int32(percent)
return
}
return
}
func GetArtistInfoList(id int32) (rep *supplyinfo.GetArtistInfoListRespond, err error) {
rep = &supplyinfo.GetArtistInfoListRespond{}
var datas []*supplyinfo.GetArtistInfoListData
var artistInfoTmp []model.ArtistInfo
if err = db.DB.Where("user_id = ? and state <=4 ", id).Find(&artistInfoTmp).Error; err != nil {
zap.L().Error("get artistInfo infos err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
for k, v := range artistInfoTmp {
artistInfoTmp[k].Model.ID = uint(v.ID)
data := &supplyinfo.GetArtistInfoListData{}
data.ID = uint64(artistInfoTmp[k].ID)
data.UserId = uint64(artistInfoTmp[k].UserId)
data.ArtistId = artistInfoTmp[k].ArtistId
data.BankAccount = artistInfoTmp[k].BankAccount
data.BankName = artistInfoTmp[k].BankName
data.Introduct = artistInfoTmp[k].Introduct
data.CountryArtLevel = artistInfoTmp[k].CountryArtLevel
data.ArtistCertPic = artistInfoTmp[k].ArtistCertPic
data.Remark = artistInfoTmp[k].Remark
data.Remark2 = artistInfoTmp[k].Remark2
data.State = uint64(artistInfoTmp[k].State)
datas = append(datas, data)
}
rep.Data = datas
return
}
func GetArtistInfo(req *supplyinfo.GetArtistInfoRequest) (rep *supplyinfo.GetArtistInfoListData, err error) {
rep = &supplyinfo.GetArtistInfoListData{}
var artistInfoTmp model.ArtistInfo
if err := db.DB.Where("id = ?", req.ID).Find(&artistInfoTmp).Error; err != nil {
zap.L().Error("get artistInfo info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
rep.ID = uint64(artistInfoTmp.ID)
rep.UserId = uint64(artistInfoTmp.UserId)
rep.ArtistId = artistInfoTmp.ArtistId
rep.BankAccount = artistInfoTmp.BankAccount
rep.BankName = artistInfoTmp.BankName
rep.Introduct = artistInfoTmp.Introduct
rep.CountryArtLevel = artistInfoTmp.CountryArtLevel
rep.ArtistCertPic = artistInfoTmp.ArtistCertPic
rep.Remark = artistInfoTmp.Remark
rep.Remark2 = artistInfoTmp.Remark2
rep.State = uint64(artistInfoTmp.State)
return
}
func UpdateArtistInfo(req *supplyinfo.UpdateArtistInfoRequest) (rep *supplyinfo.UpdateArtistInfoRespond, err error) {
rep = &supplyinfo.UpdateArtistInfoRespond{}
var artistInfoTmp model.ArtistInfo
if err := db.DB.Where("id = ? ", req.ID).Find(&artistInfoTmp).Error; err != nil {
zap.L().Error("get artistInfo info err", zap.Error(err))
err = errors.New(m.ERROR_SELECT)
return nil, err
}
artistInfoTmp.BankAccount = req.BankAccount
artistInfoTmp.BankName = req.BankName
artistInfoTmp.Introduct = req.Introduct
artistInfoTmp.State = uint(req.State)
artistInfoTmp.CountryArtLevel = req.CountryArtLevel
artistInfoTmp.ArtistCertPic = req.ArtistCertPic
if err = db.DB.Save(&artistInfoTmp).Error; err != nil {
zap.L().Error("save supplyInfo info err", zap.Error(err))
err = errors.New(m.SAVE_ERROR)
return
}
return
}

View File

@ -0,0 +1,50 @@
package logic
import (
"github.com/fonchain-artistserver/cmd/internal/dao"
"github.com/fonchain-artistserver/pb/artistinfo"
)
type IArtistInfo interface {
RegisterUser(req *artistinfo.RegisterUserRequest) (rep *artistinfo.RegisterUserRespond, err error)
GetUserById(req *artistinfo.GetUserByIdRequest) (rep *artistinfo.GetUserByIdRespond, err error)
GetUser(req *artistinfo.GetUserRequest) (rep *artistinfo.GetUserRespond, err error)
UpdateRealName(req *artistinfo.UpdateRealNameRequest) (rep *artistinfo.UpdateRealNameRespond, err error)
FinishVerify(req *artistinfo.FinishVerifyRequest) (rep *artistinfo.FinishVerifyRespond, err error)
CheckUserLock(req *artistinfo.CheckUserLockRequest) (rep *artistinfo.CheckUserLockRespond, err error)
}
func NewArtistInfo() IArtistInfo {
return &ArtistInfo{}
}
type ArtistInfo struct{}
func (a *ArtistInfo) GetUser(req *artistinfo.GetUserRequest) (rep *artistinfo.GetUserRespond, err error) {
rep, err = dao.GetUser(req)
return
}
func (a *ArtistInfo) RegisterUser(req *artistinfo.RegisterUserRequest) (rep *artistinfo.RegisterUserRespond, err error) {
rep, err = dao.RegisterUser(req)
return
}
func (a *ArtistInfo) GetUserById(req *artistinfo.GetUserByIdRequest) (rep *artistinfo.GetUserByIdRespond, err error) {
rep, err = dao.GetUserById(req)
return
}
func (a *ArtistInfo) UpdateRealName(req *artistinfo.UpdateRealNameRequest) (rep *artistinfo.UpdateRealNameRespond, err error) {
rep, err = dao.UpdateRealName(req)
return
}
func (a *ArtistInfo) FinishVerify(req *artistinfo.FinishVerifyRequest) (rep *artistinfo.FinishVerifyRespond, err error) {
rep, err = dao.FinishVerify(req)
return
}
func (a *ArtistInfo) CheckUserLock(req *artistinfo.CheckUserLockRequest) (rep *artistinfo.CheckUserLockRespond, err error) {
err = dao.CheckUserLock(int64(req.ID))
return
}

View File

@ -0,0 +1,59 @@
package logic
import (
"github.com/fonchain-artistserver/cmd/internal/dao"
"github.com/fonchain-artistserver/pb/artwork"
)
type IArtWork interface {
ArtworkAdd(req *artwork.ArtworkAddRequest) (rep *artwork.ArtworkAddRespond, err error)
UpdateArtwork(req *artwork.UpdateArtworkRequest) (rep *artwork.UpdateArtworkRespond, err error)
DelArtwork(req *artwork.DelArtworkRequest) (rep *artwork.DelArtworkRespond, err error)
GetArtworkList(req *artwork.GetArtworkListRequest) (rep *artwork.GetArtworkListRespond, err error)
GetArtwork(req *artwork.GetArtworkRequest) (rep *artwork.GetArtworkRespond, err error)
UploadArtwork(req *artwork.UploadArtworkRequest) (rep *artwork.UploadArtworkRespond, err error)
}
func NewArtWork() IArtWork {
return &ArtWork{}
}
type ArtWork struct {
}
func (a *ArtWork) ArtworkAdd(req *artwork.ArtworkAddRequest) (rep *artwork.ArtworkAddRespond, err error) {
rep = &artwork.ArtworkAddRespond{}
_, err = dao.ArtworkAdd(req)
return
}
func (a *ArtWork) UpdateArtwork(req *artwork.UpdateArtworkRequest) (rep *artwork.UpdateArtworkRespond, err error) {
err = dao.UpdateArtwork(req)
return
}
func (a *ArtWork) DelArtwork(req *artwork.DelArtworkRequest) (rep *artwork.DelArtworkRespond, err error) {
rep = &artwork.DelArtworkRespond{}
if err = dao.DelArtwork(int32(req.Id)); err != nil {
return
}
return
}
func (a *ArtWork) GetArtworkList(req *artwork.GetArtworkListRequest) (rep *artwork.GetArtworkListRespond, err error) {
rep, err = dao.GetArtworkList(req)
return
}
func (a *ArtWork) GetArtwork(req *artwork.GetArtworkRequest) (rep *artwork.GetArtworkRespond, err error) {
rep, err = dao.GetArtwork(int32(req.ID))
return
}
func (a *ArtWork) UploadArtwork(req *artwork.UploadArtworkRequest) (rep *artwork.UploadArtworkRespond, err error) {
err = dao.UploadArtwork(req.ID)
return
}

View File

@ -0,0 +1,67 @@
package logic
import (
"github.com/fonchain-artistserver/cmd/internal/dao"
"github.com/fonchain-artistserver/pb/contract"
)
type IContract interface {
FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error)
ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error)
ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error)
UpdateContract(req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error)
UpdateContractTx(req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error)
GetContract(req *contract.GetContractRequest) (rep *contract.ContractData, err error)
}
func NewContract() IContract {
return &Contract{}
}
type Contract struct {
}
func (a *Contract) FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error) {
rep = &contract.FinishContractRespond{}
err = dao.FinishContract(req.TransactionId)
if err != nil {
return nil, err
}
return
}
func (a *Contract) ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
rep, err = dao.ContractList(req)
return
}
func (a *Contract) GetContract(req *contract.GetContractRequest) (rep *contract.ContractData, err error) {
rep, err = dao.GetContract(int32(req.Id))
return
}
func (a *Contract) ContractTxList(req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
rep, err = dao.ContractTxList(req)
return
}
func (a *Contract) UpdateContract(req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error) {
rep = &contract.UpdateContractRespond{}
err = dao.UpdateContract(req)
return
}
func (a *Contract) UpdateContractTx(req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error) {
rep = &contract.UpdateContractTxRespond{}
err = dao.UpdateContractTx(req.TransactionId, int32(req.ID))
return
}

View File

@ -0,0 +1,88 @@
package logic
import (
"github.com/fonchain-artistserver/cmd/internal/dao"
"github.com/fonchain-artistserver/pb/supplyinfo"
)
type ISupply interface {
GetSupplyInfoList(req *supplyinfo.GetSupplyInfoListRequest) (rep *supplyinfo.GetSupplyInfoListRespond, err error)
GetSupplyInfo(req *supplyinfo.GetSupplyInfoRequest) (rep *supplyinfo.GetSupplyInfoData, err error)
UpdateSupplyInfo(req *supplyinfo.UpdateSupplyInfoRequest) (rep *supplyinfo.UpdateSupplyInfoRespond, err error)
GetVideoList(req *supplyinfo.GetVideoListRequest) (rep *supplyinfo.GetVideoListRespond, err error)
GetVideo(req *supplyinfo.GetVideoRequest) (rep *supplyinfo.GetVideoListData, err error)
UpdateVideo(req *supplyinfo.UpdateVideoRequest) (rep *supplyinfo.UpdateVideoRespond, err error)
GetExam(req *supplyinfo.GetExamRequest) (rep *supplyinfo.GetExamListData, err error)
GetExamList(req *supplyinfo.GetExamListRequest) (rep *supplyinfo.GetExamListRespond, err error)
UpdateExam(req *supplyinfo.UpdateExamRequest) (rep *supplyinfo.UpdateExamRespond, err error)
GetArtistInfoList(req *supplyinfo.GetArtistInfoListRequest) (rep *supplyinfo.GetArtistInfoListRespond, err error)
GetArtistInfo(req *supplyinfo.GetArtistInfoRequest) (rep *supplyinfo.GetArtistInfoListData, err error)
UpdateArtistInfo(req *supplyinfo.UpdateArtistInfoRequest) (rep *supplyinfo.UpdateArtistInfoRespond, err error)
}
func NewSupply() ISupply {
return &Supply{}
}
type Supply struct {
}
func (a *Supply) GetSupplyInfoList(req *supplyinfo.GetSupplyInfoListRequest) (rep *supplyinfo.GetSupplyInfoListRespond, err error) {
rep, err = dao.GetSupplyInfoList(int32(req.ArtistId), int32(req.Types))
return
}
func (a *Supply) GetSupplyInfo(req *supplyinfo.GetSupplyInfoRequest) (rep *supplyinfo.GetSupplyInfoRespond, err error) {
rep, err = dao.GetSupplyInfo(req)
return
}
func (a *Supply) UpdateSupplyInfo(req *supplyinfo.UpdateSupplyInfoRequest) (rep *supplyinfo.UpdateSupplyInfoRespond, err error) {
rep, err = dao.UpdateSupplyInfo(req)
return
}
func (a *Supply) GetVideoList(req *supplyinfo.GetVideoListRequest) (rep *supplyinfo.GetVideoListRespond, err error) {
rep, err = dao.GetVideoList(req.Id)
return
}
func (a *Supply) GetVideo(req *supplyinfo.GetVideoRequest) (rep *supplyinfo.GetVideoRespond, err error) {
rep, err = dao.GetVideo(req)
return
}
func (a *Supply) UpdateVideo(req *supplyinfo.UpdateVideoRequest) (rep *supplyinfo.UpdateVideoRespond, err error) {
rep, err = dao.UpdateVideo(req)
return
}
func (a *Supply) GetExam(req *supplyinfo.GetExamRequest) (rep *supplyinfo.GetExamRespond, err error) {
rep, err = dao.GetExam(req)
return
}
func (a *Supply) GetExamList(req *supplyinfo.GetExamListRequest) (rep *supplyinfo.GetExamListRespond, err error) {
rep, err = dao.GetExamList(req)
return
}
func (a *Supply) UpdateExam(req *supplyinfo.UpdateExamRequest) (rep *supplyinfo.UpdateExamRespond, err error) {
rep, err = dao.UpdateExam(req)
return
}
func (a *Supply) GetArtistInfoList(req *supplyinfo.GetArtistInfoListRequest) (rep *supplyinfo.GetArtistInfoListRespond, err error) {
rep, err = dao.GetArtistInfoList(req.Id)
return
}
func (a *Supply) GetArtistInfo(req *supplyinfo.GetArtistInfoRequest) (rep *supplyinfo.GetArtistInfoRespond, err error) {
rep, err = dao.GetArtistInfo(req)
return
}
func (a *Supply) UpdateArtistInfo(req *supplyinfo.UpdateArtistInfoRequest) (rep *supplyinfo.UpdateArtistInfoRespond, err error) {
rep, err = dao.UpdateArtistInfo(req)
return
}

View File

@ -0,0 +1,4 @@
{"level":"\u001b[34mINFO\u001b[0m","time":"2022-12-02T11:22:57.799+0800","caller":"config/root_config.go:150","message":"[Config Center] Config center doesn't start"}
{"level":"\u001b[34mINFO\u001b[0m","time":"2022-12-02T11:24:08.395+0800","caller":"config/root_config.go:150","message":"[Config Center] Config center doesn't start"}
{"level":"\u001b[34mINFO\u001b[0m","time":"2022-12-02T11:39:34.056+0800","caller":"config/root_config.go:150","message":"[Config Center] Config center doesn't start"}
{"level":"\u001b[34mINFO\u001b[0m","time":"2022-12-02T11:48:17.606+0800","caller":"config/root_config.go:150","message":"[Config Center] Config center doesn't start"}

21
cmd/model/artistinfo.go Normal file
View File

@ -0,0 +1,21 @@
package model
import (
"gorm.io/gorm"
)
//User 用户模型
type ArtistInfo struct {
gorm.Model
ID uint `gorm:"not null" json:"id"`
UserId uint `gorm:"not null default:0" json:"userId"`
ArtistId string `gorm:"type:varchar(256) default ''" json:"artistId"`
BankAccount string `gorm:"type:varchar(25) not null" json:"bankAccount"`
BankName string `gorm:"type:varchar(25) not null" json:"bankName"`
Introduct string `gorm:"type:text not null" json:"introduct"`
CountryArtLevel string `gorm:"type:varchar(256) default ''" json:"countryArtLevel"`
ArtistCertPic string `gorm:"type:varchar(256) default ''" json:"artistCertPic"`
Remark string `gorm:"type:varchar(256) default ''" json:"remark"`
Remark2 string `gorm:"type:varchar(256) default ''" json:"remark2"`
State uint `gorm:"not null default:0" json:"state"`
}

156
cmd/model/artwork.go Normal file
View File

@ -0,0 +1,156 @@
package model
import (
"gorm.io/gorm"
)
// User 用户模型
type Artwork struct {
gorm.Model
ID int32 `gorm:"not null" json:"id"`
ArtistId int32 `gorm:"not null" json:"artistId"`
Name string `gorm:"type:varchar(256) not null" json:"name"`
ArtworkId string `gorm:"type:varchar(256) default ''" json:"artworkId"`
ModelYear string `gorm:"type:varchar(256) not null" json:"modelYear"`
Photo string `gorm:"type:varchar(1024) not null" json:"photo"`
BatchId int32 `gorm:"not null" json:"batchId"`
ArtistPhoto string `gorm:"type:varchar(1024) not null" json:"artistPhoto"`
CreateAddress string `gorm:"type:varchar(256) not null" json:"createAddress"`
Width int32 `gorm:"not null" json:"width"`
Height int32 `gorm:"not null" json:"height"`
Ruler int32 `gorm:"not null" json:"ruler"`
AgeOfCreation string `gorm:"type:varchar(56) default ''" json:"ageOfCreation"`
CreateTime string `gorm:"type:varchar(20) not null" json:"createTime"`
Introduct string `gorm:"type:varchar(2048) not null" json:"introduct"`
NetworkTrace bool `gorm:"not null" json:"networkTrace"`
FlowState int32 `gorm:"default 0"`
Url string `gorm:"type:varchar(512) not null" json:"url"`
Remark string `gorm:"type:varchar(256) default ''" json:"remark"`
Remark2 string `gorm:"type:varchar(256) default ''" json:"remark2"`
State int32 `gorm:"not null" json:"state"` //1未上传2已上传3已通过4未通过
}
type ArtworkStateService struct {
ID int32 `form:"id" json:"id"`
ArtworkId int32 `form:"artworkId" json:"artworkId"`
State int32 `form:"state" json:"state"`
Pic string `form:"pic" json:"pic"`
}
type ArtworkStateData struct {
State int32 `json:"state"`
Timestamp string `json:"timestamp"`
Pic string `json:"pic"`
}
// 画作
type ArtworkList struct {
Uid string `json:"uid"` //画作唯一标志
Seqnum string `json:"seqnum2"`
TFnum string `json:"tfnum"` // 泰丰编号
Num int64 `json:"seqnum"` // 画作序号从1开始自增以批次为单位
ArtistId string `json:"artistId"` //画家id
ArtistName string `json:"artistName"` //画家名
BatchId string `json:"batchId"` //批次id
BatchNum int64 `json:"batchNum"` //批次号
BatchType int64 `json:"batchType"` //批次类型
OutBatchId string `json:"outBatchId"` // 出库批次id
IsOutbound int64 `json:"isOutbound"` // 是否出库1-已出库2-未出库
//泰丰,丰链公共字段
Name string `json:"name"` //画作名称
CopyrightName string `json:"copyrightName"`
Belong int64 `json:"belong"` //画作隶属1-泰丰2-丰链
ArtistPhoto string `json:"artistPhoto"` //画家与画作合影
SmallPic string `json:"smallPic"` //画作小图
SmallPicArtist string `json:"smallPicArtist"` //画作小图画家提供
PhotoPic string `json:"photoPic"` //手机拍摄图(信息登记人员内部拍摄)
IsSign int64 `json:"isSign"` //是否有落款1-有2-无
IsSeal int64 `json:"isSeal"` //是否有人名章1-有2-无
Quality int64 `json:"quality"` //画作品相1-完好2-有破损3-其他
IncompletePic string `json:"incompletePic"` // 残缺图片url
CopyrightPic string `json:"copyrightPic"` // 版权图
Length int64 `json:"length"` //画作长度,厘米
Width int64 `json:"width"` //画作宽度,厘米
Ruler int64 `json:"ruler"` //画作平尺数
ModelYear string `json:"modelYear"` //年款
NetworkTrace *NetworkTrace `json:"networkTrace"` //网络痕迹
ArtworkState int64 `json:"artworkState"` //实体画作状态1-丰链2-托裱3-泰丰,4-其他
PhotoState *PhotoState `json:"photoState"` //拍摄情况
ArtworkPic string `json:"artworkPic"` //图片上传
Hash *Hash `json:"hash"` //哈希值登记
Copyright *Copyright `json:"copyright"` //版权登记
IsExcellentArtwork int64 `json:"isExcellent"` //是否优秀画作1-是2-否(优秀画作将留在丰链)
ScreenNum int64 `json:"screenNum"` //条屏数量
Abstract string `json:"abstract"` // 简介
MountMode string `json:"mountMode"` // 装裱方式
Material string `json:"material"` // 画作材质
SignPic string `json:"signPic"` // 落款图
SealPic string `json:"sealPic"` // 人名章图
SignDate string `json:"signDate"` // 签约日期
CreatedDate string `json:"createDate"` // 创作日期
CreatedAddress string `json:"createAddress"` // 创作地点
//优秀画作是从泰丰批次中选一个出来的
//丰链独有字段
ArriveTime string `json:"arriveTime"` //画作到达时间,精确到日
ArtworkType int64 `json:"artworkType"` //画作类型1-优秀画作2-赠画3-卷轴4-普通画作
GiftInfo string `json:"giftInfo"` //赠画信息
Scroll *Scroll `json:"scroll"` //卷轴信息
Resume string `json:"resume"` //画家简介
RecentPhoto string `json:"recentPhoto"` // 画家近照url
Comment string `json:"comment"` // 画作备注
// 6.7
ArtCat string `json:"artCat"` // 艺术类别
ArtMeansOfExpression string `json:"artMeansOfExpression"` // 表现形式
ArtSub string `json:"artSub"` // 艺术主题
ArtStyle string `json:"artStyle"` // 风格
ArtColor string `json:"artColor"` // 颜色
Size string `json:"size"` // 画作尺寸描述 {"1":"大","2":"中","3":"小"}
ArtHorizontal string `json:"artHorizontal"` // 幅式
TagIds []string `json:"tagIds"` // 艺术品标签 逗号隔开
Aucrecords string `json:"aucrecords"`
PastCollectors string `json:"pastCollectors"`
Pastpub string `json:"pastpub"`
PastTradFroms string `json:"pastTradFroms"`
// 画家提供名称
CustomName string `json:"customName"`
BatchState string `json:"batchState"` //画作已入库图片
DigitizationState string `json:"digitizationState"` //画作已数字化图片
AuthenticateState string `json:"authenticateState"` //已鉴证
}
type NetworkTrace struct {
IsExist int64 `json:"isExist"` //1-有2-无3-有痕已无
FirstPublic string `json:"firstPublic"` //首次发表url
FirstName string `json:"firstName"` //首次命名url
Comment string `json:"comment"`
}
type PhotoState struct {
IsPhoto int `json:"isPhoto"` //是否已拍摄1-是2-否
PhotoTime string `json:"photoTime"` //拍摄日期
Comment string `json:"comment"` //备注
}
type Hash struct {
PropertyHash string `json:"property"` //物权哈希值
CopyrightHash string `json:"copyright"` //版权哈希值
PropertyHashLocation string `json:"pLocation"` //物权哈希值位置
PropertyHashContext string `json:"pComment"` //物权哈希值备注
}
type Copyright struct {
Proxy string `json:"proxy"` //画作授权委托书扫描件jpgpdf
CopyrightCert string `json:"cert"` //版权证书pdf
Type int64 `json:"type"` //版权类型1-国家版权2-江苏省版权
}
type Scroll struct {
IsNew int64 `json:"isNew"` //新卷轴还是老卷轴1-新2-旧
SendTime string `json:"sendTime"` //寄出卷轴日期
SendNum string `json:"sendNum"` //寄出卷轴单号
ReceiveTime string `json:"receiveTime"` //收到卷轴日期
ReceiveNum string `json:"receiveNum"` //收到卷轴单号
}

14
cmd/model/artworkbatch.go Normal file
View File

@ -0,0 +1,14 @@
package model
import (
"gorm.io/gorm"
)
//User 用户模型
type ArtworkBatch struct {
gorm.Model
ID int32 `gorm:"not null"`
BatchId int32 `gorm:"not null"`
ArtistId int32 `gorm:"not null"`
State int32 `gorm:"not null"`
}

14
cmd/model/artworkstate.go Normal file
View File

@ -0,0 +1,14 @@
package model
import (
"gorm.io/gorm"
)
//考核 用户模型
type ArtworkState struct {
gorm.Model
ID int32 `gorm:"not null"`
ArtworkId int32 `gorm:"default:0"`
State int32 `gorm:"default:0"`
Pic string `gorm:"type:varchar(256) default ''"`
}

15
cmd/model/bank.go Normal file
View File

@ -0,0 +1,15 @@
package model
import (
"gorm.io/gorm"
)
//User 用户模型
type Bank struct {
gorm.Model
ID int32 `gorm:"not null"`
UserId int32 `gorm:" not null"`
BankAccount string `gorm:"type:varchar(25) not null"`
BankName string `gorm:"type:varchar(25) not null"`
Enable bool `gorm:"not null"`
}

102
cmd/model/contract.go Normal file
View File

@ -0,0 +1,102 @@
package model
import (
"gorm.io/gorm"
)
// Contract 用户模型
type Contract struct {
gorm.Model
ID int32 `gorm:"not null"`
UserId int32 `gorm:"not null"`
CardId string `gorm:"type:varchar(256) default ''"`
MgmtUserId string `gorm:"not null"`
ArtworkId string `gorm:"type:varchar(256) default ''"`
ContractId string `gorm:"type:varchar(256) default ''"`
TransactionId string `gorm:"type:varchar(256) default '' "`
Type int32 `gorm:"not null"`
BatchId int32 `gorm:"not null"`
BatchName string `gorm:"type:varchar(256) default '' "`
ViewUrl string `gorm:"type:varchar(256) default ''"`
DownloadUrl string `gorm:"type:varchar(256) default ''"`
State int32 `gorm:"not null"`
}
type Reply struct {
Code int `json:"state"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
type ArtistInfoRes struct {
Uid string `json:"uid"`
Seqnum int64 `json:"seqnum"` // 序列号
Tnum string `json:"tnum"` //ex.T240
Num int `json:"num"` // 编号
Name string `json:"name"`
CardId string `json:"cardId"`
PhoneNum string `json:"phone"`
Gender string `json:"gender"` // 性别
Belong int `json:"belong"` // 画家归属1-泰丰2-丰链
RecentPhoto string `json:"recentPhoto"` // 画家近照url
AccountBank string `json:"bank"` // 开户银行
Account string `json:"account"` // 开户账号
Video []string `json:"artistVideo"` // 视频资料
ArtshowTimes int64 `json:"artshowTimes"` // 参加画展次数
Age int64 `json:"age"`
Address string `json:"address"`
Resume string `json:"resume"`
CardPicFace string `json:"cardPicFace"`
CardPicBack string `json:"cardPicBack"`
CertificatePic string `json:"certificatePic"`
CertificateNum string `json:"certificateNum"`
// Priority int64 `json:"priority"`
Agent string `json:"agent"`
PenName string `json:"penName"` // 笔名
Comment string `json:"comment"`
WtchainHash string `json:"wtchainHash"`
BaiduchainHash string `json:"baiduchanHash"`
ChengchainHash string `json:"chengchainHash"`
ChengChainCertUrl string `json:"chengChainCertUrl"`
BaiduChainCertUrl string `json:"baiduChainCertUrl"`
ChengChainCertOssUrl string `json:"chengChainCertOssUrl"`
Baiduchaincertossurl string `json:"baiduchaincertossurl"`
IsArtshow bool `json:"isArtshow"` // 是否参加过画展1参加过,2未参加过
CurrentPosition string `json:"currentPosition"` //现任职务
Email string `json:"email"`
TeaRela string `json:"teaRela"` //师
StuRela string `json:"stuRela"` //徒
GradSchoolStudyTour string `json:"gradSchoolStudyTour"` //毕业院校及游学经历
NaTittle string `json:"naTittle"` //国家级头衔
ProTittle string `json:"proTittle"` //省级头衔
MunTittle string `json:"munTittle"` //市级头衔
CouTittle string `json:"couTittle"` //区县级头衔
OtherTittle string `json:"otherTittle"` //其他头衔
PastCooForms string `json:"pastCooForms"` //过往合作平台
ExhibiInfo string `json:"exhibiInfo"` //参展信息
KeyAchi string `json:"keyAchi"` //主要成就
Works string `json:"works"` //作品集
PicAlbum string `json:"picAlbum"` //画册
// AwardInfo []AwardInfo `json:"awardInfo"` //获奖信息
// Publish []Publish `json:"publish"` //出版
// AcadePub []AcadePub `json:"acadePub"` //学术发表
// ThirdComment []ThirdComment `json:"thirdComment"` //第三方或策展人评论
CreaDirect string `json:"creaDirect"` //创作方向(科目)
ArtStyle string `json:"artStyle"` //艺术风格
PenInkSkill string `json:"penInkSkill"` //笔墨技法
DrawThink string `json:"drawThink"` //绘画思想
AcadeValue string `json:"acadeValue"` //学术价值
ArtName string `json:"artName"` // 艺名
JoinClubTime string `json:"joinClubTime"` // 入会时间
ArtistStamp string `json:"artistStamp"` // 画家印章
}
type CreateContractRes struct {
Code string `json:"code"`
Download_url string `json:"download_url"`
Msg string `json:"msg"`
Result string `json:"result"`
Viewpdf_url string `json:"viewpdf_url"`
}

21
cmd/model/exhexam.go Normal file
View File

@ -0,0 +1,21 @@
package model
import (
"gorm.io/gorm"
)
//考核 用户模型
type ExhExam struct {
gorm.Model
ID uint `gorm:"not null"`
UserId uint `gorm:"default:0"`
Title string `gorm:"type:varchar(64) default ''"`
Class string `gorm:"type:varchar(25) default ''"`
TitleScore uint `gorm:"default:0"`
Score string `gorm:"type:varchar(1024) default ''"`
Types string `gorm:"type:varchar(25) default ''"`
Remark string `gorm:"type:varchar(1024) default ''" json:"remark"`
Remark2 string `gorm:"type:varchar(1024) default ''" json:"remark2"`
Enable bool `gorm:"default:0"`
}

17
cmd/model/exhvideo.go Normal file
View File

@ -0,0 +1,17 @@
package model
import (
"gorm.io/gorm"
)
//User 用户模型
type ExhVideo struct {
gorm.Model
ID uint `gorm:"not null "`
UserId uint `gorm:"not null default:0"`
Url string `gorm:"type:varchar(256) default ''"`
Types string `gorm:"type:varchar(25) default ''"`
Remark string `gorm:"type:varchar(1024) default ''" json:"remark"`
Remark2 string `gorm:"type:varchar(1024) default ''" json:"remark2"`
Enable bool `gorm:"default:false"`
}

23
cmd/model/invite.go Normal file
View File

@ -0,0 +1,23 @@
package model
import (
"gorm.io/gorm"
)
// User 用户模型
type Invite struct {
gorm.Model
ID int32 `gorm:"not null default 0"`
UserId int32 `gorm:"not null default 0"`
InvitedId int32 `gorm:"not null default 0"`
}
type InvitedCodeService struct {
InvitedCode string `form:"invitedCode" json:"invitedCode"`
}
type InviteService struct {
Id int32 `json:"id"`
UserId int32 `form:"userId" json:"userId"`
InvitedId int32 `form:"invitedId" json:"invitedId"`
}

15
cmd/model/real_name.go Normal file
View File

@ -0,0 +1,15 @@
package model
import (
"gorm.io/gorm"
)
//实名认证模型
type RealName struct {
gorm.Model
Name string `gorm:"not null"`
IDNum string `gorm:"type:varchar(18) not null"`
TelNum string `gorm:"type:varchar(11) not null"`
IdcardFront string `gorm:"type:varchar(256) not null"`
IdcardBack string `gorm:"type:varchar(256) not null"`
}

35
cmd/model/supplyinfo.go Normal file
View File

@ -0,0 +1,35 @@
package model
import (
"gorm.io/gorm"
)
//User 用户模型
type SupplyInfo struct {
gorm.Model
ID uint `gorm:"not null"`
ArtworkId string `gorm:"type:varchar(256) default ''"`
ArtistId string `gorm:"type:varchar(256) default ''"`
UserId uint `gorm:" not null"`
Name string `gorm:"type:varchar(256) default ''"`
ModelYear string `gorm:"type:varchar(256) default ''"`
Photo string `gorm:"type:varchar(2048) default ''"`
ArtistPhoto string `gorm:"type:varchar(2048) default ''"`
Width uint `gorm:"default:0"`
Height uint `gorm:"default:0"`
Ruler uint `gorm:"default:0"`
ExhibitInfo string `gorm:"type:varchar(1024) default ''"`
ExhibitPic1 string `gorm:"type:varchar(1024) default ''"`
ExhibitPic2 string `gorm:"type:varchar(1024) default ''"`
CreateTime string `gorm:"type:varchar(20) default ''"`
Introduct string `gorm:"type:varchar(2048) default ''"`
NetworkTrace bool `gorm:"default:false"`
CreateAddress string `gorm:"type:varchar(256) not null" json:"createAddress"`
Url string `gorm:"type:varchar(1024) default ''"`
Types string `gorm:"type:varchar(25) default ''"`
Remark string `gorm:"type:varchar(1024) default ''" json:"remark"`
Remark2 string `gorm:"type:varchar(1024) default ''" json:"remark2"`
Enable bool `gorm:"default:false"`
}

43
cmd/model/user.go Normal file
View File

@ -0,0 +1,43 @@
package model
import (
"gorm.io/gorm"
)
// User 用户模型
type User struct {
gorm.Model
ID uint64 `gorm:"not null"`
MgmtUserId uint64 `gorm:"not null"`
MgmtArtistId string `gorm:"type:varchar(256) not null"`
Account string `gorm:"type:varchar(256) not null"`
MnemonicWords string `gorm:"type:varchar(256) not null"`
TelNum string `gorm:"type:varchar(20) not null"`
Name string `gorm:"type:varchar(20) not null"`
PenName string `gorm:"type:varchar(20) not null"`
StageName string `gorm:"type:varchar(20) not null"`
JoinAssoTime string `gorm:"type:varchar(64) not null"`
CertificateNum string `gorm:"type:varchar(16) not null"`
CertificateImg string `gorm:"type:varchar(512) not null"`
Key string `gorm:"type:varchar(16) not null"`
RealNameID int32 `gorm:"not null"`
IDNum string `gorm:"type:varchar(18) not null"`
Sex int32 `gorm:"not null"`
Ruler int64 `gorm:"not null"`
OpenId string `gorm:"type:varchar(2048) not null"`
CustomerId string `gorm:"type:varchar(2048) not null"`
Age int32 `gorm:"not null"`
Introduct string `gorm:"type:varchar(2048) not null"`
CreateAt int64 `gorm:"not null"`
ConAddress string `gorm:"type:varchar(2048) not null"`
Photo string `gorm:"type:varchar(2048) not null"`
Video string `gorm:"type:varchar(256) not null"`
IsRealName int64 `gorm:"not null"`
IsFdd int64 `gorm:"not null"`
WxAccount string `gorm:"type:varchar(256) not null"`
IsLock bool `gorm:"not null"`
InvitedCode string `gorm:"type:varchar(16) default ''"`
IsRead int32 `gorm:"not null"`
IsImport int32 `gorm:"not null"`
Enable bool `gorm:"not null"`
}

14
cmd/model/user_invited.go Normal file
View File

@ -0,0 +1,14 @@
package model
import (
"gorm.io/gorm"
)
//User 用户模型
type UserInvited struct {
gorm.Model
ID int32 `gorm:"not null"`
UserId int32 `gorm:"type:int not null"`
InvitedUserId int32 `gorm:"type:int not null"`
Count int32 `gorm:"type:int not null"`
}

View File

@ -0,0 +1,30 @@
package model
// 用户修改信息的服务
type UserUpdateInfoService struct {
TelNum string `form:"telNum" json:"telNum" binding:"required,len=11"`
CertificateNum string `form:"certificateNum" json:"certificateNum" binding:"required"`
CertificateImg string `form:"certificateImg" json:"certificateImg" `
JoinAssoTime string `from:"joinAssoTime" json:"joinAssoTime"`
RealName string `form:"realName" json:"realName" binding:"required"`
PenName string `form:"penName" json:"penName"`
StageName string `form:"stageName" json:"stageName"`
Sex int32 `form:"sex" json:"sex"`
IdCard string `form:"idCard" json:"idCard" binding:"required"`
IdCardFront string `form:"idCardFront" json:"idCardFront" binding:"required"`
IdCardBack string `form:"idCardBack" json:"idCardBack" binding:"required"`
Age int32 `form:"age" json:"age"`
Ruler int32 `form:"ruler" json:"ruler"`
ConAddress []string `form:"conAddress" json:"conAddress"`
Photo string `form:"photo" json:"photo" binding:"required"`
Video string `form:"video" json:"video"`
FddState int32 `form:"fddState" json:"fddState"`
CustomerId string `form:"customerId" json:"customerId"`
InvitedCode string `form:"invitedCode" json:"invitedCode"`
InvitedName string `form:"invitedName" json:"invitedName"`
WxAccount string `form:"wxAccount" json:"wxAccount"`
QrCodeImg string `form:"qrCode" json:"qrCodeImg"`
QrCodeImgDownload string `form:"qrCodeDownload" json:"qrCodeImgDownload"`
HtmlType string `form:"htmlType" json:"htmlType"`
EnvType string `form:"envType" json:"envType"`
}

29
conf/conf.ini Normal file
View File

@ -0,0 +1,29 @@
[system]
mode = dev #正式prod #测试dev
[mysql]
Db = mysql
DbHost = 121.229.45.214
DbPort = 9007
DbUser = artuser
DbPassWord = "C250PflXIWv2SQm8"
DbName = artistmgmt
[redis]
RedisDB = 2
RedisAddr = 172.16.100.99:9008
RedisPW = "nDCTrfTtBu3Pw"
RedisDBNAme =
[chain]
IP=127.0.0.1:37101
MnemonicWords=知 睡 迷 纤 纲 耀 镜 婆 渡 考 拔 百
ContractAccount=XC8214684261867838@xuper
ContractName=fp001
[zap_log]
level: "info"
filename: "logs/artist_server.log"
max_size: 200
max_age: 30
max_backups: 7

29
conf/dev/conf.ini Normal file
View File

@ -0,0 +1,29 @@
[system]
mode = dev #正式prod #测试dev
[mysql]
Db = mysql
DbHost = 127.0.0.1
DbPort = 3306
DbUser = dyb
DbPassWord = rootdyb
DbArtist = artist
[redis]
RedisDB = 2
RedisAddr = 127.0.0.1:6379
RedisPW = "7532T6R"
RedisDBNAme =
[chain]
IP=127.0.0.1:37101
MnemonicWords=知 睡 迷 纤 纲 耀 镜 婆 渡 考 拔 百
ContractAccount=XC8214684261867838@xuper
ContractName=fp001
[zap_log]
level: "info"
filename: "logs/artist_server.log"
max_size: 200
max_age: 30
max_backups: 7

69
conf/dev/dubbogo.yaml Normal file
View File

@ -0,0 +1,69 @@
dubbo:
metrics:
enable: true # default is true
path: /metrics # default is /metrics
port: 9091 # default is 9090
namespace: dubboArtist # default is dubbo 作为数据上报 metrics 的前缀
registries:
demoZK:
protocol: zookeeper
# timeout: 3s
address: 127.0.0.1:2181
protocols:
triple: #triple
name: tri
port: 20004
provider:
services:
ArtistProvider:
interface: com.fontree.microservices.common.Artist
retries: 0
# filter: myServerFilter
# application: "1234"
filter: tps
tps.limiter: method-service
tps.limit.strategy: fixedWindow
tps.limit.rejected.handler: DefaultValueHandler
tps.limit.interval: 1000
tps.limit.rate: 3
warmup: 100 #预热时间
logger:
zap-config:
level: info # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "logs/artist_server.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 10
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 15
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 10
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

18
conf/dev/sdk.real.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "39.156.69.83:37100"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: aB2hpHnTBDxko3UoP2BpBZRujwhdcAFoT
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: jknGxa6eyum1JrATWvSJKW3thJ9GKHA9n
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/dev/sdk.test.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "14.215.179.74:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: true
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: true
# 合规性背书费用
complianceCheckEndorseServiceFee: 100
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: cHvBK1TTB52GYtVxHK7HnW8N9RTqkN99R
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: XDxkpQkfLwG6h56e896f3vBHhuN5g6M9u
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/dev/sdk.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
# endorseServiceHost: "120.48.24.223:37101"
endorseServiceHost: "127.0.0.1:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"

19
conf/dubbogo.yaml Normal file
View File

@ -0,0 +1,19 @@
dubbo:
metrics:
enable: true # default is true
path: /metrics # default is /metrics
port: 9091 # default is 9090
namespace: dubboArtistInfo # default is dubbo 作为数据上报 metrics 的前缀
registries:
demoZK:
protocol: zookeeper
timeout: 3s
address: 127.0.0.1:2181
protocols:
triple: #triple
name: tri
port: 20020
provider:
services:
ArtistInfoProvider:
interface: com.fontree.microservices.common.ArtistInfo

29
conf/prod/conf.ini Normal file
View File

@ -0,0 +1,29 @@
[system]
mode = prod #正式prod #测试dev
[mysql]
Db = mysql
DbHost = 192.168.1.35
DbPort = 9005
DbUser = root
DbPassWord = sLl0b7stlbwvZ883TV
DbArtist = artist
[redis]
RedisDB = 2
RedisAddr = 192.168.1.35:6379
RedisPW =
RedisDBNAme =
[chain]
IP=127.0.0.1:37101
MnemonicWords=知 睡 迷 纤 纲 耀 镜 婆 渡 考 拔 百
ContractAccount=XC8214684261867838@xuper
ContractName=fp001
[zap_log]
level: "info"
filename: "logs/artist_server.log"
max_size: 200
max_age: 30
max_backups: 7

69
conf/prod/dubbogo.yaml Normal file
View File

@ -0,0 +1,69 @@
dubbo:
metrics:
enable: true # default is true
path: /metrics # default is /metrics
port: 9091 # default is 9090
namespace: dubboArtist # default is dubbo 作为数据上报 metrics 的前缀
registries:
demoZK:
protocol: zookeeper
timeout: 3s
address: 192.168.1.35:2181
protocols:
triple: #triple
name: tri
port: 20004
provider:
services:
ArtistProvider:
interface: com.fontree.microservices.common.Artist
retries: 0
filter: tps
# token: "dubbo"
# application: "1234"
tps.limiter: method-service
tps.limit.strategy: fixedWindow
tps.limit.rejected.handler: DefaultValueHandler
tps.limit.interval: 1000
tps.limit.rate: 3
warmup: 100 #预热时间
logger:
zap-config:
level: info # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "logs/artist_server.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 10
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 15
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 10
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

18
conf/prod/sdk.real.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "39.156.69.83:37100"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: aB2hpHnTBDxko3UoP2BpBZRujwhdcAFoT
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: jknGxa6eyum1JrATWvSJKW3thJ9GKHA9n
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/prod/sdk.test.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "14.215.179.74:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: true
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: true
# 合规性背书费用
complianceCheckEndorseServiceFee: 100
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: cHvBK1TTB52GYtVxHK7HnW8N9RTqkN99R
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: XDxkpQkfLwG6h56e896f3vBHhuN5g6M9u
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/prod/sdk.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
# endorseServiceHost: "120.48.24.223:37101"
endorseServiceHost: "127.0.0.1:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"

18
conf/sdk.real.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "39.156.69.83:37100"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: aB2hpHnTBDxko3UoP2BpBZRujwhdcAFoT
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: jknGxa6eyum1JrATWvSJKW3thJ9GKHA9n
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/sdk.test.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "14.215.179.74:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: true
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: true
# 合规性背书费用
complianceCheckEndorseServiceFee: 100
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: cHvBK1TTB52GYtVxHK7HnW8N9RTqkN99R
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: XDxkpQkfLwG6h56e896f3vBHhuN5g6M9u
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/sdk.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
# endorseServiceHost: "120.48.24.223:37101"
endorseServiceHost: "127.0.0.1:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"

29
conf/test/conf.ini Normal file
View File

@ -0,0 +1,29 @@
[system]
mode = dev #正式prod #测试dev
[mysql]
Db = mysql
DbHost = 172.16.100.99 #214
DbPort = 9007
DbUser = artuser
DbPassWord = "C250PflXIWv2SQm8"
DbArtist = artist
[redis]
RedisDB = 2
RedisAddr = 172.16.100.99:9008
RedisPW = "nDCTrfTtBu3Pw"
RedisDBNAme =
[chain]
IP=127.0.0.1:37101
MnemonicWords=知 睡 迷 纤 纲 耀 镜 婆 渡 考 拔 百
ContractAccount=XC8214684261867838@xuper
ContractName=fp001
[zap_log]
level: "info"
filename: "logs/artist_server.log"
max_size: 200
max_age: 30
max_backups: 7

73
conf/test/dubbogo.yaml Normal file
View File

@ -0,0 +1,73 @@
dubbo:
metrics:
enable: true # default is true
path: /metrics # default is /metrics
port: 9091 # default is 9090
namespace: dubboArtist # default is dubbo 作为数据上报 metrics 的前
registries:
demoZK:
protocol: zookeeper
timeout: 3s
# address: 127.0.0.1:2181
# address: 121.229.45.214:9004
# address: 114.218.158.24:2181
address: 172.16.100.93:2181
protocols:
triple: #triple
name: tri
# ip: 121.229.45.214
port: 20004
provider:
services:
ArtistProvider:
interface: com.fontree.microservices.common.Artist
retries: 0
filter: tps
# token: "dubbo"
# application: "1234"
tps.limiter: method-service
tps.limit.strategy: fixedWindow
tps.limit.rejected.handler: DefaultValueHandler
tps.limit.interval: 1000
tps.limit.rate: 3
warmup: 100 #预热时间
logger:
zap-config:
level: info # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "logs/artist_server.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 10
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 15
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 10
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

18
conf/test/sdk.real.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "39.156.69.83:37100"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: aB2hpHnTBDxko3UoP2BpBZRujwhdcAFoT
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: jknGxa6eyum1JrATWvSJKW3thJ9GKHA9n
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/test/sdk.test.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
endorseServiceHost: "14.215.179.74:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: true
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: true
# 合规性背书费用
complianceCheckEndorseServiceFee: 100
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: cHvBK1TTB52GYtVxHK7HnW8N9RTqkN99R
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: XDxkpQkfLwG6h56e896f3vBHhuN5g6M9u
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"
txVersion: 1

18
conf/test/sdk.yaml Normal file
View File

@ -0,0 +1,18 @@
# endorseService Info
# testNet addrs
# endorseServiceHost: "120.48.24.223:37101"
endorseServiceHost: "127.0.0.1:37101"
complianceCheck:
# 是否需要进行合规性背书
isNeedComplianceCheck: false
# 是否需要支付合规性背书费用
isNeedComplianceCheckFee: false
# 合规性背书费用
complianceCheckEndorseServiceFee: 400
# 支付合规性背书费用的收款地址
complianceCheckEndorseServiceFeeAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
# 如果通过合规性检查,签发认证签名的地址
complianceCheckEndorseServiceAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
#创建平行链所需要的最低费用
minNewChainAmount: "100"
crypto: "xchain"

39
go.mod Normal file
View File

@ -0,0 +1,39 @@
module github.com/fonchain-artistserver
go 1.17
replace (
github.com/fonchain/electronic-contract => ../electronic-contract
github.com/fonchain/utils/objstorage => ../utils/objstorage
github.com/fonchain/utils/utils => ../utils/utils
github.com/fonchain_enterprise/utils/aes => ../utils/aes
github.com/fonchain_enterprise/utils/baidu => ../utils/baidu
github.com/fonchain_enterprise/utils/chain => ../utils/chain
github.com/fonchain_enterprise/utils/jwt => ../utils/jwt
github.com/fonchain_enterprise/utils/rand => ../utils/rand
)
require (
dubbo.apache.org/dubbo-go/v3 v3.0.1
github.com/dubbogo/grpc-go v1.42.9
github.com/dubbogo/triple v1.1.8
github.com/fonchain/utils/objstorage v0.0.0-00010101000000-000000000000
github.com/fonchain/utils/utils v0.0.0-00010101000000-000000000000
github.com/fonchain_enterprise/utils/aes v0.0.0-00010101000000-000000000000
github.com/gin-gonic/gin v1.8.1
github.com/go-redis/redis v6.15.9+incompatible
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
go.uber.org/zap v1.21.0
golang.org/x/image v0.0.0-20190802002840-cff245a6509b
google.golang.org/protobuf v1.28.0
gopkg.in/ini.v1 v1.66.4
gorm.io/driver/mysql v1.4.4
gorm.io/gorm v1.24.1
)
require (
github.com/baidubce/bce-sdk-go v0.9.138 // indirect
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/spf13/viper v1.11.0 // indirect
)

1661
go.sum Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,174 @@
syntax = "proto3";
package artistinfo;
option go_package = "./;artistinfo";
// protoc --proto_path=. --go_out=./api/artistinfo --go-triple_out=./api/artistinfo ./api/artistinfo/artistinfo.proto
service ArtistInfo {
rpc UploadPic (UploadPicRequest) returns (UploadPicRespond) {}
rpc UploadIdCard (UploadIdCardRequest) returns (UploadIdCardRespond) {}
rpc RegisterUser (RegisterUserRequest) returns (RegisterUserRespond){}
rpc GetUser(GetUserRequest) returns (GetUserRespond){}
rpc GetUserById(GetUserByIdRequest) returns (GetUserByIdRespond){}
rpc CreateUser (CreateUserRequest) returns (CreateUserRespond){}
rpc CreateUserInfo (CreateUserInfoRequest) returns (CreateUserInfoRespond){}
rpc UpdateRealName (UpdateRealNameRequest) returns (UpdateRealNameRespond){}
rpc FinishVerify (FinishVerifyRequest) returns (FinishVerifyRespond){}
rpc CheckUserLock (CheckUserLockRequest) returns (CheckUserLockRespond) {}
}
message UploadPicRequest {
}
message UploadPicRespond {
}
message UploadIdCardRequest {
}
message UploadIdCardRespond {
}
message RegisterUserRequest {
uint64 Id =1;
uint64 MgmtUserId =2;
string MgmtArtistId = 3;
string TelNum = 4;
}
message RegisterUserRespond {
}
message GetUserRequest {
string TelNum = 1;
}
message GetUserRespond {
uint64 Id =1;
uint64 MgmtUserId =2;
string MgmtArtistId = 3;
string TelNum = 4;
int64 IsFdd = 5;
int64 IsRealName =6;
int64 ruler = 7;
}
message GetUserByIdRequest {
uint64 Id = 1;
}
message GetUserByIdRespond{
uint64 Id =1;
uint64 MgmtUserId =2;
string MgmtArtistId = 3;
string TelNum = 4;
int64 IsFdd = 5;
int64 IsRealName =6;
int64 ruler = 7;
string InvitedCode = 8;
string CustomerId = 9;
}
message GetUserByIdData {
string TelNum =1 [json_name ="telNum"];
string CertificateNum =2 [json_name ="certificateNum" ];
string CertificateImg =3 [json_name ="certificateImg" ];
string JoinAssoTime =4 [json_name= "joinAssoTime"];
string RealName =5 [json_name ="realName" ];
string PenName =6 [json_name ="penName" ];
string StageName =7 [json_name ="stageName" ];
int32 Sex =8 [json_name ="sex" ];
string IdCard =9 [json_name ="idCard" ];
string IdCardFront =10 [json_name ="idCardFront" ];
string IdCardBack =11 [json_name ="idCardBack" ];
int32 Age =12 [json_name ="age" ];
int64 Ruler =13 [json_name ="ruler" ];
repeated string ConAddress =14 [json_name ="conAddress" ];
string Photo =15 [json_name ="photo" ];
string Video =16 [json_name ="video" ];
int64 FddState =17 [json_name ="fddState" ];
string CustomerId =18 [json_name ="customerId" ];
string InvitedCode =19 [json_name ="invitedCode" ];
string InvitedName =20 [json_name ="invitedName" ];
string WxAccount =21 [json_name ="wxAccount" ];
string QrCodeImg =22 [json_name ="qrCode" ];
string QrCodeImgDownload =23 [json_name ="qrCodeDownload" ];
string HtmlType =24 [json_name ="htmlType" ];
string EnvType =25 [json_name ="envType" ];
}
message CreateUserRequest {
uint64 Id =1;
string TelNum = 2;
}
message CreateUserRespond {
}
message CreateUserInfoRequest {
string TelNum =1 [json_name ="telNum"];
string CertificateNum =2 [json_name ="certificateNum" ];
string CertificateImg =3 [json_name ="certificateImg" ];
string JoinAssoTime =4 [json_name= "joinAssoTime"];
string RealName =5 [json_name ="realName" ];
string PenName =6 [json_name ="penName" ];
string StageName =7 [json_name ="stageName" ];
int32 Sex =8 [json_name ="sex" ];
string IdCard =9 [json_name ="idCard" ];
string IdCardFront =10 [json_name ="idCardFront" ];
string IdCardBack =11 [json_name ="idCardBack" ];
int32 Age =12 [json_name ="age" ];
int64 Ruler =13 [json_name ="ruler" ];
repeated string ConAddress =14 [json_name ="conAddress" ];
string Photo =15 [json_name ="photo" ];
string Video =16 [json_name ="video" ];
int64 FddState =17 [json_name ="fddState" ];
string CustomerId =18 [json_name ="customerId" ];
string InvitedCode =19 [json_name ="invitedCode" ];
string InvitedName =20 [json_name ="invitedName" ];
string WxAccount =21 [json_name ="wxAccount" ];
string QrCodeImg =22 [json_name ="qrCode" ];
string QrCodeImgDownload =23 [json_name ="qrCodeDownload" ];
string HtmlType =24 [json_name ="htmlType" ];
string EnvType =25 [json_name ="envType" ];
}
message CreateUserInfoRespond {
}
message UpdateRealNameRequest {
uint64 Id =1;
}
message UpdateRealNameRespond {
}
message FinishVerifyRequest {
uint64 Id =1;
}
message FinishVerifyRespond {
}
message CheckUserLockRequest {
uint64 ID = 1 [json_name = "id"];
}
message CheckUserLockRespond {
}

View File

@ -0,0 +1,552 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v3.9.0
// source: api/artistinfo/artistinfo.proto
package artistinfo
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// ArtistInfoClient is the client API for ArtistInfo 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 ArtistInfoClient interface {
UploadPic(ctx context.Context, in *UploadPicRequest, opts ...grpc_go.CallOption) (*UploadPicRespond, common.ErrorWithAttachment)
UploadIdCard(ctx context.Context, in *UploadIdCardRequest, opts ...grpc_go.CallOption) (*UploadIdCardRespond, common.ErrorWithAttachment)
RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc_go.CallOption) (*RegisterUserRespond, common.ErrorWithAttachment)
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc_go.CallOption) (*GetUserRespond, common.ErrorWithAttachment)
GetUserById(ctx context.Context, in *GetUserByIdRequest, opts ...grpc_go.CallOption) (*GetUserByIdRespond, common.ErrorWithAttachment)
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc_go.CallOption) (*CreateUserRespond, common.ErrorWithAttachment)
CreateUserInfo(ctx context.Context, in *CreateUserInfoRequest, opts ...grpc_go.CallOption) (*CreateUserInfoRespond, common.ErrorWithAttachment)
UpdateRealName(ctx context.Context, in *UpdateRealNameRequest, opts ...grpc_go.CallOption) (*UpdateRealNameRespond, common.ErrorWithAttachment)
FinishVerify(ctx context.Context, in *FinishVerifyRequest, opts ...grpc_go.CallOption) (*FinishVerifyRespond, common.ErrorWithAttachment)
CheckUserLock(ctx context.Context, in *CheckUserLockRequest, opts ...grpc_go.CallOption) (*CheckUserLockRespond, common.ErrorWithAttachment)
}
type artistInfoClient struct {
cc *triple.TripleConn
}
type ArtistInfoClientImpl struct {
UploadPic func(ctx context.Context, in *UploadPicRequest) (*UploadPicRespond, error)
UploadIdCard func(ctx context.Context, in *UploadIdCardRequest) (*UploadIdCardRespond, error)
RegisterUser func(ctx context.Context, in *RegisterUserRequest) (*RegisterUserRespond, error)
GetUser func(ctx context.Context, in *GetUserRequest) (*GetUserRespond, error)
GetUserById func(ctx context.Context, in *GetUserByIdRequest) (*GetUserByIdRespond, error)
CreateUser func(ctx context.Context, in *CreateUserRequest) (*CreateUserRespond, error)
CreateUserInfo func(ctx context.Context, in *CreateUserInfoRequest) (*CreateUserInfoRespond, error)
UpdateRealName func(ctx context.Context, in *UpdateRealNameRequest) (*UpdateRealNameRespond, error)
FinishVerify func(ctx context.Context, in *FinishVerifyRequest) (*FinishVerifyRespond, error)
CheckUserLock func(ctx context.Context, in *CheckUserLockRequest) (*CheckUserLockRespond, error)
}
func (c *ArtistInfoClientImpl) GetDubboStub(cc *triple.TripleConn) ArtistInfoClient {
return NewArtistInfoClient(cc)
}
func (c *ArtistInfoClientImpl) XXX_InterfaceName() string {
return "artistinfo.ArtistInfo"
}
func NewArtistInfoClient(cc *triple.TripleConn) ArtistInfoClient {
return &artistInfoClient{cc}
}
func (c *artistInfoClient) UploadPic(ctx context.Context, in *UploadPicRequest, opts ...grpc_go.CallOption) (*UploadPicRespond, common.ErrorWithAttachment) {
out := new(UploadPicRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UploadPic", in, out)
}
func (c *artistInfoClient) UploadIdCard(ctx context.Context, in *UploadIdCardRequest, opts ...grpc_go.CallOption) (*UploadIdCardRespond, common.ErrorWithAttachment) {
out := new(UploadIdCardRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UploadIdCard", in, out)
}
func (c *artistInfoClient) RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc_go.CallOption) (*RegisterUserRespond, common.ErrorWithAttachment) {
out := new(RegisterUserRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/RegisterUser", in, out)
}
func (c *artistInfoClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc_go.CallOption) (*GetUserRespond, common.ErrorWithAttachment) {
out := new(GetUserRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetUser", in, out)
}
func (c *artistInfoClient) GetUserById(ctx context.Context, in *GetUserByIdRequest, opts ...grpc_go.CallOption) (*GetUserByIdRespond, common.ErrorWithAttachment) {
out := new(GetUserByIdRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetUserById", in, out)
}
func (c *artistInfoClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc_go.CallOption) (*CreateUserRespond, common.ErrorWithAttachment) {
out := new(CreateUserRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateUser", in, out)
}
func (c *artistInfoClient) CreateUserInfo(ctx context.Context, in *CreateUserInfoRequest, opts ...grpc_go.CallOption) (*CreateUserInfoRespond, common.ErrorWithAttachment) {
out := new(CreateUserInfoRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateUserInfo", in, out)
}
func (c *artistInfoClient) UpdateRealName(ctx context.Context, in *UpdateRealNameRequest, opts ...grpc_go.CallOption) (*UpdateRealNameRespond, common.ErrorWithAttachment) {
out := new(UpdateRealNameRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateRealName", in, out)
}
func (c *artistInfoClient) FinishVerify(ctx context.Context, in *FinishVerifyRequest, opts ...grpc_go.CallOption) (*FinishVerifyRespond, common.ErrorWithAttachment) {
out := new(FinishVerifyRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/FinishVerify", in, out)
}
func (c *artistInfoClient) CheckUserLock(ctx context.Context, in *CheckUserLockRequest, opts ...grpc_go.CallOption) (*CheckUserLockRespond, common.ErrorWithAttachment) {
out := new(CheckUserLockRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CheckUserLock", in, out)
}
// ArtistInfoServer is the server API for ArtistInfo service.
// All implementations must embed UnimplementedArtistInfoServer
// for forward compatibility
type ArtistInfoServer interface {
UploadPic(context.Context, *UploadPicRequest) (*UploadPicRespond, error)
UploadIdCard(context.Context, *UploadIdCardRequest) (*UploadIdCardRespond, error)
RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserRespond, error)
GetUser(context.Context, *GetUserRequest) (*GetUserRespond, error)
GetUserById(context.Context, *GetUserByIdRequest) (*GetUserByIdRespond, error)
CreateUser(context.Context, *CreateUserRequest) (*CreateUserRespond, error)
CreateUserInfo(context.Context, *CreateUserInfoRequest) (*CreateUserInfoRespond, error)
UpdateRealName(context.Context, *UpdateRealNameRequest) (*UpdateRealNameRespond, error)
FinishVerify(context.Context, *FinishVerifyRequest) (*FinishVerifyRespond, error)
CheckUserLock(context.Context, *CheckUserLockRequest) (*CheckUserLockRespond, error)
mustEmbedUnimplementedArtistInfoServer()
}
// UnimplementedArtistInfoServer must be embedded to have forward compatible implementations.
type UnimplementedArtistInfoServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedArtistInfoServer) UploadPic(context.Context, *UploadPicRequest) (*UploadPicRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UploadPic not implemented")
}
func (UnimplementedArtistInfoServer) UploadIdCard(context.Context, *UploadIdCardRequest) (*UploadIdCardRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UploadIdCard not implemented")
}
func (UnimplementedArtistInfoServer) RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterUser not implemented")
}
func (UnimplementedArtistInfoServer) GetUser(context.Context, *GetUserRequest) (*GetUserRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
}
func (UnimplementedArtistInfoServer) GetUserById(context.Context, *GetUserByIdRequest) (*GetUserByIdRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserById not implemented")
}
func (UnimplementedArtistInfoServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")
}
func (UnimplementedArtistInfoServer) CreateUserInfo(context.Context, *CreateUserInfoRequest) (*CreateUserInfoRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateUserInfo not implemented")
}
func (UnimplementedArtistInfoServer) UpdateRealName(context.Context, *UpdateRealNameRequest) (*UpdateRealNameRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateRealName not implemented")
}
func (UnimplementedArtistInfoServer) FinishVerify(context.Context, *FinishVerifyRequest) (*FinishVerifyRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method FinishVerify not implemented")
}
func (UnimplementedArtistInfoServer) CheckUserLock(context.Context, *CheckUserLockRequest) (*CheckUserLockRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckUserLock not implemented")
}
func (s *UnimplementedArtistInfoServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedArtistInfoServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedArtistInfoServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &ArtistInfo_ServiceDesc
}
func (s *UnimplementedArtistInfoServer) XXX_InterfaceName() string {
return "artistinfo.ArtistInfo"
}
func (UnimplementedArtistInfoServer) mustEmbedUnimplementedArtistInfoServer() {}
// UnsafeArtistInfoServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ArtistInfoServer will
// result in compilation errors.
type UnsafeArtistInfoServer interface {
mustEmbedUnimplementedArtistInfoServer()
}
func RegisterArtistInfoServer(s grpc_go.ServiceRegistrar, srv ArtistInfoServer) {
s.RegisterService(&ArtistInfo_ServiceDesc, srv)
}
func _ArtistInfo_UploadPic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadPicRequest)
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("UploadPic", 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 _ArtistInfo_UploadIdCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadIdCardRequest)
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("UploadIdCard", 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 _ArtistInfo_RegisterUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(RegisterUserRequest)
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("RegisterUser", 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 _ArtistInfo_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserRequest)
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("GetUser", 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 _ArtistInfo_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserByIdRequest)
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("GetUserById", 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 _ArtistInfo_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserRequest)
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("CreateUser", 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 _ArtistInfo_CreateUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserInfoRequest)
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("CreateUserInfo", 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 _ArtistInfo_UpdateRealName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateRealNameRequest)
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("UpdateRealName", 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 _ArtistInfo_FinishVerify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(FinishVerifyRequest)
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("FinishVerify", 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 _ArtistInfo_CheckUserLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckUserLockRequest)
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("CheckUserLock", 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)
}
// ArtistInfo_ServiceDesc is the grpc_go.ServiceDesc for ArtistInfo service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var ArtistInfo_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "artistinfo.ArtistInfo",
HandlerType: (*ArtistInfoServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "UploadPic",
Handler: _ArtistInfo_UploadPic_Handler,
},
{
MethodName: "UploadIdCard",
Handler: _ArtistInfo_UploadIdCard_Handler,
},
{
MethodName: "RegisterUser",
Handler: _ArtistInfo_RegisterUser_Handler,
},
{
MethodName: "GetUser",
Handler: _ArtistInfo_GetUser_Handler,
},
{
MethodName: "GetUserById",
Handler: _ArtistInfo_GetUserById_Handler,
},
{
MethodName: "CreateUser",
Handler: _ArtistInfo_CreateUser_Handler,
},
{
MethodName: "CreateUserInfo",
Handler: _ArtistInfo_CreateUserInfo_Handler,
},
{
MethodName: "UpdateRealName",
Handler: _ArtistInfo_UpdateRealName_Handler,
},
{
MethodName: "FinishVerify",
Handler: _ArtistInfo_FinishVerify_Handler,
},
{
MethodName: "CheckUserLock",
Handler: _ArtistInfo_CheckUserLock_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "api/artistinfo/artistinfo.proto",
}

1625
pb/artwork/artwork.pb.go Normal file

File diff suppressed because it is too large Load Diff

139
pb/artwork/artwork.proto Normal file
View File

@ -0,0 +1,139 @@
syntax = "proto3";
package Artwork;
option go_package = "./;artwork";
//$ protoc --proto_path=. --go_out=./api/artwork --go-triple_out=./api/artwork ./api/artwork/artwork.proto
service Artwork {
rpc ArtworkAdd (ArtworkAddRequest) returns (ArtworkAddRespond) {}
rpc CheckUserLock (CheckUserLockRequest) returns (CheckUserLockRespond) {}
rpc UpdateArtwork (UpdateArtworkRequest) returns (UpdateArtworkRespond) {}
rpc GetArtworkList (GetArtworkListRequest) returns (GetArtworkListRespond) {}
rpc GetArtwork (GetArtworkRequest) returns (GetArtworkRespond) {}
rpc DelArtwork (DelArtworkRequest) returns (DelArtworkRespond) {}
rpc UploadArtwork (UploadArtworkRequest) returns (UploadArtworkRespond) {}
}
message ListInterfaceRespond {
int64 Total = 1 [json_name = "total"];
// repeated []byte Data = 2 [json_name = "data"];
bytes Data = 2 [json_name = "data"];
string Msg = 3 [json_name = "msg"];
}
message ArtworkListRequest {
int64 BatchId = 1 [json_name = "batchId"];
int64 ArtistId = 2 [json_name = "artistId"];
string Name = 3 [json_name = "name"];
string ArtistName = 4 [json_name = "artistName"];
string InvitedName = 5 [json_name = "invitedName"];
int64 IsImport = 6 [json_name ="isImport"];
int64 State = 7 [json_name = "state"];
int64 Page = 8 [json_name = "page"];
int64 Num = 9 [json_name = "num"];
}
message ArtworkAddRequest {
uint64 ID = 1 [json_name = "id"];
uint64 ArtistId = 2 [json_name = "artistId"];
string Name = 3 [json_name = "name"];
string ModelYear = 4 [json_name = "modelYear"];
string Photo = 5 [json_name = "photo"];
string ArtistPhoto = 6 [json_name = "artistPhoto"];
uint64 Width = 7 [json_name = "width"];
repeated string CreateAddress = 8 [json_name = "createAddress"];
uint64 Height = 9 [json_name = "height"];
uint64 Ruler = 10 [json_name = "ruler"];
string Introduct = 11 [json_name = "introduct"];
string AgeOfCreation = 12 [json_name = "ageOfCreation"];
string CreateAt = 13 [json_name = "createAt"];
bool NetworkTrace = 14 [json_name = "networkTrace"];
string Url = 15 [json_name = "url"];
uint64 State = 16 [json_name = "state"];
}
message ArtworkAddRespond {
}
message CheckUserLockRequest {
uint64 ID = 1 [json_name = "id"];
}
message CheckUserLockRespond {
}
message UpdateArtworkRequest {
uint64 ID = 1 [json_name = "id"];
uint64 ArtistId = 2 [json_name = "artistId"];
string Name = 3 [json_name = "name"];
string ModelYear = 4 [json_name = "modelYear"];
string Photo = 5 [json_name = "photo"];
string ArtistPhoto = 6 [json_name = "artistPhoto"];
uint64 Width = 7 [json_name = "width"];
repeated string CreateAddress = 8 [json_name = "createAddress"];
uint64 Height = 9 [json_name = "height"];
uint64 Ruler = 10 [json_name = "ruler"];
string Introduct = 11 [json_name = "introduct"];
string AgeOfCreation = 12 [json_name = "ageOfCreation"];
string CreateAt = 13 [json_name = "createAt"];
bool NetworkTrace = 14 [json_name = "networkTrace"];
string Url = 15 [json_name = "url"];
uint64 State = 16 [json_name = "state"];
}
message UpdateArtworkRespond {
}
message GetArtworkListRequest {
uint64 ID = 1 [json_name = "id"];
}
message GetArtworkListRespond {
repeated UpdateArtworkRequest Data = 1 [json_name = "data"];
}
message GetArtworkRequest {
uint64 ID = 1 [json_name = "id"];
}
message GetArtworkRespond {
uint64 ID = 1 [json_name = "id"];
uint64 ArtistId = 2 [json_name = "artistId"];
string Name = 3 [json_name = "name"];
string ModelYear = 4 [json_name = "modelYear"];
string Photo = 5 [json_name = "photo"];
string ArtistPhoto = 6 [json_name = "artistPhoto"];
uint64 Width = 7 [json_name = "width"];
repeated string CreateAddress = 8 [json_name = "createAddress"];
uint64 Height = 9 [json_name = "height"];
uint64 Ruler = 10 [json_name = "ruler"];
string Introduct = 11 [json_name = "introduct"];
string AgeOfCreation = 12 [json_name = "ageOfCreation"];
string CreateAt = 13 [json_name = "createAt"];
bool NetworkTrace = 14 [json_name = "networkTrace"];
string Url = 15 [json_name = "url"];
uint64 State = 16 [json_name = "state"];
}
message DelArtworkRequest {
uint64 Id = 1 [json_name = "id"];
uint64 ArtistId =2[json_name = "artistId"];
}
message DelArtworkRespond {
}
message UploadArtworkRequest {
uint64 ID = 1 [json_name = "id"];
}
message UploadArtworkRespond {
}

View File

@ -0,0 +1,417 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v3.9.0
// source: api/artwork/artwork.proto
package artwork
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// ArtworkClient is the client API for Artwork 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 ArtworkClient interface {
ArtworkAdd(ctx context.Context, in *ArtworkAddRequest, opts ...grpc_go.CallOption) (*ArtworkAddRespond, common.ErrorWithAttachment)
CheckUserLock(ctx context.Context, in *CheckUserLockRequest, opts ...grpc_go.CallOption) (*CheckUserLockRespond, common.ErrorWithAttachment)
UpdateArtwork(ctx context.Context, in *UpdateArtworkRequest, opts ...grpc_go.CallOption) (*UpdateArtworkRespond, common.ErrorWithAttachment)
GetArtworkList(ctx context.Context, in *GetArtworkListRequest, opts ...grpc_go.CallOption) (*GetArtworkListRespond, common.ErrorWithAttachment)
GetArtwork(ctx context.Context, in *GetArtworkRequest, opts ...grpc_go.CallOption) (*GetArtworkRespond, common.ErrorWithAttachment)
DelArtwork(ctx context.Context, in *DelArtworkRequest, opts ...grpc_go.CallOption) (*DelArtworkRespond, common.ErrorWithAttachment)
UploadArtwork(ctx context.Context, in *UploadArtworkRequest, opts ...grpc_go.CallOption) (*UploadArtworkRespond, common.ErrorWithAttachment)
}
type artworkClient struct {
cc *triple.TripleConn
}
type ArtworkClientImpl struct {
ArtworkAdd func(ctx context.Context, in *ArtworkAddRequest) (*ArtworkAddRespond, error)
CheckUserLock func(ctx context.Context, in *CheckUserLockRequest) (*CheckUserLockRespond, error)
UpdateArtwork func(ctx context.Context, in *UpdateArtworkRequest) (*UpdateArtworkRespond, error)
GetArtworkList func(ctx context.Context, in *GetArtworkListRequest) (*GetArtworkListRespond, error)
GetArtwork func(ctx context.Context, in *GetArtworkRequest) (*GetArtworkRespond, error)
DelArtwork func(ctx context.Context, in *DelArtworkRequest) (*DelArtworkRespond, error)
UploadArtwork func(ctx context.Context, in *UploadArtworkRequest) (*UploadArtworkRespond, error)
}
func (c *ArtworkClientImpl) GetDubboStub(cc *triple.TripleConn) ArtworkClient {
return NewArtworkClient(cc)
}
func (c *ArtworkClientImpl) XXX_InterfaceName() string {
return "Artwork.Artwork"
}
func NewArtworkClient(cc *triple.TripleConn) ArtworkClient {
return &artworkClient{cc}
}
func (c *artworkClient) ArtworkAdd(ctx context.Context, in *ArtworkAddRequest, opts ...grpc_go.CallOption) (*ArtworkAddRespond, common.ErrorWithAttachment) {
out := new(ArtworkAddRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ArtworkAdd", in, out)
}
func (c *artworkClient) CheckUserLock(ctx context.Context, in *CheckUserLockRequest, opts ...grpc_go.CallOption) (*CheckUserLockRespond, common.ErrorWithAttachment) {
out := new(CheckUserLockRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CheckUserLock", in, out)
}
func (c *artworkClient) UpdateArtwork(ctx context.Context, in *UpdateArtworkRequest, opts ...grpc_go.CallOption) (*UpdateArtworkRespond, common.ErrorWithAttachment) {
out := new(UpdateArtworkRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateArtwork", in, out)
}
func (c *artworkClient) GetArtworkList(ctx context.Context, in *GetArtworkListRequest, opts ...grpc_go.CallOption) (*GetArtworkListRespond, common.ErrorWithAttachment) {
out := new(GetArtworkListRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtworkList", in, out)
}
func (c *artworkClient) GetArtwork(ctx context.Context, in *GetArtworkRequest, opts ...grpc_go.CallOption) (*GetArtworkRespond, common.ErrorWithAttachment) {
out := new(GetArtworkRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtwork", in, out)
}
func (c *artworkClient) DelArtwork(ctx context.Context, in *DelArtworkRequest, opts ...grpc_go.CallOption) (*DelArtworkRespond, common.ErrorWithAttachment) {
out := new(DelArtworkRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DelArtwork", in, out)
}
func (c *artworkClient) UploadArtwork(ctx context.Context, in *UploadArtworkRequest, opts ...grpc_go.CallOption) (*UploadArtworkRespond, common.ErrorWithAttachment) {
out := new(UploadArtworkRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UploadArtwork", in, out)
}
// ArtworkServer is the server API for Artwork service.
// All implementations must embed UnimplementedArtworkServer
// for forward compatibility
type ArtworkServer interface {
ArtworkAdd(context.Context, *ArtworkAddRequest) (*ArtworkAddRespond, error)
CheckUserLock(context.Context, *CheckUserLockRequest) (*CheckUserLockRespond, error)
UpdateArtwork(context.Context, *UpdateArtworkRequest) (*UpdateArtworkRespond, error)
GetArtworkList(context.Context, *GetArtworkListRequest) (*GetArtworkListRespond, error)
GetArtwork(context.Context, *GetArtworkRequest) (*GetArtworkRespond, error)
DelArtwork(context.Context, *DelArtworkRequest) (*DelArtworkRespond, error)
UploadArtwork(context.Context, *UploadArtworkRequest) (*UploadArtworkRespond, error)
mustEmbedUnimplementedArtworkServer()
}
// UnimplementedArtworkServer must be embedded to have forward compatible implementations.
type UnimplementedArtworkServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedArtworkServer) ArtworkAdd(context.Context, *ArtworkAddRequest) (*ArtworkAddRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method ArtworkAdd not implemented")
}
func (UnimplementedArtworkServer) CheckUserLock(context.Context, *CheckUserLockRequest) (*CheckUserLockRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckUserLock not implemented")
}
func (UnimplementedArtworkServer) UpdateArtwork(context.Context, *UpdateArtworkRequest) (*UpdateArtworkRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateArtwork not implemented")
}
func (UnimplementedArtworkServer) GetArtworkList(context.Context, *GetArtworkListRequest) (*GetArtworkListRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetArtworkList not implemented")
}
func (UnimplementedArtworkServer) GetArtwork(context.Context, *GetArtworkRequest) (*GetArtworkRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetArtwork not implemented")
}
func (UnimplementedArtworkServer) DelArtwork(context.Context, *DelArtworkRequest) (*DelArtworkRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelArtwork not implemented")
}
func (UnimplementedArtworkServer) UploadArtwork(context.Context, *UploadArtworkRequest) (*UploadArtworkRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UploadArtwork not implemented")
}
func (s *UnimplementedArtworkServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedArtworkServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedArtworkServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Artwork_ServiceDesc
}
func (s *UnimplementedArtworkServer) XXX_InterfaceName() string {
return "Artwork.Artwork"
}
func (UnimplementedArtworkServer) mustEmbedUnimplementedArtworkServer() {}
// UnsafeArtworkServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ArtworkServer will
// result in compilation errors.
type UnsafeArtworkServer interface {
mustEmbedUnimplementedArtworkServer()
}
func RegisterArtworkServer(s grpc_go.ServiceRegistrar, srv ArtworkServer) {
s.RegisterService(&Artwork_ServiceDesc, srv)
}
func _Artwork_ArtworkAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ArtworkAddRequest)
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("ArtworkAdd", 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 _Artwork_CheckUserLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckUserLockRequest)
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("CheckUserLock", 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 _Artwork_UpdateArtwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateArtworkRequest)
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("UpdateArtwork", 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 _Artwork_GetArtworkList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetArtworkListRequest)
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("GetArtworkList", 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 _Artwork_GetArtwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetArtworkRequest)
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("GetArtwork", 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 _Artwork_DelArtwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(DelArtworkRequest)
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("DelArtwork", 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 _Artwork_UploadArtwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadArtworkRequest)
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("UploadArtwork", 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)
}
// Artwork_ServiceDesc is the grpc_go.ServiceDesc for Artwork service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Artwork_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "Artwork.Artwork",
HandlerType: (*ArtworkServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "ArtworkAdd",
Handler: _Artwork_ArtworkAdd_Handler,
},
{
MethodName: "CheckUserLock",
Handler: _Artwork_CheckUserLock_Handler,
},
{
MethodName: "UpdateArtwork",
Handler: _Artwork_UpdateArtwork_Handler,
},
{
MethodName: "GetArtworkList",
Handler: _Artwork_GetArtworkList_Handler,
},
{
MethodName: "GetArtwork",
Handler: _Artwork_GetArtwork_Handler,
},
{
MethodName: "DelArtwork",
Handler: _Artwork_DelArtwork_Handler,
},
{
MethodName: "UploadArtwork",
Handler: _Artwork_UploadArtwork_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "api/artwork/artwork.proto",
}

1517
pb/contract/contract.pb.go Normal file

File diff suppressed because it is too large Load Diff

124
pb/contract/contract.proto Normal file
View File

@ -0,0 +1,124 @@
syntax = "proto3";
package Contract;
option go_package = "./;contract";
//$ protoc --proto_path=. --go_out=./api/contract --go-triple_out=./api/contract ./api/contract/contract.proto
service Contract {
rpc FinishContract (FinishContractRequest) returns (FinishContractRespond) {}
rpc FinishVerify (FinishVerifyRequest) returns (FinishVerifyRespond) {}
rpc ContractList (ContractListRequest) returns (ContractListRespond) {}
rpc GetContract (GetContractRequest) returns (ContractData) {}
rpc ContractTxList (ContractTxListRequest) returns (ContractTxListRespond) {}
rpc SignContract (SignContractRequest) returns (SignContractRespond) {}
rpc UpdateContract(UpdateContractRequest) returns (UpdateContractRespond) {}
rpc UpdateContractTx(UpdateContractTxRequest) returns (UpdateContractTxRespond) {}
}
message FinishContractRequest {
string TransactionId = 1 [json_name="transactionId"];
}
message FinishContractRespond {
}
message FinishVerifyRequest {
int64 ContractId = 1 [json_name="contractId"];
string HtmlType = 2 [json_name="htmlType"];
string EnvType = 3 [json_name= "envType"];
}
message FinishVerifyRespond {
}
message ContractListRequest {
int64 Num = 1 [json_name="num"];
int64 Page = 2 [json_name="page"];
int64 State = 3 [json_name="state"];
int64 ID =4 [json_name = "id"];
}
message ContractListRespond {
repeated ContractData Data =1;
}
message ContractData{
uint64 ID = 1[json_name="id"];
int64 UserId = 2[json_name="userId"];
string CardId = 3[json_name="cardId"];
string MgmtUserId = 4[json_name="mgmtUserId"];
string ArtworkId = 5[json_name="artworkId"];
string ContractId = 6[json_name="contractId"];
string TransactionId = 7[json_name="transactionId"];
int64 Type = 8[json_name="type"];
int64 BatchId = 9[json_name="batchId"];
string BatchName = 10[json_name="batchName"];
string ViewUrl = 11[json_name="viewUrl"];
string DownloadUrl = 12[json_name="downloadUrl"];
int64 State = 13[json_name="state"];
string UpdateTime = 14 [json_name="updateTime"];
string CreateTime = 15[json_name="createTime"];
string ExpirationTime = 16 [json_name="expirationTime"];
string SignTime = 17 [json_name="signTime"];
}
message ContractTxListRequest {
int64 Num = 1 [json_name="num"];
int64 Page = 2 [json_name="page"];
int64 State = 3 [json_name="state"];
int64 ID =4 [json_name = "id"];
}
message ContractTxListRespond {
repeated ContractData Data =1;
}
message SignContractRequest {
int64 ContractId = 1 [json_name="contractId"];
string HtmlType = 2 [json_name="htmlType"];
string EnvType = 3 [json_name= "envType"];
}
message SignContractRespond {
}
message GetContractRequest {
int64 Id = 1 [json_name="id"];
}
message UpdateContractRequest {
uint64 ID = 1[json_name="id"];
int64 UserId = 2[json_name="userId"];
string CardId = 3[json_name="cardId"];
string MgmtUserId = 4[json_name="mgmtUserId"];
string ArtworkId = 5[json_name="artworkId"];
string ContractId = 6[json_name="contractId"];
string TransactionId = 7[json_name="transactionId"];
int64 Type = 8[json_name="type"];
int64 BatchId = 9[json_name="batchId"];
string BatchName = 10[json_name="batchName"];
string ViewUrl = 11[json_name="viewUrl"];
string DownloadUrl = 12[json_name="downloadUrl"];
int64 State = 13[json_name="state"];
string UpdateTime = 14 [json_name="updateTime"];
string CreateTime = 15[json_name="createTime"];
string ExpirationTime = 16 [json_name="expirationTime"];
string SignTime = 17 [json_name="signTime"];
}
message UpdateContractRespond{
}
message UpdateContractTxRequest {
int64 ID = 1[json_name="id"];
string TransactionId = 2[json_name="transactionId"];
}
message UpdateContractTxRespond{
}

View File

@ -0,0 +1,462 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v3.9.0
// source: api/contract/contract.proto
package contract
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// ContractClient is the client API for Contract 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 ContractClient interface {
FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment)
FinishVerify(ctx context.Context, in *FinishVerifyRequest, opts ...grpc_go.CallOption) (*FinishVerifyRespond, common.ErrorWithAttachment)
ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment)
GetContract(ctx context.Context, in *GetContractRequest, opts ...grpc_go.CallOption) (*ContractData, common.ErrorWithAttachment)
ContractTxList(ctx context.Context, in *ContractTxListRequest, opts ...grpc_go.CallOption) (*ContractTxListRespond, common.ErrorWithAttachment)
SignContract(ctx context.Context, in *SignContractRequest, opts ...grpc_go.CallOption) (*SignContractRespond, common.ErrorWithAttachment)
UpdateContract(ctx context.Context, in *UpdateContractRequest, opts ...grpc_go.CallOption) (*UpdateContractRespond, common.ErrorWithAttachment)
UpdateContractTx(ctx context.Context, in *UpdateContractTxRequest, opts ...grpc_go.CallOption) (*UpdateContractTxRespond, common.ErrorWithAttachment)
}
type contractClient struct {
cc *triple.TripleConn
}
type ContractClientImpl struct {
FinishContract func(ctx context.Context, in *FinishContractRequest) (*FinishContractRespond, error)
FinishVerify func(ctx context.Context, in *FinishVerifyRequest) (*FinishVerifyRespond, error)
ContractList func(ctx context.Context, in *ContractListRequest) (*ContractListRespond, error)
GetContract func(ctx context.Context, in *GetContractRequest) (*ContractData, error)
ContractTxList func(ctx context.Context, in *ContractTxListRequest) (*ContractTxListRespond, error)
SignContract func(ctx context.Context, in *SignContractRequest) (*SignContractRespond, error)
UpdateContract func(ctx context.Context, in *UpdateContractRequest) (*UpdateContractRespond, error)
UpdateContractTx func(ctx context.Context, in *UpdateContractTxRequest) (*UpdateContractTxRespond, error)
}
func (c *ContractClientImpl) GetDubboStub(cc *triple.TripleConn) ContractClient {
return NewContractClient(cc)
}
func (c *ContractClientImpl) XXX_InterfaceName() string {
return "Contract.Contract"
}
func NewContractClient(cc *triple.TripleConn) ContractClient {
return &contractClient{cc}
}
func (c *contractClient) FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment) {
out := new(FinishContractRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/FinishContract", in, out)
}
func (c *contractClient) FinishVerify(ctx context.Context, in *FinishVerifyRequest, opts ...grpc_go.CallOption) (*FinishVerifyRespond, common.ErrorWithAttachment) {
out := new(FinishVerifyRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/FinishVerify", in, out)
}
func (c *contractClient) ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment) {
out := new(ContractListRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractList", in, out)
}
func (c *contractClient) GetContract(ctx context.Context, in *GetContractRequest, opts ...grpc_go.CallOption) (*ContractData, common.ErrorWithAttachment) {
out := new(ContractData)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetContract", in, out)
}
func (c *contractClient) ContractTxList(ctx context.Context, in *ContractTxListRequest, opts ...grpc_go.CallOption) (*ContractTxListRespond, common.ErrorWithAttachment) {
out := new(ContractTxListRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractTxList", in, out)
}
func (c *contractClient) SignContract(ctx context.Context, in *SignContractRequest, opts ...grpc_go.CallOption) (*SignContractRespond, common.ErrorWithAttachment) {
out := new(SignContractRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SignContract", in, out)
}
func (c *contractClient) UpdateContract(ctx context.Context, in *UpdateContractRequest, opts ...grpc_go.CallOption) (*UpdateContractRespond, common.ErrorWithAttachment) {
out := new(UpdateContractRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateContract", in, out)
}
func (c *contractClient) UpdateContractTx(ctx context.Context, in *UpdateContractTxRequest, opts ...grpc_go.CallOption) (*UpdateContractTxRespond, common.ErrorWithAttachment) {
out := new(UpdateContractTxRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateContractTx", in, out)
}
// ContractServer is the server API for Contract service.
// All implementations must embed UnimplementedContractServer
// for forward compatibility
type ContractServer interface {
FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error)
FinishVerify(context.Context, *FinishVerifyRequest) (*FinishVerifyRespond, error)
ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error)
GetContract(context.Context, *GetContractRequest) (*ContractData, error)
ContractTxList(context.Context, *ContractTxListRequest) (*ContractTxListRespond, error)
SignContract(context.Context, *SignContractRequest) (*SignContractRespond, error)
UpdateContract(context.Context, *UpdateContractRequest) (*UpdateContractRespond, error)
UpdateContractTx(context.Context, *UpdateContractTxRequest) (*UpdateContractTxRespond, error)
mustEmbedUnimplementedContractServer()
}
// UnimplementedContractServer must be embedded to have forward compatible implementations.
type UnimplementedContractServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedContractServer) FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method FinishContract not implemented")
}
func (UnimplementedContractServer) FinishVerify(context.Context, *FinishVerifyRequest) (*FinishVerifyRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method FinishVerify not implemented")
}
func (UnimplementedContractServer) ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method ContractList not implemented")
}
func (UnimplementedContractServer) GetContract(context.Context, *GetContractRequest) (*ContractData, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetContract not implemented")
}
func (UnimplementedContractServer) ContractTxList(context.Context, *ContractTxListRequest) (*ContractTxListRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method ContractTxList not implemented")
}
func (UnimplementedContractServer) SignContract(context.Context, *SignContractRequest) (*SignContractRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method SignContract not implemented")
}
func (UnimplementedContractServer) UpdateContract(context.Context, *UpdateContractRequest) (*UpdateContractRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateContract not implemented")
}
func (UnimplementedContractServer) UpdateContractTx(context.Context, *UpdateContractTxRequest) (*UpdateContractTxRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateContractTx not implemented")
}
func (s *UnimplementedContractServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedContractServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedContractServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Contract_ServiceDesc
}
func (s *UnimplementedContractServer) XXX_InterfaceName() string {
return "Contract.Contract"
}
func (UnimplementedContractServer) mustEmbedUnimplementedContractServer() {}
// UnsafeContractServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ContractServer will
// result in compilation errors.
type UnsafeContractServer interface {
mustEmbedUnimplementedContractServer()
}
func RegisterContractServer(s grpc_go.ServiceRegistrar, srv ContractServer) {
s.RegisterService(&Contract_ServiceDesc, srv)
}
func _Contract_FinishContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(FinishContractRequest)
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("FinishContract", 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 _Contract_FinishVerify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(FinishVerifyRequest)
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("FinishVerify", 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 _Contract_ContractList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ContractListRequest)
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("ContractList", 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 _Contract_GetContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetContractRequest)
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("GetContract", 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 _Contract_ContractTxList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ContractTxListRequest)
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("ContractTxList", 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 _Contract_SignContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SignContractRequest)
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("SignContract", 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 _Contract_UpdateContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateContractRequest)
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("UpdateContract", 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 _Contract_UpdateContractTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateContractTxRequest)
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("UpdateContractTx", 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)
}
// Contract_ServiceDesc is the grpc_go.ServiceDesc for Contract service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Contract_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "Contract.Contract",
HandlerType: (*ContractServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "FinishContract",
Handler: _Contract_FinishContract_Handler,
},
{
MethodName: "FinishVerify",
Handler: _Contract_FinishVerify_Handler,
},
{
MethodName: "ContractList",
Handler: _Contract_ContractList_Handler,
},
{
MethodName: "GetContract",
Handler: _Contract_GetContract_Handler,
},
{
MethodName: "ContractTxList",
Handler: _Contract_ContractTxList_Handler,
},
{
MethodName: "SignContract",
Handler: _Contract_SignContract_Handler,
},
{
MethodName: "UpdateContract",
Handler: _Contract_UpdateContract_Handler,
},
{
MethodName: "UpdateContractTx",
Handler: _Contract_UpdateContractTx_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "api/contract/contract.proto",
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
syntax = "proto3";
package Supplyinfo;
option go_package = "./;supplyinfo";
//$ protoc --proto_path=. --go_out=./api/supplyinfo --go-triple_out=./api/supplyinfo ./api/supplyinfo/supplyinfo.proto
service SupplyInfo {
rpc GetSupplyInfoList (GetSupplyInfoListRequest) returns (GetSupplyInfoListRespond) {}
rpc GetSupplyInfo (GetSupplyInfoRequest) returns (GetSupplyInfoData) {}
rpc UpdateSupplyInfo (UpdateSupplyInfoRequest) returns (UpdateSupplyInfoRespond) {}
rpc GetVideoList(GetVideoListRequest) returns (GetVideoListRespond){}
rpc GetVideo(GetVideoRequest) returns (GetVideoListData){}
rpc UpdateVideo(UpdateVideoRequest) returns (UpdateVideoRespond){}
rpc GetExamList(GetExamListRequest) returns (GetExamListRespond){}
rpc GetExam(GetExamRequest) returns (GetExamListData){}
rpc UpdateExam(UpdateExamRequest) returns (UpdateExamRespond){}
rpc GetArtistInfoList(GetArtistInfoListRequest) returns (GetArtistInfoListRespond){}
rpc GetArtistInfo(GetArtistInfoRequest) returns (GetArtistInfoListData){}
rpc UpdateArtistInfo(UpdateArtistInfoRequest) returns (UpdateArtistInfoRespond){}
}
message GetSupplyInfoListRequest {
uint64 ArtistId = 1 [json_name="artistId"];
uint64 Types = 2 [json_name="types"];
}
message GetSupplyInfoListRespond {
repeated GetSupplyInfoData Data = 1;
}
message GetSupplyInfoData{
uint64 ID = 1 [json_name="id"];
string ArtworkId = 2 [json_name="artworkId"];
string ArtistId = 3 [json_name="artistId"];
uint64 UserId = 4 [json_name="userId"];
string Name = 5 [json_name="name"];
string ModelYear = 6 [json_name="modelYear"];
string Photo = 7 [json_name="photo"];
string ArtistPhoto = 8 [json_name="artistPhoto"];
uint64 Width = 9 [json_name="width"];
uint64 Height = 10 [json_name="height"];
uint64 Ruler = 11 [json_name="ruler"];
string ExhibitInfo = 12 [json_name="exhibitInfo"];
string ExhibitPic1 = 13 [json_name="exhibitPic1"];
string ExhibitPic2 = 14 [json_name="exhibitPic2"];
string CreateTime = 15 [json_name="createTime"];
string Introduct = 16 [json_name="introduct"];
bool NetworkTrace = 17 [json_name="networkTrace"];
string CreateAddress = 18 [json_name="createAddress"];
string Url = 19 [json_name="url"];
string Types = 20 [json_name="types"];
string Remark = 21 [json_name="remark"];
string Remark2 = 22 [json_name="remark2"];
bool Enable = 23 [json_name="enable"];
}
message GetSupplyInfoRequest {
uint64 Id = 1 [json_name="artistId"];
}
message UpdateSupplyInfoRequest{
uint64 ID = 1 [json_name="id"];
string ArtworkId = 2 [json_name="artworkId"];
string ArtistId = 3 [json_name="artistId"];
uint64 UserId = 4 [json_name="userId"];
string Name = 5 [json_name="name"];
string ModelYear = 6 [json_name="modelYear"];
string Photo = 7 [json_name="photo"];
string ArtistPhoto = 8 [json_name="artistPhoto"];
uint64 Width = 9 [json_name="width"];
uint64 Height = 10 [json_name="height"];
uint64 Ruler = 11 [json_name="ruler"];
string ExhibitInfo = 12 [json_name="exhibitInfo"];
string ExhibitPic1 = 13 [json_name="exhibitPic1"];
string ExhibitPic2 = 14 [json_name="exhibitPic2"];
string CreateTime = 15 [json_name="createTime"];
string Introduct = 16 [json_name="introduct"];
bool NetworkTrace = 17 [json_name="networkTrace"];
string CreateAddress = 18 [json_name="createAddress"];
string Url = 19 [json_name="url"];
string Types = 20 [json_name="types"];
string Remark = 21 [json_name="remark"];
string Remark2 = 22 [json_name="remark2"];
bool Enable = 23 [json_name="enable"];
}
message UpdateSupplyInfoRespond {
}
message GetVideoListRequest {
string ID =1 [json_name="id"];
uint64 UserId =2 [json_name="userId"];
string Url =3 [json_name="url"];
string Types =4 [json_name="types"];
}
message GetVideoListRespond {
repeated GetVideoListData Data = 1;
}
message GetVideoListData{
uint64 ID = 1 [json_name="id"];
uint64 UserId = 2 [json_name="userId"];
string Url = 3 [json_name="url"];
string Types = 4 [json_name="types"];
string Remark = 5 [json_name="remark"];
string Remark2 = 6 [json_name="remark2"];
bool Enable = 7 [json_name="enable"];
}
message GetVideoRequest {
string ID =1 [json_name="id"];
uint64 UserId =2 [json_name="userId"];
string Url =3 [json_name="url"];
string Types =4 [json_name="types"];
}
message UpdateVideoRequest {
string ID =1 [json_name="id"];
uint64 UserId =2 [json_name="userId"];
string Url =3 [json_name="url"];
string Types =4 [json_name="types"];
}
message UpdateVideoRespond{
}
message GetExamListRequest {
string ID =1 [json_name="id"];
uint64 UserId =2 [json_name="userId"];
string Url =3 [json_name="url"];
string Types =4 [json_name="types"];
}
message GetExamListRespond {
repeated GetExamListData Data = 1;
}
message GetExamListData{
uint64 ID = 1 [json_name="id"];
uint64 UserId = 2 [json_name="userId"];
string Title = 3 [json_name="title"];
string Class = 4 [json_name="class"];
uint64 TitleScore = 5 [json_name="titleScore"];
string Score= 6 [json_name="score"];
string Types= 7 [json_name="types"];
string Remark = 8 [json_name="remark"];
string Remark2 = 9 [json_name="remark2"];
bool Enable = 10 [json_name="enable"];
}
message GetExamRequest {
uint64 ID = 1 [json_name="id"];
uint64 UserId = 2 [json_name="userId"];
string Title = 3 [json_name="title"];
string Class = 4 [json_name="class"];
uint64 TitleScore = 5 [json_name="titleScore"];
string Score= 6 [json_name="score"];
string Types= 7 [json_name="types"];
string Remark = 8 [json_name="remark"];
string Remark2 = 9 [json_name="remark2"];
bool Enable = 10 [json_name="enable"];
}
message UpdateExamRequest {
uint64 ID = 1 [json_name="id"];
uint64 UserId = 2 [json_name="userId"];
string Title = 3 [json_name="title"];
string Class = 4 [json_name="class"];
uint64 TitleScore = 5 [json_name="titleScore"];
string Score= 6 [json_name="score"];
string Types= 7 [json_name="types"];
string Remark = 8 [json_name="remark"];
string Remark2 = 9 [json_name="remark2"];
bool Enable = 10 [json_name="enable"];
}
message UpdateExamRespond{
int32 Percent = 1 [ json_name="percent"];
}
message GetArtistInfoListRequest {
string ID =1 [json_name="id"];
uint64 UserId =2 [json_name="userId"];
string Url =3 [json_name="url"];
string Types =4 [json_name="types"];
}
message GetArtistInfoListRespond {
repeated GetArtistInfoListData Data = 1;
}
message GetArtistInfoListData{
uint64 ID = 1 [json_name="id"];
uint64 UserId = 2 [json_name="userId"];
string ArtistId = 3 [json_name = "artistId"];
string BankAccount = 4 [json_name="bankAccount"];
string BankName = 5 [json_name="bankName"];
string Introduct = 6 [json_name="introduct"];
string CountryArtLevel = 7 [json_name="countryArtLevel"];
string ArtistCertPic = 8 [json_name="artistCertPic"];
string Remark = 9 [json_name="remark"];
string Remark2 = 10 [json_name="remark2"];
uint64 State = 11 [json_name="state"];
}
message GetArtistInfoRequest {
uint64 ID = 1 [json_name="id"];
uint64 UserId = 2 [json_name="userId"];
string ArtistId = 3 [json_name = "artistId"];
string BankAccount = 4 [json_name="bankAccount"];
string BankName = 5 [json_name="bankName"];
string Introduct = 6 [json_name="introduct"];
string CountryArtLevel = 7 [json_name="countryArtLevel"];
string ArtistCertPic = 8 [json_name="artistCertPic"];
string Remark = 9 [json_name="remark"];
string Remark2 = 10 [json_name="remark2"];
uint64 State = 11 [json_name="state"];
}
message UpdateArtistInfoRequest {
uint64 ID = 1 [json_name="id"];
uint64 UserId = 2 [json_name="userId"];
string ArtistId = 3 [json_name = "artistId"];
string BankAccount = 4 [json_name="bankAccount"];
string BankName = 5 [json_name="bankName"];
string Introduct = 6 [json_name="introduct"];
string CountryArtLevel = 7 [json_name="countryArtLevel"];
string ArtistCertPic = 8 [json_name="artistCertPic"];
string Remark = 9 [json_name="remark"];
string Remark2 = 10 [json_name="remark2"];
uint64 State = 11 [json_name="state"];
}
message UpdateArtistInfoRespond{
}

View File

@ -0,0 +1,642 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v3.9.0
// source: api/supplyinfo/supplyinfo.proto
package supplyinfo
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// SupplyInfoClient is the client API for SupplyInfo 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 SupplyInfoClient interface {
GetSupplyInfoList(ctx context.Context, in *GetSupplyInfoListRequest, opts ...grpc_go.CallOption) (*GetSupplyInfoListRespond, common.ErrorWithAttachment)
GetSupplyInfo(ctx context.Context, in *GetSupplyInfoRequest, opts ...grpc_go.CallOption) (*GetSupplyInfoData, common.ErrorWithAttachment)
UpdateSupplyInfo(ctx context.Context, in *UpdateSupplyInfoRequest, opts ...grpc_go.CallOption) (*UpdateSupplyInfoRespond, common.ErrorWithAttachment)
GetVideoList(ctx context.Context, in *GetVideoListRequest, opts ...grpc_go.CallOption) (*GetVideoListRespond, common.ErrorWithAttachment)
GetVideo(ctx context.Context, in *GetVideoRequest, opts ...grpc_go.CallOption) (*GetVideoListData, common.ErrorWithAttachment)
UpdateVideo(ctx context.Context, in *UpdateVideoRequest, opts ...grpc_go.CallOption) (*UpdateVideoRespond, common.ErrorWithAttachment)
GetExamList(ctx context.Context, in *GetExamListRequest, opts ...grpc_go.CallOption) (*GetExamListRespond, common.ErrorWithAttachment)
GetExam(ctx context.Context, in *GetExamRequest, opts ...grpc_go.CallOption) (*GetExamListData, common.ErrorWithAttachment)
UpdateExam(ctx context.Context, in *UpdateExamRequest, opts ...grpc_go.CallOption) (*UpdateExamRespond, common.ErrorWithAttachment)
GetArtistInfoList(ctx context.Context, in *GetArtistInfoListRequest, opts ...grpc_go.CallOption) (*GetArtistInfoListRespond, common.ErrorWithAttachment)
GetArtistInfo(ctx context.Context, in *GetArtistInfoRequest, opts ...grpc_go.CallOption) (*GetArtistInfoListData, common.ErrorWithAttachment)
UpdateArtistInfo(ctx context.Context, in *UpdateArtistInfoRequest, opts ...grpc_go.CallOption) (*UpdateArtistInfoRespond, common.ErrorWithAttachment)
}
type supplyInfoClient struct {
cc *triple.TripleConn
}
type SupplyInfoClientImpl struct {
GetSupplyInfoList func(ctx context.Context, in *GetSupplyInfoListRequest) (*GetSupplyInfoListRespond, error)
GetSupplyInfo func(ctx context.Context, in *GetSupplyInfoRequest) (*GetSupplyInfoData, error)
UpdateSupplyInfo func(ctx context.Context, in *UpdateSupplyInfoRequest) (*UpdateSupplyInfoRespond, error)
GetVideoList func(ctx context.Context, in *GetVideoListRequest) (*GetVideoListRespond, error)
GetVideo func(ctx context.Context, in *GetVideoRequest) (*GetVideoListData, error)
UpdateVideo func(ctx context.Context, in *UpdateVideoRequest) (*UpdateVideoRespond, error)
GetExamList func(ctx context.Context, in *GetExamListRequest) (*GetExamListRespond, error)
GetExam func(ctx context.Context, in *GetExamRequest) (*GetExamListData, error)
UpdateExam func(ctx context.Context, in *UpdateExamRequest) (*UpdateExamRespond, error)
GetArtistInfoList func(ctx context.Context, in *GetArtistInfoListRequest) (*GetArtistInfoListRespond, error)
GetArtistInfo func(ctx context.Context, in *GetArtistInfoRequest) (*GetArtistInfoListData, error)
UpdateArtistInfo func(ctx context.Context, in *UpdateArtistInfoRequest) (*UpdateArtistInfoRespond, error)
}
func (c *SupplyInfoClientImpl) GetDubboStub(cc *triple.TripleConn) SupplyInfoClient {
return NewSupplyInfoClient(cc)
}
func (c *SupplyInfoClientImpl) XXX_InterfaceName() string {
return "Supplyinfo.SupplyInfo"
}
func NewSupplyInfoClient(cc *triple.TripleConn) SupplyInfoClient {
return &supplyInfoClient{cc}
}
func (c *supplyInfoClient) GetSupplyInfoList(ctx context.Context, in *GetSupplyInfoListRequest, opts ...grpc_go.CallOption) (*GetSupplyInfoListRespond, common.ErrorWithAttachment) {
out := new(GetSupplyInfoListRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetSupplyInfoList", in, out)
}
func (c *supplyInfoClient) GetSupplyInfo(ctx context.Context, in *GetSupplyInfoRequest, opts ...grpc_go.CallOption) (*GetSupplyInfoData, common.ErrorWithAttachment) {
out := new(GetSupplyInfoData)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetSupplyInfo", in, out)
}
func (c *supplyInfoClient) UpdateSupplyInfo(ctx context.Context, in *UpdateSupplyInfoRequest, opts ...grpc_go.CallOption) (*UpdateSupplyInfoRespond, common.ErrorWithAttachment) {
out := new(UpdateSupplyInfoRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateSupplyInfo", in, out)
}
func (c *supplyInfoClient) GetVideoList(ctx context.Context, in *GetVideoListRequest, opts ...grpc_go.CallOption) (*GetVideoListRespond, common.ErrorWithAttachment) {
out := new(GetVideoListRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetVideoList", in, out)
}
func (c *supplyInfoClient) GetVideo(ctx context.Context, in *GetVideoRequest, opts ...grpc_go.CallOption) (*GetVideoListData, common.ErrorWithAttachment) {
out := new(GetVideoListData)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetVideo", in, out)
}
func (c *supplyInfoClient) UpdateVideo(ctx context.Context, in *UpdateVideoRequest, opts ...grpc_go.CallOption) (*UpdateVideoRespond, common.ErrorWithAttachment) {
out := new(UpdateVideoRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateVideo", in, out)
}
func (c *supplyInfoClient) GetExamList(ctx context.Context, in *GetExamListRequest, opts ...grpc_go.CallOption) (*GetExamListRespond, common.ErrorWithAttachment) {
out := new(GetExamListRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetExamList", in, out)
}
func (c *supplyInfoClient) GetExam(ctx context.Context, in *GetExamRequest, opts ...grpc_go.CallOption) (*GetExamListData, common.ErrorWithAttachment) {
out := new(GetExamListData)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetExam", in, out)
}
func (c *supplyInfoClient) UpdateExam(ctx context.Context, in *UpdateExamRequest, opts ...grpc_go.CallOption) (*UpdateExamRespond, common.ErrorWithAttachment) {
out := new(UpdateExamRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateExam", in, out)
}
func (c *supplyInfoClient) GetArtistInfoList(ctx context.Context, in *GetArtistInfoListRequest, opts ...grpc_go.CallOption) (*GetArtistInfoListRespond, common.ErrorWithAttachment) {
out := new(GetArtistInfoListRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtistInfoList", in, out)
}
func (c *supplyInfoClient) GetArtistInfo(ctx context.Context, in *GetArtistInfoRequest, opts ...grpc_go.CallOption) (*GetArtistInfoListData, common.ErrorWithAttachment) {
out := new(GetArtistInfoListData)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtistInfo", in, out)
}
func (c *supplyInfoClient) UpdateArtistInfo(ctx context.Context, in *UpdateArtistInfoRequest, opts ...grpc_go.CallOption) (*UpdateArtistInfoRespond, common.ErrorWithAttachment) {
out := new(UpdateArtistInfoRespond)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateArtistInfo", in, out)
}
// SupplyInfoServer is the server API for SupplyInfo service.
// All implementations must embed UnimplementedSupplyInfoServer
// for forward compatibility
type SupplyInfoServer interface {
GetSupplyInfoList(context.Context, *GetSupplyInfoListRequest) (*GetSupplyInfoListRespond, error)
GetSupplyInfo(context.Context, *GetSupplyInfoRequest) (*GetSupplyInfoData, error)
UpdateSupplyInfo(context.Context, *UpdateSupplyInfoRequest) (*UpdateSupplyInfoRespond, error)
GetVideoList(context.Context, *GetVideoListRequest) (*GetVideoListRespond, error)
GetVideo(context.Context, *GetVideoRequest) (*GetVideoListData, error)
UpdateVideo(context.Context, *UpdateVideoRequest) (*UpdateVideoRespond, error)
GetExamList(context.Context, *GetExamListRequest) (*GetExamListRespond, error)
GetExam(context.Context, *GetExamRequest) (*GetExamListData, error)
UpdateExam(context.Context, *UpdateExamRequest) (*UpdateExamRespond, error)
GetArtistInfoList(context.Context, *GetArtistInfoListRequest) (*GetArtistInfoListRespond, error)
GetArtistInfo(context.Context, *GetArtistInfoRequest) (*GetArtistInfoListData, error)
UpdateArtistInfo(context.Context, *UpdateArtistInfoRequest) (*UpdateArtistInfoRespond, error)
mustEmbedUnimplementedSupplyInfoServer()
}
// UnimplementedSupplyInfoServer must be embedded to have forward compatible implementations.
type UnimplementedSupplyInfoServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedSupplyInfoServer) GetSupplyInfoList(context.Context, *GetSupplyInfoListRequest) (*GetSupplyInfoListRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSupplyInfoList not implemented")
}
func (UnimplementedSupplyInfoServer) GetSupplyInfo(context.Context, *GetSupplyInfoRequest) (*GetSupplyInfoData, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSupplyInfo not implemented")
}
func (UnimplementedSupplyInfoServer) UpdateSupplyInfo(context.Context, *UpdateSupplyInfoRequest) (*UpdateSupplyInfoRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateSupplyInfo not implemented")
}
func (UnimplementedSupplyInfoServer) GetVideoList(context.Context, *GetVideoListRequest) (*GetVideoListRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetVideoList not implemented")
}
func (UnimplementedSupplyInfoServer) GetVideo(context.Context, *GetVideoRequest) (*GetVideoListData, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetVideo not implemented")
}
func (UnimplementedSupplyInfoServer) UpdateVideo(context.Context, *UpdateVideoRequest) (*UpdateVideoRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateVideo not implemented")
}
func (UnimplementedSupplyInfoServer) GetExamList(context.Context, *GetExamListRequest) (*GetExamListRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetExamList not implemented")
}
func (UnimplementedSupplyInfoServer) GetExam(context.Context, *GetExamRequest) (*GetExamListData, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetExam not implemented")
}
func (UnimplementedSupplyInfoServer) UpdateExam(context.Context, *UpdateExamRequest) (*UpdateExamRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateExam not implemented")
}
func (UnimplementedSupplyInfoServer) GetArtistInfoList(context.Context, *GetArtistInfoListRequest) (*GetArtistInfoListRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetArtistInfoList not implemented")
}
func (UnimplementedSupplyInfoServer) GetArtistInfo(context.Context, *GetArtistInfoRequest) (*GetArtistInfoListData, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetArtistInfo not implemented")
}
func (UnimplementedSupplyInfoServer) UpdateArtistInfo(context.Context, *UpdateArtistInfoRequest) (*UpdateArtistInfoRespond, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateArtistInfo not implemented")
}
func (s *UnimplementedSupplyInfoServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedSupplyInfoServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedSupplyInfoServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &SupplyInfo_ServiceDesc
}
func (s *UnimplementedSupplyInfoServer) XXX_InterfaceName() string {
return "Supplyinfo.SupplyInfo"
}
func (UnimplementedSupplyInfoServer) mustEmbedUnimplementedSupplyInfoServer() {}
// UnsafeSupplyInfoServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SupplyInfoServer will
// result in compilation errors.
type UnsafeSupplyInfoServer interface {
mustEmbedUnimplementedSupplyInfoServer()
}
func RegisterSupplyInfoServer(s grpc_go.ServiceRegistrar, srv SupplyInfoServer) {
s.RegisterService(&SupplyInfo_ServiceDesc, srv)
}
func _SupplyInfo_GetSupplyInfoList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSupplyInfoListRequest)
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("GetSupplyInfoList", 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 _SupplyInfo_GetSupplyInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSupplyInfoRequest)
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("GetSupplyInfo", 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 _SupplyInfo_UpdateSupplyInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateSupplyInfoRequest)
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("UpdateSupplyInfo", 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 _SupplyInfo_GetVideoList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetVideoListRequest)
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("GetVideoList", 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 _SupplyInfo_GetVideo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetVideoRequest)
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("GetVideo", 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 _SupplyInfo_UpdateVideo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateVideoRequest)
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("UpdateVideo", 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 _SupplyInfo_GetExamList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetExamListRequest)
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("GetExamList", 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 _SupplyInfo_GetExam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetExamRequest)
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("GetExam", 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 _SupplyInfo_UpdateExam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateExamRequest)
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("UpdateExam", 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 _SupplyInfo_GetArtistInfoList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetArtistInfoListRequest)
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("GetArtistInfoList", 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 _SupplyInfo_GetArtistInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetArtistInfoRequest)
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("GetArtistInfo", 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 _SupplyInfo_UpdateArtistInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateArtistInfoRequest)
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("UpdateArtistInfo", 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)
}
// SupplyInfo_ServiceDesc is the grpc_go.ServiceDesc for SupplyInfo service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var SupplyInfo_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "Supplyinfo.SupplyInfo",
HandlerType: (*SupplyInfoServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "GetSupplyInfoList",
Handler: _SupplyInfo_GetSupplyInfoList_Handler,
},
{
MethodName: "GetSupplyInfo",
Handler: _SupplyInfo_GetSupplyInfo_Handler,
},
{
MethodName: "UpdateSupplyInfo",
Handler: _SupplyInfo_UpdateSupplyInfo_Handler,
},
{
MethodName: "GetVideoList",
Handler: _SupplyInfo_GetVideoList_Handler,
},
{
MethodName: "GetVideo",
Handler: _SupplyInfo_GetVideo_Handler,
},
{
MethodName: "UpdateVideo",
Handler: _SupplyInfo_UpdateVideo_Handler,
},
{
MethodName: "GetExamList",
Handler: _SupplyInfo_GetExamList_Handler,
},
{
MethodName: "GetExam",
Handler: _SupplyInfo_GetExam_Handler,
},
{
MethodName: "UpdateExam",
Handler: _SupplyInfo_UpdateExam_Handler,
},
{
MethodName: "GetArtistInfoList",
Handler: _SupplyInfo_GetArtistInfoList_Handler,
},
{
MethodName: "GetArtistInfo",
Handler: _SupplyInfo_GetArtistInfo_Handler,
},
{
MethodName: "UpdateArtistInfo",
Handler: _SupplyInfo_UpdateArtistInfo_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "api/supplyinfo/supplyinfo.proto",
}

51
pkg/cache/redis.go vendored Normal file
View File

@ -0,0 +1,51 @@
package cache
import (
"strconv"
"dubbo.apache.org/dubbo-go/v3/common/logger"
"github.com/go-redis/redis"
"gopkg.in/ini.v1"
)
// RedisClient Redis缓存客户端单例
var (
RedisClient *redis.Client
RedisDB int
RedisAddr string
RedisPw string
//RedisDbName string
)
// InitRedis 在中间件中初始化redis链接 防止循环导包,所以放在这里
func InitRedis(confPath string) {
//从本地读取环境变量
file, err := ini.Load(confPath)
if err != nil {
panic(err)
}
LoadRedisData(file)
connRedis()
}
// connRedis 在中间件中初始化redis链接
func connRedis() {
RedisClient = redis.NewClient(&redis.Options{
Addr: RedisAddr,
Password: RedisPw,
DB: RedisDB,
})
_, err := RedisClient.Ping().Result()
if err != nil {
logger.Errorf("connRedis err", err)
panic(err)
}
}
func LoadRedisData(file *ini.File) {
dbStr := file.Section("redis").Key("RedisDb").String()
RedisDB, _ = strconv.Atoi(dbStr)
RedisAddr = file.Section("redis").Key("RedisAddr").String()
RedisPw = file.Section("redis").Key("RedisPW").String()
//RedisDbName = file.Section("redis").Key("RedisDbName").String()
}

106
pkg/db/init.go Normal file
View File

@ -0,0 +1,106 @@
package model
import (
"fmt"
"os"
"strings"
"time"
"github.com/fonchain-artistserver/cmd/model"
"github.com/fonchain-artistserver/pkg/m"
"github.com/gin-gonic/gin"
"gopkg.in/ini.v1"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"gorm.io/gorm/schema"
)
var DB *gorm.DB
var (
Db string
DbHost string
DbPort string
DbUser string
DbPassWord string
DbLogName string
)
func Init(confPath string) {
//从本地读取环境变量
file, err := ini.Load(confPath)
if err != nil {
fmt.Println(m.ERROR_SERVER, err)
}
//加载数据库配置
LoadMysqlData(file)
//MySQL数据库
path := strings.Join([]string{DbUser, ":", DbPassWord, "@tcp(", DbHost, ":", DbPort, ")/", DbLogName, "?charset=utf8&parseTime=true"}, "")
//连接数据库
Database(path)
migration() //迁移表 如果需要就打开使用
}
func LoadMysqlData(file *ini.File) {
Db = file.Section("mysql").Key("Db").String()
DbHost = file.Section("mysql").Key("DbHost").String()
DbPort = file.Section("mysql").Key("DbPort").String()
DbUser = file.Section("mysql").Key("DbUser").String()
DbPassWord = file.Section("mysql").Key("DbPassWord").String()
DbLogName = file.Section("mysql").Key("DbName").String()
}
func Database(conn string) {
var ormLogger logger.Interface
if gin.Mode() == "debug" {
ormLogger = logger.Default.LogMode(logger.Info)
} else {
ormLogger = logger.Default
}
db, err := gorm.Open(mysql.New(mysql.Config{
DSN: conn, // DSN data source name
DefaultStringSize: 256, // string 类型字段的默认长度
DisableDatetimePrecision: true, // 禁用 datetime 精度MySQL 5.6 之前的数据库不支持
DontSupportRenameIndex: true, // 重命名索引时采用删除并新建的方式MySQL 5.7 之前的数据库和 MariaDB 不支持重命名索引
DontSupportRenameColumn: true, // 用 `change` 重命名列MySQL 8 之前的数据库和 MariaDB 不支持重命名列
SkipInitializeWithVersion: false, // 根据版本自动配置
}), &gorm.Config{
Logger: ormLogger,
NamingStrategy: schema.NamingStrategy{
SingularTable: true,
},
})
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(20) //设置连接池,空闲
sqlDB.SetMaxOpenConns(100) //打开
sqlDB.SetConnMaxLifetime(time.Second * 30)
DB = db
if err != nil {
panic(err)
}
}
func migration() {
//自迁移模式
err := DB.AutoMigrate(&model.User{},
&model.Bank{},
&model.RealName{},
&model.Artwork{},
&model.Contract{},
&model.SupplyInfo{},
&model.ExhVideo{},
&model.ExhExam{},
&model.Invite{},
&model.ArtistInfo{},
&model.UserInvited{},
&model.ArtworkState{},
&model.ArtworkBatch{},
)
if err != nil {
fmt.Println("register table fail")
os.Exit(0)
}
fmt.Println("register table success")
}

17
pkg/m/artistinfo.go Normal file
View File

@ -0,0 +1,17 @@
package m
//HTTP
const (
CertPath = "./key/artist.fontree.cn.crt"
PrivPath = "./key/artist.fontree.cn.key"
Enabled = "false"
// ReturnUrl = "http://artist.fontree.cn"
ReturnUrl = "192.168.10.7"
)
const (
URL = "https://cdn.fontree.cn"
AK = "e102c02f0a7843d29a8abe561a17913e"
SK = "a6042bb43d4747259a7da72133cc5ce6"
Bucket = "dci-file"
)

77
pkg/m/msg.go Normal file
View File

@ -0,0 +1,77 @@
package m
import "github.com/fonchain_enterprise/utils/aes"
var Encryption aes.Encryption
var JWTSecret = []byte("asdfqwer1234")
const (
SERVER_CONFIG = "../conf/conf.ini"
SERVER_DUBBOGO_CONFIG = "dubbogo.yaml"
MODE_ENV = "MODE_ENV"
)
const (
TokenTime = 12
)
const (
SUCCESS = "success"
FAILED = "failed"
)
const (
ERRORPWD = "账号或密码错误"
ERRORCODE = "验证码错误"
ERROT_SAME_TEL = "新手机号与旧手机号相同"
ERRORCONFIG = "配置文件读取错误,请检查文件路径:"
ACCOUNT_EXIST = "账号已存在"
ERROR_SERVER = "服务器错误"
ERROR_STRUCT = "结构体错误"
WARNING_WAITING = "稍等重试"
ERROR_DELETE = "删除错误"
ERROR_UPDATE = "更新异常"
ERROR_CREATE_ARTIST_INVALID = "创建画家参数错误"
CREATE_SUCCESS = "创建成功"
CREATE_ERROR = "创建失败"
UPDATE_SUCCESS = "更新成功"
ERROR_UID = "uid创建错误"
ERROR_CREATE_PROFILE_DAO = "创建画家信息表错误"
ERROR_CREATE_EXT_DATA = "创建画家扩充数据错误"
ERROR_ARTIST_NAME_EMPTY = "画家名字为空"
ERROR_CAA_NAME_NOT_EMPTY = "证书和名字都不能为空"
ERROR_CAA_NUM_EMPTY = "证书编号为空"
ERROR_CAA_NUM_INVALID = "证书不匹配"
ERROR_CAA_NO_DATA = "证书未查询到数据"
ERROR_ALREADY_AUTH = "此身份证已实名认证"
ERROR_MARSHAL = "数据序列化错误"
ERROR_UNMARSHAL = "数据反序列化错误"
ERROR_AFFECT_ROWS_ZERO = "影响行为0"
ERROR_AFFECT_ROWS = "影响行不一致"
ERROR_SELECT = "查询异常"
SAVE_ERROR = "数据库保存或者更新数据错误"
UPDATE_FAILED = "更新失败"
ERROR_UPDATE_MEAID_INVALID = "更新图像参数不合法"
ERROR_Index_INVALID = "更新指数参数不合法"
ERROR_UPDATE_MEDIA_DAO = "更新图像错误"
ARTIST_NOT_EXISTS = "画家不存在"
ERROR_DATA_NOT_EXISTS = "数据不存在"
ERROR_UPDATE_ARTIST = "数据不存在"
ERROR_INVALID_CARDID = "身份证号不合法"
INVITE_CODE_INVALID = "邀请码无效"
ERROR_ISLOCK = "用户已被锁定"
ERROR_UPDATE_HONOR_INVALID = "更新荣誉参数不合法"
ERROR_HONOR_TYPE = "荣誉类型不合法"
ERROR_HONOR_CREATE = "荣誉信息创建错误"
ERROR_DEL_ARTIST_INVALID = "删除画家参数错误"
ERROR_DEL_ARTIST_DAO = "删除画家DAO错误"
ERROR_DEL_ARTIST_FAILED = "删除画家失败"
DEL_SUCCESS = "删除成功"
ERROR_BATCH_INSERT = "批量插入失败"
CREATE_BATCH_SUCCESS = "批量插入成功"
)

28
pkg/util/file.go Normal file
View File

@ -0,0 +1,28 @@
package util
import (
"fmt"
"os"
)
func CreateArtistInfo(id int64) {
if _, err := os.Stat("static/artist/" + fmt.Sprintf("%d", id) + "/"); err != nil {
if !os.IsExist(err) {
os.MkdirAll("static/artist/"+fmt.Sprintf("%d", id)+"/", os.ModePerm)
}
}
if _, err := os.Stat("static/artist/" + fmt.Sprintf("%d", id) + "/info/"); err != nil {
if !os.IsExist(err) {
os.MkdirAll("static/artist/"+fmt.Sprintf("%d", id)+"/info", os.ModePerm)
}
}
}
func CreateArtworkInfo(id int64) {
if _, err := os.Stat("static/artwork/" + fmt.Sprintf("%d", id) + "/"); err != nil {
if !os.IsExist(err) {
os.MkdirAll("static/artwork/"+fmt.Sprintf("%d", id)+"/", os.ModePerm)
}
}
}

130
pkg/util/qrcode.go Normal file
View File

@ -0,0 +1,130 @@
package util
import (
"fmt"
"image"
"image/color"
"image/draw"
"image/png"
"io/ioutil"
"log"
"os"
"github.com/fonchain/utils/utils"
"github.com/golang/freetype"
"github.com/nfnt/resize"
"golang.org/x/image/font"
)
func CreateQrCode(invitedCode, userName string) error {
QrCodePath, err := utils.GenQRCode("https://artist.fontree.cn/login?invitedCode=" + invitedCode)
if err != nil {
return err
}
tmp, err := os.Open(QrCodePath)
if err != nil {
return err
}
defer tmp.Close()
src, err := os.Open("./qrcodebg.png")
if err != nil {
log.Println(err)
return err
}
defer src.Close()
img, err := png.Decode(src)
if err != nil {
log.Println(err)
return err
}
outimage, _ := addLabel(img, userName+"邀请您注册画家宝用户", 210, 300, color.RGBA{255, 255, 255, 255}, 55, "font1716.ttf")
outimage, _ = addLabel(outimage, "(使用此二维码后,"+userName+"将成为你的邀请人)", 210, 400, color.RGBA{255, 255, 255, 255}, 38, "font1716.ttf")
outimage, _ = addLabel(outimage, "邀请码:"+invitedCode, 260, 1340, color.RGBA{69, 137, 239, 255}, 70, "font1716.ttf")
QrCode2Path := "static/qrcode/" + invitedCode + "-2.png"
f, err := os.Create(QrCode2Path)
if err != nil {
log.Println(err)
return err
}
defer f.Close()
newImg := image.NewNRGBA(image.Rect(0, 0, 1125, 2436))
// fe, err := os.Open("./" + artistPhoto.SmallPic + "_small.jpg")
qrImg, err := png.Decode(tmp)
if err != nil {
fmt.Println(err.Error())
return err
}
qrImg = resize.Resize(uint(700), uint(700), qrImg, resize.Lanczos3)
draw.Draw(newImg, newImg.Bounds(), outimage, outimage.Bounds().Min.Sub(image.Pt(0, 0)), draw.Over)
draw.Draw(newImg, newImg.Bounds(), qrImg, qrImg.Bounds().Min.Sub(image.Pt(210, 570)), draw.Over)
err = png.Encode(f, newImg)
if err != nil {
return err
}
tmp.Close()
tmps, err := os.OpenFile(QrCodePath, os.O_RDWR|os.O_CREATE, 0777)
if err != nil {
return err
}
defer tmps.Close()
_, err = UploadToBos(tmps, fmt.Sprintf("artistmgmt/static/qrcode/%v.png", invitedCode))
if err != nil {
return err
}
// fmt.Println(urlss)
tmp2, err := os.Open(QrCode2Path)
if err != nil {
return err
}
defer tmp2.Close()
str, err := UploadToBos(tmp2, fmt.Sprintf("artistmgmt/static/qrcode/%v-2.png", invitedCode))
if err != nil {
return err
}
fmt.Println(str, "===============")
return nil
}
func addLabel(img image.Image, label string, x, y int, fontColor color.Color, size float64, fontPath string) (image.Image, error) {
bound := img.Bounds()
// 创建一个新的图片
rgba := image.NewRGBA(image.Rect(0, 0, bound.Dx(), bound.Dy()))
// 读取字体
fontBytes, err := ioutil.ReadFile(fontPath)
if err != nil {
return rgba, err
}
myFont, err := freetype.ParseFont(fontBytes)
if err != nil {
return rgba, err
}
draw.Draw(rgba, rgba.Bounds(), img, bound.Min, draw.Src)
c := freetype.NewContext()
c.SetDPI(72)
c.SetFont(myFont)
c.SetFontSize(size)
c.SetClip(rgba.Bounds())
c.SetDst(rgba)
uni := image.NewUniform(fontColor)
c.SetSrc(uni)
c.SetHinting(font.HintingNone)
// 在指定的位置显示
pt := freetype.Pt(x, y+int(c.PointToFixed(size)>>6))
if _, err := c.DrawString(label, pt); err != nil {
return rgba, err
}
return rgba, nil
}

167
pkg/util/utils.go Normal file
View File

@ -0,0 +1,167 @@
package util
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"reflect"
"strconv"
"strings"
"time"
"github.com/fonchain-artistserver/pkg/m"
"github.com/fonchain/utils/objstorage"
)
// IdCardTurnAge 身份证号读取年龄
func IdCardTurnAge(idCard string) int {
var mapmou = map[string]int{"January": 1, "february": 2, "March": 3, "April": 4, "May": 5, "June": 6, "July": 7, "August": 8, "September": 9, "October": 10, "November": 11, "December": 12}
// idCard := "34052419800101001X" //身份证
now := time.Now()
now_year := now.Year() // 年
now_mo := mapmou[now.Month().String()] // 月
now_day := now.Day() // 日
fmt.Println(now_year, now_mo, now_day)
idcard_year, _ := strconv.Atoi(Substr(idCard, 6, 4)) // 年
idcard_mo, _ := strconv.Atoi(Substr(idCard, 10, 2)) // 月
idcard_day, _ := strconv.Atoi(Substr(idCard, 12, 2)) // 日
fmt.Println(idcard_year, idcard_mo, idcard_day)
fmt.Println("idCard:" + idCard)
age := now_year - idcard_year // 如果计算虚岁需这样age := now_year - idcard_year+1
if now_year < idcard_year {
age = 0
} else {
if now_mo < idcard_mo {
age = age - 1
} else {
if now_day < idcard_day {
age = age - 1
}
}
}
fmt.Println("age:", age)
return age
}
func Substr(str string, start, length int) string {
rs := []rune(str)
rl := len(rs)
end := 0
if start < 0 {
start = rl - 1 + start
}
end = start + length
if start > end {
start, end = end, start
}
if start < 0 {
start = 0
}
if start > rl {
start = rl
}
if end < 0 {
end = 0
}
if end > rl {
end = rl
}
return string(rs[start:end])
}
// 封装上传图片到bos然后返回状态和图片的url单张
func UploadToBos(file multipart.File, objName string) (string, error) {
BOSClient, err := objstorage.NewBOS(m.AK, m.SK, objstorage.BOS_BJ)
if err != nil {
fmt.Println(err)
}
b := new(strings.Builder)
io.Copy(b, file)
_, err = BOSClient.PutObjectFromBytes(m.Bucket, objName, []byte(b.String()))
if err != nil {
return "", err
}
url := m.URL + "/" + objName
return url, nil
}
type CopyOption struct {
Src interface{}
Dst interface{}
WhiteFields string
BlackFields string
}
// 反射
func CopyStructSuper(copyOpt CopyOption) {
st := reflect.TypeOf(copyOpt.Src)
sv := reflect.ValueOf(copyOpt.Src)
dt := reflect.TypeOf(copyOpt.Dst)
dv := reflect.ValueOf(copyOpt.Dst)
if st.Kind() == reflect.Ptr { //处理指针
st = st.Elem()
sv = sv.Elem()
}
if dt.Kind() == reflect.Ptr { //处理指针
dt = dt.Elem()
}
if st.Kind() != reflect.Struct || dt.Kind() != reflect.Struct { //如果不是struct类型直接返回dst
return
}
dv = reflect.ValueOf(dv.Interface())
// 遍历TypeOf 类型
for i := 0; i < dt.NumField(); i++ { //通过索引来取得它的所有字段,同时来决定循环的次数
f := dt.Field(i) //通过这个i作为它的索引从0开始来取得它的字段
dVal := dv.Elem().Field(i)
sVal := sv.FieldByName(f.Name)
if copyOpt.WhiteFields != "" {
if !strings.Contains(copyOpt.WhiteFields, fmt.Sprintf(",%s,", f.Name)) {
continue
}
}
if copyOpt.BlackFields != "" {
if strings.Contains(copyOpt.BlackFields, fmt.Sprintf(",%s,", f.Name)) {
continue
}
}
//src数据有效且dst字段能赋值,类型一致
if sVal.IsValid() && dVal.CanSet() && f.Type.Kind() == sVal.Type().Kind() {
dVal.Set(sVal)
}
}
}
func Post(url, data string) (string, error) {
reader := bytes.NewReader([]byte(data))
request, err := http.NewRequest("POST", url, reader)
if err != nil {
return "", err
}
defer request.Body.Close() //程序在使用完回复后必须关闭回复的主体
request.Header.Set("Content-Type", "application/json;charset=UTF-8")
//必须设定该参数,POST参数才能正常提交意思是以json串提交数据
client := http.Client{}
resp, err := client.Do(request) //Do 方法发送请求,返回 HTTP 回复
if err != nil {
return "", err
}
respBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
//byte数组直接转成string优化内存
// str := (*string)(unsafe.Pointer(&respBytes))
return string(respBytes), nil
}