Compare commits
No commits in common. "main" and "chat" have entirely different histories.
@ -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"]
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -31,7 +29,7 @@ service AccountFiee {
|
||||
rpc OnlineLog (LoginInfosByUserIdRequest) returns (LoginLogsResponse) {}//根据用户id获取登录的信息
|
||||
rpc OnlineLogById (OnlineLogByIdRequest) returns (LoginLog) {}//根据用户id获取登录的信息
|
||||
rpc CheckPwd (CheckPwdRequest) returns (UpdateResponse) {}//检测密码是否正确
|
||||
// rpc RegisterOrExist (RegistRequest) returns (RequestStatus) {}
|
||||
// rpc RegisterOrExist (RegistRequest) returns (RequestStatus) {}
|
||||
rpc SendMsg (SendMsgRequest) returns (SendMsgStatusResponse) {} //登陆发送验证码
|
||||
rpc SendCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}//定制化发送内容
|
||||
rpc SendExCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}//定制化发送内容
|
||||
@ -64,10 +62,6 @@ service AccountFiee {
|
||||
rpc VerifySliderCaptcha(VerifySliderCaptchaRequest) returns (VerifySliderCaptchaResponse) {}// 验证滑块验证码位置
|
||||
rpc SendNationMsg (SendNationMsgRequest) returns (SendMsgStatusResponse) {} //发送境外国际短信验证码 --艺术商城
|
||||
rpc VerifySliderStatus(VerifySliderStatusRequest) returns (VerifySliderStatusResponse) {}// 验证滑块验证码状态
|
||||
rpc SendNationTemplateMsg (SendNationMsgRequest) returns (SendMsgStatusResponse) {} //发送境外国际短信验证码 --艺术商城
|
||||
|
||||
|
||||
rpc CreateUserAndRealName (CreateUserAndRealNameRequest) returns (CreateUserAndRealNameResponse) {}// 创建用户并实名, 自动导入
|
||||
|
||||
// submit info
|
||||
rpc SaveSubmitInfo(SubmitInfoRequest) returns (CommonResponse);
|
||||
@ -190,9 +184,6 @@ message UserListRequest{
|
||||
int32 auditStatus = 7;
|
||||
uint64 page = 8;
|
||||
uint64 pageSize = 9;
|
||||
string blurNameTel = 10;
|
||||
repeated int64 ids = 11;
|
||||
string nationality = 12;
|
||||
}
|
||||
message UserInfoResponse{
|
||||
uint64 id = 1;
|
||||
@ -213,7 +204,6 @@ message UserInfoResponse{
|
||||
string subscriberNumber = 16;
|
||||
string nickName = 17;
|
||||
string telNum = 18;
|
||||
string telAreaCode = 19;
|
||||
}
|
||||
message RealNameResponse{
|
||||
uint64 id = 1;
|
||||
@ -814,7 +804,7 @@ message ClockBatchBindRequest{
|
||||
repeated uint64 deviceId =3;
|
||||
}
|
||||
message ClockBatchListResponse{
|
||||
repeated ClockUserDeviceBatch data = 1;
|
||||
repeated ClockUserDeviceBatch data = 1;
|
||||
}
|
||||
message ClockUserDeviceBatch{
|
||||
uint64 userId = 1;
|
||||
@ -876,7 +866,7 @@ enum MsgType{
|
||||
ImageMsgType = 2 ;//图片
|
||||
AudioMsgType = 3 ;//音频
|
||||
VideoMsgType = 4 ;//视频
|
||||
CardType = 5 ;//卡片
|
||||
FileType = 5 ;//文件
|
||||
}
|
||||
message ChatRecordData{
|
||||
int64 ID=1;
|
||||
@ -893,7 +883,6 @@ message ChatRecordData{
|
||||
int32 waiterRead=12;//客服是否已读 1=已读 2=未读 (被任意客服读取过均为已读)
|
||||
int64 localStamp = 13; //本地时间戳 用户端的消息唯一值,用于用户本地的一些逻辑处理
|
||||
string domain =14;//域
|
||||
int32 role=15;//用户角色: 1=用户 2=客服 3=机器人
|
||||
}
|
||||
message CreateChatRecordResp{
|
||||
ChatRecordData data=1;
|
||||
@ -983,7 +972,7 @@ message ChatUser2{
|
||||
string name=2;
|
||||
string avatar=3;
|
||||
string origin=4;
|
||||
int64 originId=5;
|
||||
string originId=5;
|
||||
}
|
||||
message GetChatUserListResp2{
|
||||
repeated ChatUser2 list=1;
|
||||
@ -1034,7 +1023,7 @@ message ChatUserData{
|
||||
int64 deletedAt = 4; //
|
||||
string nickName = 5; //昵称
|
||||
string account = 6; //账号
|
||||
int32 role = 7; //聊天角色 1=用户 2=客服 3=机器人
|
||||
int32 role = 7; //聊天角色 1=用户 2=客服
|
||||
string origin = 8; //数据来源
|
||||
int64 originId = 9; //数据来源对应的用户ID
|
||||
string avatar = 10; //头像
|
||||
@ -1065,24 +1054,3 @@ message GetChatUserListResp{
|
||||
int64 pageSize=3;
|
||||
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;
|
||||
}
|
@ -5,11 +5,11 @@ package accountFiee
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_ "github.com/mwitkow/go-proto-validators"
|
||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||
math "math"
|
||||
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.
|
||||
@ -525,181 +525,3 @@ func (this *ClockLogListResponse) Validate() error {
|
||||
func (this *SubmitInfoRequest) Validate() error {
|
||||
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
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v5.26.1
|
||||
// source: api/accountFiee/accountFiee.proto
|
||||
// - protoc v4.22.0--rc2
|
||||
// source: accountFiee.proto
|
||||
|
||||
package accountFiee
|
||||
|
||||
@ -68,8 +68,6 @@ type AccountFieeClient interface {
|
||||
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)
|
||||
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
|
||||
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)
|
||||
SendNationMsg func(ctx context.Context, in *SendNationMsgRequest) (*SendMsgStatusResponse, 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)
|
||||
CreateChatUser func(ctx context.Context, in *ChatUserData) (*CreateChatUserResp, 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)
|
||||
}
|
||||
|
||||
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) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -640,8 +624,6 @@ type AccountFieeServer interface {
|
||||
VerifySliderCaptcha(context.Context, *VerifySliderCaptchaRequest) (*VerifySliderCaptchaResponse, error)
|
||||
SendNationMsg(context.Context, *SendNationMsgRequest) (*SendMsgStatusResponse, error)
|
||||
VerifySliderStatus(context.Context, *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error)
|
||||
SendNationTemplateMsg(context.Context, *SendNationMsgRequest) (*SendMsgStatusResponse, error)
|
||||
CreateUserAndRealName(context.Context, *CreateUserAndRealNameRequest) (*CreateUserAndRealNameResponse, error)
|
||||
// submit info
|
||||
SaveSubmitInfo(context.Context, *SubmitInfoRequest) (*CommonResponse, error)
|
||||
// -----------------------------客服聊天系统--------------------------------
|
||||
@ -796,12 +778,6 @@ func (UnimplementedAccountFieeServer) SendNationMsg(context.Context, *SendNation
|
||||
func (UnimplementedAccountFieeServer) VerifySliderStatus(context.Context, *VerifySliderStatusRequest) (*VerifySliderStatusResponse, error) {
|
||||
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) {
|
||||
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)
|
||||
}
|
||||
|
||||
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) {
|
||||
in := new(SubmitInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3046,14 +2964,6 @@ var AccountFiee_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "VerifySliderStatus",
|
||||
Handler: _AccountFiee_VerifySliderStatus_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SendNationTemplateMsg",
|
||||
Handler: _AccountFiee_SendNationTemplateMsg_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateUserAndRealName",
|
||||
Handler: _AccountFiee_CreateUserAndRealName_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SaveSubmitInfo",
|
||||
Handler: _AccountFiee_SaveSubmitInfo_Handler,
|
||||
@ -3164,5 +3074,5 @@ var AccountFiee_ServiceDesc = grpc_go.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "api/accountFiee/accountFiee.proto",
|
||||
Metadata: "accountFiee.proto",
|
||||
}
|
||||
|
BIN
cmd/code/1.png
Before Width: | Height: | Size: 291 KiB |
BIN
cmd/code/10.png
Before Width: | Height: | Size: 228 KiB |
BIN
cmd/code/2.png
Before Width: | Height: | Size: 357 KiB |
BIN
cmd/code/3.png
Before Width: | Height: | Size: 377 KiB |
BIN
cmd/code/4.png
Before Width: | Height: | Size: 375 KiB |
BIN
cmd/code/5.png
Before Width: | Height: | Size: 386 KiB |
BIN
cmd/code/6.png
Before Width: | Height: | Size: 230 KiB |
BIN
cmd/code/7.png
Before Width: | Height: | Size: 306 KiB |
BIN
cmd/code/8.png
Before Width: | Height: | Size: 167 KiB |
BIN
cmd/code/9.png
Before Width: | Height: | Size: 307 KiB |
8
docs/env/dev/conf.ini
vendored
@ -11,10 +11,10 @@ Domain = "fontree.cn"
|
||||
|
||||
[mysql]
|
||||
Db = "mysql"
|
||||
DbHost = "172.16.100.99"
|
||||
DbPort = "9007"
|
||||
DbUser = "artuser"
|
||||
DbPassWord = "C250PflXIWv2SQm8"
|
||||
DbHost = "172.16.100.30"
|
||||
DbPort = "3306"
|
||||
DbUser = "root"
|
||||
DbPassWord = "IhQmhg8HZjDmU=Ove5PnA^D"
|
||||
DbName = "micro-account"
|
||||
|
||||
[redis]
|
||||
|
32
docs/env/prod/log.yaml
vendored
@ -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"
|
18
docs/env/prod/sdk.yaml
vendored
@ -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"
|
@ -3,12 +3,10 @@ package utils
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
@ -20,9 +18,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
ImgURL = "https://cdns.fontree.cn/fonchain-main/test/image/artwork/config/slidCode_%d.jpg"
|
||||
ImgPath = "./code/%d.jpg" //本地路径,暂不使用
|
||||
ImgPathPng = "./code/%d.png" //本地路径,暂不使用
|
||||
ImgURL = "https://cdns.fontree.cn/fonchain-main/test/image/artwork/config/slidCode_%d.jpg"
|
||||
ImgPath = "./code/%d.jpg" //本地路径,暂不使用
|
||||
)
|
||||
|
||||
// 生成指定范围内的随机数
|
||||
@ -32,96 +29,41 @@ func GetNonceByRange(start, end int) int {
|
||||
}
|
||||
|
||||
// 获取缓冲图片,可能是通过URL或本地路径
|
||||
func GetBufferedImage(place, canvasWidth, canvasHeight int) (draw.Image, error) {
|
||||
|
||||
startTime := time.Now()
|
||||
fmt.Println("")
|
||||
fmt.Println("")
|
||||
fmt.Println("")
|
||||
fmt.Println("1---")
|
||||
func GetBufferedImage(place int) (image.Image, error) {
|
||||
nonce := GetNonceByRange(1, 10)
|
||||
|
||||
fmt.Println("2", time.Now().Sub(startTime))
|
||||
var imgURL string
|
||||
|
||||
//place = 0 // 注意,这边的图片现在只使用url图片
|
||||
if place == 1 {
|
||||
place = 0 // 注意,这边的图片现在只使用url图片
|
||||
|
||||
fmt.Println("3-1", time.Now().Sub(startTime))
|
||||
if place == 0 {
|
||||
imgURL = fmt.Sprintf(ImgURL, nonce)
|
||||
resp, err := http.Get(imgURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Println("3-2", time.Now().Sub(startTime))
|
||||
defer resp.Body.Close()
|
||||
img, ff, err := image.Decode(resp.Body)
|
||||
fmt.Println("----", ff)
|
||||
img, _, err := image.Decode(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Println("3-3", time.Now().Sub(startTime))
|
||||
|
||||
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))
|
||||
return img, nil
|
||||
} else {
|
||||
file, err := os.Open(fmt.Sprintf(ImgPath, nonce))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
//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)
|
||||
img, _, err := image.Decode(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ss := ImageResize(img, canvasWidth, canvasHeight)
|
||||
canvasImage := ss.(*image.RGBA)
|
||||
|
||||
return canvasImage, nil
|
||||
return img, 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 {
|
||||
return resize.Resize(uint(width), uint(height), bufferedImage, resize.Bilinear)
|
||||
return resize.Resize(uint(width), uint(height), bufferedImage, resize.Lanczos3)
|
||||
}
|
||||
|
||||
// CutByTemplate 根据模板裁剪图像 // 生成圆角正方形的滑块图像
|
||||
@ -422,19 +364,6 @@ func ToBase64(img image.Image, format string) string {
|
||||
switch format {
|
||||
case "png":
|
||||
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())
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ const SIG_NO = 145031
|
||||
const SIG_NO_SELLER = 159789
|
||||
|
||||
func SendMsg(telNum string, project string) (string, error) {
|
||||
TMP := 277455
|
||||
|
||||
var sigNo uint
|
||||
sigNo = SIG_NO
|
||||
|
||||
@ -28,7 +28,7 @@ func SendMsg(telNum string, project string) (string, error) {
|
||||
|
||||
code := mobile.RandCode()
|
||||
//content := "验证码模板:尊敬的用户,您的验证码为$$,15分钟内有效,请勿泄露。"
|
||||
fmt.Println("发送短信请求参数:", telNum, TMP, sigNo, code)
|
||||
fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
|
||||
|
||||
/**
|
||||
TODO
|
||||
@ -40,14 +40,13 @@ func SendMsg(telNum string, project string) (string, error) {
|
||||
}
|
||||
*/
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
func SendMsgV2(telNum string, project string, tempSignNo uint) (string, error) {
|
||||
|
||||
TMP := 277455
|
||||
var sigNo uint
|
||||
sigNo = SIG_NO
|
||||
//if project == "seller" {
|
||||
@ -72,8 +71,9 @@ func SendMsgV2(telNum string, project string, tempSignNo uint) (string, error) {
|
||||
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)
|
||||
//return code, mobileTemplate.SendAlSms(telNum, mobile.Sign, mobile.AlTMP1, code)
|
||||
|
||||
|
@ -69,9 +69,6 @@ func (chatDao) UpdateChatRecord(data *model.ChatRecord) (err error) {
|
||||
if data.LocalStamp != 0 {
|
||||
thisData.LocalStamp = data.LocalStamp
|
||||
}
|
||||
if data.Role != 0 {
|
||||
thisData.Role = data.Role
|
||||
}
|
||||
|
||||
if err = model.DB.Updates(&thisData).Error; err != nil {
|
||||
return err
|
||||
@ -101,7 +98,7 @@ func (chatDao) GetChatRecordById(id int) (res model.ChatRecord, err error) {
|
||||
|
||||
// 批量查询ChatRecord
|
||||
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.SessionId != "" {
|
||||
@ -128,9 +125,6 @@ func (chatDao) GetChatRecordList(info *accountFiee.GetChatRecordListRequest) (re
|
||||
if info.Query.LocalStamp != 0 {
|
||||
dbQuery = dbQuery.Where("local_stamp = ?", info.Query.LocalStamp)
|
||||
}
|
||||
if info.Query.Role != 0 {
|
||||
dbQuery = dbQuery.Where("role = ?", info.Query.Role)
|
||||
}
|
||||
}
|
||||
if info.Where != "" {
|
||||
dbQuery = dbQuery.Where(info.Where)
|
||||
@ -141,9 +135,6 @@ func (chatDao) GetChatRecordList(info *accountFiee.GetChatRecordListRequest) (re
|
||||
//数据查询
|
||||
dbQuery.Count(&total)
|
||||
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 {
|
||||
//log.L().Error("GetChatRecordList Err", zap.Error(err))
|
||||
err = errors.New(m.DBError)
|
||||
@ -253,39 +244,28 @@ func (chatDao) GetChatMediaList(info *accountFiee.GetChatMediaListRequest) (resp
|
||||
|
||||
// 批量查询ChatMedia
|
||||
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 != "" {
|
||||
dbQuery = dbQuery.Where(req.Where)
|
||||
}
|
||||
if req.UserIdIn != nil {
|
||||
dbQuery = dbQuery.Where("id in (?)", req.UserIdIn)
|
||||
dbQuery = dbQuery.Where("user_id in (?)", req.UserIdIn)
|
||||
}
|
||||
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 != "" {
|
||||
dbQuery = dbQuery.Where(fmt.Sprintf("account like '%%%v%%'", req.Account))
|
||||
dbQuery = dbQuery.Where(fmt.Sprintf("account like '%%%v%%'", req.Name))
|
||||
}
|
||||
if req.RoleIn != nil {
|
||||
dbQuery = dbQuery.Where("role in (?)", req.RoleIn)
|
||||
}
|
||||
var data []model.ChatUser
|
||||
//数据查询
|
||||
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 {
|
||||
//log.L().Error("GetChatUserList Err", zap.Error(err))
|
||||
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
|
||||
}
|
||||
|
@ -56,9 +56,6 @@ func (chatAutoReplyRulerDao) UpdateChatAutoReplyRuler(data *model.ChatAutoReplyR
|
||||
if data.Status != 0 {
|
||||
thisData.Status = data.Status
|
||||
}
|
||||
if data.Response != "" {
|
||||
thisData.Response = data.Response
|
||||
}
|
||||
|
||||
if err = model.DB.Updates(&thisData).Error; err != nil {
|
||||
return err
|
||||
|
@ -120,11 +120,9 @@ func (AsChatLogic) GetChatRecordList(req *accountFiee.GetChatRecordListRequest)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
fmt.Println("GetChatRecordList len(data):", len(data))
|
||||
if err = copier.CopyWithOption(&resp.List, &data, utils.CopierProtoOptions); err != nil {
|
||||
return
|
||||
}
|
||||
fmt.Println("GetChatRecordList len(resp.List):", len(resp.List))
|
||||
return
|
||||
}
|
||||
func (AsChatLogic) RegisterWaiter(request *accountFiee.RegisterWaiterRequest) (resp *accountFiee.RegisterWaiterResp, err error) {
|
||||
|
@ -29,7 +29,6 @@ type ChatRecord struct {
|
||||
Medias []*ChatMedia `gorm:"many2many:chat_record_media;"`
|
||||
WaiterRead int32 `gorm:"column:waiter_read;default:2;comment:客服是否已读 1=已读 2=未读"` // (被任意客服读取过均为已读)
|
||||
LocalStamp int64 `gorm:"column:local_stamp;comment:用户端的消息唯一值,用于用户端的消息校验"`
|
||||
Role int32 `gorm:"column:role,comment:用户角色: 1=用户 2=客服 3=机器人"`
|
||||
}
|
||||
|
||||
func (c ChatRecord) TableName() string {
|
||||
|
@ -28,7 +28,7 @@ func LoadEnv(config MysqlConfig) {
|
||||
|
||||
//MySQL数据库
|
||||
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)
|
||||
//连接数据库
|
||||
|
@ -643,7 +643,6 @@ func (a *AccountFieeProvider) Info(ctx context.Context, in *account.InfoRequest)
|
||||
SubscriberNumber: user.SubscriberNumber,
|
||||
NickName: user.Nickname,
|
||||
TelNum: user.TelNum,
|
||||
TelAreaCode: user.TelAreaCode,
|
||||
}
|
||||
|
||||
return response, nil
|
||||
@ -655,9 +654,6 @@ func (a *AccountFieeProvider) UserList(ctx context.Context, in *account.UserList
|
||||
if in.Domain != "" {
|
||||
modelObj.Where("domain = ? ", in.Domain)
|
||||
}
|
||||
if len(in.Ids) != 0 {
|
||||
modelObj.Where("user.id in (?) ", in.Ids)
|
||||
}
|
||||
if 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 != "" {
|
||||
modelObj.Where("RealName.name like ? ", "%"+in.Name+"%")
|
||||
}
|
||||
if in.Nationality != "" {
|
||||
modelObj.Where("RealName.nationality like ? ", "%"+in.Nationality+"%")
|
||||
}
|
||||
if in.DocumentType != 0 {
|
||||
modelObj.Where("RealName.document_type = ? ", in.DocumentType)
|
||||
}
|
||||
@ -681,9 +674,6 @@ func (a *AccountFieeProvider) UserList(ctx context.Context, in *account.UserList
|
||||
if 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)
|
||||
if in.Page > 0 && in.PageSize > 0 {
|
||||
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
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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) {
|
||||
startTime := time.Now()
|
||||
realTime := time.Now()
|
||||
|
||||
captcha := &model.Captcha{
|
||||
CanvasWidth: int(in.CanvasWidth),
|
||||
@ -794,12 +755,6 @@ func (a *AccountFieeProvider) GenerateSliderCaptcha(_ context.Context, in *accou
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
fmt.Println("1-耗时", time.Now().Sub(startTime))
|
||||
startTime = time.Now()
|
||||
canvasWidth := captcha.CanvasWidth
|
||||
canvasHeight := captcha.CanvasHeight
|
||||
blockWidth := captcha.BlockWidth
|
||||
@ -807,66 +762,41 @@ func (a *AccountFieeProvider) GenerateSliderCaptcha(_ context.Context, in *accou
|
||||
//blockRadius := captcha.BlockRadius
|
||||
place := captcha.Place
|
||||
|
||||
canvasImage, _ := utils.GetBufferedImage(place, canvasWidth, canvasHeight)
|
||||
|
||||
fmt.Println("2-耗时", time.Now().Sub(startTime))
|
||||
startTime = time.Now()
|
||||
fmt.Println()
|
||||
|
||||
fmt.Println("3-耗时", time.Now().Sub(startTime))
|
||||
startTime = time.Now()
|
||||
img, _ := utils.GetBufferedImage(place)
|
||||
canvasImage := utils.ImageResize(img, canvasWidth, canvasHeight).(*image.RGBA)
|
||||
blockX := utils.GetNonceByRange(blockWidth, canvasWidth-blockWidth-10)
|
||||
|
||||
fmt.Println("4-耗时", time.Now().Sub(startTime))
|
||||
startTime = time.Now()
|
||||
|
||||
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))
|
||||
|
||||
fmt.Println("6-耗时", time.Now().Sub(startTime))
|
||||
startTime = time.Now()
|
||||
|
||||
utils.CutByTemplate(canvasImage, blockImage, blockWidth, blockHeight, blockX, blockY)
|
||||
fmt.Println("1---", 0)
|
||||
fmt.Println("2---", blockY)
|
||||
fmt.Println("2---X", blockX)
|
||||
|
||||
fmt.Println("6-耗时", time.Now().Sub(startTime))
|
||||
startTime = time.Now()
|
||||
fmt.Println("2---", blockX)
|
||||
|
||||
// 生成UUID
|
||||
nonceStr := fmt.Sprintf("%x", rand2.New(rand2.NewSource(time.Now().UnixNano())).Uint64())
|
||||
|
||||
fmt.Println("6-耗时", time.Now().Sub(startTime))
|
||||
startTime = time.Now()
|
||||
|
||||
// 保存X轴像素
|
||||
cache.RedisClient.Set("imageCode:"+nonceStr, blockX, 15*time.Minute)
|
||||
|
||||
resp := &account.GenerateSliderCaptchaResponse{
|
||||
NonceStr: nonceStr,
|
||||
CanvasSrc: utils.ToBase64(canvasImage, "jpeg"),
|
||||
CanvasSrc: utils.ToBase64(canvasImage, "png"),
|
||||
BlockSrc: utils.ToBase64(blockImage, "png"),
|
||||
BlockY: uint64(blockY),
|
||||
FaceY: 0,
|
||||
//BlockX: uint64(blockX),
|
||||
}
|
||||
fmt.Println("7耗时", time.Now().Sub(startTime))
|
||||
fmt.Println("总耗时", time.Now().Sub(realTime))
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (a *AccountFieeProvider) VerifySliderCaptcha(_ context.Context, in *account.VerifySliderCaptchaRequest) (*account.VerifySliderCaptchaResponse, error) {
|
||||
|
||||
resp := &account.VerifySliderCaptchaResponse{}
|
||||
|
||||
// 检查图像验证码
|
||||
key := "imageCode:" + in.NonceStr
|
||||
text, err := cache.RedisClient.Get(key).Result()
|
||||
text, err := cache.RedisClient.Get("imageCode:" + in.NonceStr).Result()
|
||||
if err == redis.Nil {
|
||||
err = errors.New("验证码已失效")
|
||||
return resp, err
|
||||
@ -884,20 +814,6 @@ func (a *AccountFieeProvider) VerifySliderCaptcha(_ context.Context, in *account
|
||||
if err != nil {
|
||||
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
|
||||
|
||||
@ -941,12 +857,7 @@ func (a *AccountFieeProvider) UserByTel(_ context.Context, in *account.UserByTel
|
||||
response := &account.UserInfoResponse{}
|
||||
|
||||
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.Error() == "record not found" { //不存在
|
||||
@ -1233,57 +1144,3 @@ func (a *AccountFieeProvider) VerifySliderStatus(_ context.Context, in *account.
|
||||
}
|
||||
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
|
||||
}
|
||||
|