Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
0bbb9e23b1 | |||
04d062a779 | |||
8e632c0b8e | |||
70da033bee | |||
0a8a4c8b4e | |||
953548b581 | |||
f8d923197c | |||
cbc6a53731 | |||
5fbfaa77fc | |||
8b867003be | |||
d0e90e0628 | |||
b515257936 | |||
6ba13ddb13 | |||
8fe0d6ab7a | |||
5eca4cf59a | |||
63f7029192 | |||
f7b8558dbc | |||
cb23383843 | |||
bc5fd3014b | |||
d6ff42f3ce | |||
572a1e13b5 | |||
534ecc32f9 | |||
bc657da66f | |||
b2eceb73f1 | |||
e88797bdaf | |||
8521bffbdc | |||
c4f42fa251 | |||
e9d96a7cb3 | |||
17ac03cef9 | |||
7984f258a6 | |||
db44510f0a | |||
762291e780 | |||
9769c22b48 | |||
4503494fe8 | |||
4b7e529b7c | |||
b244f85a57 | |||
f41697bcf0 | |||
503ff1af90 |
19
DockerfileSlim
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
@ -62,6 +64,10 @@ 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);
|
||||||
@ -184,6 +190,9 @@ 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;
|
||||||
@ -204,6 +213,7 @@ 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;
|
||||||
@ -866,7 +876,7 @@ enum MsgType{
|
|||||||
ImageMsgType = 2 ;//图片
|
ImageMsgType = 2 ;//图片
|
||||||
AudioMsgType = 3 ;//音频
|
AudioMsgType = 3 ;//音频
|
||||||
VideoMsgType = 4 ;//视频
|
VideoMsgType = 4 ;//视频
|
||||||
FileType = 5 ;//文件
|
CardType = 5 ;//卡片
|
||||||
}
|
}
|
||||||
message ChatRecordData{
|
message ChatRecordData{
|
||||||
int64 ID=1;
|
int64 ID=1;
|
||||||
@ -883,6 +893,7 @@ 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;
|
||||||
@ -972,7 +983,7 @@ message ChatUser2{
|
|||||||
string name=2;
|
string name=2;
|
||||||
string avatar=3;
|
string avatar=3;
|
||||||
string origin=4;
|
string origin=4;
|
||||||
string originId=5;
|
int64 originId=5;
|
||||||
}
|
}
|
||||||
message GetChatUserListResp2{
|
message GetChatUserListResp2{
|
||||||
repeated ChatUser2 list=1;
|
repeated ChatUser2 list=1;
|
||||||
@ -1023,7 +1034,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=客服
|
int32 role = 7; //聊天角色 1=用户 2=客服 3=机器人
|
||||||
string origin = 8; //数据来源
|
string origin = 8; //数据来源
|
||||||
int64 originId = 9; //数据来源对应的用户ID
|
int64 originId = 9; //数据来源对应的用户ID
|
||||||
string avatar = 10; //头像
|
string avatar = 10; //头像
|
||||||
@ -1054,3 +1065,24 @@ 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;
|
||||||
|
}
|
@ -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"
|
||||||
regexp "regexp"
|
|
||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@ -525,3 +525,181 @@ 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
|
||||||
|
}
|
||||||
|
@ -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 v4.22.0--rc2
|
// - protoc v5.26.1
|
||||||
// source: accountFiee.proto
|
// source: api/accountFiee/accountFiee.proto
|
||||||
|
|
||||||
package accountFiee
|
package accountFiee
|
||||||
|
|
||||||
@ -68,6 +68,8 @@ 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)
|
||||||
// -----------------------------客服聊天系统--------------------------------
|
// -----------------------------客服聊天系统--------------------------------
|
||||||
@ -143,6 +145,8 @@ 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)
|
||||||
@ -418,6 +422,18 @@ 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)
|
||||||
@ -624,6 +640,8 @@ 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)
|
||||||
// -----------------------------客服聊天系统--------------------------------
|
// -----------------------------客服聊天系统--------------------------------
|
||||||
@ -778,6 +796,12 @@ 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")
|
||||||
}
|
}
|
||||||
@ -2018,6 +2042,64 @@ 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 {
|
||||||
@ -2964,6 +3046,14 @@ 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,
|
||||||
@ -3074,5 +3164,5 @@ var AccountFiee_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc_go.StreamDesc{},
|
Streams: []grpc_go.StreamDesc{},
|
||||||
Metadata: "accountFiee.proto",
|
Metadata: "api/accountFiee/accountFiee.proto",
|
||||||
}
|
}
|
||||||
|
BIN
cmd/code/1.png
Normal file
After Width: | Height: | Size: 291 KiB |
BIN
cmd/code/10.png
Normal file
After Width: | Height: | Size: 228 KiB |
BIN
cmd/code/2.png
Normal file
After Width: | Height: | Size: 357 KiB |
BIN
cmd/code/3.png
Normal file
After Width: | Height: | Size: 377 KiB |
BIN
cmd/code/4.png
Normal file
After Width: | Height: | Size: 375 KiB |
BIN
cmd/code/5.png
Normal file
After Width: | Height: | Size: 386 KiB |
BIN
cmd/code/6.png
Normal file
After Width: | Height: | Size: 230 KiB |
BIN
cmd/code/7.png
Normal file
After Width: | Height: | Size: 306 KiB |
BIN
cmd/code/8.png
Normal file
After Width: | Height: | Size: 167 KiB |
BIN
cmd/code/9.png
Normal file
After Width: | Height: | Size: 307 KiB |
8
docs/env/dev/conf.ini
vendored
@ -11,10 +11,10 @@ Domain = "fontree.cn"
|
|||||||
|
|
||||||
[mysql]
|
[mysql]
|
||||||
Db = "mysql"
|
Db = "mysql"
|
||||||
DbHost = "172.16.100.30"
|
DbHost = "172.16.100.99"
|
||||||
DbPort = "3306"
|
DbPort = "9007"
|
||||||
DbUser = "root"
|
DbUser = "artuser"
|
||||||
DbPassWord = "IhQmhg8HZjDmU=Ove5PnA^D"
|
DbPassWord = "C250PflXIWv2SQm8"
|
||||||
DbName = "micro-account"
|
DbName = "micro-account"
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
|
32
docs/env/prod/log.yaml
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
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
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# endorseService Info
|
||||||
|
# testNet addrs
|
||||||
|
# endorseServiceHost: "120.48.24.223:37101"
|
||||||
|
endorseServiceHost: "127.0.0.1:37101"
|
||||||
|
complianceCheck:
|
||||||
|
# 是否需要进行合规性背书
|
||||||
|
isNeedComplianceCheck: false
|
||||||
|
# 是否需要支付合规性背书费用
|
||||||
|
isNeedComplianceCheckFee: false
|
||||||
|
# 合规性背书费用
|
||||||
|
complianceCheckEndorseServiceFee: 400
|
||||||
|
# 支付合规性背书费用的收款地址
|
||||||
|
complianceCheckEndorseServiceFeeAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
|
||||||
|
# 如果通过合规性检查,签发认证签名的地址
|
||||||
|
complianceCheckEndorseServiceAddr: WwLgfAatHyKx2mCJruRaML4oVf7Chzp42
|
||||||
|
#创建平行链所需要的最低费用
|
||||||
|
minNewChainAmount: "100"
|
||||||
|
crypto: "xchain"
|
@ -3,10 +3,12 @@ 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,6 +22,7 @@ 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" //本地路径,暂不使用
|
||||||
)
|
)
|
||||||
|
|
||||||
// 生成指定范围内的随机数
|
// 生成指定范围内的随机数
|
||||||
@ -29,41 +32,96 @@ func GetNonceByRange(start, end int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取缓冲图片,可能是通过URL或本地路径
|
// 获取缓冲图片,可能是通过URL或本地路径
|
||||||
func GetBufferedImage(place int) (image.Image, error) {
|
func GetBufferedImage(place, canvasWidth, canvasHeight int) (draw.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 {
|
||||||
|
|
||||||
if place == 0 {
|
fmt.Println("3-1", time.Now().Sub(startTime))
|
||||||
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, _, err := image.Decode(resp.Body)
|
img, ff, err := image.Decode(resp.Body)
|
||||||
|
fmt.Println("----", ff)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return img, nil
|
|
||||||
} else {
|
fmt.Println("3-3", time.Now().Sub(startTime))
|
||||||
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.Lanczos3)
|
return resize.Resize(uint(width), uint(height), bufferedImage, resize.Bilinear)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CutByTemplate 根据模板裁剪图像 // 生成圆角正方形的滑块图像
|
// CutByTemplate 根据模板裁剪图像 // 生成圆角正方形的滑块图像
|
||||||
@ -364,6 +422,19 @@ 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())
|
||||||
}
|
}
|
||||||
|
@ -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, mobile.TMP1, sigNo, code)
|
fmt.Println("发送短信请求参数:", telNum, TMP, sigNo, code)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
TODO
|
TODO
|
||||||
@ -40,13 +40,14 @@ func SendMsg(telNum string, project string) (string, error) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fmt.Println("发送短信请求参数:", telNum, mobile.TMP1, sigNo, code)
|
fmt.Println("发送短信请求参数:", telNum, TMP, sigNo, code)
|
||||||
return code, mobileTemplate.Send(telNum, mobile.TMP1, sigNo, code)
|
return code, mobileTemplate.Send(telNum, uint(TMP), 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" {
|
||||||
@ -71,9 +72,8 @@ func SendMsgV2(telNum string, project string, tempSignNo uint) (string, error) {
|
|||||||
return code, nil
|
return code, nil
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
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)
|
|
||||||
//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)
|
||||||
|
|
||||||
|
@ -69,6 +69,9 @@ 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
|
||||||
@ -98,7 +101,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")
|
var dbQuery = model.DB.Model(&model.ChatRecord{}).Preload("Medias").Debug()
|
||||||
if info.Query != nil {
|
if info.Query != nil {
|
||||||
|
|
||||||
if info.Query.SessionId != "" {
|
if info.Query.SessionId != "" {
|
||||||
@ -125,6 +128,9 @@ 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)
|
||||||
@ -135,6 +141,9 @@ 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)
|
||||||
@ -244,28 +253,39 @@ 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.User{})
|
var dbQuery = model.DB.Model(&model.ChatUser{}).Debug()
|
||||||
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("user_id in (?)", req.UserIdIn)
|
dbQuery = dbQuery.Where("id in (?)", req.UserIdIn)
|
||||||
}
|
}
|
||||||
if req.Name != "" {
|
if req.Name != "" {
|
||||||
dbQuery = dbQuery.Where(fmt.Sprintf("name like '%%%v%%'", req.Name))
|
dbQuery = dbQuery.Where(fmt.Sprintf("nick_name like '%%%v%%'", req.Name))
|
||||||
}
|
}
|
||||||
if req.Account != "" {
|
if req.Account != "" {
|
||||||
dbQuery = dbQuery.Where(fmt.Sprintf("account like '%%%v%%'", req.Name))
|
dbQuery = dbQuery.Where(fmt.Sprintf("account like '%%%v%%'", req.Account))
|
||||||
}
|
}
|
||||||
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(&resp).Error
|
err = dbQuery.Scopes(db.Pagination(req.Page, req.PageSize)).Find(&data).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
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,9 @@ 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
|
||||||
|
@ -120,9 +120,11 @@ 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) {
|
||||||
|
@ -29,6 +29,7 @@ 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 {
|
||||||
|
@ -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=utf8&parseTime=true&loc=Local"}, "")
|
config.DbPort, ")/", config.DbName, "?charset=utf8mb4&parseTime=true&loc=Local"}, "")
|
||||||
|
|
||||||
fmt.Println(path)
|
fmt.Println(path)
|
||||||
//连接数据库
|
//连接数据库
|
||||||
|
@ -643,6 +643,7 @@ 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
|
||||||
@ -654,6 +655,9 @@ 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+"%")
|
||||||
}
|
}
|
||||||
@ -665,6 +669,9 @@ 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)
|
||||||
}
|
}
|
||||||
@ -674,6 +681,9 @@ 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))
|
||||||
@ -690,6 +700,33 @@ 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{}
|
||||||
@ -742,6 +779,8 @@ 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),
|
||||||
@ -755,6 +794,12 @@ 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
|
||||||
@ -762,41 +807,66 @@ func (a *AccountFieeProvider) GenerateSliderCaptcha(_ context.Context, in *accou
|
|||||||
//blockRadius := captcha.BlockRadius
|
//blockRadius := captcha.BlockRadius
|
||||||
place := captcha.Place
|
place := captcha.Place
|
||||||
|
|
||||||
img, _ := utils.GetBufferedImage(place)
|
canvasImage, _ := utils.GetBufferedImage(place, canvasWidth, canvasHeight)
|
||||||
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---", blockX)
|
fmt.Println("2---X", 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, "png"),
|
CanvasSrc: utils.ToBase64(canvasImage, "jpeg"),
|
||||||
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{}
|
||||||
|
|
||||||
// 检查图像验证码
|
// 检查图像验证码
|
||||||
text, err := cache.RedisClient.Get("imageCode:" + in.NonceStr).Result()
|
key := "imageCode:" + in.NonceStr
|
||||||
|
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
|
||||||
@ -814,6 +884,20 @@ 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
|
||||||
|
|
||||||
@ -857,7 +941,12 @@ 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" { //不存在
|
||||||
@ -1144,3 +1233,57 @@ 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
|
||||||
|
}
|
||||||
|