Compare commits

..

No commits in common. "main" and "chat" have entirely different histories.
main ... chat

26 changed files with 3782 additions and 3090 deletions

View File

@ -1,19 +0,0 @@
FROM busybox:glibc
COPY ./docs/Shanghai /usr/share/zoneinfo/Asia/Shanghai
COPY ./docs/certs /etc/ssl/certs
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
#ENV TZ Asia/Shanghai
ARG GIT_COMMIT=default_value
ENV GIT_COMMIT=$GIT_COMMIT
WORKDIR /app/main-client
#通过名称引用
COPY ./build/app ./bin/mainServer
COPY ./cmd/code/ ./bin/code/
COPY ./conf/ /app/conf/
COPY ./conf/ ./conf/
WORKDIR /app/main-client/bin
CMD ["./mainServer"]

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -31,7 +29,7 @@ service AccountFiee {
rpc OnlineLog (LoginInfosByUserIdRequest) returns (LoginLogsResponse) {}//id获取登录的信息 rpc OnlineLog (LoginInfosByUserIdRequest) returns (LoginLogsResponse) {}//id获取登录的信息
rpc OnlineLogById (OnlineLogByIdRequest) returns (LoginLog) {}//id获取登录的信息 rpc OnlineLogById (OnlineLogByIdRequest) returns (LoginLog) {}//id获取登录的信息
rpc CheckPwd (CheckPwdRequest) returns (UpdateResponse) {}// rpc CheckPwd (CheckPwdRequest) returns (UpdateResponse) {}//
// rpc RegisterOrExist (RegistRequest) returns (RequestStatus) {} // rpc RegisterOrExist (RegistRequest) returns (RequestStatus) {}
rpc SendMsg (SendMsgRequest) returns (SendMsgStatusResponse) {} // rpc SendMsg (SendMsgRequest) returns (SendMsgStatusResponse) {} //
rpc SendCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}// rpc SendCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}//
rpc SendExCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}// rpc SendExCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}//
@ -64,10 +62,6 @@ service AccountFiee {
rpc VerifySliderCaptcha(VerifySliderCaptchaRequest) returns (VerifySliderCaptchaResponse) {}// rpc VerifySliderCaptcha(VerifySliderCaptchaRequest) returns (VerifySliderCaptchaResponse) {}//
rpc SendNationMsg (SendNationMsgRequest) returns (SendMsgStatusResponse) {} // -- rpc SendNationMsg (SendNationMsgRequest) returns (SendMsgStatusResponse) {} // --
rpc VerifySliderStatus(VerifySliderStatusRequest) returns (VerifySliderStatusResponse) {}// rpc VerifySliderStatus(VerifySliderStatusRequest) returns (VerifySliderStatusResponse) {}//
rpc SendNationTemplateMsg (SendNationMsgRequest) returns (SendMsgStatusResponse) {} // --
rpc CreateUserAndRealName (CreateUserAndRealNameRequest) returns (CreateUserAndRealNameResponse) {}// ,
// submit info // submit info
rpc SaveSubmitInfo(SubmitInfoRequest) returns (CommonResponse); rpc SaveSubmitInfo(SubmitInfoRequest) returns (CommonResponse);
@ -190,9 +184,6 @@ message UserListRequest{
int32 auditStatus = 7; int32 auditStatus = 7;
uint64 page = 8; uint64 page = 8;
uint64 pageSize = 9; uint64 pageSize = 9;
string blurNameTel = 10;
repeated int64 ids = 11;
string nationality = 12;
} }
message UserInfoResponse{ message UserInfoResponse{
uint64 id = 1; uint64 id = 1;
@ -213,7 +204,6 @@ message UserInfoResponse{
string subscriberNumber = 16; string subscriberNumber = 16;
string nickName = 17; string nickName = 17;
string telNum = 18; string telNum = 18;
string telAreaCode = 19;
} }
message RealNameResponse{ message RealNameResponse{
uint64 id = 1; uint64 id = 1;
@ -814,7 +804,7 @@ message ClockBatchBindRequest{
repeated uint64 deviceId =3; repeated uint64 deviceId =3;
} }
message ClockBatchListResponse{ message ClockBatchListResponse{
repeated ClockUserDeviceBatch data = 1; repeated ClockUserDeviceBatch data = 1;
} }
message ClockUserDeviceBatch{ message ClockUserDeviceBatch{
uint64 userId = 1; uint64 userId = 1;
@ -876,7 +866,7 @@ enum MsgType{
ImageMsgType = 2 ;// ImageMsgType = 2 ;//
AudioMsgType = 3 ;// AudioMsgType = 3 ;//
VideoMsgType = 4 ;// VideoMsgType = 4 ;//
CardType = 5 ;// FileType = 5 ;//
} }
message ChatRecordData{ message ChatRecordData{
int64 ID=1; int64 ID=1;
@ -893,7 +883,6 @@ message ChatRecordData{
int32 waiterRead=12;// 1= 2= int32 waiterRead=12;// 1= 2=
int64 localStamp = 13; // int64 localStamp = 13; //
string domain =14;// string domain =14;//
int32 role=15;//: 1= 2= 3=
} }
message CreateChatRecordResp{ message CreateChatRecordResp{
ChatRecordData data=1; ChatRecordData data=1;
@ -983,7 +972,7 @@ message ChatUser2{
string name=2; string name=2;
string avatar=3; string avatar=3;
string origin=4; string origin=4;
int64 originId=5; string originId=5;
} }
message GetChatUserListResp2{ message GetChatUserListResp2{
repeated ChatUser2 list=1; repeated ChatUser2 list=1;
@ -1034,7 +1023,7 @@ message ChatUserData{
int64 deletedAt = 4; // int64 deletedAt = 4; //
string nickName = 5; // string nickName = 5; //
string account = 6; // string account = 6; //
int32 role = 7; // 1= 2= 3= int32 role = 7; // 1= 2=
string origin = 8; // string origin = 8; //
int64 originId = 9; //ID int64 originId = 9; //ID
string avatar = 10; // string avatar = 10; //
@ -1065,24 +1054,3 @@ message GetChatUserListResp{
int64 pageSize=3; int64 pageSize=3;
int64 Total=4; int64 Total=4;
} }
message CreateUserAndRealNameRequest{
string userNum = 1;
string userName = 2;
string userTelArea = 3;
string userTel = 4;
string userSex = 5;
string nationality = 6;
string placeOfResidence = 7;
int32 documentType = 8;
string userIdCardFrontUrl = 9;
string userIdCardReverseUrl = 10;
string userIdCardValidity = 11;
string auditTime = 12;
}
message CreateUserAndRealNameResponse {
int64 userId = 1;
string userNum = 2;
string userName = 3;
}

View File

@ -5,11 +5,11 @@ package accountFiee
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators" _ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
math "math"
regexp "regexp" regexp "regexp"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -525,181 +525,3 @@ func (this *ClockLogListResponse) Validate() error {
func (this *SubmitInfoRequest) Validate() error { func (this *SubmitInfoRequest) Validate() error {
return nil return nil
} }
func (this *CommonMsg) Validate() error {
return nil
}
func (this *ChatRecordData) Validate() error {
for _, item := range this.Medias {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Medias", err)
}
}
}
return nil
}
func (this *CreateChatRecordResp) 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 *DeleteChatRecordRequest) Validate() error {
return nil
}
func (this *GetChatRecordByIdRequest) Validate() error {
return nil
}
func (this *GetChatRecordListRequest) Validate() error {
if this.Query != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Query); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Query", err)
}
}
return nil
}
func (this *GetChatRecordListResp) Validate() error {
for _, item := range this.List {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
}
}
}
return nil
}
func (this *RegisterWaiterRequest) Validate() error {
return nil
}
func (this *RegisterWaiterResp) Validate() error {
return nil
}
func (this *ChatMediaData) Validate() error {
return nil
}
func (this *CreateChatMediaResp) 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 *DeleteChatMediaRequest) Validate() error {
return nil
}
func (this *GetChatMediaByIdRequest) Validate() error {
return nil
}
func (this *GetChatMediaListRequest) Validate() error {
if this.Query != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Query); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Query", err)
}
}
return nil
}
func (this *GetChatMediaListResp) Validate() error {
for _, item := range this.List {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
}
}
}
return nil
}
func (this *GetChatUserListRequest2) Validate() error {
return nil
}
func (this *ChatUser2) Validate() error {
return nil
}
func (this *GetChatUserListResp2) Validate() error {
for _, item := range this.List {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
}
}
}
return nil
}
func (this *ChatAutoReplyRulerData) Validate() error {
return nil
}
func (this *CreateChatAutoReplyRulerResp) 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 *DeleteChatAutoReplyRulerRequest) Validate() error {
return nil
}
func (this *GetChatAutoReplyRulerByIdRequest) Validate() error {
return nil
}
func (this *GetChatAutoReplyRulerListRequest) Validate() error {
if this.Query != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Query); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Query", err)
}
}
return nil
}
func (this *GetChatAutoReplyRulerListResp) Validate() error {
for _, item := range this.List {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
}
}
}
return nil
}
func (this *ChatUserData) Validate() error {
return nil
}
func (this *CreateChatUserResp) 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 *DeleteChatUserRequest) Validate() error {
return nil
}
func (this *GetChatUserByIdRequest) Validate() error {
return nil
}
func (this *GetChatUserListRequest) Validate() error {
if this.Query != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Query); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Query", err)
}
}
return nil
}
func (this *GetChatUserListResp) Validate() error {
for _, item := range this.List {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
}
}
}
return nil
}
func (this *CreateUserAndRealNameRequest) Validate() error {
return nil
}
func (this *CreateUserAndRealNameResponse) Validate() error {
return nil
}

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT. // Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-triple v1.0.8 // - protoc-gen-go-triple v1.0.8
// - protoc v5.26.1 // - protoc v4.22.0--rc2
// source: api/accountFiee/accountFiee.proto // source: accountFiee.proto
package accountFiee package accountFiee
@ -68,8 +68,6 @@ type AccountFieeClient interface {
VerifySliderCaptcha(ctx context.Context, in *VerifySliderCaptchaRequest, opts ...grpc_go.CallOption) (*VerifySliderCaptchaResponse, common.ErrorWithAttachment) VerifySliderCaptcha(ctx context.Context, in *VerifySliderCaptchaRequest, opts ...grpc_go.CallOption) (*VerifySliderCaptchaResponse, common.ErrorWithAttachment)
SendNationMsg(ctx context.Context, in *SendNationMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) SendNationMsg(ctx context.Context, in *SendNationMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment)
VerifySliderStatus(ctx context.Context, in *VerifySliderStatusRequest, opts ...grpc_go.CallOption) (*VerifySliderStatusResponse, common.ErrorWithAttachment) VerifySliderStatus(ctx context.Context, in *VerifySliderStatusRequest, opts ...grpc_go.CallOption) (*VerifySliderStatusResponse, common.ErrorWithAttachment)
SendNationTemplateMsg(ctx context.Context, in *SendNationMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment)
CreateUserAndRealName(ctx context.Context, in *CreateUserAndRealNameRequest, opts ...grpc_go.CallOption) (*CreateUserAndRealNameResponse, common.ErrorWithAttachment)
// submit info // submit info
SaveSubmitInfo(ctx context.Context, in *SubmitInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) SaveSubmitInfo(ctx context.Context, in *SubmitInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
// -----------------------------客服聊天系统-------------------------------- // -----------------------------客服聊天系统--------------------------------
@ -145,8 +143,6 @@ type AccountFieeClientImpl struct {
VerifySliderCaptcha func(ctx context.Context, in *VerifySliderCaptchaRequest) (*VerifySliderCaptchaResponse, error) VerifySliderCaptcha func(ctx context.Context, in *VerifySliderCaptchaRequest) (*VerifySliderCaptchaResponse, error)
SendNationMsg func(ctx context.Context, in *SendNationMsgRequest) (*SendMsgStatusResponse, error) SendNationMsg func(ctx context.Context, in *SendNationMsgRequest) (*SendMsgStatusResponse, error)
VerifySliderStatus func(ctx context.Context, in *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error) VerifySliderStatus func(ctx context.Context, in *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error)
SendNationTemplateMsg func(ctx context.Context, in *SendNationMsgRequest) (*SendMsgStatusResponse, error)
CreateUserAndRealName func(ctx context.Context, in *CreateUserAndRealNameRequest) (*CreateUserAndRealNameResponse, error)
SaveSubmitInfo func(ctx context.Context, in *SubmitInfoRequest) (*CommonResponse, error) SaveSubmitInfo func(ctx context.Context, in *SubmitInfoRequest) (*CommonResponse, error)
CreateChatUser func(ctx context.Context, in *ChatUserData) (*CreateChatUserResp, error) CreateChatUser func(ctx context.Context, in *ChatUserData) (*CreateChatUserResp, error)
UpdateChatUser func(ctx context.Context, in *ChatUserData) (*CommonMsg, error) UpdateChatUser func(ctx context.Context, in *ChatUserData) (*CommonMsg, error)
@ -422,18 +418,6 @@ func (c *accountFieeClient) VerifySliderStatus(ctx context.Context, in *VerifySl
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/VerifySliderStatus", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/VerifySliderStatus", in, out)
} }
func (c *accountFieeClient) SendNationTemplateMsg(ctx context.Context, in *SendNationMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) {
out := new(SendMsgStatusResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SendNationTemplateMsg", in, out)
}
func (c *accountFieeClient) CreateUserAndRealName(ctx context.Context, in *CreateUserAndRealNameRequest, opts ...grpc_go.CallOption) (*CreateUserAndRealNameResponse, common.ErrorWithAttachment) {
out := new(CreateUserAndRealNameResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateUserAndRealName", in, out)
}
func (c *accountFieeClient) SaveSubmitInfo(ctx context.Context, in *SubmitInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) { func (c *accountFieeClient) SaveSubmitInfo(ctx context.Context, in *SubmitInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse) out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -640,8 +624,6 @@ type AccountFieeServer interface {
VerifySliderCaptcha(context.Context, *VerifySliderCaptchaRequest) (*VerifySliderCaptchaResponse, error) VerifySliderCaptcha(context.Context, *VerifySliderCaptchaRequest) (*VerifySliderCaptchaResponse, error)
SendNationMsg(context.Context, *SendNationMsgRequest) (*SendMsgStatusResponse, error) SendNationMsg(context.Context, *SendNationMsgRequest) (*SendMsgStatusResponse, error)
VerifySliderStatus(context.Context, *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error) VerifySliderStatus(context.Context, *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error)
SendNationTemplateMsg(context.Context, *SendNationMsgRequest) (*SendMsgStatusResponse, error)
CreateUserAndRealName(context.Context, *CreateUserAndRealNameRequest) (*CreateUserAndRealNameResponse, error)
// submit info // submit info
SaveSubmitInfo(context.Context, *SubmitInfoRequest) (*CommonResponse, error) SaveSubmitInfo(context.Context, *SubmitInfoRequest) (*CommonResponse, error)
// -----------------------------客服聊天系统-------------------------------- // -----------------------------客服聊天系统--------------------------------
@ -796,12 +778,6 @@ func (UnimplementedAccountFieeServer) SendNationMsg(context.Context, *SendNation
func (UnimplementedAccountFieeServer) VerifySliderStatus(context.Context, *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error) { func (UnimplementedAccountFieeServer) VerifySliderStatus(context.Context, *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifySliderStatus not implemented") return nil, status.Errorf(codes.Unimplemented, "method VerifySliderStatus not implemented")
} }
func (UnimplementedAccountFieeServer) SendNationTemplateMsg(context.Context, *SendNationMsgRequest) (*SendMsgStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendNationTemplateMsg not implemented")
}
func (UnimplementedAccountFieeServer) CreateUserAndRealName(context.Context, *CreateUserAndRealNameRequest) (*CreateUserAndRealNameResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateUserAndRealName not implemented")
}
func (UnimplementedAccountFieeServer) SaveSubmitInfo(context.Context, *SubmitInfoRequest) (*CommonResponse, error) { func (UnimplementedAccountFieeServer) SaveSubmitInfo(context.Context, *SubmitInfoRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SaveSubmitInfo not implemented") return nil, status.Errorf(codes.Unimplemented, "method SaveSubmitInfo not implemented")
} }
@ -2042,64 +2018,6 @@ func _AccountFiee_VerifySliderStatus_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _AccountFiee_SendNationTemplateMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SendNationMsgRequest)
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("SendNationTemplateMsg", 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 _AccountFiee_CreateUserAndRealName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserAndRealNameRequest)
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("CreateUserAndRealName", 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 _AccountFiee_SaveSubmitInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _AccountFiee_SaveSubmitInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SubmitInfoRequest) in := new(SubmitInfoRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -3046,14 +2964,6 @@ var AccountFiee_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "VerifySliderStatus", MethodName: "VerifySliderStatus",
Handler: _AccountFiee_VerifySliderStatus_Handler, Handler: _AccountFiee_VerifySliderStatus_Handler,
}, },
{
MethodName: "SendNationTemplateMsg",
Handler: _AccountFiee_SendNationTemplateMsg_Handler,
},
{
MethodName: "CreateUserAndRealName",
Handler: _AccountFiee_CreateUserAndRealName_Handler,
},
{ {
MethodName: "SaveSubmitInfo", MethodName: "SaveSubmitInfo",
Handler: _AccountFiee_SaveSubmitInfo_Handler, Handler: _AccountFiee_SaveSubmitInfo_Handler,
@ -3164,5 +3074,5 @@ var AccountFiee_ServiceDesc = grpc_go.ServiceDesc{
}, },
}, },
Streams: []grpc_go.StreamDesc{}, Streams: []grpc_go.StreamDesc{},
Metadata: "api/accountFiee/accountFiee.proto", Metadata: "accountFiee.proto",
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 KiB

View File

@ -11,10 +11,10 @@ Domain = "fontree.cn"
[mysql] [mysql]
Db = "mysql" Db = "mysql"
DbHost = "172.16.100.99" DbHost = "172.16.100.30"
DbPort = "9007" DbPort = "3306"
DbUser = "artuser" DbUser = "root"
DbPassWord = "C250PflXIWv2SQm8" DbPassWord = "IhQmhg8HZjDmU=Ove5PnA^D"
DbName = "micro-account" DbName = "micro-account"
[redis] [redis]

View File

@ -1,32 +0,0 @@
logger:
CallerSkip: 4
zap-config:
level: info # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "console"
# 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: ""
EncodeDuration: zapcore.SecondsDurationEncoder,
params:
service: "my-service"
version: "1.0.0"
outputPaths:
- "stderr"
initialFields:
app: "account"
errorOutputPaths:
- "stderr"

View File

@ -1,18 +0,0 @@
# 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"

View File

@ -3,12 +3,10 @@ package utils
import ( import (
"bytes" "bytes"
"encoding/base64" "encoding/base64"
"errors"
"fmt" "fmt"
"image" "image"
"image/color" "image/color"
"image/draw" "image/draw"
"image/jpeg"
"image/png" "image/png"
"math/rand" "math/rand"
"net/http" "net/http"
@ -20,9 +18,8 @@ import (
) )
const ( const (
ImgURL = "https://cdns.fontree.cn/fonchain-main/test/image/artwork/config/slidCode_%d.jpg" ImgURL = "https://cdns.fontree.cn/fonchain-main/test/image/artwork/config/slidCode_%d.jpg"
ImgPath = "./code/%d.jpg" //本地路径,暂不使用 ImgPath = "./code/%d.jpg" //本地路径,暂不使用
ImgPathPng = "./code/%d.png" //本地路径,暂不使用
) )
// 生成指定范围内的随机数 // 生成指定范围内的随机数
@ -32,96 +29,41 @@ func GetNonceByRange(start, end int) int {
} }
// 获取缓冲图片可能是通过URL或本地路径 // 获取缓冲图片可能是通过URL或本地路径
func GetBufferedImage(place, canvasWidth, canvasHeight int) (draw.Image, error) { func GetBufferedImage(place int) (image.Image, error) {
startTime := time.Now()
fmt.Println("")
fmt.Println("")
fmt.Println("")
fmt.Println("1---")
nonce := GetNonceByRange(1, 10) nonce := GetNonceByRange(1, 10)
fmt.Println("2", time.Now().Sub(startTime))
var imgURL string var imgURL string
//place = 0 // 注意这边的图片现在只使用url图片 place = 0 // 注意这边的图片现在只使用url图片
if place == 1 {
fmt.Println("3-1", time.Now().Sub(startTime)) if place == 0 {
imgURL = fmt.Sprintf(ImgURL, nonce) imgURL = fmt.Sprintf(ImgURL, nonce)
resp, err := http.Get(imgURL) resp, err := http.Get(imgURL)
if err != nil { if err != nil {
return nil, err return nil, err
} }
fmt.Println("3-2", time.Now().Sub(startTime))
defer resp.Body.Close() defer resp.Body.Close()
img, ff, err := image.Decode(resp.Body) img, _, err := image.Decode(resp.Body)
fmt.Println("----", ff)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return img, nil
fmt.Println("3-3", time.Now().Sub(startTime)) } else {
file, err := os.Open(fmt.Sprintf(ImgPath, nonce))
canvasImage := ImageResize(img, canvasWidth, canvasHeight).(*image.RGBA)
return canvasImage, nil
} else { //从redis中获取
file, err := os.Open(fmt.Sprintf(ImgPathPng, nonce))
fmt.Println("4-1", time.Now().Sub(startTime))
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer file.Close() defer file.Close()
img, _, err := image.Decode(file)
//img, format, err := image.Decode(file)
img, err := png.Decode(file)
format := "1"
fmt.Println("", err)
//img, err := jpeg.Decode(file)
fmt.Println("4-1-1", time.Now().Sub(startTime), err)
fmt.Println("4-2", time.Now().Sub(startTime), format)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return img, nil
ss := ImageResize(img, canvasWidth, canvasHeight)
canvasImage := ss.(*image.RGBA)
return canvasImage, nil
} }
return nil, errors.New("类型错误")
}
// 将 image.YCbCr 转换为 *image.RGBA
func convertYCbCrToRGBA(yCbCrImage *image.YCbCr) *image.RGBA {
bounds := yCbCrImage.Bounds()
rgba := image.NewRGBA(bounds)
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
for x := bounds.Min.X; x < bounds.Max.X; x++ {
// 获取 (x, y) 点的颜色
ycbcrColor := yCbCrImage.At(x, y)
// 使用 color.RGBAModel 转换为 RGBA 颜色
rgbaColor := color.RGBAModel.Convert(ycbcrColor).(color.RGBA)
// 设置到 RGBA 图像中
rgba.SetRGBA(x, y, rgbaColor)
}
}
return rgba
} }
// 调整图片大小 // 调整图片大小
func ImageResize(bufferedImage image.Image, width, height int) image.Image { func ImageResize(bufferedImage image.Image, width, height int) image.Image {
return resize.Resize(uint(width), uint(height), bufferedImage, resize.Bilinear) return resize.Resize(uint(width), uint(height), bufferedImage, resize.Lanczos3)
} }
// CutByTemplate 根据模板裁剪图像 // 生成圆角正方形的滑块图像 // CutByTemplate 根据模板裁剪图像 // 生成圆角正方形的滑块图像
@ -422,19 +364,6 @@ func ToBase64(img image.Image, format string) string {
switch format { switch format {
case "png": case "png":
png.Encode(buf, img) png.Encode(buf, img)
case "jpeg":
jpeg.Encode(buf, img, &jpeg.Options{Quality: 80})
}
return base64.StdEncoding.EncodeToString(buf.Bytes())
}
// ToBase64Jpeg 将图像转换为Base64编码
func ToBase64Jpeg(img image.Image, format string) string {
buf := new(bytes.Buffer)
switch format {
case "png":
jpeg.Encode(buf, img, &jpeg.Options{Quality: 100})
} }
return base64.StdEncoding.EncodeToString(buf.Bytes()) return base64.StdEncoding.EncodeToString(buf.Bytes())
} }

View File

@ -13,7 +13,7 @@ const SIG_NO = 145031
const SIG_NO_SELLER = 159789 const SIG_NO_SELLER = 159789
func SendMsg(telNum string, project string) (string, error) { func SendMsg(telNum string, project string) (string, error) {
TMP := 277455
var sigNo uint var sigNo uint
sigNo = SIG_NO sigNo = SIG_NO
@ -28,7 +28,7 @@ func SendMsg(telNum string, project string) (string, error) {
code := mobile.RandCode() code := mobile.RandCode()
//content := "验证码模板:尊敬的用户,您的验证码为$$15分钟内有效请勿泄露。" //content := "验证码模板:尊敬的用户,您的验证码为$$15分钟内有效请勿泄露。"
fmt.Println("发送短信请求参数:", telNum, TMP, sigNo, code) fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
/** /**
TODO TODO
@ -40,14 +40,13 @@ func SendMsg(telNum string, project string) (string, error) {
} }
*/ */
fmt.Println("发送短信请求参数:", telNum, TMP, sigNo, code) fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
return code, mobileTemplate.Send(telNum, uint(TMP), sigNo, code) return code, mobileTemplate.Send(telNum, mobile.TMP1, sigNo, code)
} }
func SendMsgV2(telNum string, project string, tempSignNo uint) (string, error) { func SendMsgV2(telNum string, project string, tempSignNo uint) (string, error) {
TMP := 277455
var sigNo uint var sigNo uint
sigNo = SIG_NO sigNo = SIG_NO
//if project == "seller" { //if project == "seller" {
@ -72,8 +71,9 @@ func SendMsgV2(telNum string, project string, tempSignNo uint) (string, error) {
return code, nil return code, nil
} }
*/ */
fmt.Println("发送短信请求参数:", telNum, TMP, sigNo, code)
return code, mobileTemplate.Send(telNum, uint(TMP), sigNo, code) fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
return code, mobileTemplate.Send(telNum, mobile.TMP1, sigNo, code)
//fmt.Println("发送短信请求参数:", telNum, mobile.Sign, mobile.AlTMP1, code) //fmt.Println("发送短信请求参数:", telNum, mobile.Sign, mobile.AlTMP1, code)
//return code, mobileTemplate.SendAlSms(telNum, mobile.Sign, mobile.AlTMP1, code) //return code, mobileTemplate.SendAlSms(telNum, mobile.Sign, mobile.AlTMP1, code)

View File

@ -69,9 +69,6 @@ func (chatDao) UpdateChatRecord(data *model.ChatRecord) (err error) {
if data.LocalStamp != 0 { if data.LocalStamp != 0 {
thisData.LocalStamp = data.LocalStamp thisData.LocalStamp = data.LocalStamp
} }
if data.Role != 0 {
thisData.Role = data.Role
}
if err = model.DB.Updates(&thisData).Error; err != nil { if err = model.DB.Updates(&thisData).Error; err != nil {
return err return err
@ -101,7 +98,7 @@ func (chatDao) GetChatRecordById(id int) (res model.ChatRecord, err error) {
// 批量查询ChatRecord // 批量查询ChatRecord
func (chatDao) GetChatRecordList(info *accountFiee.GetChatRecordListRequest) (resp []model.ChatRecord, total int64, err error) { func (chatDao) GetChatRecordList(info *accountFiee.GetChatRecordListRequest) (resp []model.ChatRecord, total int64, err error) {
var dbQuery = model.DB.Model(&model.ChatRecord{}).Preload("Medias").Debug() var dbQuery = model.DB.Model(&model.ChatRecord{}).Preload("Medias")
if info.Query != nil { if info.Query != nil {
if info.Query.SessionId != "" { if info.Query.SessionId != "" {
@ -128,9 +125,6 @@ func (chatDao) GetChatRecordList(info *accountFiee.GetChatRecordListRequest) (re
if info.Query.LocalStamp != 0 { if info.Query.LocalStamp != 0 {
dbQuery = dbQuery.Where("local_stamp = ?", info.Query.LocalStamp) dbQuery = dbQuery.Where("local_stamp = ?", info.Query.LocalStamp)
} }
if info.Query.Role != 0 {
dbQuery = dbQuery.Where("role = ?", info.Query.Role)
}
} }
if info.Where != "" { if info.Where != "" {
dbQuery = dbQuery.Where(info.Where) dbQuery = dbQuery.Where(info.Where)
@ -141,9 +135,6 @@ func (chatDao) GetChatRecordList(info *accountFiee.GetChatRecordListRequest) (re
//数据查询 //数据查询
dbQuery.Count(&total) dbQuery.Count(&total)
err = dbQuery.Scopes(db.Pagination(info.Page, info.PageSize)).Find(&resp).Error err = dbQuery.Scopes(db.Pagination(info.Page, info.PageSize)).Find(&resp).Error
fmt.Println("err:", err)
fmt.Println("resp.len:", len(resp))
fmt.Println("total", total)
if err != nil { if err != nil {
//log.L().Error("GetChatRecordList Err", zap.Error(err)) //log.L().Error("GetChatRecordList Err", zap.Error(err))
err = errors.New(m.DBError) err = errors.New(m.DBError)
@ -253,39 +244,28 @@ func (chatDao) GetChatMediaList(info *accountFiee.GetChatMediaListRequest) (resp
// 批量查询ChatMedia // 批量查询ChatMedia
func (chatDao) GetChatUserList(req *accountFiee.GetChatUserListRequest2) (resp []*accountFiee.ChatUser2, total int64, err error) { func (chatDao) GetChatUserList(req *accountFiee.GetChatUserListRequest2) (resp []*accountFiee.ChatUser2, total int64, err error) {
var dbQuery = model.DB.Model(&model.ChatUser{}).Debug() var dbQuery = model.DB.Model(&model.User{})
if req.Where != "" { if req.Where != "" {
dbQuery = dbQuery.Where(req.Where) dbQuery = dbQuery.Where(req.Where)
} }
if req.UserIdIn != nil { if req.UserIdIn != nil {
dbQuery = dbQuery.Where("id in (?)", req.UserIdIn) dbQuery = dbQuery.Where("user_id in (?)", req.UserIdIn)
} }
if req.Name != "" { if req.Name != "" {
dbQuery = dbQuery.Where(fmt.Sprintf("nick_name like '%%%v%%'", req.Name)) dbQuery = dbQuery.Where(fmt.Sprintf("name like '%%%v%%'", req.Name))
} }
if req.Account != "" { if req.Account != "" {
dbQuery = dbQuery.Where(fmt.Sprintf("account like '%%%v%%'", req.Account)) dbQuery = dbQuery.Where(fmt.Sprintf("account like '%%%v%%'", req.Name))
} }
if req.RoleIn != nil { if req.RoleIn != nil {
dbQuery = dbQuery.Where("role in (?)", req.RoleIn) dbQuery = dbQuery.Where("role in (?)", req.RoleIn)
} }
var data []model.ChatUser
//数据查询 //数据查询
dbQuery.Count(&total) dbQuery.Count(&total)
err = dbQuery.Scopes(db.Pagination(req.Page, req.PageSize)).Find(&data).Error err = dbQuery.Scopes(db.Pagination(req.Page, req.PageSize)).Find(&resp).Error
if err != nil { if err != nil {
//log.L().Error("GetChatUserList Err", zap.Error(err)) //log.L().Error("GetChatUserList Err", zap.Error(err))
err = errors.New(m.DBError) err = errors.New(m.DBError)
} }
for _, v := range data {
tmp := &accountFiee.ChatUser2{
UserId: v.ID,
Name: v.NickName,
Avatar: v.Avatar,
Origin: v.Origin,
OriginId: v.OriginId,
}
resp = append(resp, tmp)
}
return return
} }

View File

@ -56,9 +56,6 @@ func (chatAutoReplyRulerDao) UpdateChatAutoReplyRuler(data *model.ChatAutoReplyR
if data.Status != 0 { if data.Status != 0 {
thisData.Status = data.Status thisData.Status = data.Status
} }
if data.Response != "" {
thisData.Response = data.Response
}
if err = model.DB.Updates(&thisData).Error; err != nil { if err = model.DB.Updates(&thisData).Error; err != nil {
return err return err

View File

@ -120,11 +120,9 @@ func (AsChatLogic) GetChatRecordList(req *accountFiee.GetChatRecordListRequest)
if err != nil { if err != nil {
return return
} }
fmt.Println("GetChatRecordList len(data):", len(data))
if err = copier.CopyWithOption(&resp.List, &data, utils.CopierProtoOptions); err != nil { if err = copier.CopyWithOption(&resp.List, &data, utils.CopierProtoOptions); err != nil {
return return
} }
fmt.Println("GetChatRecordList len(resp.List):", len(resp.List))
return return
} }
func (AsChatLogic) RegisterWaiter(request *accountFiee.RegisterWaiterRequest) (resp *accountFiee.RegisterWaiterResp, err error) { func (AsChatLogic) RegisterWaiter(request *accountFiee.RegisterWaiterRequest) (resp *accountFiee.RegisterWaiterResp, err error) {

View File

@ -29,7 +29,6 @@ type ChatRecord struct {
Medias []*ChatMedia `gorm:"many2many:chat_record_media;"` Medias []*ChatMedia `gorm:"many2many:chat_record_media;"`
WaiterRead int32 `gorm:"column:waiter_read;default:2;comment:客服是否已读 1=已读 2=未读"` // (被任意客服读取过均为已读) WaiterRead int32 `gorm:"column:waiter_read;default:2;comment:客服是否已读 1=已读 2=未读"` // (被任意客服读取过均为已读)
LocalStamp int64 `gorm:"column:local_stamp;comment:用户端的消息唯一值,用于用户端的消息校验"` LocalStamp int64 `gorm:"column:local_stamp;comment:用户端的消息唯一值,用于用户端的消息校验"`
Role int32 `gorm:"column:role,comment:用户角色: 1=用户 2=客服 3=机器人"`
} }
func (c ChatRecord) TableName() string { func (c ChatRecord) TableName() string {

View File

@ -28,7 +28,7 @@ func LoadEnv(config MysqlConfig) {
//MySQL数据库 //MySQL数据库
path := strings.Join([]string{config.DbUser, ":", config.DbPassWord, "@tcp(", config.DbHost, ":", path := strings.Join([]string{config.DbUser, ":", config.DbPassWord, "@tcp(", config.DbHost, ":",
config.DbPort, ")/", config.DbName, "?charset=utf8mb4&parseTime=true&loc=Local"}, "") config.DbPort, ")/", config.DbName, "?charset=utf8&parseTime=true&loc=Local"}, "")
fmt.Println(path) fmt.Println(path)
//连接数据库 //连接数据库

View File

@ -643,7 +643,6 @@ func (a *AccountFieeProvider) Info(ctx context.Context, in *account.InfoRequest)
SubscriberNumber: user.SubscriberNumber, SubscriberNumber: user.SubscriberNumber,
NickName: user.Nickname, NickName: user.Nickname,
TelNum: user.TelNum, TelNum: user.TelNum,
TelAreaCode: user.TelAreaCode,
} }
return response, nil return response, nil
@ -655,9 +654,6 @@ func (a *AccountFieeProvider) UserList(ctx context.Context, in *account.UserList
if in.Domain != "" { if in.Domain != "" {
modelObj.Where("domain = ? ", in.Domain) modelObj.Where("domain = ? ", in.Domain)
} }
if len(in.Ids) != 0 {
modelObj.Where("user.id in (?) ", in.Ids)
}
if in.SubNum != "" { if in.SubNum != "" {
modelObj.Where("sub_num like ? ", "%"+in.SubNum+"%") modelObj.Where("sub_num like ? ", "%"+in.SubNum+"%")
} }
@ -669,9 +665,6 @@ func (a *AccountFieeProvider) UserList(ctx context.Context, in *account.UserList
if in.Name != "" { if in.Name != "" {
modelObj.Where("RealName.name like ? ", "%"+in.Name+"%") modelObj.Where("RealName.name like ? ", "%"+in.Name+"%")
} }
if in.Nationality != "" {
modelObj.Where("RealName.nationality like ? ", "%"+in.Nationality+"%")
}
if in.DocumentType != 0 { if in.DocumentType != 0 {
modelObj.Where("RealName.document_type = ? ", in.DocumentType) modelObj.Where("RealName.document_type = ? ", in.DocumentType)
} }
@ -681,9 +674,6 @@ func (a *AccountFieeProvider) UserList(ctx context.Context, in *account.UserList
if in.Sex != "" { if in.Sex != "" {
modelObj.Where("RealName.sex = ?", in.Sex) modelObj.Where("RealName.sex = ?", in.Sex)
} }
if in.BlurNameTel != "" {
modelObj.Where("RealName.name like ? or tel_num like ? ", "%"+in.BlurNameTel+"%", "%"+in.BlurNameTel+"%")
}
modelObj.Count(&count) modelObj.Count(&count)
if in.Page > 0 && in.PageSize > 0 { if in.Page > 0 && in.PageSize > 0 {
modelObj.Limit(int(in.PageSize)).Offset(page.GetOffset(in.Page, in.PageSize)) modelObj.Limit(int(in.PageSize)).Offset(page.GetOffset(in.Page, in.PageSize))
@ -700,33 +690,6 @@ func (a *AccountFieeProvider) UserList(ctx context.Context, in *account.UserList
return response, nil return response, nil
} }
// SendNationTemplateMsg 发送国际模板短信
func (a *AccountFieeProvider) SendNationTemplateMsg(_ context.Context, in *account.SendNationMsgRequest) (*account.SendMsgStatusResponse, error) {
response := &account.SendMsgStatusResponse{}
if domain.InBlockList(in.Domain, in.TelNum) {
return nil, errors.New(m.Black_Mobile_Sended)
}
//是否存活 (1分钟冷却) (1-是否已经发送 2-是否今日发送超过指定数量) 55秒
if err := domain.CodeLive(in.Domain, in.TelNum); err != nil {
return nil, err
}
//今日是否达到上限
if err := domain.CheckMsg(redis_key.GetAccountKeyCountToday(in.Domain, in.TelNum)); err != nil {
return nil, err
}
err := verifica.SendNationMsg(in.TelNum, "FiEE", int(in.MId))
if err != nil {
return nil, err
}
return response, nil
}
// 艺术商城,发送国际短信验证码 // 艺术商城,发送国际短信验证码
func (a *AccountFieeProvider) SendNationMsg(_ context.Context, in *account.SendNationMsgRequest) (*account.SendMsgStatusResponse, error) { func (a *AccountFieeProvider) SendNationMsg(_ context.Context, in *account.SendNationMsgRequest) (*account.SendMsgStatusResponse, error) {
response := &account.SendMsgStatusResponse{} response := &account.SendMsgStatusResponse{}
@ -779,8 +742,6 @@ func (a *AccountFieeProvider) SendNationMsg(_ context.Context, in *account.SendN
} }
func (a *AccountFieeProvider) GenerateSliderCaptcha(_ context.Context, in *account.GenerateSliderCaptchaRequest) (*account.GenerateSliderCaptchaResponse, error) { func (a *AccountFieeProvider) GenerateSliderCaptcha(_ context.Context, in *account.GenerateSliderCaptchaRequest) (*account.GenerateSliderCaptchaResponse, error) {
startTime := time.Now()
realTime := time.Now()
captcha := &model.Captcha{ captcha := &model.Captcha{
CanvasWidth: int(in.CanvasWidth), CanvasWidth: int(in.CanvasWidth),
@ -794,12 +755,6 @@ func (a *AccountFieeProvider) GenerateSliderCaptcha(_ context.Context, in *accou
if err != nil { if err != nil {
return nil, err return nil, err
} }
fmt.Println()
fmt.Println()
fmt.Println()
fmt.Println("1-耗时", time.Now().Sub(startTime))
startTime = time.Now()
canvasWidth := captcha.CanvasWidth canvasWidth := captcha.CanvasWidth
canvasHeight := captcha.CanvasHeight canvasHeight := captcha.CanvasHeight
blockWidth := captcha.BlockWidth blockWidth := captcha.BlockWidth
@ -807,66 +762,41 @@ func (a *AccountFieeProvider) GenerateSliderCaptcha(_ context.Context, in *accou
//blockRadius := captcha.BlockRadius //blockRadius := captcha.BlockRadius
place := captcha.Place place := captcha.Place
canvasImage, _ := utils.GetBufferedImage(place, canvasWidth, canvasHeight) img, _ := utils.GetBufferedImage(place)
canvasImage := utils.ImageResize(img, canvasWidth, canvasHeight).(*image.RGBA)
fmt.Println("2-耗时", time.Now().Sub(startTime))
startTime = time.Now()
fmt.Println()
fmt.Println("3-耗时", time.Now().Sub(startTime))
startTime = time.Now()
blockX := utils.GetNonceByRange(blockWidth, canvasWidth-blockWidth-10) blockX := utils.GetNonceByRange(blockWidth, canvasWidth-blockWidth-10)
fmt.Println("4-耗时", time.Now().Sub(startTime))
startTime = time.Now()
blockY := utils.GetNonceByRange(10, canvasHeight-blockHeight+1) blockY := utils.GetNonceByRange(10, canvasHeight-blockHeight+1)
fmt.Println("5-耗时", time.Now().Sub(startTime))
startTime = time.Now()
blockImage := image.NewRGBA(image.Rect(0, 0, blockWidth, blockHeight)) blockImage := image.NewRGBA(image.Rect(0, 0, blockWidth, blockHeight))
fmt.Println("6-耗时", time.Now().Sub(startTime))
startTime = time.Now()
utils.CutByTemplate(canvasImage, blockImage, blockWidth, blockHeight, blockX, blockY) utils.CutByTemplate(canvasImage, blockImage, blockWidth, blockHeight, blockX, blockY)
fmt.Println("1---", 0) fmt.Println("1---", 0)
fmt.Println("2---", blockY) fmt.Println("2---", blockY)
fmt.Println("2---X", blockX) fmt.Println("2---", blockX)
fmt.Println("6-耗时", time.Now().Sub(startTime))
startTime = time.Now()
// 生成UUID // 生成UUID
nonceStr := fmt.Sprintf("%x", rand2.New(rand2.NewSource(time.Now().UnixNano())).Uint64()) nonceStr := fmt.Sprintf("%x", rand2.New(rand2.NewSource(time.Now().UnixNano())).Uint64())
fmt.Println("6-耗时", time.Now().Sub(startTime))
startTime = time.Now()
// 保存X轴像素 // 保存X轴像素
cache.RedisClient.Set("imageCode:"+nonceStr, blockX, 15*time.Minute) cache.RedisClient.Set("imageCode:"+nonceStr, blockX, 15*time.Minute)
resp := &account.GenerateSliderCaptchaResponse{ resp := &account.GenerateSliderCaptchaResponse{
NonceStr: nonceStr, NonceStr: nonceStr,
CanvasSrc: utils.ToBase64(canvasImage, "jpeg"), CanvasSrc: utils.ToBase64(canvasImage, "png"),
BlockSrc: utils.ToBase64(blockImage, "png"), BlockSrc: utils.ToBase64(blockImage, "png"),
BlockY: uint64(blockY), BlockY: uint64(blockY),
FaceY: 0, FaceY: 0,
//BlockX: uint64(blockX), //BlockX: uint64(blockX),
} }
fmt.Println("7耗时", time.Now().Sub(startTime))
fmt.Println("总耗时", time.Now().Sub(realTime))
return resp, nil return resp, nil
} }
func (a *AccountFieeProvider) VerifySliderCaptcha(_ context.Context, in *account.VerifySliderCaptchaRequest) (*account.VerifySliderCaptchaResponse, error) { func (a *AccountFieeProvider) VerifySliderCaptcha(_ context.Context, in *account.VerifySliderCaptchaRequest) (*account.VerifySliderCaptchaResponse, error) {
resp := &account.VerifySliderCaptchaResponse{} resp := &account.VerifySliderCaptchaResponse{}
// 检查图像验证码 // 检查图像验证码
key := "imageCode:" + in.NonceStr text, err := cache.RedisClient.Get("imageCode:" + in.NonceStr).Result()
text, err := cache.RedisClient.Get(key).Result()
if err == redis.Nil { if err == redis.Nil {
err = errors.New("验证码已失效") err = errors.New("验证码已失效")
return resp, err return resp, err
@ -884,20 +814,6 @@ func (a *AccountFieeProvider) VerifySliderCaptcha(_ context.Context, in *account
if err != nil { if err != nil {
return resp, err return resp, err
} }
// 获取验证次数计数器key
countKey := "imageCode:count:" + in.NonceStr
count, _ := cache.RedisClient.Get(countKey).Int64()
// 验证成功,增加计数
count++
if count >= 2 {
// 达到2次后删除两个key
cache.RedisClient.Del(key)
cache.RedisClient.Del(countKey)
} else {
// 未达到2次更新计数并设置过期时间
cache.RedisClient.Set(countKey, count, 15*time.Minute)
}
resp.NonceStr = in.NonceStr resp.NonceStr = in.NonceStr
@ -941,12 +857,7 @@ func (a *AccountFieeProvider) UserByTel(_ context.Context, in *account.UserByTel
response := &account.UserInfoResponse{} response := &account.UserInfoResponse{}
var user *model.User var user *model.User
if in.Tel == "" {
return response, errors.New("无效参数tel")
}
if in.Domain == "" {
return response, errors.New("无效参数domain")
}
if err := model.DB.Model(&model.User{}).Preload("RealName").Where(&model.User{Domain: &in.Domain, TelNum: in.Tel}).First(&user).Error; err != nil { if err := model.DB.Model(&model.User{}).Preload("RealName").Where(&model.User{Domain: &in.Domain, TelNum: in.Tel}).First(&user).Error; err != nil {
if err.Error() == "record not found" { //不存在 if err.Error() == "record not found" { //不存在
@ -1233,57 +1144,3 @@ func (a *AccountFieeProvider) VerifySliderStatus(_ context.Context, in *account.
} }
return resp, nil return resp, nil
} }
func (a *AccountFieeProvider) CreateUserAndRealName(ctx context.Context, in *account.CreateUserAndRealNameRequest) (*account.CreateUserAndRealNameResponse, error) {
var tempUser *model.User
if err := model.DB.Model(&model.User{}).Where("deleted_at = 0 and domain='app' and tel_num=?", in.UserTel).First(&tempUser).Error; err == nil {
// 用户已存在
return nil, errors.New("用户已存在")
}
// 实名
newRealName := model.RealName{
Name: in.UserName,
Sex: in.UserSex,
Nationality: in.Nationality,
DocumentType: int(in.DocumentType),
CertificatePicture: in.UserIdCardFrontUrl,
Validity: in.UserIdCardValidity,
PlaceOfResidence: in.PlaceOfResidence,
GroupPhoto: in.UserIdCardFrontUrl,
}
// 创建实名信息
if err := model.DB.Create(&newRealName).Error; err != nil {
return nil, err
}
// 更新用户的实名信息 ID
domain := "app"
date := time.Now().Format("20060102")
// 生成一个 5 位随机数
rand2.Seed(time.Now().UnixNano())
randomNum := rand2.Intn(90000) + 10000
subscriberNumber := fmt.Sprintf("FiEE%s%05d", date, randomNum)
// 建用户
user := model.User{
Domain: &domain,
TelNum: in.UserTel,
Status: m.Pass,
TelAreaCode: in.UserTelArea,
AuditTime: in.AuditTime,
RegistrationTime: in.AuditTime,
SubNum: in.UserNum,
RealNameID: &newRealName.ID,
SubscriberNumber: subscriberNumber,
Language: "zh_CN",
Nickname: in.UserName,
}
if err := model.DB.Create(&user).Error; err != nil {
return nil, err
}
return &account.CreateUserAndRealNameResponse{UserId: int64(user.ID), UserNum: user.SubNum, UserName: user.Nickname}, nil
}