Compare commits

..

No commits in common. "main" and "feat-zjy-issue-013" have entirely different histories.

14 changed files with 5425 additions and 3091 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
syntax = "proto3"; syntax = "proto3";
package accountFiee; package accountFiee;
import "api/accountFiee/validator.proto"; import "github.com/mwitkow/go-proto-validators@v0.3.2/validator.proto";
option go_package = "./;accountFiee"; option go_package = "./;accountFiee";
//protoc -I . -I C:\Users\lenovo\go\src --go_out=. --go-triple_out=. ./accountFiee.proto //protoc -I . -I C:\Users\lenovo\go\src --go_out=. --go-triple_out=. ./accountFiee.proto
@ -43,7 +43,6 @@ service AccountFiee {
rpc DecryptJwt (DecryptJwtRequest) returns (DecryptJwtResponse) {}// rpc DecryptJwt (DecryptJwtRequest) returns (DecryptJwtResponse) {}//
rpc Info (InfoRequest) returns (UserInfoResponse) {} rpc Info (InfoRequest) returns (UserInfoResponse) {}
rpc JobNumGetInfo (JobNumGetInfoRequest) returns (InfoResponse) {} rpc JobNumGetInfo (JobNumGetInfoRequest) returns (InfoResponse) {}
rpc SubNumGetInfo (SubNumGetInfoRequest) returns (UserInfoResponse) {}
rpc List (ListRequest) returns (ListResponse) {} rpc List (ListRequest) returns (ListResponse) {}
rpc RandList (ListRequest) returns (ListResponse) {} rpc RandList (ListRequest) returns (ListResponse) {}
rpc ListByIDs (ListByIDsRequest) returns (ListResponse) {} rpc ListByIDs (ListByIDsRequest) returns (ListResponse) {}
@ -180,9 +179,6 @@ message UserListInfo{
string language = 18; string language = 18;
string subscriberNumber = 19; string subscriberNumber = 19;
string nickName = 20; string nickName = 20;
string idNumber = 21;
string dateOfBirth = 22;
string age = 23;
} }
message UserListRequest{ message UserListRequest{
string domain = 1; string domain = 1;
@ -197,7 +193,6 @@ message UserListRequest{
string blurNameTel = 10; string blurNameTel = 10;
repeated int64 ids = 11; repeated int64 ids = 11;
string nationality = 12; string nationality = 12;
string nameAndNumber = 13;
} }
message UserInfoResponse{ message UserInfoResponse{
uint64 id = 1; uint64 id = 1;
@ -219,8 +214,6 @@ message UserInfoResponse{
string nickName = 17; string nickName = 17;
string telNum = 18; string telNum = 18;
string telAreaCode = 19; string telAreaCode = 19;
string idNumber = 20;
string dateOfBirth = 21;
} }
message RealNameResponse{ message RealNameResponse{
uint64 id = 1; uint64 id = 1;
@ -237,8 +230,6 @@ message RealNameRequest{
string placeOfResidence = 8; string placeOfResidence = 8;
string groupPhoto = 9; string groupPhoto = 9;
string attachment = 10; string attachment = 10;
string idNumber = 11;
string dateOfBirth = 12;
} }
message RegisterResponse{ message RegisterResponse{
uint64 ID = 1; uint64 ID = 1;
@ -749,10 +740,6 @@ message JobNumGetInfoRequest{
string jobNum = 1; string jobNum = 1;
string domain = 2; string domain = 2;
} }
message SubNumGetInfoRequest{
string subNum = 1;
string domain = 2;
}
message CreateClockDeviceRequest{ message CreateClockDeviceRequest{
string deviceNum =1; string deviceNum =1;
string deviceName =2; string deviceName =2;

View File

@ -5,11 +5,11 @@ package accountFiee
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators" _ "github.com/mwitkow/go-proto-validators"
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.
@ -431,9 +431,6 @@ func (this *PositionUser) Validate() error {
func (this *JobNumGetInfoRequest) Validate() error { func (this *JobNumGetInfoRequest) Validate() error {
return nil return nil
} }
func (this *SubNumGetInfoRequest) Validate() error {
return nil
}
func (this *CreateClockDeviceRequest) Validate() error { func (this *CreateClockDeviceRequest) Validate() error {
return nil return nil
} }

View File

@ -1,7 +1,7 @@
// 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.5 // - protoc-gen-go-triple v1.0.8
// - protoc v6.32.0 // - protoc v5.26.1
// source: api/accountFiee/accountFiee.proto // source: api/accountFiee/accountFiee.proto
package accountFiee package accountFiee
@ -47,7 +47,6 @@ type AccountFieeClient interface {
DecryptJwt(ctx context.Context, in *DecryptJwtRequest, opts ...grpc_go.CallOption) (*DecryptJwtResponse, common.ErrorWithAttachment) DecryptJwt(ctx context.Context, in *DecryptJwtRequest, opts ...grpc_go.CallOption) (*DecryptJwtResponse, common.ErrorWithAttachment)
Info(ctx context.Context, in *InfoRequest, opts ...grpc_go.CallOption) (*UserInfoResponse, common.ErrorWithAttachment) Info(ctx context.Context, in *InfoRequest, opts ...grpc_go.CallOption) (*UserInfoResponse, common.ErrorWithAttachment)
JobNumGetInfo(ctx context.Context, in *JobNumGetInfoRequest, opts ...grpc_go.CallOption) (*InfoResponse, common.ErrorWithAttachment) JobNumGetInfo(ctx context.Context, in *JobNumGetInfoRequest, opts ...grpc_go.CallOption) (*InfoResponse, common.ErrorWithAttachment)
SubNumGetInfo(ctx context.Context, in *SubNumGetInfoRequest, opts ...grpc_go.CallOption) (*UserInfoResponse, common.ErrorWithAttachment)
List(ctx context.Context, in *ListRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment) List(ctx context.Context, in *ListRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment)
RandList(ctx context.Context, in *ListRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment) RandList(ctx context.Context, in *ListRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment)
ListByIDs(ctx context.Context, in *ListByIDsRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment) ListByIDs(ctx context.Context, in *ListByIDsRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment)
@ -125,7 +124,6 @@ type AccountFieeClientImpl struct {
DecryptJwt func(ctx context.Context, in *DecryptJwtRequest) (*DecryptJwtResponse, error) DecryptJwt func(ctx context.Context, in *DecryptJwtRequest) (*DecryptJwtResponse, error)
Info func(ctx context.Context, in *InfoRequest) (*UserInfoResponse, error) Info func(ctx context.Context, in *InfoRequest) (*UserInfoResponse, error)
JobNumGetInfo func(ctx context.Context, in *JobNumGetInfoRequest) (*InfoResponse, error) JobNumGetInfo func(ctx context.Context, in *JobNumGetInfoRequest) (*InfoResponse, error)
SubNumGetInfo func(ctx context.Context, in *SubNumGetInfoRequest) (*UserInfoResponse, error)
List func(ctx context.Context, in *ListRequest) (*ListResponse, error) List func(ctx context.Context, in *ListRequest) (*ListResponse, error)
RandList func(ctx context.Context, in *ListRequest) (*ListResponse, error) RandList func(ctx context.Context, in *ListRequest) (*ListResponse, error)
ListByIDs func(ctx context.Context, in *ListByIDsRequest) (*ListResponse, error) ListByIDs func(ctx context.Context, in *ListByIDsRequest) (*ListResponse, error)
@ -298,12 +296,6 @@ func (c *accountFieeClient) JobNumGetInfo(ctx context.Context, in *JobNumGetInfo
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/JobNumGetInfo", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/JobNumGetInfo", in, out)
} }
func (c *accountFieeClient) SubNumGetInfo(ctx context.Context, in *SubNumGetInfoRequest, opts ...grpc_go.CallOption) (*UserInfoResponse, common.ErrorWithAttachment) {
out := new(UserInfoResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SubNumGetInfo", in, out)
}
func (c *accountFieeClient) List(ctx context.Context, in *ListRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment) { func (c *accountFieeClient) List(ctx context.Context, in *ListRequest, opts ...grpc_go.CallOption) (*ListResponse, common.ErrorWithAttachment) {
out := new(ListResponse) out := new(ListResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -627,7 +619,6 @@ type AccountFieeServer interface {
DecryptJwt(context.Context, *DecryptJwtRequest) (*DecryptJwtResponse, error) DecryptJwt(context.Context, *DecryptJwtRequest) (*DecryptJwtResponse, error)
Info(context.Context, *InfoRequest) (*UserInfoResponse, error) Info(context.Context, *InfoRequest) (*UserInfoResponse, error)
JobNumGetInfo(context.Context, *JobNumGetInfoRequest) (*InfoResponse, error) JobNumGetInfo(context.Context, *JobNumGetInfoRequest) (*InfoResponse, error)
SubNumGetInfo(context.Context, *SubNumGetInfoRequest) (*UserInfoResponse, error)
List(context.Context, *ListRequest) (*ListResponse, error) List(context.Context, *ListRequest) (*ListResponse, error)
RandList(context.Context, *ListRequest) (*ListResponse, error) RandList(context.Context, *ListRequest) (*ListResponse, error)
ListByIDs(context.Context, *ListByIDsRequest) (*ListResponse, error) ListByIDs(context.Context, *ListByIDsRequest) (*ListResponse, error)
@ -742,9 +733,6 @@ func (UnimplementedAccountFieeServer) Info(context.Context, *InfoRequest) (*User
func (UnimplementedAccountFieeServer) JobNumGetInfo(context.Context, *JobNumGetInfoRequest) (*InfoResponse, error) { func (UnimplementedAccountFieeServer) JobNumGetInfo(context.Context, *JobNumGetInfoRequest) (*InfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method JobNumGetInfo not implemented") return nil, status.Errorf(codes.Unimplemented, "method JobNumGetInfo not implemented")
} }
func (UnimplementedAccountFieeServer) SubNumGetInfo(context.Context, *SubNumGetInfoRequest) (*UserInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SubNumGetInfo not implemented")
}
func (UnimplementedAccountFieeServer) List(context.Context, *ListRequest) (*ListResponse, error) { func (UnimplementedAccountFieeServer) List(context.Context, *ListRequest) (*ListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented") return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
} }
@ -1445,35 +1433,6 @@ func _AccountFiee_JobNumGetInfo_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _AccountFiee_SubNumGetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SubNumGetInfoRequest)
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("SubNumGetInfo", 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_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _AccountFiee_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRequest) in := new(ListRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -3003,10 +2962,6 @@ var AccountFiee_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "JobNumGetInfo", MethodName: "JobNumGetInfo",
Handler: _AccountFiee_JobNumGetInfo_Handler, Handler: _AccountFiee_JobNumGetInfo_Handler,
}, },
{
MethodName: "SubNumGetInfo",
Handler: _AccountFiee_SubNumGetInfo_Handler,
},
{ {
MethodName: "List", MethodName: "List",
Handler: _AccountFiee_List_Handler, Handler: _AccountFiee_List_Handler,

View File

@ -1,80 +0,0 @@
// Copyright 2016 Michal Witkowski. All Rights Reserved.
// See LICENSE for licensing terms.
// Protocol Buffers extensions for defining auto-generateable validators for messages.
// TODO(mwitkow): Add example.
syntax = "proto2";
package validator;
import "google/protobuf/descriptor.proto";
option go_package = "github.com/mwitkow/go-proto-validators;validator";
// TODO(mwitkow): Email protobuf-global-extension-registry@google.com to get an extension ID.
extend google.protobuf.FieldOptions {
optional FieldValidator field = 65020;
}
extend google.protobuf.OneofOptions {
optional OneofValidator oneof = 65021;
}
message FieldValidator {
// Uses a Golang RE2-syntax regex to match the field contents.
optional string regex = 1;
// Field value of integer strictly greater than this value.
optional int64 int_gt = 2;
// Field value of integer strictly smaller than this value.
optional int64 int_lt = 3;
// Used for nested message types, requires that the message type exists.
optional bool msg_exists = 4;
// Human error specifies a user-customizable error that is visible to the user.
optional string human_error = 5;
// Field value of double strictly greater than this value.
// Note that this value can only take on a valid floating point
// value. Use together with float_epsilon if you need something more specific.
optional double float_gt = 6;
// Field value of double strictly smaller than this value.
// Note that this value can only take on a valid floating point
// value. Use together with float_epsilon if you need something more specific.
optional double float_lt = 7;
// Field value of double describing the epsilon within which
// any comparison should be considered to be true. For example,
// when using float_gt = 0.35, using a float_epsilon of 0.05
// would mean that any value above 0.30 is acceptable. It can be
// thought of as a {float_value_condition} +- {float_epsilon}.
// If unset, no correction for floating point inaccuracies in
// comparisons will be attempted.
optional double float_epsilon = 8;
// Floating-point value compared to which the field content should be greater or equal.
optional double float_gte = 9;
// Floating-point value compared to which the field content should be smaller or equal.
optional double float_lte = 10;
// Used for string fields, requires the string to be not empty (i.e different from "").
optional bool string_not_empty = 11;
// Repeated field with at least this number of elements.
optional int64 repeated_count_min = 12;
// Repeated field with at most this number of elements.
optional int64 repeated_count_max = 13;
// Field value of length greater than this value.
optional int64 length_gt = 14;
// Field value of length smaller than this value.
optional int64 length_lt = 15;
// Field value of length strictly equal to this value.
optional int64 length_eq = 16;
// Requires that the value is in the enum.
optional bool is_in_enum = 17;
// Ensures that a string value is in UUID format.
// uuid_ver specifies the valid UUID versions. Valid values are: 0-5.
// If uuid_ver is 0 all UUID versions are accepted.
optional int32 uuid_ver = 18;
}
message OneofValidator {
// Require that one of the oneof fields is set.
optional bool required = 1;
}

View File

@ -1 +1 @@
ls api/accountFiee/*.pb.go | xargs -n1 -IX bash -c 'sed s/,omitempty// X > X.tmp && mv X{.tmp,}'; ls api/account/*.pb.go | xargs -n1 -IX bash -c 'sed s/,omitempty// X > X.tmp && mv X{.tmp,}';

View File

@ -11,15 +11,15 @@ Domain = "fontree.cn"
[mysql] [mysql]
Db = "mysql" Db = "mysql"
DbHost = "svc-fontree-mysql-service-artist" DbHost = "172.16.100.99"
DbPort = "3306" DbPort = "9007"
DbUser = "artuser" DbUser = "artuser"
DbPassWord = "C250PflXIWv2SQm8" DbPassWord = "C250PflXIWv2SQm8"
DbName = "micro-account" DbName = "micro-account"
[redis] [redis]
RedisDB = "2" RedisDB = "2"
RedisAddr = "svc-fontree-redis-service:6379" RedisAddr = "172.16.100.114:6379"
RedisPW = "kP6tW4tS3qB2dW4aE6uI5cX2" RedisPW = "kP6tW4tS3qB2dW4aE6uI5cX2"
RedisDBNAme = "2" RedisDBNAme = "2"

View File

@ -2,7 +2,7 @@ dubbo:
registries: registries:
demoZK: demoZK:
protocol: zookeeper protocol: zookeeper
address: zookeeper:2181 address: 172.16.100.93:2181
protocols: protocols:
triple: triple:
name: tri name: tri

4
go.mod
View File

@ -1,6 +1,6 @@
module github.com/fonchain_enterprise/micro-account module github.com/fonchain_enterprise/micro-account
go 1.24.6 go 1.18
replace ( replace (
github.com/fonchain_enterprise/utils/aes => ../utils/aes github.com/fonchain_enterprise/utils/aes => ../utils/aes
@ -29,7 +29,6 @@ require (
github.com/go-redis/redis v6.15.9+incompatible github.com/go-redis/redis v6.15.9+incompatible
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
github.com/jinzhu/copier v0.3.5
github.com/mozillazg/go-pinyin v0.20.0 github.com/mozillazg/go-pinyin v0.20.0
github.com/mwitkow/go-proto-validators v0.3.2 github.com/mwitkow/go-proto-validators v0.3.2
github.com/nacos-group/nacos-sdk-go v1.1.1 github.com/nacos-group/nacos-sdk-go v1.1.1
@ -128,6 +127,7 @@ require (
github.com/ipfs/go-ipfs-addr v0.0.1 // indirect github.com/ipfs/go-ipfs-addr v0.0.1 // indirect
github.com/ipfs/go-log v1.0.4 // indirect github.com/ipfs/go-log v1.0.4 // indirect
github.com/ipfs/go-log/v2 v2.1.1 // indirect github.com/ipfs/go-log/v2 v2.1.1 // indirect
github.com/jinzhu/copier v0.3.5 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect

View File

@ -35,7 +35,6 @@ const (
ACCOUNT_EXIST = "账号已存在" ACCOUNT_EXIST = "账号已存在"
JOB_NUMBER_EXIST = "工号已存在" JOB_NUMBER_EXIST = "工号已存在"
Not_Found = "没有找到数据" Not_Found = "没有找到数据"
Not_Found_Artist = "没有找到此艺人"
Not_Person_Verify = "您未进行实名认证" Not_Person_Verify = "您未进行实名认证"
Forbidden_Ip = "网络地址被禁用" Forbidden_Ip = "网络地址被禁用"
Mobile_Sended = "已经发送过,验证码尚可用" Mobile_Sended = "已经发送过,验证码尚可用"

View File

@ -29,8 +29,6 @@ func migration() {
AddColumn(&User{}, "nickname") AddColumn(&User{}, "nickname")
AddColumn(&User{}, "language") AddColumn(&User{}, "language")
AddColumn(&User{}, "subscriber_number") AddColumn(&User{}, "subscriber_number")
AddColumn(&RealName{}, "id_number")
AddColumn(&RealName{}, "date_of_birth")
} }
// 数据迁移 // 数据迁移

View File

@ -1,9 +1,8 @@
package model package model
import ( import (
"time"
"gorm.io/plugin/soft_delete" "gorm.io/plugin/soft_delete"
"time"
) )
// RealName 实名认证模型 // RealName 实名认证模型
@ -21,6 +20,4 @@ type RealName struct {
PlaceOfResidence string `gorm:"column:place_of_residence;comment:居住地" json:"placeOfResidence"` PlaceOfResidence string `gorm:"column:place_of_residence;comment:居住地" json:"placeOfResidence"`
GroupPhoto string `gorm:"column:group_photo;comment:证件合影" json:"groupPhoto"` GroupPhoto string `gorm:"column:group_photo;comment:证件合影" json:"groupPhoto"`
Attachment string `gorm:"column:attachment;comment:附件" json:"attachment"` Attachment string `gorm:"column:attachment;comment:附件" json:"attachment"`
IdNumber string `gorm:"column:id_number;comment:证件号" json:"idNumber"`
DateOfBirth string `gorm:"column:date_of_birth;comment:出生日期" json:"dateOfBirth"`
} }

View File

@ -1,9 +1,6 @@
package serializer package serializer
import ( import (
"strconv"
"time"
account "github.com/fonchain_enterprise/micro-account/api/accountFiee" account "github.com/fonchain_enterprise/micro-account/api/accountFiee"
"github.com/fonchain_enterprise/micro-account/pkg/common/utils" "github.com/fonchain_enterprise/micro-account/pkg/common/utils"
"github.com/fonchain_enterprise/micro-account/pkg/model" "github.com/fonchain_enterprise/micro-account/pkg/model"
@ -71,7 +68,6 @@ func BuildUserList(user []*model.User) []*account.UserListInfo {
return []*account.UserListInfo{} return []*account.UserListInfo{}
} }
var userList []*account.UserListInfo var userList []*account.UserListInfo
currentYear := time.Now().Year()
for _, i := range user { for _, i := range user {
realName := i.RealName realName := i.RealName
if realName == nil { if realName == nil {
@ -85,8 +81,6 @@ func BuildUserList(user []*model.User) []*account.UserListInfo {
PlaceOfResidence: "", PlaceOfResidence: "",
GroupPhoto: "", GroupPhoto: "",
Attachment: "", Attachment: "",
IdNumber: "",
DateOfBirth: "",
} }
} }
userList = append(userList, &account.UserListInfo{ userList = append(userList, &account.UserListInfo{
@ -110,41 +104,10 @@ func BuildUserList(user []*model.User) []*account.UserListInfo {
Language: i.Language, Language: i.Language,
SubscriberNumber: i.SubscriberNumber, SubscriberNumber: i.SubscriberNumber,
NickName: i.Nickname, NickName: i.Nickname,
IdNumber: realName.IdNumber,
DateOfBirth: realName.DateOfBirth,
Age: getAgeString(realName.DateOfBirth, realName.IdNumber, currentYear),
}) })
} }
return userList return userList
} }
func getAgeString(dateOfBirth, idNumber string, currentYear int) string {
// 尝试从出生日期获取年份
if dateOfBirth != "" && len(dateOfBirth) >= 4 {
if year, err := strconv.Atoi(dateOfBirth[0:4]); err == nil && year > 1900 && year <= currentYear {
return strconv.Itoa(currentYear - year)
}
}
// 尝试从身份证号获取年份
if idNumber != "" {
var birthYear int
if len(idNumber) == 15 {
if year, err := strconv.Atoi("19" + idNumber[6:8]); err == nil {
birthYear = year
}
} else if len(idNumber) == 18 {
if year, err := strconv.Atoi(idNumber[6:10]); err == nil {
birthYear = year
}
}
if birthYear > 1900 && birthYear <= currentYear {
return strconv.Itoa(currentYear - birthYear)
}
}
return ""
}
func SynInvitationCode(userId uint) (string, error) { func SynInvitationCode(userId uint) (string, error) {
//保存实名信息 //保存实名信息

View File

@ -3,18 +3,10 @@ package service
import ( import (
"context" "context"
"database/sql" "database/sql"
"errors"
"fmt"
"image"
"log"
"math"
rand2 "math/rand"
"strconv"
"strings"
"time"
"dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/common/logger"
_ "dubbo.apache.org/dubbo-go/v3/imports" _ "dubbo.apache.org/dubbo-go/v3/imports"
"errors"
"fmt"
account "github.com/fonchain_enterprise/micro-account/api/accountFiee" account "github.com/fonchain_enterprise/micro-account/api/accountFiee"
"github.com/fonchain_enterprise/micro-account/pkg/application" "github.com/fonchain_enterprise/micro-account/pkg/application"
"github.com/fonchain_enterprise/micro-account/pkg/cache" "github.com/fonchain_enterprise/micro-account/pkg/cache"
@ -32,6 +24,13 @@ import (
"github.com/go-redis/redis" "github.com/go-redis/redis"
uuid2 "github.com/google/uuid" uuid2 "github.com/google/uuid"
"gorm.io/gorm" "gorm.io/gorm"
"image"
"log"
"math"
rand2 "math/rand"
"strconv"
"strings"
"time"
) )
type AccountFieeProvider struct { type AccountFieeProvider struct {
@ -398,8 +397,6 @@ func (a *AccountFieeProvider) RealName(_ context.Context, in *account.RealNameRe
PlaceOfResidence: in.PlaceOfResidence, PlaceOfResidence: in.PlaceOfResidence,
GroupPhoto: in.GroupPhoto, GroupPhoto: in.GroupPhoto,
Attachment: in.Attachment, Attachment: in.Attachment,
IdNumber: in.IdNumber,
DateOfBirth: in.DateOfBirth,
} }
// 创建实名信息 // 创建实名信息
if err := model.DB.Create(&newRealName).Error; err != nil { if err := model.DB.Create(&newRealName).Error; err != nil {
@ -427,8 +424,6 @@ func (a *AccountFieeProvider) RealName(_ context.Context, in *account.RealNameRe
"place_of_residence": in.PlaceOfResidence, "place_of_residence": in.PlaceOfResidence,
"group_photo": in.GroupPhoto, "group_photo": in.GroupPhoto,
"attachment": in.Attachment, "attachment": in.Attachment,
"id_number": in.IdNumber,
"date_of_birth": in.DateOfBirth,
} }
// 更新 RealName 表中的数据 // 更新 RealName 表中的数据
var existingRealName model.RealName var existingRealName model.RealName
@ -628,8 +623,6 @@ func (a *AccountFieeProvider) Info(ctx context.Context, in *account.InfoRequest)
PlaceOfResidence: "", PlaceOfResidence: "",
GroupPhoto: "", GroupPhoto: "",
Attachment: "", Attachment: "",
IdNumber: "",
DateOfBirth: "",
} }
} }
response := &account.UserInfoResponse{ response := &account.UserInfoResponse{
@ -651,8 +644,6 @@ func (a *AccountFieeProvider) Info(ctx context.Context, in *account.InfoRequest)
NickName: user.Nickname, NickName: user.Nickname,
TelNum: user.TelNum, TelNum: user.TelNum,
TelAreaCode: user.TelAreaCode, TelAreaCode: user.TelAreaCode,
IdNumber: realName.IdNumber,
DateOfBirth: realName.DateOfBirth,
} }
return response, nil return response, nil
@ -693,9 +684,6 @@ func (a *AccountFieeProvider) UserList(ctx context.Context, in *account.UserList
if in.BlurNameTel != "" { if in.BlurNameTel != "" {
modelObj.Where("RealName.name like ? or tel_num like ? ", "%"+in.BlurNameTel+"%", "%"+in.BlurNameTel+"%") modelObj.Where("RealName.name like ? or tel_num like ? ", "%"+in.BlurNameTel+"%", "%"+in.BlurNameTel+"%")
} }
if in.NameAndNumber != "" {
modelObj.Where("RealName.name like ? or sub_num like ? ", "%"+in.NameAndNumber+"%", "%"+in.NameAndNumber+"%")
}
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))
@ -1227,54 +1215,6 @@ func (a *AccountFieeProvider) UsersByJobNum(_ context.Context, in *account.Users
return response, nil return response, nil
} }
func (a *AccountFieeProvider) SubNumGetInfo(_ context.Context, in *account.SubNumGetInfoRequest) (*account.UserInfoResponse, error) {
//获取该用户信息
var user *model.User
if in.SubNum == "" || in.Domain == "" {
return nil, errors.New("subNum or domain is empty")
}
if err := model.DB.Where("domain=? and sub_num=?", in.Domain, in.SubNum).Preload("RealName").First(&user).Error; err != nil {
logger.Error(err)
return nil, errors.New(m.Not_Found_Artist)
}
realName := user.RealName
if realName == nil {
realName = &model.RealName{
Name: "",
Sex: "",
Nationality: "",
DocumentType: 0,
CertificatePicture: "",
Validity: "",
PlaceOfResidence: "",
GroupPhoto: "",
Attachment: "",
}
}
response := &account.UserInfoResponse{
Id: uint64(user.ID),
Status: int32(user.Status),
Name: realName.Name,
Sex: realName.Sex,
Nationality: realName.Nationality,
DocumentType: int32(realName.DocumentType),
CertificatePicture: realName.CertificatePicture,
Validity: realName.Validity,
PlaceOfResidence: realName.PlaceOfResidence,
GroupPhoto: realName.GroupPhoto,
Attachment: realName.Attachment,
SubNum: user.SubNum,
NotPassRemarks: user.NotPassRemarks,
Language: user.Language,
SubscriberNumber: user.SubscriberNumber,
NickName: user.Nickname,
TelNum: user.TelNum,
TelAreaCode: user.TelAreaCode,
}
return response, nil
}
func (a *AccountFieeProvider) VerifySliderStatus(_ context.Context, in *account.VerifySliderStatusRequest) (*account.VerifySliderStatusResponse, error) { func (a *AccountFieeProvider) VerifySliderStatus(_ context.Context, in *account.VerifySliderStatusRequest) (*account.VerifySliderStatusResponse, error) {
resp := &account.VerifySliderStatusResponse{} resp := &account.VerifySliderStatusResponse{}
status, err := cache.RedisClient.Get("SliderStatus:" + in.NonceStr).Result() status, err := cache.RedisClient.Get("SliderStatus:" + in.NonceStr).Result()