Compare commits

...

3 Commits

Author SHA1 Message Date
6b9b4e9f3a 国展报名 2024-02-04 14:07:17 +08:00
35e6ab4550 国展报名 2024-02-02 17:06:06 +08:00
4dba7eff58 国展报名 2024-02-01 18:55:43 +08:00
18 changed files with 545 additions and 106 deletions

33
DockerfileProd Normal file
View File

@ -0,0 +1,33 @@
FROM 172.16.100.99:9006/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
#ADD go.mod .
#ADD go.sum .
#RUN go mod download
#COPY . .
#RUN go env -w GOOS=linux && go build -ldflags "-s -w" -o /app/meal-main-server ./cmd/app.go
COPY exhibition-main-server /app/exhibition-main-server
#FROM 172.16.100.99:9006/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
FROM 172.16.100.99:9006/self-alpine
COPY ./conf /app/conf
ENV TZ Asia/Shanghai
ENV MODE_ENV prod
WORKDIR /app
COPY --from=builder /app/exhibition-main-server .
EXPOSE 9025
CMD ["/app/exhibition-main-server"]

33
DockerfileTest Normal file
View File

@ -0,0 +1,33 @@
FROM 172.16.100.99:9006/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
#ADD go.mod .
#ADD go.sum .
#RUN go mod download
#COPY . .
#RUN go env -w GOOS=linux && go build -ldflags "-s -w" -o /app/meal-main-server ./cmd/app.go
COPY exhibition-main-server /app/exhibition-main-server
#FROM 172.16.100.99:9006/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
FROM 172.16.100.99:9006/self-alpine
COPY ./conf /app/conf
ENV TZ Asia/Shanghai
ENV MODE_ENV test
WORKDIR /app
COPY --from=builder /app/exhibition-main-server .
EXPOSE 9025
CMD ["/app/exhibition-main-server"]

41
DockerfileWindowsProd Normal file
View File

@ -0,0 +1,41 @@
FROM golang:1.20-alpine AS builder
MAINTAINER 570956418@qq.com
LABEL stage=gobuilder
ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
ENV CGO_ENABLED 0
ENV GOOS linux
ENV GOPROXY https://goproxy.cn,direct
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#
#RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
#ADD ./fonchain-main/go.mod .
#ADD ./fonchain-main/go.sum .
#COPY ./utils ../utils
#RUN go env -w GO111MODULE=on
#RUN go env -w GOPROXY=https://goproxy.cn,direct
#RUN go mod download
#COPY ./fonchain-main .
#RUN go build -ldflags "-s -w" -o /app/mainServer ./cmd/app.go
COPY ./build/exhibition-main-server /app/exhibition-main-server
FROM 172.16.100.99:9006/fonchain-base
#FROM alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update --no-cache
RUN apk add --no-cache ca-certificates
RUN apk add --no-cache tzdata
COPY ./conf /app/conf
COPY ./data /app/data
ENV TZ Asia/Shanghai
#ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
ENV MODE_ENV prod
#RUN apk add --no-cache ffmpeg
WORKDIR /app
COPY --from=builder /app/exhibition-main-server .
EXPOSE 9040
CMD ["/app/exhibition-main-server"]

41
DockerfileWindowsTest Normal file
View File

@ -0,0 +1,41 @@
FROM golang:1.20-alpine AS builder
MAINTAINER 570956418@qq.com
LABEL stage=gobuilder
ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
ENV CGO_ENABLED 0
ENV GOOS linux
ENV GOPROXY https://goproxy.cn,direct
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#
#RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
#ADD ./fonchain-main/go.mod .
#ADD ./fonchain-main/go.sum .
#COPY ./utils ../utils
#RUN go env -w GO111MODULE=on
#RUN go env -w GOPROXY=https://goproxy.cn,direct
#RUN go mod download
#COPY ./fonchain-main .
#RUN go build -ldflags "-s -w" -o /app/mainServer ./cmd/app.go
COPY ./build/exhibition-main-server /app/exhibition-main-server
FROM 172.16.100.99:9006/fonchain-base
#FROM alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update --no-cache
RUN apk add --no-cache ca-certificates
RUN apk add --no-cache tzdata
COPY ./conf /app/conf
COPY ./data /app/data
ENV TZ Asia/Shanghai
#ENV DUBBO_GO_CONFIG_PATH ./conf/dubbogo.yaml
ENV MODE_ENV test
#RUN apk add --no-cache ffmpeg
WORKDIR /app
COPY --from=builder /app/exhibition-main-server .
EXPOSE 9040
CMD ["/app/exhibition-main-server"]

View File

@ -154,7 +154,8 @@ type SaveRegisterRecordResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg"`
Data *RegisterInfo `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
}
func (x *SaveRegisterRecordResp) Reset() {
@ -189,6 +190,13 @@ func (*SaveRegisterRecordResp) Descriptor() ([]byte, []int) {
return file_pb_exhibition_proto_rawDescGZIP(), []int{1}
}
func (x *SaveRegisterRecordResp) GetData() *RegisterInfo {
if x != nil {
return x.Data
}
return nil
}
func (x *SaveRegisterRecordResp) GetMsg() string {
if x != nil {
return x.Msg
@ -267,6 +275,8 @@ type RecordListReq struct {
Keyword string `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword"`
Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page"`
PageSize int32 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize"`
SortKey int32 `protobuf:"varint,4,opt,name=sortKey,proto3" json:"sortKey"`
Sort string `protobuf:"bytes,5,opt,name=sort,proto3" json:"sort"`
}
func (x *RecordListReq) Reset() {
@ -322,6 +332,20 @@ func (x *RecordListReq) GetPageSize() int32 {
return 0
}
func (x *RecordListReq) GetSortKey() int32 {
if x != nil {
return x.SortKey
}
return 0
}
func (x *RecordListReq) GetSort() string {
if x != nil {
return x.Sort
}
return ""
}
type RecordListResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -632,77 +656,83 @@ var file_pb_exhibition_proto_rawDesc = []byte{
0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x64, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x2a, 0x0a, 0x16, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x67,
0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x58, 0x0a, 0x16, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x67,
0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73,
0x67, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52,
0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, 0x12, 0x10, 0x0a,
0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12,
0x2c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e,
0x2c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e,
0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73,
0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x59, 0x0a,
0x0d, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18,
0x0a, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x63,
0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x04, 0x64,
0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69,
0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70,
0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12,
0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73,
0x67, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72,
0x64, 0x52, 0x65, 0x71, 0x22, 0x92, 0x02, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49,
0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e,
0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20,
0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70,
0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70,
0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72,
0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x12,
0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x43,
0x61, 0x72, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61,
0x72, 0x74, 0x69, 0x73, 0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a,
0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x50, 0x0a, 0x10, 0x45, 0x78, 0x70,
0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a,
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x78,
0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x32, 0xc4, 0x02, 0x0a, 0x0a,
0x45, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x43, 0x68,
0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e,
0x66, 0x6f, 0x1a, 0x1a, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x52,
0x0a, 0x12, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x12, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x22,
0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x61, 0x76, 0x65,
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
0x73, 0x70, 0x12, 0x4b, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74,
0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
0x51, 0x0a, 0x14, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72,
0x64, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f,
0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a,
0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22,
0x6a, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x73,
0x70, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01,
0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6d,
0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x2c, 0x0a,
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x78,
0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x87, 0x01, 0x0a, 0x0d,
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a,
0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70,
0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70,
0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x72, 0x74, 0x4b,
0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6f, 0x72, 0x74, 0x4b, 0x65,
0x79, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x73, 0x6f, 0x72, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65,
0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x6d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x11,
0x0a, 0x0f, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
0x71, 0x22, 0x92, 0x02, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f,
0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x68, 0x6f, 0x6e,
0x65, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e,
0x65, 0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x43, 0x61, 0x72, 0x64,
0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x64, 0x43,
0x61, 0x72, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x72, 0x74, 0x69,
0x73, 0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61,
0x72, 0x74, 0x69, 0x73, 0x74, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x50, 0x0a, 0x10, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74,
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x04, 0x64, 0x61,
0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x32, 0xc4, 0x02, 0x0a, 0x0a, 0x45, 0x78, 0x68,
0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b,
0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x1a,
0x1a, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x65,
0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x52, 0x0a, 0x12, 0x53,
0x61, 0x76, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72,
0x64, 0x12, 0x18, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x22, 0x2e, 0x65, 0x78,
0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x67,
0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
0x4b, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72,
0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
0x1a, 0x1a, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x51, 0x0a, 0x14,
0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
0x73, 0x70, 0x42, 0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70, 0x62, 0x2f, 0x65, 0x78, 0x68, 0x69, 0x62,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x71, 0x1a, 0x1c, 0x2e, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45,
0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x42,
0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70, 0x62, 0x2f, 0x65, 0x78, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69,
0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -729,22 +759,23 @@ var file_pb_exhibition_proto_goTypes = []interface{}{
(*ExportRecordResp)(nil), // 7: exhibition.ExportRecordResp
}
var file_pb_exhibition_proto_depIdxs = []int32{
0, // 0: exhibition.CheckPhoneResp.data:type_name -> exhibition.RegisterInfo
0, // 1: exhibition.RecordListResp.data:type_name -> exhibition.RegisterInfo
6, // 2: exhibition.ExportRecordResp.data:type_name -> exhibition.ExportInfo
0, // 3: exhibition.Exhibition.CheckPhone:input_type -> exhibition.RegisterInfo
0, // 4: exhibition.Exhibition.SaveRegisterRecord:input_type -> exhibition.RegisterInfo
3, // 5: exhibition.Exhibition.RegisterRecordList:input_type -> exhibition.RecordListReq
5, // 6: exhibition.Exhibition.ExportRegisterRecord:input_type -> exhibition.ExportRecordReq
2, // 7: exhibition.Exhibition.CheckPhone:output_type -> exhibition.CheckPhoneResp
1, // 8: exhibition.Exhibition.SaveRegisterRecord:output_type -> exhibition.SaveRegisterRecordResp
4, // 9: exhibition.Exhibition.RegisterRecordList:output_type -> exhibition.RecordListResp
7, // 10: exhibition.Exhibition.ExportRegisterRecord:output_type -> exhibition.ExportRecordResp
7, // [7:11] is the sub-list for method output_type
3, // [3:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
0, // 0: exhibition.SaveRegisterRecordResp.data:type_name -> exhibition.RegisterInfo
0, // 1: exhibition.CheckPhoneResp.data:type_name -> exhibition.RegisterInfo
0, // 2: exhibition.RecordListResp.data:type_name -> exhibition.RegisterInfo
6, // 3: exhibition.ExportRecordResp.data:type_name -> exhibition.ExportInfo
0, // 4: exhibition.Exhibition.CheckPhone:input_type -> exhibition.RegisterInfo
0, // 5: exhibition.Exhibition.SaveRegisterRecord:input_type -> exhibition.RegisterInfo
3, // 6: exhibition.Exhibition.RegisterRecordList:input_type -> exhibition.RecordListReq
5, // 7: exhibition.Exhibition.ExportRegisterRecord:input_type -> exhibition.ExportRecordReq
2, // 8: exhibition.Exhibition.CheckPhone:output_type -> exhibition.CheckPhoneResp
1, // 9: exhibition.Exhibition.SaveRegisterRecord:output_type -> exhibition.SaveRegisterRecordResp
4, // 10: exhibition.Exhibition.RegisterRecordList:output_type -> exhibition.RecordListResp
7, // 11: exhibition.Exhibition.ExportRegisterRecord:output_type -> exhibition.ExportRecordResp
8, // [8:12] is the sub-list for method output_type
4, // [4:8] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_pb_exhibition_proto_init() }

View File

@ -21,6 +21,11 @@ func (this *RegisterInfo) Validate() error {
return nil
}
func (this *SaveRegisterRecordResp) Validate() error {
if this.Data != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
}
}
return nil
}
func (this *CheckPhoneResp) Validate() error {

View File

@ -12,7 +12,7 @@ system:
redis:
db: 1
addr: 127.0.0.1:6379
password: 7532T6R
password:
jaeger:
addr: 127.0.0.1:6831
open: true
@ -24,4 +24,12 @@ zapLog:
max_backups: 30
jwt:
key: "3Ei*^!a6^6$w^wgK"
expire: 24
expire: 24
bos:
Ak: "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk: "d2ecaa9d75114d3b9f42b99014198306"
BucketName: "dci-file-new"
BosUrl: ".bj.bcebos.com"
BosBaseDir: "fonchain-main"
BosHttp: "https://"
BosDomain: "cdns.fontree.cn"

View File

@ -1,6 +1,6 @@
dubbo:
registries:
meal_zk:
demoZK:
protocol: zookeeper
timeout: 30s
address: 127.0.0.1:2181
@ -13,7 +13,6 @@ dubbo:
references:
ExhibitionClientImpl:
protocol: tri
filter: tps
interface: com.fontree.microservices.common.Exhibition
logger:
zap-config:
@ -44,7 +43,7 @@ dubbo:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "logs/runtime/meal-main.log"
filename: "logs/runtime/exhibition-main.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)

View File

@ -24,4 +24,12 @@ zapLog:
max_backups: 30
jwt:
key: "tP0xXGErz4~"
expire: 24
expire: 24
bos:
Ak: "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk: "d2ecaa9d75114d3b9f42b99014198306"
BucketName: "dci-file-new"
BosUrl: ".bj.bcebos.com"
BosBaseDir: "fonchain-main"
BosHttp: "https://"
BosDomain: "cdns.fontree.cn"

View File

@ -1,6 +1,6 @@
dubbo:
registries:
meal_zk:
demoZK:
protocol: zookeeper
timeout: 3s
address: zookeeper:2181
@ -13,7 +13,6 @@ dubbo:
references:
ExhibitionClientImpl:
protocol: tri
filter: tps
interface: com.fontree.microservices.common.Exhibition
logger:
zap-config:
@ -44,7 +43,7 @@ dubbo:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "runtime/meal-main.log"
filename: "runtime/exhibition-main.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)

View File

@ -24,4 +24,12 @@ zapLog:
max_backups: 30
jwt:
key: "SxjwBuEcHg42t73"
expire: 24
expire: 24
bos:
Ak: "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk: "d2ecaa9d75114d3b9f42b99014198306"
BucketName: "dci-file-new"
BosUrl: ".bj.bcebos.com"
BosBaseDir: "fonchain-main"
BosHttp: "https://"
BosDomain: "cdns.fontree.cn"

View File

@ -1,6 +1,6 @@
dubbo:
registries:
meal_zk:
demoZK:
protocol: zookeeper
timeout: 3s
address: zookeeper:2181
@ -13,7 +13,6 @@ dubbo:
references:
ExhibitionClientImpl:
protocol: tri
filter: tps
interface: com.fontree.microservices.common.Exhibition
logger:
zap-config:
@ -44,7 +43,7 @@ dubbo:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "runtime/meal-main.log"
filename: "runtime/exhibition-main.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)

4
go.mod
View File

@ -16,7 +16,9 @@ replace (
require (
dubbo.apache.org/dubbo-go/v3 v3.0.5
github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/disintegration/imaging v1.6.2
github.com/dubbogo/gost v1.13.2
github.com/dubbogo/grpc-go v1.42.10
github.com/dubbogo/triple v1.2.2-rc2
@ -39,6 +41,7 @@ require (
github.com/satori/go.uuid v1.2.0
github.com/spf13/viper v1.7.0
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271
github.com/tealeg/xlsx v1.0.5
github.com/u2takey/ffmpeg-go v0.5.0
github.com/uber/jaeger-client-go v2.30.0+incompatible
go.uber.org/zap v1.21.0
@ -118,6 +121,7 @@ require (
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/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/mschoch/smat v0.2.0 // indirect
github.com/nacos-group/nacos-sdk-go v1.1.4 // indirect
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect

View File

@ -31,5 +31,6 @@ const (
ERROR_BAIDU_IMAGE = "图片审核不通过"
ERROR_BAIDU_FAIL = "图片审核失败"
ErrorUploadBos
ErrorUploadBos = "上传到服务器失败"
ErrorDownloadFile = "下载文件错误"
)

75
pkg/logic/excel.go Normal file
View File

@ -0,0 +1,75 @@
package logic
import (
"fmt"
"github.com/360EntSecGroup-Skylar/excelize"
"github.com/exhibition-main/internal/model"
"github.com/exhibition-main/pkg/utils"
"image"
"math"
"os"
"path/filepath"
"strings"
)
func DealExcelImg(filePath string) (err error) {
f, err := excelize.OpenFile(filePath)
filename := filepath.Base(filePath)
var cellHeight, cellWidth float64 = 150, 40
//minColumn := int([]byte("A")[0])
// string(rune(i))
rows := f.GetRows("Sheet1")
var columnFullName string
var lineNo, columnNo int32
var cellNo string
for k, row := range rows {
lineNo = int32(k + 1)
if lineNo != 1 {
f.SetRowHeight("Sheet1", int(lineNo), cellHeight)
}
var firstCell int32
var suffix string
var columnName, firstCellName string
columnFullName = ""
for kk, colCell := range row {
cellNo = ""
columnNo = int32(int([]byte("A")[0]) + kk%26)
columnName = string(columnNo)
if kk >= 26 {
firstCell = int32(int([]byte("A")[0]) + (int(math.Floor(float64(kk)/float64(26))) - 1))
firstCellName = string(firstCell)
}
columnFullName = fmt.Sprintf("%s%s", firstCellName, columnName)
if strings.Contains(colCell, "cdns.fontree.cn") {
suffix = colCell[strings.LastIndex(colCell, "."):]
if strings.Contains(".jpg,.png,.gif,.bmp,.jpeg,", suffix) {
cellNo = fmt.Sprintf("%s%v", columnFullName, lineNo)
// 需要转化图片 ,先下载图片
fullPath, _ := utils.SaveUrlFileDisk(colCell, "./tmp_img", "")
reader, _ := os.Open(fullPath)
defer reader.Close()
im, _, _ := image.DecodeConfig(reader)
rateX := cellWidth * 2.0 / float64(im.Width)
rateY := cellHeight * 1.33 / float64(im.Height)
f.SetCellValue("Sheet1", cellNo, "")
err = f.AddPicture("Sheet1", cellNo, fullPath, fmt.Sprintf(`{"x_scale": %v, "y_scale": %v, "hyperlink": "%s", "hyperlink_type": "External"}`, rateX, rateY, colCell))
_ = os.Remove(fullPath)
if err != nil {
return
}
}
}
}
}
f.SetColWidth("Sheet1", "A", columnFullName, cellWidth)
if err != nil {
fmt.Println(err)
}
err = f.SaveAs(fmt.Sprintf("%s%s", model.MediaPath, filename))
if err != nil {
fmt.Println(err)
}
return
}

View File

@ -19,7 +19,7 @@ func NewRouter() *gin.Engine {
//加入日志中间件,跨域中间件
r.Use(middleware.NewLogger(), middleware.Cors(), middleware.GinRecovery(true))
auth := r.Group("")
auth.Use(middleware.JWTAuthMiddleware())
//auth.Use(middleware.JWTAuthMiddleware())
// 上传
upload := auth.Group("upload")
{
@ -28,9 +28,10 @@ func NewRouter() *gin.Engine {
registerAuth := auth.Group("register")
{
registerAuth.POST("register_record_list", service.RegisterRecordList)
registerAuth.POST("check_by_phone", service.CheckPhone)
registerAuth.POST("save_register_info", service.SaveRegisterRecord)
registerAuth.POST("register_record_list", service.RegisterList)
registerAuth.POST("check_by_phone", service.CheckByPhone)
registerAuth.POST("save_register_info", service.SaveRegister)
registerAuth.POST("export_register", service.ExportRegister)
}
//静态文件

View File

@ -2,14 +2,20 @@ package service
import (
"context"
"fmt"
"github.com/dubbogo/gost/log/logger"
"github.com/exhibition-main/api/exhibition"
"github.com/exhibition-main/internal/config"
"github.com/exhibition-main/internal/model"
"github.com/exhibition-main/internal/msg"
"github.com/exhibition-main/internal/response"
"github.com/exhibition-main/pkg/logic"
"github.com/exhibition-main/pkg/utils"
"github.com/gin-gonic/gin"
"time"
)
func RegisterRecordList(c *gin.Context) {
func RegisterList(c *gin.Context) {
var recordListReq exhibition.RecordListReq
if err := c.ShouldBind(&recordListReq); err != nil {
logger.Errorf("RegisterRecordList ShouldBind err", err)
@ -26,7 +32,7 @@ func RegisterRecordList(c *gin.Context) {
}
func CheckPhone(c *gin.Context) {
func CheckByPhone(c *gin.Context) {
var registerInfo exhibition.RegisterInfo
if err := c.ShouldBind(&registerInfo); err != nil {
logger.Errorf("CheckPhone ShouldBind err", err)
@ -43,7 +49,7 @@ func CheckPhone(c *gin.Context) {
}
func SaveRegisterRecord(c *gin.Context) {
func SaveRegister(c *gin.Context) {
var registerInfo exhibition.RegisterInfo
if err := c.ShouldBind(&registerInfo); err != nil {
logger.Errorf("SaveRegisterRecord ShouldBind err", err)
@ -59,3 +65,67 @@ func SaveRegisterRecord(c *gin.Context) {
return
}
// ExportRegister 导出报名信息列表
func ExportRegister(c *gin.Context) {
var exportRecordReq exhibition.ExportRecordReq
//if err := c.ShouldBind(&exportRecordReq); err != nil {
// logger.Errorf("SaveRegisterRecord ShouldBind err", err)
// response.ResponseQuickMsg(c, msg.Fail, msg.INVALID_PARAMS, nil)
// return
//}
resp, err := GrpcExhibitionClientImpl.ExportRegisterRecord(context.Background(), &exportRecordReq)
if err != nil {
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
return
}
if len(resp.Data) == 0 {
resp.Data = []*exhibition.ExportInfo{}
}
columns := []string{"画家姓名", "性别", "手机号", "身份证号", "通讯地址", "身份证照片", "本人近照", "报名时间", "更新时间"}
exportFileName := fmt.Sprintf("国展报名%v.xlsx", time.Now().Format("2006-01-01"))
filePath := fmt.Sprintf("./runtime/%s", exportFileName)
data := make([]interface{}, 0)
for _, v := range resp.Data {
var temp []string
temp = append(temp, v.ArtistName)
var gender string
if v.Gender == 1 {
gender = "男"
} else {
gender = "女"
}
temp = append(temp, gender)
temp = append(temp, v.PhoneNum)
temp = append(temp, v.IdCard)
temp = append(temp, v.Address)
temp = append(temp, v.IdCardPhoto)
temp = append(temp, v.ArtistPhoto)
temp = append(temp, v.CreatedAt)
temp = append(temp, v.UpdatedAt)
data = append(data, &temp)
}
_, _ = utils.ToExcelByType(columns, data, "slice", filePath)
//处理图片
err = logic.DealExcelImg(filePath)
if err != nil {
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
return
}
var httpType string
if config.IsHttps {
httpType = model.HttpsType
} else {
httpType = model.HttpType
}
var exportUrl string = fmt.Sprintf("%s%s/static/%s", httpType, c.Request.Host, exportFileName)
response.ResponseQuickMsg(c, msg.Ok, resp.Msg, map[string]string{
"exportUrl": exportUrl,
})
return
}

View File

@ -2,10 +2,18 @@ package utils
import (
"bytes"
"errors"
"fmt"
"github.com/dubbogo/gost/log/logger"
"github.com/exhibition-main/internal/msg"
"github.com/tealeg/xlsx"
"go.uber.org/zap"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
"time"
)
@ -45,3 +53,78 @@ func Get(url string) string {
return result.String()
}
// ToExcelByType 转成Excel类型
func ToExcelByType(titleList []string, dataList []interface{}, dataType string, filePath string) (content io.ReadSeeker, err error) {
// 生成一个新的文件
file := xlsx.NewFile()
// 添加sheet页
sheet, _ := file.AddSheet("Sheet1")
// 插入表头
titleRow := sheet.AddRow()
for _, v := range titleList {
cell := titleRow.AddCell()
cell.Value = v
}
// 插入内容
for _, v := range dataList {
row := sheet.AddRow()
if dataType == "struct" {
row.WriteStruct(v, -1)
} else if dataType == "slice" {
row.WriteSlice(v, -1)
}
}
var buffer bytes.Buffer
_ = file.Write(&buffer)
if filePath != "" {
if err = file.Save(filePath); err != nil {
return
}
} else {
content = bytes.NewReader(buffer.Bytes())
}
return
}
// SaveUrlFileDisk 保存图片到本地
func SaveUrlFileDisk(url string, path string, filename string) (fullPath string, err error) {
if err = CreateDirPath(path); err != nil {
zap.L().Error("SaveUrlFileDisk err ", zap.Error(err))
return
}
if filename == "" {
stepName := strings.Split(url, "/")
if len(stepName) > 1 {
filename = stepName[len(stepName)-1]
}
}
resp, err := http.Get(url)
if err != nil {
logger.Errorf("SaveUrlFileDisk get err", err)
err = errors.New(msg.ErrorDownloadFile)
return
}
defer func() {
if err := recover(); err != nil {
logger.Errorf("SaveUrlFileDisk close err", err)
}
resp.Body.Close()
}()
bytes, err := ioutil.ReadAll(resp.Body)
fullPath = fmt.Sprintf("%s/%s", path, filename)
// 写入数据
err = ioutil.WriteFile(fullPath, bytes, 0777)
return
}
// CreateDirPath 递归创建文件夹
func CreateDirPath(path string) (err error) {
if _, err = os.Stat(path); os.IsNotExist(err) {
if err = os.MkdirAll(path, os.ModePerm); err != nil {
return
}
}
return
}