上传artistinfo微服务
This commit is contained in:
commit
928a9f0387
33
DockerfileWindowsTest
Normal file
33
DockerfileWindowsTest
Normal 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
26
cmd/app.go
Normal 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 {}
|
||||
}
|
77
cmd/internal/controller/artisrInfo.go
Normal file
77
cmd/internal/controller/artisrInfo.go
Normal file
@ -0,0 +1,77 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/fonchain-artistserver/cmd/internal/logic"
|
||||
artistInfo "github.com/fonchain-artistserver/pb/artistinfo"
|
||||
)
|
||||
|
||||
type ArtistInfoProvider struct {
|
||||
artistInfo.UnimplementedArtistInfoServer
|
||||
artistInfoLogic *logic.ArtistInfo
|
||||
}
|
||||
|
||||
func (a *ArtistInfoProvider) GetUserInfo(ctx context.Context, req *artistInfo.GetUserInfoRequest) (rep *artistInfo.GetUserInfoRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
// backup := &artistInfo.GetUserInfoRespond{}
|
||||
if rep, err = a.artistInfoLogic.GetUserInfo(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (a *ArtistInfoProvider) CreateUserInfo(ctx context.Context, req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.CreateUserInfoRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
// backup := &artistInfo.GetUserInfoRespond{}
|
||||
if rep, err = a.artistInfoLogic.CreateUserInfo(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (a *ArtistInfoProvider) UpdateUserInfo(ctx context.Context, req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.UpdateUserInfoRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
// backup := &artistInfo.GetUserInfoRespond{}
|
||||
if rep, err = a.artistInfoLogic.UpdateUserInfo(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (a *ArtistInfoProvider) UserUpdateTel(ctx context.Context, req *artistInfo.UserUpdateTelRequest) (rep *artistInfo.UserUpdateTelRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
// backup := &artistInfo.GetUserInfoRespond{}
|
||||
if rep, err = a.artistInfoLogic.UserUpdateTel(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (a *ArtistInfoProvider) UserUpdateMsg(ctx context.Context, req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.UserUpdateMsgRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
// backup := &artistInfo.GetUserInfoRespond{}
|
||||
if rep, err = a.artistInfoLogic.UserUpdateMsg(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
func (a *ArtistInfoProvider) Verifyfdd(ctx context.Context, req *artistInfo.VerifyfddRequest) (rep *artistInfo.VerifyfddRespond, err error) {
|
||||
fmt.Println("第一处")
|
||||
// backup := &artistInfo.GetUserInfoRespond{}
|
||||
if rep, err = a.artistInfoLogic.Verifyfdd(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
|
||||
}
|
441
cmd/internal/dao/artistInfo.go
Normal file
441
cmd/internal/dao/artistInfo.go
Normal file
@ -0,0 +1,441 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/fonchain-artistserver/cmd/model"
|
||||
artistInfo "github.com/fonchain-artistserver/pb/artistinfo"
|
||||
"github.com/fonchain-artistserver/pkg/cache"
|
||||
db "github.com/fonchain-artistserver/pkg/db"
|
||||
"github.com/fonchain-artistserver/pkg/m"
|
||||
"github.com/fonchain-artistserver/pkg/util"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func User(req *artistInfo.GetUserInfoRequest) (rep *artistInfo.GetUserInfoRespond, err error) {
|
||||
rep = &artistInfo.GetUserInfoRespond{}
|
||||
service := rep.Data
|
||||
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 nil, err
|
||||
}
|
||||
|
||||
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 nil, err
|
||||
}
|
||||
|
||||
var artworkList []model.Artwork
|
||||
if err = db.DB.Where("artist_id = ? ", int32(req.Id)).Find(&artworkList).Error; err != nil {
|
||||
zap.L().Error("get artworkList info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, v := range artworkList {
|
||||
if v.State == 3 {
|
||||
service.Ruler = service.Ruler + v.Ruler
|
||||
}
|
||||
}
|
||||
|
||||
service.TelNum = user.TelNum
|
||||
service.CertificateNum = user.CertificateNum
|
||||
if user.CertificateImg != "" {
|
||||
service.CertificateImg = fmt.Sprintf("%v?v=%d", user.CertificateImg, user.UpdatedAt.Unix())
|
||||
}
|
||||
service.RealName = realName.Name
|
||||
service.PenName = user.PenName
|
||||
service.Age = int32(util.IdCardTurnAge(realName.IDNum))
|
||||
service.IdCard = realName.IDNum
|
||||
|
||||
service.StageName = user.StageName
|
||||
service.WxAccount = user.WxAccount
|
||||
service.JoinAssoTime = user.JoinAssoTime
|
||||
service.IdCardFront = fmt.Sprintf("%v?v=%d", realName.IdcardFront, realName.UpdatedAt.Unix())
|
||||
service.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
|
||||
}
|
||||
service.ConAddress = conAddressArr
|
||||
service.InvitedCode = user.InvitedCode
|
||||
|
||||
var invited model.Invite
|
||||
if err = db.DB.Where("user_id=?", user.ID).First(&invited).Error; err != nil {
|
||||
//如果查询不到,返回相应的错误
|
||||
if err.Error() == "record not found" {
|
||||
user.InvitedCode = ""
|
||||
}
|
||||
//数据库操作异常
|
||||
zap.L().Error("get invite info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var invitedUser model.User
|
||||
if err = db.DB.Where("id=?", invited.InvitedId).First(&invitedUser).Error; err != nil {
|
||||
//如果查询不到,返回相应的错误
|
||||
if err.Error() == "record not found" {
|
||||
user.InvitedCode = ""
|
||||
return nil, err
|
||||
}
|
||||
//数据库操作异常
|
||||
zap.L().Error("get user info err", zap.Error(err))
|
||||
err = errors.New(m.ERROR_SELECT)
|
||||
return nil, err
|
||||
}
|
||||
service.InvitedName = invitedUser.Name
|
||||
service.Sex = user.Sex
|
||||
service.FddState = user.FddState
|
||||
service.CustomerId = user.CustomerId
|
||||
service.Photo = fmt.Sprintf("%v?v=%d", user.Photo, user.UpdatedAt.Unix())
|
||||
if user.Video != "" {
|
||||
service.Video = fmt.Sprintf("%v?v=%d", user.Video, user.UpdatedAt.Unix())
|
||||
}
|
||||
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)
|
||||
// service.QrCodeImgDownload=("http://192.168.1.18:9400/qrcodebg.png")
|
||||
service.QrCodeImgDownload = fmt.Sprintf("https://cdn.fontree.cn/artistmgmt/static/qrcode/%v-2.png", user.InvitedCode)
|
||||
rep.Data = service
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
// Update 用户修改信息
|
||||
func Create(req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.CreateUserInfoRespond, err error) {
|
||||
rep = &artistInfo.CreateUserInfoRespond{}
|
||||
// user := rep.User
|
||||
var user model.User
|
||||
// user := rep.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 nil, err
|
||||
}
|
||||
|
||||
var realNameFind model.RealName
|
||||
if err = db.DB.First(&realNameFind, "id_num = ?", req.UserUpdateInfoService.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.UserUpdateInfoService.RealName,
|
||||
IDNum: req.UserUpdateInfoService.IdCard,
|
||||
TelNum: req.UserUpdateInfoService.TelNum,
|
||||
IdcardFront: req.UserUpdateInfoService.IdCardFront,
|
||||
IdcardBack: req.UserUpdateInfoService.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(req.Id)
|
||||
user.Name = req.UserUpdateInfoService.RealName
|
||||
user.PenName = req.UserUpdateInfoService.PenName
|
||||
user.RealNameID = int32(realname.ID)
|
||||
user.StageName = req.UserUpdateInfoService.StageName
|
||||
user.Age = int32(util.IdCardTurnAge(realname.IDNum))
|
||||
user.Sex = int32(req.UserUpdateInfoService.Sex)
|
||||
user.JoinAssoTime = req.UserUpdateInfoService.JoinAssoTime
|
||||
user.CertificateNum = req.UserUpdateInfoService.CertificateNum
|
||||
conAddessByte, err := json.Marshal(req.UserUpdateInfoService.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.UserUpdateInfoService.Photo
|
||||
user.WxAccount = req.UserUpdateInfoService.WxAccount
|
||||
user.CertificateImg = req.UserUpdateInfoService.CertificateImg
|
||||
user.Video = req.UserUpdateInfoService.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.UserUpdateInfoService.InvitedCode)
|
||||
if err != nil {
|
||||
Createinvite(user.ID, res.ID)
|
||||
}
|
||||
}
|
||||
user.ID = int32(req.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: rep.User,
|
||||
}
|
||||
util.CopyStructSuper(copyOpt)
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
// 用户修改信息
|
||||
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 *artistInfo.UserInfoCommonRequest) (rep *artistInfo.UpdateUserInfoRespond, err error) {
|
||||
rep = &artistInfo.UpdateUserInfoRespond{}
|
||||
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.UserUpdateInfoService.PenName
|
||||
user.Photo = req.UserUpdateInfoService.Photo
|
||||
user.Video = req.UserUpdateInfoService.Video
|
||||
user.CertificateImg = req.UserUpdateInfoService.CertificateImg
|
||||
conAddessByte, err := json.Marshal(req.UserUpdateInfoService.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.UserUpdateInfoService.WxAccount
|
||||
user.CertificateNum = req.UserUpdateInfoService.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.UserUpdateInfoService.IdCardBack
|
||||
realName.IdcardFront = req.UserUpdateInfoService.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: rep.User,
|
||||
}
|
||||
util.CopyStructSuper(copyOpt)
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateTel(req *artistInfo.UserUpdateTelRequest) (rep *artistInfo.UserUpdateTelRespond, err error) {
|
||||
rep = &artistInfo.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 *artistInfo.UserInfoCommonRequest) (rep *artistInfo.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 *artistInfo.VerifyfddRequest) (rep *artistInfo.VerifyfddRespond, err error) {
|
||||
rep = &artistInfo.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 *artistInfo.FinishVerifyRequest) (rep *artistInfo.FinishVerifyRespond, err error) {
|
||||
rep = &artistInfo.FinishVerifyRespond{}
|
||||
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: rep.User,
|
||||
}
|
||||
util.CopyStructSuper(copyOpt)
|
||||
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
|
||||
|
||||
}
|
151
cmd/internal/logic/artistInfo.go
Normal file
151
cmd/internal/logic/artistInfo.go
Normal file
@ -0,0 +1,151 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/fonchain-artistserver/cmd/internal/dao"
|
||||
"github.com/fonchain-artistserver/cmd/model"
|
||||
artistInfo "github.com/fonchain-artistserver/pb/artistinfo"
|
||||
"github.com/fonchain-artistserver/pkg/m"
|
||||
"github.com/fonchain-artistserver/pkg/util"
|
||||
fdd "github.com/fonchain/electronic-contract/server"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type IArtistInfo interface {
|
||||
GetUserInfo(req *artistInfo.GetUserInfoRequest) (rep *artistInfo.GetUserInfoRespond, err error)
|
||||
CreateUserInfo(req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.CreateUserInfoRespond, err error)
|
||||
UpdateUserInfo(req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.UpdateUserInfoRespond, err error)
|
||||
UserUpdateTel(req *artistInfo.UserUpdateTelRequest) (rep *artistInfo.UserUpdateTelRespond, err error)
|
||||
UserUpdateMsg(req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.UserUpdateMsgRespond, err error)
|
||||
Verifyfdd(req *artistInfo.VerifyfddRequest) (rep *artistInfo.VerifyfddRespond, err error)
|
||||
FinishVerify(req *artistInfo.FinishVerifyRequest) (rep *artistInfo.FinishVerifyRespond, err error)
|
||||
}
|
||||
|
||||
func NewArtistInfo() IArtistInfo {
|
||||
return &ArtistInfo{}
|
||||
}
|
||||
|
||||
type ArtistInfo struct{}
|
||||
|
||||
func (a *ArtistInfo) GetUserInfo(req *artistInfo.GetUserInfoRequest) (rep *artistInfo.GetUserInfoRespond, err error) {
|
||||
rep, err = dao.User(req)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *ArtistInfo) CreateUserInfo(req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.CreateUserInfoRespond, err error) {
|
||||
// rep = &artistInfo.CreateUserInfoRespond{}
|
||||
util.CreateArtistInfo(req.Id)
|
||||
|
||||
rep, err = dao.Create(req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
fddClient, err := fdd.NewFddClient()
|
||||
if err != nil {
|
||||
zap.L().Error("newFddClient err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
userInfos, err := dao.GetUserInfoSelf(req.Id)
|
||||
if err != nil {
|
||||
zap.L().Error("getUserInfoSelf err", zap.Error(err))
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
err = util.CreateQrCode(userInfos.InvitedCode, userInfos.RealName)
|
||||
if err != nil {
|
||||
zap.L().Error("createQrCode err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
_, b, err := fddClient.PersonVerify(userInfos.CustomerId, "1", req.UserUpdateInfoService.RealName, req.UserUpdateInfoService.IdCard, req.UserUpdateInfoService.TelNum, fmt.Sprintf("%v/contractreturn?id=%d&htmltype=%s&envtype=%s", m.ReturnUrl, req.Id, req.UserUpdateInfoService.HtmlType, req.UserUpdateInfoService.EnvType))
|
||||
|
||||
if err != nil {
|
||||
zap.L().Error("fddClient personVerify err", zap.Error(err))
|
||||
return
|
||||
}
|
||||
url, err := base64.StdEncoding.DecodeString(b)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
rep.Url = string(url)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (a *ArtistInfo) UpdateUserInfo(req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.UpdateUserInfoRespond, err error) {
|
||||
util.CreateArtistInfo(req.Id)
|
||||
req.UserUpdateInfoService.Photo = strings.Split(req.UserUpdateInfoService.Photo, "?v=")[0]
|
||||
//转移画家视频
|
||||
req.UserUpdateInfoService.CertificateImg = strings.Split(req.UserUpdateInfoService.CertificateImg, "?v=")[0]
|
||||
//转移画家视频
|
||||
req.UserUpdateInfoService.Video = strings.Split(req.UserUpdateInfoService.Video, "?v=")[0]
|
||||
//转移身份证正面
|
||||
req.UserUpdateInfoService.IdCardFront = strings.Split(req.UserUpdateInfoService.IdCardFront, "?v=")[0]
|
||||
req.UserUpdateInfoService.IdCardBack = strings.Split(req.UserUpdateInfoService.IdCardBack, "?v=")[0]
|
||||
rep, err = dao.Update(req)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *ArtistInfo) UserUpdateTel(req *artistInfo.UserUpdateTelRequest) (rep *artistInfo.UserUpdateTelRespond, err error) {
|
||||
rep, err = dao.UpdateTel(req)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *ArtistInfo) UserUpdateMsg(req *artistInfo.UserInfoCommonRequest) (rep *artistInfo.UserUpdateMsgRespond, err error) {
|
||||
rep, err = dao.UpdateMsg(req)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *ArtistInfo) Verifyfdd(req *artistInfo.VerifyfddRequest) (rep *artistInfo.VerifyfddRespond, err error) {
|
||||
rep, err = dao.VerifyFdd(req)
|
||||
if err != nil {
|
||||
if !rep.Ready {
|
||||
fddClient, err := fdd.NewFddClient()
|
||||
if err != nil {
|
||||
zap.L().Error("newFddClient err", zap.Error(err))
|
||||
return rep, err
|
||||
}
|
||||
|
||||
userInfo, err := dao.GetUserInfoSelf(req.Id)
|
||||
if err != nil {
|
||||
zap.L().Error("getUserInfoSelf err", zap.Error(err))
|
||||
return rep, nil
|
||||
}
|
||||
|
||||
err = util.CreateQrCode(userInfo.InvitedCode, userInfo.RealName)
|
||||
if err != nil {
|
||||
zap.L().Error("createQrCode err", zap.Error(err))
|
||||
return rep, err
|
||||
}
|
||||
|
||||
//注意!!!userUpdateInfoService没有值!!!!
|
||||
var userUpdateInfoService model.UserUpdateInfoService
|
||||
_, b, err := fddClient.PersonVerify(userInfo.CustomerId, "1", userUpdateInfoService.RealName, userUpdateInfoService.IdCard, userUpdateInfoService.TelNum, fmt.Sprintf("%v/contractreturn?id=%d&htmltype=%s&envtype=%s", m.ReturnUrl, req.Id, userUpdateInfoService.HtmlType, userUpdateInfoService.EnvType))
|
||||
if err != nil {
|
||||
zap.L().Error("fddClient personVerify err", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url, err := base64.StdEncoding.DecodeString(b)
|
||||
if err != nil {
|
||||
zap.L().Error("base64 decodeString err", zap.Error(err))
|
||||
}
|
||||
rep.Url = string(url)
|
||||
} else {
|
||||
rep.Url = ""
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (a *ArtistInfo) FinishVerify(req *artistInfo.FinishVerifyRequest) (rep *artistInfo.FinishVerifyRespond, err error) {
|
||||
rep, err = dao.FinishVerify(req)
|
||||
return
|
||||
}
|
4
cmd/logs/artist_server.log
Normal file
4
cmd/logs/artist_server.log
Normal 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"}
|
19
cmd/model/artistinfo.go
Normal file
19
cmd/model/artistinfo.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// User 用户模型
|
||||
type ArtistInfo struct {
|
||||
gorm.Model
|
||||
ID int32 `gorm:"not null" json:"id"`
|
||||
UserId int32 `gorm:"not null default:0" json:"userId"`
|
||||
ArtistId string `gorm:"type:varchar(256) default ''"`
|
||||
BankAccount string `gorm:"type:varchar(25) not null" json:"bankAccount"`
|
||||
BankName string `gorm:"type:varchar(25) not null" json:"bankName"`
|
||||
Introduct string `gorm:"type:varchar(2048) not null" json:"introduct"`
|
||||
CountryArtLevel string `gorm:"type:varchar(256) default ''"`
|
||||
ArtistCertPic string `gorm:"type:varchar(256) default ''"`
|
||||
State int32 `gorm:"not null default:0" json:"state"`
|
||||
}
|
31
cmd/model/artwork.go
Normal file
31
cmd/model/artwork.go
Normal file
@ -0,0 +1,31 @@
|
||||
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未通过
|
||||
}
|
14
cmd/model/artworkbatch.go
Normal file
14
cmd/model/artworkbatch.go
Normal 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
14
cmd/model/artworkstate.go
Normal 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
15
cmd/model/bank.go
Normal 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"`
|
||||
}
|
23
cmd/model/contract.go
Normal file
23
cmd/model/contract.go
Normal file
@ -0,0 +1,23 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Contract 用户模型
|
||||
type Contract struct {
|
||||
gorm.Model
|
||||
ID int32 `gorm:"not null"`
|
||||
UserId int `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 int `gorm:"not null"`
|
||||
BatchId int `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 int `gorm:"not null"`
|
||||
}
|
19
cmd/model/exhexam.go
Normal file
19
cmd/model/exhexam.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
//考核 用户模型
|
||||
type ExhExam struct {
|
||||
gorm.Model
|
||||
ID int32 `gorm:"not null"`
|
||||
UserId int32 `gorm:"default:0"`
|
||||
Title string `gorm:"type:varchar(64) default ''"`
|
||||
Class string `gorm:"type:varchar(25) default ''"`
|
||||
TitleScore int32 `gorm:"default:0"`
|
||||
Score string `gorm:"type:varchar(1024) default ''"`
|
||||
Types string `gorm:"type:varchar(25) default ''"`
|
||||
Remarks string `gorm:"type:varchar(1024) default ''"`
|
||||
Enable bool `gorm:"default:0"`
|
||||
}
|
16
cmd/model/exhvideo.go
Normal file
16
cmd/model/exhvideo.go
Normal file
@ -0,0 +1,16 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// User 用户模型
|
||||
type ExhVideo struct {
|
||||
gorm.Model
|
||||
ID int32 `gorm:"not null "`
|
||||
UserId int32 `gorm:"not null default:0"`
|
||||
Url string `gorm:"type:varchar(256) default ''"`
|
||||
Types string `gorm:"type:varchar(25) default ''"`
|
||||
Remarks string `gorm:"type:varchar(1024) default ''"`
|
||||
Enable bool `gorm:"default:false"`
|
||||
}
|
23
cmd/model/invite.go
Normal file
23
cmd/model/invite.go
Normal 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
15
cmd/model/real_name.go
Normal 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"`
|
||||
}
|
33
cmd/model/supplyinfo.go
Normal file
33
cmd/model/supplyinfo.go
Normal file
@ -0,0 +1,33 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
//User 用户模型
|
||||
type SupplyInfo struct {
|
||||
gorm.Model
|
||||
ID int32 `gorm:"not null"`
|
||||
ArtworkId string `gorm:"type:varchar(256) default ''"`
|
||||
ArtistId string `gorm:"type:varchar(256) default ''"`
|
||||
UserId int32 `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 int32 `gorm:"default:0"`
|
||||
Height int32 `gorm:"default:0"`
|
||||
Ruler int32 `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 ''"`
|
||||
Remarks string `gorm:"type:varchar(1024) default ''"`
|
||||
Enable bool `gorm:"default:false"`
|
||||
}
|
40
cmd/model/user.go
Normal file
40
cmd/model/user.go
Normal file
@ -0,0 +1,40 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// User 用户模型
|
||||
type User struct {
|
||||
gorm.Model
|
||||
ID int32 `gorm:"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"`
|
||||
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 bool `gorm:"not null"`
|
||||
FddState int32 `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
14
cmd/model/user_invited.go
Normal 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"`
|
||||
}
|
30
cmd/model/user_update_info.go
Normal file
30
cmd/model/user_update_info.go
Normal 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
29
conf/conf.ini
Normal 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
29
conf/dev/conf.ini
Normal 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
69
conf/dev/dubbogo.yaml
Normal 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
18
conf/dev/sdk.real.yaml
Normal 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
18
conf/dev/sdk.test.yaml
Normal 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
18
conf/dev/sdk.yaml
Normal 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
19
conf/dubbogo.yaml
Normal 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
29
conf/prod/conf.ini
Normal 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
69
conf/prod/dubbogo.yaml
Normal 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
18
conf/prod/sdk.real.yaml
Normal 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
18
conf/prod/sdk.test.yaml
Normal 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
18
conf/prod/sdk.yaml
Normal 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
18
conf/sdk.real.yaml
Normal 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
18
conf/sdk.test.yaml
Normal 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
18
conf/sdk.yaml
Normal 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
29
conf/test/conf.ini
Normal 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
73
conf/test/dubbogo.yaml
Normal 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
18
conf/test/sdk.real.yaml
Normal 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
18
conf/test/sdk.test.yaml
Normal 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
18
conf/test/sdk.yaml
Normal 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"
|
161
go.mod
Normal file
161
go.mod
Normal file
@ -0,0 +1,161 @@
|
||||
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/electronic-contract v0.0.0-00010101000000-000000000000
|
||||
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 (
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.4.0 // indirect
|
||||
github.com/RoaringBitmap/roaring v0.7.1 // indirect
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||
github.com/Workiva/go-datastructures v1.0.52 // indirect
|
||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
|
||||
github.com/alibaba/sentinel-golang v1.0.4 // indirect
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.4+incompatible // indirect
|
||||
github.com/apache/dubbo-getty v1.4.7 // indirect
|
||||
github.com/apache/dubbo-go-hessian2 v1.11.0 // indirect
|
||||
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/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.2.0 // indirect
|
||||
github.com/boombuler/barcode v1.0.1 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||
github.com/creasty/defaults v1.5.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
|
||||
github.com/dubbogo/gost v1.11.22 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.7.3 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-co-op/gocron v1.9.0 // indirect
|
||||
github.com/go-errors/errors v1.0.1 // indirect
|
||||
github.com/go-kit/log v0.1.0 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.0 // indirect
|
||||
github.com/go-logr/logr v0.4.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/go-playground/locales v0.14.0 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.10.0 // indirect
|
||||
github.com/go-resty/resty/v2 v2.7.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.6.0 // indirect
|
||||
github.com/goccy/go-json v0.9.7 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/go-cmp v0.5.7 // indirect
|
||||
github.com/google/gofuzz v1.1.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/vault/sdk v0.3.0 // indirect
|
||||
github.com/jinzhu/copier v0.3.5 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/k0kubun/pp v3.0.1+incompatible // indirect
|
||||
github.com/knadh/koanf v1.4.0 // indirect
|
||||
github.com/leodido/go-urn v1.2.1 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.3 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mschoch/smat v0.2.0 // indirect
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.0 // indirect
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pelletier/go-toml v1.9.4 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
|
||||
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/polarismesh/polaris-go v1.0.1 // indirect
|
||||
github.com/prometheus/client_golang v1.12.1 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
|
||||
github.com/shirou/gopsutil v3.20.11+incompatible // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.8.2 // indirect
|
||||
github.com/spf13/cast v1.4.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.11.0 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.6 // indirect
|
||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||
github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3 // indirect
|
||||
github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
|
||||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
|
||||
github.com/ugorji/go/codec v1.2.7 // indirect
|
||||
github.com/zouyx/agollo/v3 v3.4.5 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.2 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.2 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
|
||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
|
||||
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect
|
||||
google.golang.org/grpc v1.45.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
k8s.io/apimachinery v0.22.4 // indirect
|
||||
k8s.io/klog/v2 v2.9.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
|
||||
)
|
1670
pb/artistinfo/artistinfo.pb.go
Normal file
1670
pb/artistinfo/artistinfo.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
145
pb/artistinfo/artistinfo.proto
Normal file
145
pb/artistinfo/artistinfo.proto
Normal file
@ -0,0 +1,145 @@
|
||||
syntax = "proto3";
|
||||
package ArtistInfo;
|
||||
option go_package = "./;artistInfo";
|
||||
|
||||
service ArtistInfo {
|
||||
rpc GetUserInfo (GetUserInfoRequest) returns (GetUserInfoRespond) {}
|
||||
rpc CreateUserInfo (UserInfoCommonRequest) returns (CreateUserInfoRespond) {}
|
||||
rpc UpdateUserInfo (UserInfoCommonRequest) returns (UpdateUserInfoRespond) {}
|
||||
rpc UserUpdateTel (UserUpdateTelRequest) returns (UserUpdateTelRespond) {}
|
||||
rpc UserUpdateMsg (UserUpdateMsgRequest) returns (UserUpdateMsgRespond) {}
|
||||
rpc Verifyfdd (VerifyfddRequest) returns (VerifyfddRespond) {}
|
||||
rpc FinishVerify (FinishVerifyRequest) returns (FinishVerifyRespond) {}
|
||||
}
|
||||
message UserUpdateInfoService{
|
||||
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"];
|
||||
int32 Ruler = 13 [json_name = "ruler"];
|
||||
repeated string ConAddress = 14 [json_name = "conAddress"];
|
||||
string Photo = 15 [json_name = "photo"];
|
||||
string Video = 16 [json_name = "video"];
|
||||
int32 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 User{
|
||||
int32 ID =1 [json_name = "id"];
|
||||
string Account = 2 [json_name = "account"];
|
||||
string MnemonicWords = 3 [json_name = "mnemonicWords"];
|
||||
string TelNum = 4 [json_name = "telNum"];
|
||||
string Name = 5 [json_name = "name"];
|
||||
string PenName = 6 [json_name = "penName"];
|
||||
string StageName = 7 [json_name = "stageName"];
|
||||
string JoinAssoTime = 8 [json_name = "joinAssoTime"];
|
||||
string CertificateNum = 9 [json_name = "certificateNum"];
|
||||
string CertificateImg = 10 [json_name = "certificateImg"];
|
||||
string Key = 11 [json_name = "key"];
|
||||
int32 RealNameID = 12 [json_name = "realNameID"];
|
||||
string IDNum = 13 [json_name = "idNum"];
|
||||
int32 Sex = 14 [json_name = "sex"];
|
||||
string OpenId = 15 [json_name = "openId"];
|
||||
string CustomerId = 16 [json_name = "customerId"];
|
||||
int32 Age = 17 [json_name = "age"];
|
||||
string Introduct = 18 [json_name = "introduct"];
|
||||
int64 CreateAt = 19 [json_name = "createAt"];
|
||||
string ConAddress =20 [json_name = "conAddress"];
|
||||
string Photo = 21 [json_name = "photo"];
|
||||
string Video = 22 [json_name = "video"];
|
||||
bool IsRealName = 23 [json_name = "isRealName"];
|
||||
int32 FddState = 24 [json_name = "fddState"];
|
||||
string WxAccount = 25 [json_name = "wxAccount"];
|
||||
bool IsLock = 26 [json_name = "isLock"];
|
||||
string InvitedCode = 27 [json_name = "invitedCode"];
|
||||
int32 IsRead = 28 [json_name = "isRead"];
|
||||
int32 IsImport = 29 [json_name = "isImport"];
|
||||
bool Enable = 30 [json_name = "enable"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
message UserInfoCommonRequest{
|
||||
int64 Id = 1 [json_name = "id"];
|
||||
UserUpdateInfoService UserUpdateInfoService = 2 [json_name = "userUpdateInfoService"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
message GetUserInfoRequest {
|
||||
int64 Id = 1 [json_name = "id"];
|
||||
}
|
||||
|
||||
message GetUserInfoRespond {
|
||||
UserUpdateInfoService Data = 1 [json_name = "data"];
|
||||
}
|
||||
|
||||
// message CreateUserInfoRequest {
|
||||
// int64 Id = 1 [json_name = "id"];
|
||||
// UserUpdateInfoService UserUpdateInfoService = 2 [json_name = "userUpdateInfoService"];
|
||||
// }
|
||||
|
||||
message CreateUserInfoRespond {
|
||||
User User = 1 [json_name = "user"];
|
||||
string Url = 2 [json_name = "url"];
|
||||
}
|
||||
|
||||
// message UpdateUserInfoRequest {
|
||||
// int64 Id = 1 [json_name = "id"];
|
||||
// UserUpdateInfoService UserUpdateInfoService = 2 [json_name = "userUpdateInfoService"];
|
||||
// }
|
||||
|
||||
message UpdateUserInfoRespond {
|
||||
User User = 1 [json_name = "user"];
|
||||
}
|
||||
|
||||
message UserUpdateTelRequest {
|
||||
int64 Id = 1 [json_name = "id"];
|
||||
string TelNum = 2 [json_name = "telNum"];
|
||||
string VerCode = 3 [json_name = "verCode"];
|
||||
}
|
||||
|
||||
message UserUpdateTelRespond {
|
||||
string TelNum = 1 [json_name = "telNum"];
|
||||
}
|
||||
|
||||
message UserUpdateMsgRequest {
|
||||
int64 Id = 1 [json_name = "id"];
|
||||
}
|
||||
|
||||
message UserUpdateMsgRespond {}
|
||||
|
||||
message VerifyfddRequest {
|
||||
int64 Id = 1 [json_name = "id"];
|
||||
}
|
||||
|
||||
message VerifyfddRespond {
|
||||
bool Ready = 1 [json_name = "ready"];
|
||||
string Url = 2 [json_name = "url"];
|
||||
}
|
||||
|
||||
message FinishVerifyRequest {
|
||||
int64 Id = 1 [json_name = "id"];
|
||||
int64 ContractId = 2 [json_name = "contractId"];
|
||||
string HtmlType = 3 [json_name = "htmlType"];
|
||||
string EnvType = 4 [json_name = "envType"];
|
||||
}
|
||||
|
||||
message FinishVerifyRespond {
|
||||
User User = 1 [json_name = "user"];
|
||||
}
|
417
pb/artistinfo/artistinfo_triple.pb.go
Normal file
417
pb/artistinfo/artistinfo_triple.pb.go
Normal file
@ -0,0 +1,417 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.8
|
||||
// source: 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 {
|
||||
GetUserInfo(ctx context.Context, in *GetUserInfoRequest, opts ...grpc_go.CallOption) (*GetUserInfoRespond, common.ErrorWithAttachment)
|
||||
CreateUserInfo(ctx context.Context, in *UserInfoCommonRequest, opts ...grpc_go.CallOption) (*CreateUserInfoRespond, common.ErrorWithAttachment)
|
||||
UpdateUserInfo(ctx context.Context, in *UserInfoCommonRequest, opts ...grpc_go.CallOption) (*UpdateUserInfoRespond, common.ErrorWithAttachment)
|
||||
UserUpdateTel(ctx context.Context, in *UserUpdateTelRequest, opts ...grpc_go.CallOption) (*UserUpdateTelRespond, common.ErrorWithAttachment)
|
||||
UserUpdateMsg(ctx context.Context, in *UserUpdateMsgRequest, opts ...grpc_go.CallOption) (*UserUpdateMsgRespond, common.ErrorWithAttachment)
|
||||
Verifyfdd(ctx context.Context, in *VerifyfddRequest, opts ...grpc_go.CallOption) (*VerifyfddRespond, common.ErrorWithAttachment)
|
||||
FinishVerify(ctx context.Context, in *FinishVerifyRequest, opts ...grpc_go.CallOption) (*FinishVerifyRespond, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type artistInfoClient struct {
|
||||
cc *triple.TripleConn
|
||||
}
|
||||
|
||||
type ArtistInfoClientImpl struct {
|
||||
GetUserInfo func(ctx context.Context, in *GetUserInfoRequest) (*GetUserInfoRespond, error)
|
||||
CreateUserInfo func(ctx context.Context, in *UserInfoCommonRequest) (*CreateUserInfoRespond, error)
|
||||
UpdateUserInfo func(ctx context.Context, in *UserInfoCommonRequest) (*UpdateUserInfoRespond, error)
|
||||
UserUpdateTel func(ctx context.Context, in *UserUpdateTelRequest) (*UserUpdateTelRespond, error)
|
||||
UserUpdateMsg func(ctx context.Context, in *UserUpdateMsgRequest) (*UserUpdateMsgRespond, error)
|
||||
Verifyfdd func(ctx context.Context, in *VerifyfddRequest) (*VerifyfddRespond, error)
|
||||
FinishVerify func(ctx context.Context, in *FinishVerifyRequest) (*FinishVerifyRespond, 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) GetUserInfo(ctx context.Context, in *GetUserInfoRequest, opts ...grpc_go.CallOption) (*GetUserInfoRespond, common.ErrorWithAttachment) {
|
||||
out := new(GetUserInfoRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetUserInfo", in, out)
|
||||
}
|
||||
|
||||
func (c *artistInfoClient) CreateUserInfo(ctx context.Context, in *UserInfoCommonRequest, 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) UpdateUserInfo(ctx context.Context, in *UserInfoCommonRequest, opts ...grpc_go.CallOption) (*UpdateUserInfoRespond, common.ErrorWithAttachment) {
|
||||
out := new(UpdateUserInfoRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateUserInfo", in, out)
|
||||
}
|
||||
|
||||
func (c *artistInfoClient) UserUpdateTel(ctx context.Context, in *UserUpdateTelRequest, opts ...grpc_go.CallOption) (*UserUpdateTelRespond, common.ErrorWithAttachment) {
|
||||
out := new(UserUpdateTelRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UserUpdateTel", in, out)
|
||||
}
|
||||
|
||||
func (c *artistInfoClient) UserUpdateMsg(ctx context.Context, in *UserUpdateMsgRequest, opts ...grpc_go.CallOption) (*UserUpdateMsgRespond, common.ErrorWithAttachment) {
|
||||
out := new(UserUpdateMsgRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UserUpdateMsg", in, out)
|
||||
}
|
||||
|
||||
func (c *artistInfoClient) Verifyfdd(ctx context.Context, in *VerifyfddRequest, opts ...grpc_go.CallOption) (*VerifyfddRespond, common.ErrorWithAttachment) {
|
||||
out := new(VerifyfddRespond)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Verifyfdd", 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)
|
||||
}
|
||||
|
||||
// ArtistInfoServer is the server API for ArtistInfo service.
|
||||
// All implementations must embed UnimplementedArtistInfoServer
|
||||
// for forward compatibility
|
||||
type ArtistInfoServer interface {
|
||||
GetUserInfo(context.Context, *GetUserInfoRequest) (*GetUserInfoRespond, error)
|
||||
CreateUserInfo(context.Context, *UserInfoCommonRequest) (*CreateUserInfoRespond, error)
|
||||
UpdateUserInfo(context.Context, *UserInfoCommonRequest) (*UpdateUserInfoRespond, error)
|
||||
UserUpdateTel(context.Context, *UserUpdateTelRequest) (*UserUpdateTelRespond, error)
|
||||
UserUpdateMsg(context.Context, *UserUpdateMsgRequest) (*UserUpdateMsgRespond, error)
|
||||
Verifyfdd(context.Context, *VerifyfddRequest) (*VerifyfddRespond, error)
|
||||
FinishVerify(context.Context, *FinishVerifyRequest) (*FinishVerifyRespond, error)
|
||||
mustEmbedUnimplementedArtistInfoServer()
|
||||
}
|
||||
|
||||
// UnimplementedArtistInfoServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedArtistInfoServer struct {
|
||||
proxyImpl protocol.Invoker
|
||||
}
|
||||
|
||||
func (UnimplementedArtistInfoServer) GetUserInfo(context.Context, *GetUserInfoRequest) (*GetUserInfoRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArtistInfoServer) CreateUserInfo(context.Context, *UserInfoCommonRequest) (*CreateUserInfoRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateUserInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArtistInfoServer) UpdateUserInfo(context.Context, *UserInfoCommonRequest) (*UpdateUserInfoRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateUserInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArtistInfoServer) UserUpdateTel(context.Context, *UserUpdateTelRequest) (*UserUpdateTelRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UserUpdateTel not implemented")
|
||||
}
|
||||
func (UnimplementedArtistInfoServer) UserUpdateMsg(context.Context, *UserUpdateMsgRequest) (*UserUpdateMsgRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UserUpdateMsg not implemented")
|
||||
}
|
||||
func (UnimplementedArtistInfoServer) Verifyfdd(context.Context, *VerifyfddRequest) (*VerifyfddRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Verifyfdd not implemented")
|
||||
}
|
||||
func (UnimplementedArtistInfoServer) FinishVerify(context.Context, *FinishVerifyRequest) (*FinishVerifyRespond, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FinishVerify 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_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserInfoRequest)
|
||||
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("GetUserInfo", 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(UserInfoCommonRequest)
|
||||
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_UpdateUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UserInfoCommonRequest)
|
||||
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("UpdateUserInfo", 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_UserUpdateTel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UserUpdateTelRequest)
|
||||
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("UserUpdateTel", 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_UserUpdateMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UserUpdateMsgRequest)
|
||||
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("UserUpdateMsg", 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_Verifyfdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(VerifyfddRequest)
|
||||
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("Verifyfdd", 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)
|
||||
}
|
||||
|
||||
// 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: "GetUserInfo",
|
||||
Handler: _ArtistInfo_GetUserInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateUserInfo",
|
||||
Handler: _ArtistInfo_CreateUserInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateUserInfo",
|
||||
Handler: _ArtistInfo_UpdateUserInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UserUpdateTel",
|
||||
Handler: _ArtistInfo_UserUpdateTel_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UserUpdateMsg",
|
||||
Handler: _ArtistInfo_UserUpdateMsg_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Verifyfdd",
|
||||
Handler: _ArtistInfo_Verifyfdd_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "FinishVerify",
|
||||
Handler: _ArtistInfo_FinishVerify_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "artistinfo.proto",
|
||||
}
|
51
pkg/cache/redis.go
vendored
Normal file
51
pkg/cache/redis.go
vendored
Normal 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
106
pkg/db/init.go
Normal 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
17
pkg/m/artistinfo.go
Normal 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"
|
||||
)
|
76
pkg/m/msg.go
Normal file
76
pkg/m/msg.go
Normal file
@ -0,0 +1,76 @@
|
||||
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_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 = "批量插入成功"
|
||||
)
|
19
pkg/util/file.go
Normal file
19
pkg/util/file.go
Normal file
@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
130
pkg/util/qrcode.go
Normal file
130
pkg/util/qrcode.go
Normal 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
|
||||
}
|
137
pkg/util/utils.go
Normal file
137
pkg/util/utils.go
Normal file
@ -0,0 +1,137 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"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)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user